Package jade.domain.FIPAAgentManagement

Examples of jade.domain.FIPAAgentManagement.DFAgentDescription


        Logger.getLogger(ResourceAgent.class.getName()).log(Level.SEVERE,
                "{0} running as {1}",
                new Object[]{getAID().getLocalName(), serviceName});


        DFAgentDescription dfd = new DFAgentDescription();
        dfd.setName(getAID());
        ServiceDescription sd = new ServiceDescription();

        sd.setType(RESOURCE_AGENT_TYPE);
        sd.setName(serviceName);
        dfd.addServices(sd);

        addBehaviour(new ResourceBehaviour());

        try {
            DFService.register(this, dfd);
View Full Code Here


    public void setup() {
        Object[] arguments = getArguments();
        if (arguments != null) {
            destinationLocalName = (String) arguments[0];
            fullServiceName = NODE_AGENT_SERVICE_PREFIX + destinationLocalName;
            DFAgentDescription dfd = new DFAgentDescription();
            dfd.setName(getAID());
            ServiceDescription sd = new ServiceDescription();

            sd.setType(NODE_AGENT_TYPE);
            sd.setName(fullServiceName);
            dfd.addServices(sd);

            try {
                DFService.register(this, dfd);
            } catch (FIPAException fe) {
                Logger.getLogger(NodeAgent.class.getName()).log(Level.SEVERE, null, fe);
View Full Code Here

    /**
     * Registers this agent with the DF.
     */
    private void register() {
        DFAgentDescription dfd = new DFAgentDescription();
        dfd.setName(getAID());
        ServiceDescription sd = new ServiceDescription();

        sd.setType(CLIENT_AGENT_TYPE);
        sd.setName(CLIENT_AGENT_SERVICE);
        dfd.addServices(sd);
        try {
            DFService.register(this, dfd);
        } catch (FIPAException ex) {
            Logger.getLogger(ClientAgent.class.getName()).log(Level.SEVERE, null, ex);
        }
View Full Code Here

     *
     * @param type The agent type that should be searched for
     * @return The DFAgentDescription template
     */
    private DFAgentDescription buildSearchTemplateForType(String type) {
        DFAgentDescription template = new DFAgentDescription();
        ServiceDescription sd = new ServiceDescription();
        sd.setType(type);
        template.addServices(sd);
        return template;
    }
View Full Code Here

     *
     * @param service The service name that should be searched for
     * @return The DFAgentDescription template
     */
    private DFAgentDescription buildSearchTemplateForService(String service) {
        DFAgentDescription template = new DFAgentDescription();
        ServiceDescription sd = new ServiceDescription();
        sd.setName(service);
        template.addServices(sd);
        return template;
    }
View Full Code Here

     * @param service The service name that should be searched for
     * @param type The agent type that should be searched for
     * @return The DFAgentDescription template
     */
    private DFAgentDescription buildSearchTemplateForServiceAndType(String service, String type) {
        DFAgentDescription template = new DFAgentDescription();
        ServiceDescription sd = new ServiceDescription();
        sd.setName(service);
        sd.setType(type);
        template.addServices(sd);
        return template;
    }
View Full Code Here

     * @param resource The destination resource
     * @param value1 Value 1
     * @param value2 Value 2
     */
    public void makeRequest(String resource, String value1, String value2) {
        DFAgentDescription template = buildSearchTemplateForServiceAndType(
                NODE_AGENT_SERVICE_PREFIX + resource,
                NODE_AGENT_TYPE);
        try {
            DFAgentDescription[] result = DFService.search(this, template);
            ACLMessage requestMessage = new ACLMessage(ACLMessage.PROPOSE);
View Full Code Here

   
    public Object next() {
      if (hasMoreElements) {
        try {
          String name = rs.getString("aid");
          DFAgentDescription dfd = getDFD(name);
          hasMoreElements = rs.next();
          return dfd;
        }
        catch (SQLException sqle) {
          hasMoreElements = false;
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());
View Full Code Here

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

    if( e != null ){
      while(e.hasMoreElements()){
        DFAgentDescription dfd = (DFAgentDescription)e.nextElement();
        SubscriptionResponder.Subscription s = getSubscription((Object) dfd);
        if((s.getMessage().getConversationId()).equals(convID)){
          subscriptions.remove(dfd);
          break;
        }
View Full Code Here

TOP

Related Classes of jade.domain.FIPAAgentManagement.DFAgentDescription

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.