Package jade.core

Examples of jade.core.ContainerID


    }

    private void handleNewMTP(VerticalCommand cmd) throws IMTPException, ServiceException {
      Object[] params = cmd.getParams();
      MTPDescriptor mtp = (MTPDescriptor) params[0];
      ContainerID cid = (ContainerID) params[1];

      GenericCommand hCmd = new GenericCommand(MainReplicationSlice.H_NEWMTP, MainReplicationSlice.NAME, null);
      hCmd.addParam(mtp);
      hCmd.addParam(cid);
View Full Code Here


    }

    private void handleDeadMTP(VerticalCommand cmd) throws IMTPException, ServiceException {
      Object[] params = cmd.getParams();
      MTPDescriptor mtp = (MTPDescriptor) params[0];
      ContainerID cid = (ContainerID) params[1];

      GenericCommand hCmd = new GenericCommand(MainReplicationSlice.H_DEADMTP, MainReplicationSlice.NAME, null);
      hCmd.addParam(mtp);
      hCmd.addParam(cid);
View Full Code Here

          AID[] agents = (AID[]) params[0];
          ContainerID[] containers = (ContainerID[]) params[1];
          fillGADT(agents, containers);
        } else if (cmdName.equals(MainReplicationSlice.H_BORNAGENT)) {
          AID name = (AID) params[0];
          ContainerID cid = (ContainerID) params[1];
          bornAgent(name, cid, cmd.getPrincipal(), cmd.getCredentials());
        } else if (cmdName.equals(MainReplicationSlice.H_DEADAGENT)) {
          AID name = (AID) params[0];
          deadAgent(name);
        } else if (cmdName.equals(MainReplicationSlice.H_SUSPENDEDAGENT)) {
          AID name = (AID) params[0];
          suspendedAgent(name);
        } else if (cmdName.equals(MainReplicationSlice.H_RESUMEDAGENT)) {
          AID name = (AID) params[0];
          resumedAgent(name);
        } else if (cmdName.equals(MainReplicationSlice.H_NEWMTP)) {
          MTPDescriptor mtp = (MTPDescriptor) params[0];
          ContainerID cid = (ContainerID) params[1];
          newMTP(mtp, cid);
        } else if (cmdName.equals(MainReplicationSlice.H_DEADMTP)) {
          MTPDescriptor mtp = (MTPDescriptor) params[0];
          ContainerID cid = (ContainerID) params[1];
          deadMTP(mtp, cid);
        } else if (cmdName.equals(MainReplicationSlice.H_NEWTOOL)) {
          AID tool = (AID) params[0];
          newTool(tool);
        } else if (cmdName.equals(MainReplicationSlice.H_DEADTOOL)) {
View Full Code Here

        if (myLogger.isLoggable(Logger.CONFIG))
          myLogger.log(Logger.CONFIG, "Agent " + name.getName() + " inserted into GADT");

      } catch (NameClashException nce) {
        try {
          ContainerID oldCid = myMain.getContainerID(name);
          Node n = myMain.getContainerNode(oldCid).getNode();

          // Perform a non-blocking ping to check...
          n.ping(false);
View Full Code Here

  public boolean showInstallMTPDialog(jade.domain.JADEAgentManagement.InstallMTP imtp) {
    String[] names = (String[])containerNames.toArray(new String[0]);
    installDlg.reset(names, imtp.getContainer().getName());
    installDlg.pack();
    installDlg.setVisible(true);
    imtp.setContainer(new ContainerID(installDlg.getContainer(), null));
    imtp.setAddress(installDlg.getAddress());
    imtp.setClassName(installDlg.getClassName());
    return installDlg.isConfirmed();
  }
View Full Code Here

    myContainer = c;
    myMain = m;
    platformState = PlatformState.PLATFORM_STATE_READY;
    myMain.addListener(new AgentManagerListenerAdapter() {
      public void removedContainer(jade.core.event.PlatformEvent ev) {
        ContainerID cid = ev.getContainer();
        try {
          if (cid.getName().equals(myContainer.getContainerName())) {
            // The local main container is terminating -->
            // The whole platform is terminating
            platformState = PlatformState.PLATFORM_STATE_KILLED;
          }
        }
View Full Code Here

    ListenerWrapper(PlatformController.Listener l) {
      myListener = l;
    }
   
    public void removedContainer(jade.core.event.PlatformEvent ev) {
      ContainerID cid = ev.getContainer();
      try {
        if (cid.getName().equals(myContainer.getContainerName())) {
          // The local main container is terminating -->
          // The whole platform is terminating
          myListener.killedPlatform(new jade.wrapper.PlatformEvent() {
            public String getAgentGUID() {
              return null;
View Full Code Here

     
      Object[] params = cmd.getParams();
      String name = (String)params[0];
      String className = (String)params[1];
      Object[]args = (Object[])params[2];
      ContainerID cid = (ContainerID)params[3];
      JADEPrincipal owner = (JADEPrincipal) params[4];
      Credentials initialCredentials = (Credentials) params[5];
     
      if(myLogger.isLoggable(Logger.CONFIG))
        myLogger.log(Logger.CONFIG,"Source Sink consuming command REQUEST_CREATE. Name is "+name);
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        AID agentID = new AID(name, AID.ISLOCALNAME);
        AgentManagementSlice targetSlice = (AgentManagementSlice)getSlice(cid.getName());
        if (targetSlice != null) {
          try {
            targetSlice.createAgent(agentID, className, args, owner, initialCredentials, AgentManagementSlice.CREATE_AND_START, cmd);
          }
          catch(IMTPException imtpe) {
            // Try to get a newer slice and repeat...
            targetSlice = (AgentManagementSlice)getFreshSlice(cid.getName());
            targetSlice.createAgent(agentID, className, args, owner, initialCredentials, AgentManagementSlice.CREATE_AND_START, cmd);
          }
        }
        else {
          throw new NotFoundException("Container "+cid.getName()+" not found");
        }
      }
      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

      if(myLogger.isLoggable(Logger.CONFIG))
        myLogger.log(Logger.CONFIG,"Source Sink consuming command REQUEST_KILL. Name is "+agentID.getName());
     
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        ContainerID cid = impl.getContainerID(agentID);
        // Note that since getContainerID() succeeded, targetSlice can't be null
        AgentManagementSlice targetSlice = (AgentManagementSlice)getSlice(cid.getName());
        try {
          targetSlice.killAgent(agentID, cmd);
        }
        catch(IMTPException imtpe) {
          // Try to get a newer slice and repeat...
          targetSlice = (AgentManagementSlice)getFreshSlice(cid.getName());
          targetSlice.killAgent(agentID, cmd);
        }
      }
      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

        newState = Agent.AP_ACTIVE;
      }
     
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        ContainerID cid = impl.getContainerID(agentID);
        // Note that since getContainerID() succeeded, targetSlice can't be null
        AgentManagementSlice targetSlice = (AgentManagementSlice)getSlice(cid.getName());
        try {
          targetSlice.changeAgentState(agentID, newState);
        }
        catch(IMTPException imtpe) {
          // Try to get a newer slice and repeat...
          targetSlice = (AgentManagementSlice)getFreshSlice(cid.getName());
          targetSlice.changeAgentState(agentID, newState);
        }
      }
      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

TOP

Related Classes of jade.core.ContainerID

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.