Package jade.domain.FIPAAgentManagement

Examples of jade.domain.FIPAAgentManagement.Envelope


    public void run() {
      agent.getGui().queuedMsgListModel.add(0, (Object) new MsgIndication(msg, MsgIndication.INCOMING, new Date()));
      StringACLCodec codec = new StringACLCodec();
      try {
        String charset;
        Envelope e;
        if (((e = msg.getEnvelope()) == null) || ((charset = e.getPayloadEncoding()) == null)) {
          charset = ACLCodec.DEFAULT_CHARSET;
        }
        codec.decode(codec.encode(msg,charset),charset);
      } catch (ACLCodec.CodecException ce) {
        ce.printStackTrace();
View Full Code Here


        ACLMessage m = currentMsgGui.getMsg();
        queuedMsgListModel.add(0, (Object) new MsgIndication(m, MsgIndication.OUTGOING, new Date()));
        StringACLCodec codec = new StringACLCodec();
        try {
          String charset; 
          Envelope env;
          if (((env = m.getEnvelope()) == null) ||
              ((charset = env.getPayloadEncoding()) == null)) {
                charset = ACLCodec.DEFAULT_CHARSET;
              }
          codec.decode(codec.encode(m,charset),charset);
          myAgent.send(m);
        }
View Full Code Here

   */
  private ACLMessage deserializeACL() throws IOException, LEAPSerializationException {
    ACLMessage msg = LEAPACLCodec.deserializeACL(this);
    //#CUSTOM_EXCLUDE_BEGIN
    if (readBoolean()) {
      Envelope env = deserializeEnvelope();
      msg.setEnvelope(env);
    }
    //#CUSTOM_EXCLUDE_END

    return msg;
View Full Code Here

    return aida;
  }

  private GenericMessage deserializeGenericMessage() throws IOException, LEAPSerializationException {
    byte[] payload = deserializeByteArray();   
    Envelope env = (Envelope) readObject();
    GenericMessage gm = new GenericMessage(env, payload);
    gm.setAMSFailure(readBoolean());
    gm.setTraceID((String) readObject());
    return gm;
  }
View Full Code Here

    }
  }

  private Envelope deserializeEnvelope() throws LEAPSerializationException {
    try {
      Envelope e = new Envelope();
      while (readBoolean()) {
        e.addTo(deserializeAID());
      }

      e.setFrom(readAID());
      e.setComments(readString());
      e.setAclRepresentation(readString());
      e.setPayloadLength(new Long(readLong()));
      e.setPayloadEncoding(readString());
      e.setDate(readDate());

      while (readBoolean()) {
        e.addIntendedReceiver(deserializeAID());
      }

      e.setReceived((ReceivedObject) readObject());

      while (readBoolean()) {
        e.addProperties(deserializeProperty());
      }

      return e;
    }
    catch (IOException ioe) {
View Full Code Here

       
        jade.domain.introspection.ACLMessage m = new jade.domain.introspection.ACLMessage();
        // Note that we need to clone the Envelope otherwise we would
        // overwrite the acl representation (if any) previously set in the
        // Envelope
        Envelope env = msg.getEnvelope();
        if (env != null) {
          m.setEnvelope((Envelope) msg.getEnvelope().clone());
        }
        m.setAclRepresentation(StringACLCodec.NAME);
        m.setPayload(msg.toString());
View Full Code Here

    public void message(FipaMessage aFipaMessage) {
      FIPA.Envelope[] envelopes = aFipaMessage.messageEnvelopes;
      byte[] payload = aFipaMessage.messageBody;
     
      Envelope env = new Envelope();

      // Read all the envelopes sequentially, so that later slots
      // overwrite earlier ones.
      for(int e = 0; e < envelopes.length; e++) {
  FIPA.Envelope IDLenv = envelopes[e];

  // Read in the 'to' slot
  if(IDLenv.to.length > 0)
    env.clearAllTo();
  for(int i = 0; i < IDLenv.to.length; i++) {
    AID id = unmarshalAID(IDLenv.to[i]);
    env.addTo(id);
  }

  // Read in the 'from' slot
  if(IDLenv.from.length > 0) {
    AID id = unmarshalAID(IDLenv.from[0]);
    env.setFrom(id);
  }

  // Read in the 'intended-receiver' slot
  if(IDLenv.intendedReceiver.length > 0)
    env.clearAllIntendedReceiver();
  for(int i = 0; i < IDLenv.intendedReceiver.length; i++) {
    AID id = unmarshalAID(IDLenv.intendedReceiver[i]);
    env.addIntendedReceiver(id);
  }

  // Read in the 'encrypted' slot
  //if(IDLenv.encrypted.length > 0)
  //  env.clearAllEncrypted();
  //for(int i = 0; i < IDLenv.encrypted.length; i++) {
  //  String word = IDLenv.encrypted[i];
  //  env.addEncrypted(word);
  //}

  // Read in the other slots
  if(IDLenv.comments.length() > 0)
    env.setComments(IDLenv.comments);
  if(IDLenv.aclRepresentation.length() > 0)
    env.setAclRepresentation(IDLenv.aclRepresentation);
  if(IDLenv.payloadLength > 0)
    env.setPayloadLength(new Long(IDLenv.payloadLength));
  if(IDLenv.payloadEncoding.length() > 0)
    env.setPayloadEncoding(IDLenv.payloadEncoding);
  if(IDLenv.date.length > 0) {
    Date d = unmarshalDateTime(IDLenv.date[0]);
    env.setDate(d);
  }

  // Read in the 'received' stamp
  if(IDLenv.received.length > 0)
    env.addStamp(unmarshalReceivedObj(IDLenv.received[0]));

  // Read in the 'user-defined properties' slot
  if(IDLenv.userDefinedProperties.length > 0)
    env.clearAllProperties();
  for(int i = 0; i < IDLenv.userDefinedProperties.length; i++) {
    env.addProperties(unmarshalProperty(IDLenv.userDefinedProperties[i]));
  }
      }
     
      //String tmp = "\n\n"+(new  java.util.Date()).toString()+"   RECEIVED IIOP MESSAGE"+ "\n" + env.toString() + "\n" + new String(payload);
      //System.out.println(tmp);
View Full Code Here

  public TableUpdater(MessagePanel wnd, SentMessage sm) {
    try {
      modelFrom = null;
      modelTo = wnd.getOutProcessedModel();
      String charset;
      Envelope e;
      jade.domain.introspection.ACLMessage m = sm.getMessage();
      if (((e = m.getEnvelope()) == null) ||
          ((charset = e.getPayloadEncoding()) == null)) {
        charset = ACLCodec.DEFAULT_CHARSET;
      }
      String s = m.getPayload();
      ACLCodec codec = new StringACLCodec();
      msg = codec.decode(s.getBytes(charset),charset);
View Full Code Here

  public TableUpdater(MessagePanel wnd, PostedMessage pm) {
    try {
      modelFrom = null;
      modelTo = wnd.getInPendingModel();
      String charset;
      Envelope e;
      jade.domain.introspection.ACLMessage m = pm.getMessage();
      if (((e = m.getEnvelope()) == null) ||
          ((charset = e.getPayloadEncoding()) == null)) {
        charset = ACLCodec.DEFAULT_CHARSET;
      }
      String s = m.getPayload();
      ACLCodec codec = new StringACLCodec();
      msg = codec.decode(s.getBytes(charset),charset);
View Full Code Here

  public TableUpdater(MessagePanel wnd, ReceivedMessage rm) {
    try {
      modelFrom = wnd.getInPendingModel();
      modelTo = wnd.getInProcessedModel();
      String charset;
      Envelope e;
      jade.domain.introspection.ACLMessage m = rm.getMessage();
      if (((e = m.getEnvelope()) == null) ||
          ((charset = e.getPayloadEncoding()) == null)) {
        charset = ACLCodec.DEFAULT_CHARSET;
      }
      String s = m.getPayload();
      ACLCodec codec = new StringACLCodec();
      msg = codec.decode(s.getBytes(charset),charset);
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.