Package jade.core

Examples of jade.core.MainContainer


    private void handleSniffOn(VerticalCommand cmd) throws IMTPException, ServiceException, NotFoundException {
      Object[] params = cmd.getParams();
      AID sniffer = (AID)params[0];
      List targets = (List)params[1];
     
      MainContainer impl = myContainer.getMain();
      if(impl != null) {   
        // Activate sniffing each element of the list
        Iterator it = targets.iterator();
        while(it.hasNext()) {
          AID target = (AID)it.next();
          ContainerID cid = impl.getContainerID(target);
         
          NotificationSlice slice = (NotificationSlice)getSlice(cid.getName());
          try {
            slice.sniffOn(sniffer, target);
          }
View Full Code Here


    private void handleSniffOff(VerticalCommand cmd) throws IMTPException, ServiceException, NotFoundException {
      Object[] params = cmd.getParams();
      AID sniffer = (AID)params[0];
      List targets = (List)params[1];
     
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        // Deactivate sniffing each element of the list
        Iterator it = targets.iterator();
        while(it.hasNext()) {
          AID target = (AID)it.next();
          ContainerID cid = impl.getContainerID(target);
         
          NotificationSlice slice = (NotificationSlice)getSlice(cid.getName());
          try {
            slice.sniffOff(sniffer, target);
          }
View Full Code Here

    private void handleDebugOn(VerticalCommand cmd) throws IMTPException, ServiceException, NotFoundException {
      Object[] params = cmd.getParams();
      AID introspector = (AID)params[0];
      List targets = (List)params[1];
     
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        // Activate debugging each element of the list
        Iterator it = targets.iterator();
        while(it.hasNext()) {
          AID target = (AID)it.next();
          ContainerID cid = impl.getContainerID(target);
         
          NotificationSlice slice = (NotificationSlice)getSlice(cid.getName());
          try {
            slice.debugOn(introspector, target);
          }
View Full Code Here

    private void handleDebugOff(VerticalCommand cmd) throws IMTPException, ServiceException, NotFoundException {
      Object[] params = cmd.getParams();
      AID introspector = (AID)params[0];
      List targets = (List)params[1];
     
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        // Deactivate debugging each element of the list
        Iterator it = targets.iterator();
        while(it.hasNext()) {
          AID target = (AID)it.next();
          ContainerID cid = impl.getContainerID(target);
         
          NotificationSlice slice = (NotificationSlice)getSlice(cid.getName());
          try {
            slice.debugOff(introspector, target);
          }
View Full Code Here

   
    private void handleSetPlatformAddresses(VerticalCommand cmd) {   
    }
   
    private void handleNewSlice(VerticalCommand cmd) {
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        Object[] params = cmd.getParams();
        String newSliceName = (String) params[0];
        try {
          // Be sure to get the new (fresh) slice --> Bypass the service cache
          MessagingSlice newSlice = (MessagingSlice) getFreshSlice(newSliceName);
         
          // Send all possible routes to the new slice
          ContainerID[] cids = impl.containerIDs();
          for(int i = 0; i < cids.length; i++) {
            ContainerID cid = cids[i];
           
            try {
              List mtps = impl.containerMTPs(cid);
              Iterator it = mtps.iterator();
              while(it.hasNext()) {
                MTPDescriptor mtp = (MTPDescriptor)it.next();
                newSlice.addRoute(mtp, cid.getName());
              }
View Full Code Here

        throw new MTPException("No such address was found on this container: " + address);
      }
    }
   
    private  void newMTP(MTPDescriptor mtp, ContainerID cid) throws IMTPException, ServiceException {
      MainContainer impl = myContainer.getMain();
     
      if(impl != null) {
       
        // Update the routing tables of all the other slices
        Service.Slice[] slices = getAllSlices();
        for(int i = 0; i < slices.length; i++) {
          try {
            MessagingSlice slice = (MessagingSlice)slices[i];
            String sliceName = slice.getNode().getName();
            if(!sliceName.equals(cid.getName())) {
              slice.addRoute(mtp, cid.getName());
            }
          }
          catch(Throwable t) {
            // Re-throw allowed exceptions
            if(t instanceof IMTPException) {
              throw (IMTPException)t;
            }
            if(t instanceof ServiceException) {
              throw (ServiceException)t;
            }
            //System.err.println("### addRoute() threw " + t.getClass().getName() + " ###");
            myLogger.log(Logger.WARNING,"### addRoute() threw " + t + " ###");
          }
        }
        impl.newMTP(mtp, cid);
      }
      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

        // Do nothing for now, but could also route the command to the main slice, thus enabling e.g. AMS replication
      }
    }
   
    private void deadMTP(MTPDescriptor mtp, ContainerID cid) throws IMTPException, ServiceException {
      MainContainer impl = myContainer.getMain();
     
      if(impl != null) {
       
        // Update the routing tables of all the other slices
        Service.Slice[] slices = getAllSlices();
        for(int i = 0; i < slices.length; i++) {
          try {
            MessagingSlice slice = (MessagingSlice)slices[i];
            String sliceName = slice.getNode().getName();
            if(!sliceName.equals(cid.getName())) {
              slice.removeRoute(mtp, cid.getName());
            }
          }
          catch(Throwable t) {
            // Re-throw allowed exceptions
            if(t instanceof IMTPException) {
              throw (IMTPException)t;
            }
            if(t instanceof ServiceException) {
              throw (ServiceException)t;
            }
           
            myLogger.log(Logger.WARNING,"### removeRoute() threw " + t + " ###");
          }
        }
        impl.deadMTP(mtp, cid);
      }
      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

    private void handleRequestMove(VerticalCommand cmd) throws IMTPException, ServiceException, NotFoundException {
      Object[] params = cmd.getParams();
      AID agentID = (AID)params[0];
      Location where = (Location)params[1];
     
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        ContainerID cid = impl.getContainerID(agentID);
        AgentMobilitySlice targetSlice = (AgentMobilitySlice)getSlice(cid.getName());
        try {
          targetSlice.moveAgent(agentID, where);
        }
        catch(IMTPException imtpe) {
View Full Code Here

      Object[] params = cmd.getParams();
      AID agentID = (AID)params[0];
      Location where = (Location)params[1];
      String newName = (String)params[2];
     
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        ContainerID cid = impl.getContainerID(agentID);
        AgentMobilitySlice targetSlice = (AgentMobilitySlice)getSlice(cid.getName());
        try {
          targetSlice.copyAgent(agentID, where, newName);
        }
        catch(IMTPException imtpe) {
View Full Code Here

      myContainer.releaseLocalAgent(agentID);
    }
   
    // FIXME: adjust principal
    private void clonedAgent(AID agentID, ContainerID cid, Credentials credentials) throws JADESecurityException, NotFoundException, NameClashException {
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        // Retrieve the ownership from the credentials
        String ownership = "NONE";
        if (credentials != null) {
          JADEPrincipal ownerPr = credentials.getOwner();
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.