Package jade.core.messaging
Class LightMessagingService
- java.lang.Object
-
- jade.core.BaseService
-
- jade.core.messaging.LightMessagingService
-
- All Implemented Interfaces:
jade.core.messaging.MessageManager.Channel,Service
public class LightMessagingService extends BaseService implements jade.core.messaging.MessageManager.Channel
A minimal version of the JADE service to manage the message passing subsystem installed on the platform. This class just supports direct ACL message delivery, and relies on another one for any other feature (such as message routing and MTP management).- Author:
- Giovanni Rimassa - FRAMeTech s.r.l., Jerome Picault - Motorola Labs
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jade.core.Service
Service.Slice, Service.SliceProxy
-
-
Field Summary
-
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 LightMessagingService()
-
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.voiddeliverNow(GenericMessage msg, AID receiverID)FiltergetCommandFilter(boolean direction)Access the command filter this service needs to perform its tasks.SinkgetCommandSink(boolean side)Access the command sink this service uses to handle its own vertical commands.protected Service.SlicegetFreshSlice(String name)Class<?>getHorizontalInterface()Retrieve the interface through which the different service slices will communicate, that is, the service Horizontal Interface.Service.SlicegetLocalSlice()Retrieve the locally installed slice of this service.StringgetName()Retrieve the name of this service, that can be used to look up its slices in the Service Finder.String[]getOwnedCommands()Access the names of the vertical commands this service wants to handle as their final destination.voidinit(AgentContainer ac, Profile p)Performs the passive initialization step of the service.voidnotifyFailureToSender(GenericMessage msg, AID receiver, InternalError ie)This method is used internally by the platform in order to notify the sender of a message that a failure was reported by the Message Transport Service.-
Methods inherited from class jade.core.BaseService
addAlias, broadcast, clearCachedSlice, createInvokator, dump, getAllSlices, getAMSBehaviour, getHelper, getIMTPManager, getLocalNode, getNumberOfSlices, getSlice, isLocal, lookupAlias, shutdown, stringifySlice, submit
-
-
-
-
Method Detail
-
init
public void init(AgentContainer ac, Profile p) throws ProfileException
Performs 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.
-
getName
public String getName()
Retrieve the name of this service, that can be used to look up its slices in the Service Finder.- Specified by:
getNamein interfaceService- Returns:
- The name of this service.
- See Also:
ServiceFinder
-
getHorizontalInterface
public Class<?> getHorizontalInterface()
Retrieve the interface through which the different service slices will communicate, that is, the service Horizontal Interface.- Specified by:
getHorizontalInterfacein interfaceService- Overrides:
getHorizontalInterfacein classBaseService- Returns:
- A
Classobject, representing the interface that is implemented by the slices of this service.
-
getLocalSlice
public Service.Slice getLocalSlice()
Retrieve the locally installed slice of this service.- 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.
-
getCommandFilter
public Filter getCommandFilter(boolean direction)
Access the command filter this service needs to perform its tasks. This filter will be installed within the local command processing engine.- 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. - See Also:
CommandProcessor
-
getCommandSink
public Sink getCommandSink(boolean side)
Access the command sink this service uses to handle its own vertical commands.- 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()
Access the names of the vertical commands this service wants to handle as their final destination. This set must not overlap with the owned commands set of any previously installed service, or an exception will be raised and service activation will fail.- 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()
-
boot
public void boot(Profile myProfile)
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.
-
deliverNow
public void deliverNow(GenericMessage msg, AID receiverID) throws UnreachableException
- Specified by:
deliverNowin interfacejade.core.messaging.MessageManager.Channel- Throws:
UnreachableException
-
notifyFailureToSender
public void notifyFailureToSender(GenericMessage msg, AID receiver, InternalError ie)
This method is used internally by the platform in order to notify the sender of a message that a failure was reported by the Message Transport Service. Package scoped as it can be called by the MessageManager- Specified by:
notifyFailureToSenderin interfacejade.core.messaging.MessageManager.Channel
-
getFreshSlice
protected Service.Slice getFreshSlice(String name) throws ServiceException
- Overrides:
getFreshSlicein classBaseService- Throws:
ServiceException
-
-