Package jade.domain.FIPAAgentManagement

Examples of jade.domain.FIPAAgentManagement.Envelope


    if((param = msg.getEncoding())== null) param = "";
    encoding.setText(param);

    //Envelope
    Envelope envelope = msg.getEnvelope();

    if(envelope != null)
      showEnvelope(envelope);

View Full Code Here


    param = (encoding.getText()).trim();
    if(param.length() > 0)
      msg.setEncoding(param);

    Envelope env = new Envelope()

    Enumeration to_Enum = toPanel.getContent();
    while(to_Enum.hasMoreElements())
      env.addTo((AID)to_Enum.nextElement());

    if(newAIDFrom!= null)
      fromAID = newAIDFrom;
    if (fromAID.getName().length() > 0)
      env.setFrom(fromAID);

    param = comments.getText().trim();
    if(param.length()>0)
      env.setComments(param);

    param = representation.getText().trim();
    if(param.length()>0)
      env.setAclRepresentation(param);

    try {
      param = payloadLength.getText().trim();
      env.setPayloadLength(new Long(param));
    } catch (Exception e) {
      //System.err.println("Incorrect int format. payloadLength must be an integer. Automatic reset to -1.");
      //env.setPayloadLength(new Long(-1));
      //payloadLength.setText("-1");
    }

    param = payloadEncoding.getText().trim();
    if(param.length()>0)
      env.setPayloadEncoding(param);

    //setDate require a Date not a String
    if (dateDate != null)
      env.setDate(dateDate);

    Enumeration int_Enum = intendedReceiverPanel.getContent();
    while(int_Enum.hasMoreElements())
      env.addIntendedReceiver((AID)int_Enum.nextElement());


    param = language.getText().trim();
    if (param.length()>0)
      msg.setLanguage(param);
View Full Code Here

          String command = e.getActionCommand();
          if(command.equals("Set Default Envelope"))
          {
            ACLMessage tmp = getMsg();
            tmp.setDefaultEnvelope();
            Envelope envtmp = tmp.getEnvelope();
            showEnvelope(envtmp);
          }
        }
      });
      put(aclPanel,tmpPanel,0,17,3,1,false);
View Full Code Here

        try {
          Occurred o = (Occurred)getContentManager().extractContent(current);
          EventRecord er = o.getWhat();
          Event ev = er.getWhat();
          String content = null;
          Envelope env = null;
          AID unicastReceiver = null;
          if(ev instanceof SentMessage) {
            content = ((SentMessage)ev).getMessage().getPayload();
            env = ((SentMessage)ev).getMessage().getEnvelope();
            unicastReceiver = ((SentMessage)ev).getReceiver();
          } else if(ev instanceof PostedMessage) {
            content = ((PostedMessage)ev).getMessage().getPayload();
            env = ((PostedMessage)ev).getMessage().getEnvelope();
            unicastReceiver = ((PostedMessage)ev).getReceiver();
            AID sender = ((PostedMessage)ev).getSender();
            // If the sender is currently under sniff, then the message was already
            // displayed when the 'sent-message' event occurred --> just skip this message.
            if(agentsUnderSniff.contains(new Agent(sender))) {
              return;
            }
          } else {
            return;
          }

          ACLCodec codec = new StringACLCodec();
          String charset = null
          if ((env == null) || ((charset = env.getPayloadEncoding()) == null)) {
            charset = ACLCodec.DEFAULT_CHARSET;
          }
          ACLMessage tmp = codec.decode(content.getBytes(charset),charset);
          tmp.setEnvelope(env);
          Message msg = new Message(tmp, unicastReceiver);
View Full Code Here

   */
  public void setItsMsg(ACLMessage msg) {
    itsMsg = msg;
    itsEnvelope = msg.getEnvelope();
    if (itsEnvelope == null) {
      itsEnvelope = new Envelope();
      msg.setEnvelope(itsEnvelope);
    }

    //message
    senderTextField.setText(itsMsg.getSender() != null ? itsMsg.getSender().getName() : "");
View Full Code Here

                    AID senderID = (AID) params[0];
                    GenericMessage msg = (GenericMessage) params[1];
                    AID receiverID = (AID) params[2];
                    dispatchLocally(senderID, msg, receiverID);
                } else if (cmdName.equals(MessagingSlice.H_ROUTEOUT)) {
                    Envelope env = (Envelope) params[0];
                    byte[] payload = (byte[]) params[1];
                    AID receiverID = (AID) params[2];
                    String address = (String) params[3];

                    routeOut(env, payload, receiverID, address);
View Full Code Here

        if (cmdName.equals(PersistentDeliverySlice.H_STOREMESSAGE)) {
          String storeName = (String)params[0];
          // NOTE that we can't send the GenericMessage directly as a parameter
          // since we would loose the embedded ACLMessage
          ACLMessage acl = (ACLMessage) params[1];
          Envelope env = (Envelope) params[2];
          byte[] payload = (byte[]) params[3];
          Boolean foreignRecv = (Boolean) params[4];
          String traceId = (String) params[5];
          GenericMessage msg = new GenericMessage();
          msg.update(acl, env, payload);
View Full Code Here

          AID agentID = (AID)params[0];
         
          cmd.setReturnValue(getAgentLocation(agentID));
        }
        else if(cmdName.equals(MessagingSlice.H_ROUTEOUT)) {
          Envelope env = (Envelope)params[0];
          byte[] payload = (byte[])params[1];
          AID receiverID = (AID)params[2];
          String address = (String)params[3];
         
          routeOut(env, payload, receiverID, address);
View Full Code Here

  // *               Decoding methods                  *
  // ***************************************************
  
    /** This method is called when start the document XML*/
  public void startDocument() {
    env = new Envelope();
  }
View Full Code Here

            StringReader sr = new StringReader(envelope.toString());
            //#DOTNET_EXCLUDE_END
            /*#DOTNET_INCLUDE_BEGIN
             System.IO.StringReader sr = new System.IO.StringReader( envelope.toString() );
             #DOTNET_INCLUDE_END*/
            Envelope env = codec.parse(sr);
           
            /*#DOTNET_INCLUDE_BEGIN
             //There are problems if PayloadEncoding is set to US-ASCII
              if (env.getPayloadEncoding() == null)
              env.setPayloadEncoding(XMLCodec.CHARS_CODEC);
              #DOTNET_INCLUDE_END*/
           
            //System.out.println("Envelope received:\n"+env);
            //Post the Message to Jade platform 
            synchronized (dispatcher) {
             
              if(logger.isLoggable(Logger.WARNING)) {
                // check payload size
                if ((env.getPayloadLength() != null) && (env.getPayloadLength().intValue() >= 0) && (env.getPayloadLength().intValue() != payload.size()))
                  logger.log(Logger.WARNING,"Payload size does not match envelope information");
              }
              dispatcher.dispatchMessage(env,payload.toByteArray());
            }
            if (HTTPIO.KA.equalsIgnoreCase(type)) {
View Full Code Here

TOP

Related Classes of jade.domain.FIPAAgentManagement.Envelope

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.