|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Service
The Service interface represents a centralized view of
a JADE kernel-level service. Most JADE services are actually
distributed, and each part of theirs, that is deployed at a given
network node (container), is called service slice. The various slices
of a service work together to carry out that service's task.
| Nested Class Summary | |
|---|---|
static interface |
Service.Slice
The Slice nested interface represents that part of
a service that is deployed at a given network node. |
| Field Summary | |
|---|---|
static java.lang.String |
ADOPTED_NODE
Service independent vertical command issued on the Main container whenever a node that was monitored by a Main container replica is adopted (i.e. the local Main container starts monitoring it) |
static java.lang.String |
DEAD_NODE
Service independent vertical command issued on the Main container whenever a node is removed |
static java.lang.String |
DEAD_PLATFORM_MANAGER
Service independent vertical command issued on a peripheral container when a fault of the PlatformManager is detected |
static java.lang.String |
DEAD_REPLICA
Service independent vertical command issued on the Main container whenever a main replica is removed |
static java.lang.String |
DEAD_SLICE
Service independent vertical command issued on the Main container whenever a slice of a given service is removed |
static java.lang.String |
NEW_NODE
Service independent vertical command issued on the Main container whenever a new node is added |
static java.lang.String |
NEW_REPLICA
Service independent vertical command issued on the Main container whenever a new main replica is added |
static java.lang.String |
NEW_SLICE
Service independent vertical command issued on the Main container whenever a new slice of a given service is added |
static java.lang.String |
REATTACHED
Service independent vertical command issued on a peripheral container when it re-attaches to a recovered Main Container |
static java.lang.String |
RECONNECTED
Service independent vertical command issued on a peripheral container when it reconnects to a new master Main Container |
| Method Summary | |
|---|---|
void |
boot(Profile p)
Performs the active initialization step of a kernel-level service. |
Service.Slice[] |
getAllSlices()
Retrieve the whole array of slices that compose this service. |
Behaviour |
getAMSBehaviour()
Retrieve a behaviour that is associated with this service, and that will be deployed within the AMS. |
Filter |
getCommandFilter(boolean direction)
Access the command filter this service needs to perform its tasks. |
Sink |
getCommandSink(boolean side)
Access the command sink this service uses to handle its own vertical commands. |
ServiceHelper |
getHelper(Agent a)
Get the helper for accessing this service. |
java.lang.Class |
getHorizontalInterface()
Retrieve the interface through which the different service slices will communicate, that is, the service Horizontal Interface. |
Service.Slice |
getLocalSlice()
Retrieve the locally installed slice of this service. |
java.lang.String |
getName()
Retrieve the name of this service, that can be used to look up its slices in the Service Finder. |
int |
getNumberOfSlices()
Query by how many slices this service is composed at present. |
java.lang.String[] |
getOwnedCommands()
Access the names of the vertical commands this service wants to handle as their final destination. |
Service.Slice |
getSlice(java.lang.String name)
Retrieve by name a slice of this service. |
void |
init(AgentContainer ac,
Profile p)
Performs the passive initialization step of the service. |
void |
shutdown()
Performs the shutdown step of a kernel-level service. |
java.lang.Object |
submit(VerticalCommand cmd)
Allows submitting a vertical command for processing. |
| Field Detail |
|---|
static final java.lang.String NEW_NODE
static final java.lang.String DEAD_NODE
static final java.lang.String ADOPTED_NODE
static final java.lang.String NEW_SLICE
static final java.lang.String DEAD_SLICE
static final java.lang.String NEW_REPLICA
static final java.lang.String DEAD_REPLICA
static final java.lang.String DEAD_PLATFORM_MANAGER
static final java.lang.String REATTACHED
static final java.lang.String RECONNECTED
| Method Detail |
|---|
java.lang.String getName()
ServiceFinder
Service.Slice getSlice(java.lang.String name)
throws ServiceException
name - A name for the requested slice. The name must be
unique within this service.
Slice object that is a part of this
service and is identified by the given name, or
null if no such slice exists.
- Throws:
ServiceException - If some underlying error (e.g. a
network problem) occurs, that does not allow to decide whether
the requested slice exists or not.Service.Slice getLocalSlice()
null from this method.
null if no such slice exists.
Service.Slice[] getAllSlices()
throws ServiceException
Service.Slice objects, whose
elements are the slices of this service deployed at the
different platform nodes.
ServiceException - If some underlying error (e.g. a
network problem) occurs, that does not allow to retrieve the
full slice list.java.lang.Class getHorizontalInterface()
Class object, representing the interface
that is implemented by the slices of this service. Let
s be the Class object corresponding
to the Service.Slice interface, and let
c be the returned Class object. Then,
the two following conditions must hold:
c.isInterface() == trues.isAssignableFrom(c) == trueint getNumberOfSlices()
Filter getCommandFilter(boolean direction)
direction
parameter this method MUST always return the same object!
direction - One of the two constants
Filter.INCOMING and Filter.OUTGOING,
distinguishing between the two filter chains managed by the
command processor.
Filter object, 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 return null when
appropriate.jade.core.CommandProcessorSink getCommandSink(boolean side)
side - One of the two constants
Sink.COMMAND_SOURCE or
Sink.COMMAND_TARGET, to state whether this sink
will handle locally issued commands or commands incoming from
remote nodes.
Sink interface, 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 return null.getOwnedCommands()java.lang.String[] getOwnedCommands()
null as well.jade.core.Service#getCommandSink()
ServiceHelper getHelper(Agent a)
throws ServiceException
a - The agent which the helper is requested for.
ServiceExceptionAgentToolkit#getHelper,
Agent.getHelper(java.lang.String)Behaviour getAMSBehaviour()
Behaviour object associated with this
service, or null if no such behaviour exists.
void init(AgentContainer ac,
Profile p)
throws ProfileException
boot() method.
ac - The agent container this service is activated on.p - The configuration profile for this service.
ProfileException - If the given profile is not valid.
void boot(Profile p)
throws ServiceException
p - The configuration profile for this service.
ServiceException - If a problem occurs during service
initialization.void shutdown()
java.lang.Object submit(VerticalCommand cmd)
throws ServiceException
getOwnedCommands(), or an
exception is thrown
cmd - The command to submit to the service.
null if this
command produced no result. If an exception was produced, it
will not be thrown, but will be returned as well.
ServiceException - If the passed command does not belong
to this service.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||