Package jade.core

Examples of jade.core.MainContainer


   
    private void handleRemoveTool(VerticalCommand cmd) {
      Object[] params = cmd.getParams();
      AID tool = (AID)params[0];
     
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        impl.toolRemoved(tool);
      }
      else {
        // Do nothing for now, but could also route the command to the main slice, thus enabling e.g. AMS replication
      }
    }
View Full Code Here


     
      myContainer.releaseLocalAgent(agentID);
    }
   
    private void bornAgent(AID name, ContainerID cid, JADEPrincipal principal, Credentials credentials) throws NameClashException, NotFoundException {
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        // Retrieve the ownership from the credentials
        String ownership = "NONE";
        if (credentials != null) {
          JADEPrincipal ownerPr = credentials.getOwner();
          if (ownerPr != null) {
            ownership = ownerPr.getName();
          }
        }
        try {
          // If the name is already in the GADT, throws NameClashException
          impl.bornAgent(name, cid, principal, ownership, false);
        }
        catch(NameClashException nce) {
          //#CUSTOMJ2SE_EXCLUDE_BEGIN
          try {
            ContainerID oldCid = impl.getContainerID(name);
            if (oldCid != null) {
              Node n = impl.getContainerNode(oldCid).getNode();
             
              // Perform a non-blocking ping to check...
              n.ping(false);
             
              // Ping succeeded: rethrow the NameClashException
              throw nce;
            }
            else {
              // The old agent is registered with the AMS, but does not live in the platform --> cannot check if it still exists
              throw nce;
            }
          }
          catch(NameClashException nce2) {
            // This is the re-thrown NameClashException --> let it through
            throw nce2;
          }
          catch(Exception e) {
            // Either the old agent disappeared in the meanwhile or the Ping failed: forcibly replace the old agent...
            impl.bornAgent(name, cid, principal, ownership, true);
          }
          //#CUSTOMJ2SE_EXCLUDE_END
          /*#CUSTOMJ2SE_INCLUDE_BEGIN
           try {
           //System.out.println("Replacing old agent "+name.getName());
View Full Code Here

     }
     }
     #CUSTOMJ2SE_INCLUDE_END*/
   
    private void deadAgent(AID name) throws NotFoundException {
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        impl.deadAgent(name, false);
        /*#CUSTOMJ2SE_INCLUDE_BEGIN
         notifyDead(name);
         #CUSTOMJ2SE_INCLUDE_END*/
      }
    }
 
View Full Code Here

         #CUSTOMJ2SE_INCLUDE_END*/
      }
    }
   
    private void suspendedAgent(AID name) throws NotFoundException {
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        impl.suspendedAgent(name);
      }
    }
View Full Code Here

        impl.suspendedAgent(name);
      }
    }
   
    private void resumedAgent(AID name) throws NotFoundException {
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        impl.resumedAgent(name);
      }
    }
View Full Code Here

TOP

Related Classes of jade.core.MainContainer

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.