Package jade.wrapper

Examples of jade.wrapper.ControllerException


   * @param localAgentName The short local name of the desired agent.
   * @throws ControllerException If any problems occur obtaining this proxy.
   */
  public static AgentController getAgent(String localName) throws ControllerException {
    if(myFrontEnd == null) {
      throw new ControllerException("FrontEndContainer  not found");
    }
    // Check that the agent exists
    jade.core.Agent instance = myFrontEnd.getLocalAgent(localName);
    if (instance == null) {
      throw new ControllerException("Agent " + localName + " not found.");
    }
    return new MicroAgentControllerImpl(localName, myFrontEnd);
  }
View Full Code Here


    if (myContainer == null || !myContainer.isJoined()) {
      initProfile();
     
      myContainer = Runtime.instance().createAgentContainer(profile);
      if (myContainer == null) {
        throw new ControllerException("JADE startup failed.");
      }
    }
    if (myAgent == null) {
      try {
        Agent a = (Agent) Class.forName(agentType).newInstance();
        if (a instanceof GatewayAgent) {
          //#DOTNET_EXCLUDE_BEGIN
          ((GatewayAgent) a).setListener(new GatewayListenerImpl());
          //#DOTNET_EXCLUDE_END
         
          // We are able to detect the GatewayAgent state only if the internal agent is a GatewayAgent instance
          gatewayAgentState = NOT_ACTIVE;
        }
        a.setArguments(agentArguments);
        myAgent = myContainer.acceptNewAgent("Control"+myContainer.getContainerName(), a);
       
        if (gatewayAgentState == NOT_ACTIVE) {
          // Set the ACTIVE state synchronously so that when checkJADE() completes isGatewayActive() certainly returns true
          gatewayAgentState = ACTIVE;
        }
        myAgent.start();
      }
      catch (StaleProxyException spe) {
        // Just let it through
        throw spe;
      }
      catch (Exception e) {
        throw new ControllerException("Error creating GatewayAgent [" + e + "]");
      }
    }
  }
View Full Code Here

TOP

Related Classes of jade.wrapper.ControllerException

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.