Package jade.core

Examples of jade.core.VerticalCommand


        throw new ServiceException("Problem in contacting the IMTP Manager", imtpe);
      }
    }

    public VerticalCommand serve(HorizontalCommand cmd) {
      VerticalCommand result = null;
      try {
        String cmdName = cmd.getName();
        Object[] params = cmd.getParams();
        if (cmdName.equals(PersistentDeliverySlice.H_STOREMESSAGE)) {
          String storeName = (String)params[0];
View Full Code Here


        throw new ServiceException("Problem in contacting the IMTP Manager", imtpe);
      }
    }
   
    public VerticalCommand serve(HorizontalCommand cmd) {
      VerticalCommand result = null;
      try {
        String cmdName = cmd.getName();
        Object[] params = cmd.getParams();

        if(cmdName.equals(AgentMobilitySlice.H_CREATEAGENT)) {
          AID agentID = (AID)params[0];
          byte[] serializedInstance = (byte[])params[1];
          String classSiteName = (String)params[2];
          boolean isCloned = ((Boolean)params[3]).booleanValue();
          boolean startIt = ((Boolean)params[4]).booleanValue();
         
          createAgent(agentID, serializedInstance, classSiteName, isCloned, startIt);
        }
        else if(cmdName.equals(AgentMobilitySlice.H_FETCHCLASSFILE)) {
          String className = (String)params[0];
          String agentName = (String)params[1];
         
          cmd.setReturnValue(fetchClassFile(className, agentName));
        }
        else if(cmdName.equals(AgentMobilitySlice.H_MOVEAGENT)) {
          GenericCommand gCmd = new GenericCommand(AgentMobilityHelper.REQUEST_MOVE, AgentMobilitySlice.NAME, null);
          AID agentID = (AID)params[0];
          Location where = (Location)params[1];
          gCmd.addParam(agentID);
          gCmd.addParam(where);
         
          result = gCmd;
        }
        else if(cmdName.equals(AgentMobilitySlice.H_COPYAGENT)) {
          GenericCommand gCmd = new GenericCommand(AgentMobilityHelper.REQUEST_CLONE, AgentMobilitySlice.NAME, null);
          AID agentID = (AID)params[0];
          Location where = (Location)params[1];
          String newName = (String)params[2];
          gCmd.addParam(agentID);
          gCmd.addParam(where);
          gCmd.addParam(newName);
         
          result = gCmd;
        }
        else if(cmdName.equals(AgentMobilitySlice.H_PREPARE)) {
         
          cmd.setReturnValue(new Boolean(prepare()));
        }
        else if(cmdName.equals(AgentMobilitySlice.H_TRANSFERIDENTITY)) {
          AID agentID = (AID)params[0];
          Location src = (Location)params[1];
          Location dest = (Location)params[2];
         
          cmd.setReturnValue(new Boolean(transferIdentity(agentID, src, dest)));
        }
        else if(cmdName.equals(AgentMobilitySlice.H_HANDLETRANSFERRESULT)) {
          AID agentID = (AID)params[0];
          boolean transferResult = ((Boolean)params[1]).booleanValue();
          List messages = (List)params[2];
         
          handleTransferResult(agentID, transferResult, messages);
        }
        else if(cmdName.equals(AgentMobilitySlice.H_CLONEDAGENT)) {
          GenericCommand gCmd = new GenericCommand(AgentMobilityHelper.INFORM_CLONED, AgentMobilitySlice.NAME, null);
          AID agentID = (AID)params[0];
          ContainerID cid = (ContainerID)params[1];
          Credentials creds = (Credentials)params[2];
          gCmd.addParam(agentID);
          gCmd.addParam(cid);
          gCmd.addParam(creds);
         
          result = gCmd;
        }
        //#J2ME_EXCLUDE_BEGIN
        else if(cmdName.equals(AgentMobilitySlice.H_CLONECODELOCATORENTRY)) {
          AID oldAgentID = (AID)params[0];
          AID newAgentID = (AID)params[1];
         
          handleCloneCodeLocatorEntry(oldAgentID, newAgentID);
        }
        else if(cmdName.equals(AgentMobilitySlice.H_REMOVECODELOCATORENTRY)) {
          AID agentID = (AID)params[0];

          handleRemoveCodeLocatorEntry(agentID);
        }
        //#J2ME_EXCLUDE_END
      }
      catch(Throwable t) {
        cmd.setReturnValue(t);
        if(result != null) {
          result.setReturnValue(t);
        }
      }
     
      return result;
    }
View Full Code Here

        throw new ServiceException("Problem in contacting the IMTP Manager", imtpe);
      }
    }
   
    public VerticalCommand serve(HorizontalCommand cmd) {
      VerticalCommand result = null;
      try {
        String cmdName = cmd.getName();
        Object[] params = cmd.getParams();
       
        if(cmdName.equals(MessagingSlice.H_DISPATCHLOCALLY)) {
View Full Code Here

        // Become the new leader if it is the case...
        if ((oldLabel != 0) && (myLabel == 0)) {
          myLogger.log(Logger.INFO, "-- I'm the new leader ---");
          myContainer.becomeLeader(feeder);
          VerticalCommand cmd = new GenericCommand(MainReplicationSlice.LEADERSHIP_ACQUIRED, NAME, null);
          submit(cmd);
        }
        else {
          if (feeder != null) {
            // NO new AMS --> No need for intercepting events anymore
View Full Code Here

        throw new ServiceException("Problem in contacting the IMTP Manager", imtpe);
      }
    }

    public VerticalCommand serve(HorizontalCommand cmd) {
      VerticalCommand result = null;
      try {
        String cmdName = cmd.getName();
        Object[] params = cmd.getParams();

        if(cmdName.equals(AddressNotificationSlice.H_ADDSERVICEMANAGERADDRESS)) {
          String addr = (String)params[0];
          addServiceManagerAddress(addr);
        }
        else if(cmdName.equals(AddressNotificationSlice.H_GETSERVICEMANAGERADDRESS)) {
          cmd.setReturnValue(getServiceManagerAddress());
        }
      }
      catch(Throwable t) {
        cmd.setReturnValue(t);
        if(result != null) {
          result.setReturnValue(t);
        }
      }

      return result;
    }
View Full Code Here

        throw new ServiceException("Problem in contacting the IMTP Manager", imtpe);
      }
    }
   
    public VerticalCommand serve(HorizontalCommand cmd) {
      VerticalCommand result = null;
      try {
        String cmdName = cmd.getName();
        Object[] params = cmd.getParams();
       
        if(cmdName.equals(AgentManagementSlice.H_CREATEAGENT)) {
View Full Code Here

        throw new ServiceException("Problem in contacting the IMTP Manager", imtpe);
      }
    }

    public VerticalCommand serve(HorizontalCommand cmd) {
      VerticalCommand result = null;
      try {
        String cmdName = cmd.getName();
        Object[] params = cmd.getParams();

        if(cmdName.equals(AgentManagementSlice.H_CREATEAGENT)) {
View Full Code Here

TOP

Related Classes of jade.core.VerticalCommand

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.