Package jade.lang.acl

Examples of jade.lang.acl.ACLMessage


    else {
      throw new UnsupportedFunction();
    }
   
    // Prepare the notification
    ACLMessage notification = request.createReply();
    notification.setPerformative(ACLMessage.INFORM);
    Done d = new Done(slAction);
    try {
      theDF.getContentManager().fillContent(notification, d);
    }
    catch (Exception e) {
View Full Code Here


  //
  public void subscribe(Object dfd, SubscriptionResponder.Subscription s) throws NotUnderstoodException{
    try{
      DFAgentDescription dfdTemplate = (DFAgentDescription) dfd;
      ACLMessage aclSub = (ACLMessage) s.getMessage();
      subscriptions.put(dfdTemplate, s);
    }catch(Exception e){
                  if(logger.isLoggable(Logger.SEVERE))
                    logger.log(Logger.SEVERE,"Subscribe error: "+e.getMessage());
      throw new NotUnderstoodException(e.getMessage());
View Full Code Here

  }


  public void unsubscribe(SubscriptionResponder.Subscription sub ){

    ACLMessage aclSub = sub.getMessage();
    String convID = aclSub.getConversationId();
    Enumeration e = getSubscriptionDfAgentDescriptions();

    if( e != null ){
      while(e.hasMoreElements()){
        DFAgentDescription dfd = (DFAgentDescription)e.nextElement();
View Full Code Here

     the method locally discovers that the passed parameters are not valid.
  *  @see jade.domain.FIPAAgentManagement.SearchConstraints
  */
   public RequestFIPAServiceBehaviour(Agent a, AID receiver, String actionName, Object agentDescription, SearchConstraints constraints) throws FIPAException {
       //super(a, new ACLMessage(ACLMessage.REQUEST), mt);
       super(a,new ACLMessage(ACLMessage.REQUEST));
       ACLMessage msg = FIPAService.createRequestMessage(a,receiver);
     Action act = new Action();
     act.setActor(receiver);
     if (actionName.equalsIgnoreCase(FIPAManagementVocabulary.REGISTER)) {
       Register action = new Register();
       action.setDescription(agentDescription);
       act.setAction(action);
     }
     else if (actionName.equalsIgnoreCase(FIPAManagementVocabulary.DEREGISTER)) {
       Deregister action = new Deregister();
       action.setDescription(agentDescription);
       act.setAction(action);
     }
     else if (actionName.equalsIgnoreCase(FIPAManagementVocabulary.MODIFY)) {
       Modify action = new Modify();
       action.setDescription(agentDescription);
       act.setAction(action);
     }
     else if (actionName.equalsIgnoreCase(FIPAManagementVocabulary.SEARCH)) {
       Search action = new Search();
       action.setDescription(agentDescription);
       action.setConstraints(constraints);
       act.setAction(action);
       // set a timeout for the recursive search.
       msg.setReplyByDate(new Date(System.currentTimeMillis()+ timeout));
     }
     else
       throw new UnsupportedFunction();

     // initialize SL0 Codec and FIPAManagementVocabulary
View Full Code Here

     */
    protected void handleAllResponses(Vector reply){
  notYetReady = false;
  if(reply.size() == 0)
      //the timeout has expired: no replies received.
      lastMsg = new ACLMessage(ACLMessage.NOT_UNDERSTOOD);
  else
      lastMsg = (ACLMessage)((ACLMessage)reply.elementAt(0)).clone();
    }
View Full Code Here

     list.addElement(msg);
     #MIDP_INCLUDE_END*/
  }

  public ACLMessage receive(MessageTemplate pattern) {
    ACLMessage result = null;
    // This is just for the MIDP implementation where iterator.remove() is not supported.
    // We don't surround it with preprocessor directives to avoid making the code unreadable
    int cnt = 0;
    for (Iterator messages = iterator(); messages.hasNext(); cnt++) {
      ACLMessage msg = (ACLMessage)messages.next();
      if (pattern == null || pattern.match(msg)) {
        //#MIDP_EXCLUDE_BEGIN
        messages.remove();
        //#MIDP_EXCLUDE_END
        /*#MIDP_INCLUDE_BEGIN
 
View Full Code Here

  }
 
  private StringACLCodec codec = new StringACLCodec();
 
  protected void subscribeSingle(Object dfd, SubscriptionResponder.Subscription s) throws SQLException, NotUnderstoodException{
    ACLMessage aclM = s.getMessage();
    String msgStr = aclM.toString();
    String convID = aclM.getConversationId();
    registerSubscription(convID, msgStr);
  }
View Full Code Here

    try {
      rs = getPreparedStatements().stm_selSubscriptions.executeQuery();
      while (rs.next()) {
        String base64Str = rs.getString("aclm");
        String aclmStr = new String(Base64.decodeBase64(base64Str.getBytes("US-ASCII")), "US-ASCII");
        ACLMessage aclm = codec.decode(aclmStr.getBytes(), ACLCodec.DEFAULT_CHARSET);
        subscriptions.add(sr.createSubscription(aclm));
      }
     
    } catch (Exception e) {
      if(logger.isLoggable(Logger.SEVERE))
View Full Code Here

    return subscriptions.elements();
  }
 
 
  protected void unsubscribeSingle(SubscriptionResponder.Subscription sub) throws SQLException {
    ACLMessage aclM = sub.getMessage();
    String convID = aclM.getConversationId();
    boolean deleted = deregisterSubscription(convID);
    if(!deleted)
      if(logger.isLoggable(Logger.WARNING))
        logger.log(Logger.WARNING,"No subscription to delete.");
  }
View Full Code Here

    }
    return null;
  }

  private ACLMessage createAMSRequest() {
    ACLMessage request = new ACLMessage(ACLMessage.REQUEST);
    request.addReceiver(myAgent.getAMS());
    request.setProtocol(FIPANames.InteractionProtocol.FIPA_REQUEST);
    request.setLanguage(FIPANames.ContentLanguage.FIPA_SL);
    request.setOntology(JADEManagementOntology.getInstance().getName());
    return request;
  }
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.