Package jade.lang.acl

Examples of jade.lang.acl.MessageTemplate


            this.resource = resource;
        }

        @Override
        public void action() {
            MessageTemplate mt = MessageTemplate.MatchPerformative(ACLMessage.CONFIRM);
            ACLMessage message = myAgent.receive(mt);
            if (message != null) {
                requestMessage.addReceiver(message.getSender());
                myAgent.send(requestMessage);
                myAgent.addBehaviour(new ClientBehaviour());
View Full Code Here


     */
    class ClientBehaviour extends CyclicBehaviour {

        @Override
        public void action() {
            MessageTemplate mt = MessageTemplate.MatchPerformative(ACLMessage.INFORM);
            ACLMessage message = myAgent.receive(mt);
            if (message != null) {
                clientNodeGui.clearValues();
                clientNodeGui.setResultText(message.getContent());
                myAgent.removeBehaviour(this);
View Full Code Here

   */
  public AMSSubscriber() {
    super();
   
    // Prepare the template to receive AMS notification
    MessageTemplate mt1 = MessageTemplate.MatchLanguage(FIPANames.ContentLanguage.FIPA_SL0);
    MessageTemplate mt2 = MessageTemplate.MatchOntology(IntrospectionOntology.NAME);
    MessageTemplate mt12 = MessageTemplate.and(mt1, mt2);
   
    mt1 = MessageTemplate.MatchInReplyTo(AMS_SUBSCRIPTION);
    mt2 = MessageTemplate.MatchPerformative(ACLMessage.INFORM);
    listenTemplate = MessageTemplate.and(mt1, mt2);
    listenTemplate = MessageTemplate.and(listenTemplate, mt12);
View Full Code Here

    if (disableValidation) {
      getContentManager().setValidationMode(false);
    }
   
    // Create and add behaviours
    MessageTemplate mt = MessageTemplate.MatchPerformative(ACLMessage.REQUEST);
    MessageTemplate mt1 = null;
   
    // Behaviour dealing with FIPA management actions
    mt1 = MessageTemplate.and(mt, MessageTemplate.MatchOntology(FIPAManagementOntology.getInstance().getName()));
    mt1 = MessageTemplate.and(mt1, MessageTemplate.not(MessageTemplate.MatchProtocol(FIPANames.InteractionProtocol.ITERATED_FIPA_REQUEST)));
    //#PJAVA_EXCLUDE_BEGIN
View Full Code Here

    }
    // Register languages and ontologies
    getContentManager().registerLanguage(codec)
    getContentManager().registerOntology(LogManagementOntology.getInstance());
   
    MessageTemplate mt = MessageTemplate.MatchOntology(LogManagementOntology.NAME);
    addBehaviour(new LogHelperAgentBehaviour(this, mt));
    logger.log(Logger.INFO, getName() + " started using " + logManagerClass );
  }
View Full Code Here

    getContentManager().registerLanguage(codec, FIPANames.ContentLanguage.FIPA_SL1);
    getContentManager().registerLanguage(codec, FIPANames.ContentLanguage.FIPA_SL2);
    getContentManager().registerLanguage(codec, FIPANames.ContentLanguage.FIPA_SL);

    // The behaviour managing FIPA requests
    MessageTemplate mtF = MessageTemplate.and(MessageTemplate.MatchPerformative(ACLMessage.REQUEST), MessageTemplate.MatchOntology(FIPAManagementVocabulary.NAME));
    Behaviour fipaResponderB = new AMSFipaAgentManagementBehaviour(this, mtF);
    addBehaviour(fipaResponderB);

    // The behaviour managing JADE requests
    // MobilityOntology is matched for JADE 2.5 Backward compatibility
    MessageTemplate mtJ = MessageTemplate.and(MessageTemplate.MatchPerformative(ACLMessage.REQUEST), MessageTemplate.or(MessageTemplate.MatchOntology(JADEManagementVocabulary.NAME), MessageTemplate.MatchOntology(jade.domain.mobility.MobilityOntology.NAME)));
    Behaviour jadeResponderB = new AMSJadeAgentManagementBehaviour(this, mtJ);
    addBehaviour(jadeResponderB);

    // The behaviours dealing with platform tools
    Behaviour registerTool = new RegisterToolBehaviour();
View Full Code Here

    private MessageTemplate subscriptionTemplate;

    RegisterToolBehaviour() {

      MessageTemplate mt1 = MessageTemplate.MatchLanguage(FIPANames.ContentLanguage.FIPA_SL0);
      MessageTemplate mt2 = MessageTemplate.MatchOntology(IntrospectionOntology.NAME);
      MessageTemplate mt12 = MessageTemplate.and(mt1, mt2);

      mt1 = MessageTemplate.MatchReplyWith("tool-subscription");
      mt2 = MessageTemplate.MatchPerformative(ACLMessage.SUBSCRIBE);
      subscriptionTemplate = MessageTemplate.and(mt1, mt2);
      subscriptionTemplate = MessageTemplate.and(subscriptionTemplate, mt12);
View Full Code Here

    private MessageTemplate cancellationTemplate;

    DeregisterToolBehaviour() {

      MessageTemplate mt1 = MessageTemplate.MatchLanguage(FIPANames.ContentLanguage.FIPA_SL0);
      MessageTemplate mt2 = MessageTemplate.MatchOntology(IntrospectionOntology.NAME);
      MessageTemplate mt12 = MessageTemplate.and(mt1, mt2);

      mt1 = MessageTemplate.MatchReplyWith("tool-cancellation");
      mt2 = MessageTemplate.MatchPerformative(ACLMessage.CANCEL);
      cancellationTemplate = MessageTemplate.and(mt1, mt2);
      cancellationTemplate = MessageTemplate.and(cancellationTemplate, mt12);
View Full Code Here

      request.setConversationId("cid-"+key);
    }
   
    long sendTime = System.currentTimeMillis();
    a.send(request);
    MessageTemplate mt = MessageTemplate.MatchInReplyTo(request.getReplyWith());
   
    ACLMessage reply = a.blockingReceive(mt, timeout);
   
    if(reply != null) {
      if (reply.getPerformative() == ACLMessage.INFORM) {
View Full Code Here

    // Unless a template is explicitly set, we get messages matching the ontology, the served performatives.
    if (template == null) {
      if (servedPerformatives != null) {
        template = MessageTemplate.and(
            MessageTemplate.MatchOntology(onto.getName()),
              new MessageTemplate(new MatchExpression() {
                public boolean match(ACLMessage msg) {
                  int perf = msg.getPerformative();
                  for (int p : servedPerformatives) {
                    if (p == perf) {
                      return true;
View Full Code Here

TOP

Related Classes of jade.lang.acl.MessageTemplate

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.