Package jade.core.mobility
Class AgentMobilityService
- java.lang.Object
-
- jade.core.BaseService
-
- jade.core.mobility.AgentMobilityService
-
- All Implemented Interfaces:
Service
public class AgentMobilityService extends BaseService
The JADE service to manage mobility-related agent life cycle: migration and clonation.- Author:
- Giovanni Rimassa - FRAMeTech s.r.l., Giovanni Caire - TILAB
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jade.core.Service
Service.Slice, Service.SliceProxy
-
-
Field Summary
Fields Modifier and Type Field Description static intAP_COPYstatic intAP_GONEstatic intAP_TRANSITstatic StringNAME-
Fields inherited from class jade.core.BaseService
ALL_DUMP_KEY, MAIN_SLICE, myFinder, myLogger, THIS_SLICE
-
Fields inherited from interface jade.core.Service
ADOPTED_NODE, DEAD_NODE, DEAD_PLATFORM_MANAGER, DEAD_REPLICA, DEAD_SLICE, NEW_NODE, NEW_REPLICA, NEW_SLICE, REATTACHED, RECONNECTED
-
-
Constructor Summary
Constructors Constructor Description AgentMobilityService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidboot(Profile myProfile)Performs the active initialization step of a kernel-level service.voidbornAgent(AID agentID, ContainerID cid, JADEPrincipal principal, String ownership, boolean forceReplacement)StringgetClassSite(Agent a)Retrieve the name of the container where the classes of a given agent can be foundFiltergetCommandFilter(boolean direction)This should be properly implemented by the services that have filters.SinkgetCommandSink(boolean side)This should be properly implemented by the services that have sinks.protected Service.SlicegetFreshSlice(String name)ServiceHelpergetHelper(Agent a)This should be properly implemented by the services that have helpers.Class<?>getHorizontalInterface()This should be properly implemented by the services that have non-empty slices.Service.SlicegetLocalSlice()This should be properly implemented by the services that have non-empty slices.StringgetName()Retrieve the name of this service, that can be used to look up its slices in the Service Finder.String[]getOwnedCommands()This should be properly implemented by the services that owns vertival commands.voidinit(AgentContainer ac, Profile p)Performs the passive initialization step of the service.voidmovedAgent(AID agentID, ContainerID src, ContainerID dest)-
Methods inherited from class jade.core.BaseService
addAlias, broadcast, clearCachedSlice, createInvokator, dump, getAllSlices, getAMSBehaviour, getIMTPManager, getLocalNode, getNumberOfSlices, getSlice, isLocal, lookupAlias, shutdown, stringifySlice, submit
-
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
AP_TRANSIT
public static final int AP_TRANSIT
- See Also:
- Constant Field Values
-
AP_COPY
public static final int AP_COPY
- See Also:
- Constant Field Values
-
AP_GONE
public static final int AP_GONE
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(AgentContainer ac, Profile p) throws ProfileException
Description copied from interface:ServicePerforms the passive initialization step of the service. This method is called before activating the service. Its role should be simply the one of a constructor, setting up the internal data as needed. Service implementations should not use the Service Manager and Service Finder facilities from within this method. A distributed initialization protocol, if needed, should be exectuted within theboot()method.- Specified by:
initin interfaceService- Overrides:
initin classBaseService- Parameters:
ac- The agent container this service is activated on.p- The configuration profile for this service.- Throws:
ProfileException- If the given profile is not valid.
-
boot
public void boot(Profile myProfile) throws ServiceException
Description copied from interface:ServicePerforms the active initialization step of a kernel-level service. When JADE kernel calls this method, the service has already been already associated with its container and registered with the Service Manager.- Specified by:
bootin interfaceService- Overrides:
bootin classBaseService- Parameters:
myProfile- The configuration profile for this service.- Throws:
ServiceException- If a problem occurs during service initialization.
-
getName
public String getName()
Description copied from interface:ServiceRetrieve the name of this service, that can be used to look up its slices in the Service Finder.- Returns:
- The name of this service.
- See Also:
ServiceFinder
-
getHorizontalInterface
public Class<?> getHorizontalInterface()
Description copied from class:BaseServiceThis should be properly implemented by the services that have non-empty slices.- Specified by:
getHorizontalInterfacein interfaceService- Overrides:
getHorizontalInterfacein classBaseService- Returns:
- A
Classobject, representing the interface that is implemented by the slices of this service. Letsbe theClassobject corresponding to theService.Sliceinterface, and letcbe the returnedClassobject. Then, the two following conditions must hold:c.isInterface() == trues.isAssignableFrom(c) == true
-
getLocalSlice
public Service.Slice getLocalSlice()
Description copied from class:BaseServiceThis should be properly implemented by the services that have non-empty slices.- Specified by:
getLocalSlicein interfaceService- Overrides:
getLocalSlicein classBaseService- Returns:
- The slice of this service that resides on the local
platform node, or
nullif no such slice exists.
-
getHelper
public ServiceHelper getHelper(Agent a)
Description copied from class:BaseServiceThis should be properly implemented by the services that have helpers.- Specified by:
getHelperin interfaceService- Overrides:
getHelperin classBaseService- Parameters:
a- The agent which the helper is requested for.- Returns:
- The ServiceHelper to be used by the agent.
- See Also:
AgentToolkit.getHelper(jade.core.Agent, java.lang.String),Agent.getHelper(java.lang.String)
-
getCommandFilter
public Filter getCommandFilter(boolean direction)
Description copied from class:BaseServiceThis should be properly implemented by the services that have filters. Note that when called multiple times with the same value of thedirectionparameter this method MUST always return the same object!- Specified by:
getCommandFilterin interfaceService- Overrides:
getCommandFilterin classBaseService- Parameters:
direction- One of the two constantsFilter.INCOMINGandFilter.OUTGOING, distinguishing between the two filter chains managed by the command processor.- Returns:
- A
Filterobject, used by this service to intercept and process kernel-level commands. If the service does not wish to install a command filter for one or both directions, it can just returnnullwhen appropriate. - See Also:
CommandProcessor
-
getCommandSink
public Sink getCommandSink(boolean side)
Description copied from class:BaseServiceThis should be properly implemented by the services that have sinks.- Specified by:
getCommandSinkin interfaceService- Overrides:
getCommandSinkin classBaseService- Parameters:
side- One of the two constantsSink.COMMAND_SOURCEorSink.COMMAND_TARGET, to state whether this sink will handle locally issued commands or commands incoming from remote nodes.- Returns:
- Concrete services must return their own implementation
of the
Sinkinterface, that will be invoked by the kernel in order to consume any incoming vertical command owned by this service. If the service does not wish to install a command sink, it can just returnnull. - See Also:
Service.getOwnedCommands()
-
getOwnedCommands
public String[] getOwnedCommands()
Description copied from class:BaseServiceThis should be properly implemented by the services that owns vertival commands.- Specified by:
getOwnedCommandsin interfaceService- Overrides:
getOwnedCommandsin classBaseService- Returns:
- An array containing the names of all the vertical
commands this service wants to own. If this service has no such
commands (it acts purely as a command filter), it can return an
empty array, or
nullas well. - See Also:
jade.core.Service#getCommandSink()
-
getClassSite
public String getClassSite(Agent a)
Retrieve the name of the container where the classes of a given agent can be found
-
movedAgent
public void movedAgent(AID agentID, ContainerID src, ContainerID dest) throws NotFoundException
- Throws:
NotFoundException
-
bornAgent
public void bornAgent(AID agentID, ContainerID cid, JADEPrincipal principal, String ownership, boolean forceReplacement) throws NameClashException, NotFoundException
- Throws:
NameClashExceptionNotFoundException
-
getFreshSlice
protected Service.Slice getFreshSlice(String name) throws ServiceException
- Overrides:
getFreshSlicein classBaseService- Throws:
ServiceException
-
-