Package jade.lang.acl

Examples of jade.lang.acl.ACLMessage


        Object[] params = cmd.getParams();
        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();
View Full Code Here


          removeAgent(aid);
        }
      }
     
      // Send back the notification
      ACLMessage result = request.createReply();
      result.setPerformative(ACLMessage.INFORM);
      Done d = new Done(requestAction);
      try {
        myAgent.getContentManager().fillContent(result, d);
      }
      catch (Exception e) {
View Full Code Here

   * Currently sniffed agents are also unsniffed to avoid errors.
   */
  protected void toolTakeDown() {

    List l = (List)(agentsUnderSniff.clone());
    ACLMessage request = getSniffMsg(l, SNIFF_OFF);

    // Start a FIPARequestProtocol to sniffOff all the agents since
    // the sniffer is shutting down
    try {
      if(request != null)
View Full Code Here

  /**
   * This method adds an AMSClientBehaviour that performs a request to the AMS for sniffing/unsniffing list of agents.
   **/
  public void sniffMsg(List agents, boolean onFlag) {
    ACLMessage request = getSniffMsg(agents,onFlag);
    if (request != null)
      addBehaviour(new AMSClientBehaviour((onFlag?"SniffAgentOn":"SniffAgentOff"),request));

  }
View Full Code Here

        try {
          Action a = new Action();
          a.setActor(getAMS());
          a.setAction(so);

          ACLMessage requestMsg = getRequest();
          requestMsg.setOntology(JADEManagementOntology.NAME);
          getContentManager().fillContent(requestMsg, a);
          return requestMsg;
        }
        catch(Exception fe) {
          fe.printStackTrace();
        }
      }
    }

    else {
      SniffOff so = new SniffOff();
      so.setSniffer(getAID());
      boolean empty = true;
      while(it.hasNext()) {
        Agent a = (Agent)it.next();
        AID agentID = new AID();
        agentID.setName(a.agentName + '@' + getHap());
        if(agentsUnderSniff.contains(a)) {
          agentsUnderSniff.remove(a);
          so.addSniffedAgents(agentID);
          empty = false;
        }
      }
      if(!empty) {
        try {
          Action a = new Action();
          a.setActor(getAMS());
          a.setAction(so);

          ACLMessage requestMsg = getRequest();
          requestMsg.setOntology(JADEManagementOntology.NAME);
          getContentManager().fillContent(requestMsg, a);
          requestMsg.setReplyWith(getName()+ (new Date().getTime()));
          return requestMsg;
        }
        catch(Exception fe) {
          fe.printStackTrace();
        }
View Full Code Here

  }
 
  private boolean isPersistentDeliveryRetry(GenericMessage msg) {
    boolean ret = false;
    //#J2ME_EXCLUDE_BEGIN
    ACLMessage acl = msg.getACLMessage();
    if (acl != null) {
      ret = acl.getAllUserDefinedParameters().containsKey(PersistentDeliveryService.ACL_USERDEF_DUE_DATE);
    }
    //#J2ME_EXCLUDE_END
    return ret;
  }
View Full Code Here

   * This method is used internally by the platform in order
   * to notify the sender of a message that a failure was reported by
   * the Message Transport Service.
   */
  public void notifyFailureToSender(GenericMessage msg, AID receiver, InternalError ie) {
    ACLMessage acl = msg.getACLMessage();
    if (acl == null) {
      // ACLMessage can be null in case we get a failure delivering a message coming from an external platform (received by a local MTP).
      // In this case in fact the message is encoded. Try to decode it so that a suitable FAILURE response can be sent back.
      // If the payload is mangled in some way (e.g. encrypted) decoding will fail and no suitable FAILURE response will be sent
      try {
        acl = ((IncomingEncodingFilter) encInFilter).decodeMessage(msg.getEnvelope(), msg.getPayload());
        acl.setEnvelope(msg.getEnvelope());
        msg.setACLMessage(acl);
      }
      catch (Exception e) {
        // Just do nothing
        e.printStackTrace();
      }
    }
    if (acl == null) {
      myLogger.log(Logger.WARNING, "Cannot notify failure to sender: GenericMessage contains no ACLMessage");
      return;
    }
    if ("true".equals(acl.getUserDefinedParameter(ACLMessage.IGNORE_FAILURE))) {
      // Ignore the failure
      return;
    }
   
    GenericCommand cmd = new GenericCommand(MessagingSlice.NOTIFY_FAILURE, MessagingSlice.NAME, null);
View Full Code Here

    return super.getFreshSlice(name);
  }
 
 
  private final boolean needSynchDelivery(GenericMessage gMsg) {
    ACLMessage acl = gMsg.getACLMessage();
    if (acl != null) {
      return "true".equals(acl.clearUserDefinedParameter(ACLMessage.SYNCH_DELIVERY));
    }
    return false;
  }
View Full Code Here

     // Note: this class uses the DummyAgentActionIcon just because it
     // never displays an icon, but a parameter must anyway be passed.

     super ("DGGUIActionIcon","Show the DF GUI",actPro);
     myRMA = anRMA;
     msg = new ACLMessage(ACLMessage.REQUEST);
     msg.addReceiver(myRMA.getDefaultDF());
     msg.setOntology(JADEManagementOntology.NAME);
     msg.setLanguage(FIPANames.ContentLanguage.FIPA_SL0);
     msg.setProtocol(FIPANames.InteractionProtocol.FIPA_REQUEST);
     Action a = new Action();
View Full Code Here

 
  // Only for debugging:
  private volatile int traceCnt = 0;
 
  private void checkTracing(GenericMessage msg) {
    ACLMessage acl = msg.getACLMessage();
    if (acl != null) {
      if (myLogger.isLoggable(Logger.FINE) || "true".equals(acl.getUserDefinedParameter(ACLMessage.TRACE))) {
        msg.setTraceID(ACLMessage.getPerformative(acl.getPerformative())+"-"+msg.getSender().getLocalName()+"-"+traceCnt);
        traceCnt++;
      }
    }
  }
View Full Code Here

TOP

Related Classes of jade.lang.acl.ACLMessage

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.