Package jade.core

Examples of jade.core.GenericCommand


      Object[] params = cmd.getParams();
      AID agentID = (AID) params[0];
      String newState = (String) params[1];

      if (newState.equals(jade.domain.FIPAAgentManagement.AMSAgentDescription.SUSPENDED)) {
        GenericCommand hCmd = new GenericCommand(MainReplicationSlice.H_SUSPENDEDAGENT, MainReplicationSlice.NAME, null);
        hCmd.addParam(agentID);

        broadcastToReplicas(hCmd, EXCLUDE_MYSELF);
      } else if (newState.equals(jade.domain.FIPAAgentManagement.AMSAgentDescription.ACTIVE)) {
        GenericCommand hCmd = new GenericCommand(MainReplicationSlice.H_RESUMEDAGENT, MainReplicationSlice.NAME, null);
        hCmd.addParam(agentID);

        broadcastToReplicas(hCmd, EXCLUDE_MYSELF);
      }

    }
View Full Code Here


    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);

      broadcastToReplicas(hCmd, EXCLUDE_MYSELF);
    }
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);

      broadcastToReplicas(hCmd, EXCLUDE_MYSELF);
    }
View Full Code Here

        myPlatformManager.removeReplica(monitoredSvcMgr, false);
        myPlatformManager.removeNode(new NodeDescriptor(n), false);

        // Broadcast a 'removeReplica()' method (exclude yourself from bcast)
        GenericCommand hCmd = new GenericCommand(MainReplicationSlice.H_REMOVEREPLICA, MainReplicationSlice.NAME, null);
        hCmd.addParam(monitoredSvcMgr);
        hCmd.addParam(new Integer(monitoredLabel));
        broadcastToReplicas(hCmd, EXCLUDE_MYSELF);

        int oldLabel = myLabel;

        adjustLabels(monitoredLabel);

        // -- Attach to the new neighbour slice...
        MainReplicationSlice newSlice = (MainReplicationSlice) replicas.get(monitoredLabel);
        attachTo(monitoredLabel, newSlice);

        // 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

public class MainReplicationProxy extends SliceProxy implements MainReplicationSlice {


    public int getLabel() throws IMTPException {
  try {
      GenericCommand cmd = new GenericCommand(H_GETLABEL, NAME, null);

      Node n = getNode();
      Object result = n.accept(cmd);
      if((result != null) && (result instanceof Throwable)) {
    if(result instanceof IMTPException) {
View Full Code Here

  }
    }

    public String getPlatformManagerAddress() throws IMTPException {
  try {
      GenericCommand cmd = new GenericCommand(H_GETPLATFORMMANAGERADDRESS, NAME, null);

      Node n = getNode();
      Object result = n.accept(cmd);
      if((result != null) && (result instanceof Throwable)) {
    if(result instanceof IMTPException) {
View Full Code Here

  }
    }

    public void addReplica(String sliceName, String smAddr, int sliceIndex, NodeDescriptor dsc, Vector services) throws IMTPException {
  try {
      GenericCommand cmd = new GenericCommand(H_ADDREPLICA, NAME, null);
      cmd.addParam(sliceName);
      cmd.addParam(smAddr);
      cmd.addParam(new Integer(sliceIndex));
      cmd.addParam(dsc);
      cmd.addParam(services);

      Node n = getNode();
      Object result = n.accept(cmd);
      if((result != null) && (result instanceof Throwable)) {
    if(result instanceof IMTPException) {
View Full Code Here

  }
    }

    public void removeReplica(String smAddr, int sliceIndex) throws IMTPException {
  try {
      GenericCommand cmd = new GenericCommand(H_REMOVEREPLICA, NAME, null);
      cmd.addParam(smAddr);
      cmd.addParam(new Integer(sliceIndex));

      Node n = getNode();
      Object result = n.accept(cmd);
      if((result != null) && (result instanceof Throwable)) {
    if(result instanceof IMTPException) {
View Full Code Here

  }
    }

    public void fillGADT(AID[] agents, ContainerID[] containers) throws IMTPException {
  try {
      GenericCommand cmd = new GenericCommand(H_FILLGADT, NAME, null);
      cmd.addParam(agents);
      cmd.addParam(containers);

      Node n = getNode();
      Object result = n.accept(cmd);
      if((result != null) && (result instanceof Throwable)) {
    if(result instanceof IMTPException) {
View Full Code Here

  }
    }*/

    public void suspendedAgent(AID name) throws IMTPException, NotFoundException {
  try {
      GenericCommand cmd = new GenericCommand(H_SUSPENDEDAGENT, NAME, null);
      cmd.addParam(name);

      Node n = getNode();
      Object result = n.accept(cmd);
      if((result != null) && (result instanceof Throwable)) {
    if(result instanceof IMTPException) {
View Full Code Here

TOP

Related Classes of jade.core.GenericCommand

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.