|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jade.core.behaviours.Behaviour | +--jade.core.behaviours.SimpleBehaviour | +--jade.core.behaviours.CyclicBehaviour | +--jade.domain.introspection.AMSSubscriber
This behaviour subscribes to the AMS to receive notifications
about platform-wide events. The installHandlers
method must be redefined to define the handlers for events the
agent executing this behaviour is interested in.
Nested Class Summary | |
static interface |
AMSSubscriber.EventHandler
This interface must be implemented by concrete event handlers installed by this AMSSubscriber. |
Field Summary | |
static java.lang.String |
AMS_CANCELLATION
|
static java.lang.String |
AMS_SUBSCRIPTION
|
static java.lang.String |
PLATFORM_EVENTS
|
Fields inherited from class jade.core.behaviours.Behaviour |
myAgent |
Constructor Summary | |
AMSSubscriber()
Construct an AMSSubscriber behaviour to receive notifications about platform events from the local AMS |
|
AMSSubscriber(AID ams)
Construct an AMSSubscriber behaviour to receive notifications about platform events from the AMS of a remote platform. |
Method Summary | |
void |
action()
Runs the behaviour. |
ACLMessage |
getCancel()
Retrieve the cancel ACL message
used to cancel the subscription to the AMS.
|
ACLMessage |
getSubscribe()
Retrieve the subscribe ACL message used to subscribe
to the AMS.
|
protected abstract void |
installHandlers(java.util.Map handlersTable)
This method has to be implemented by concrete subclasses, filling the Map passed as parameter with
implementations of the EventHandler interface,
using the name of the event as key (see the Event
interface. |
void |
onStart()
This method is just an empty placeholders for subclasses. |
Methods inherited from class jade.core.behaviours.CyclicBehaviour |
done |
Methods inherited from class jade.core.behaviours.SimpleBehaviour |
reset |
Methods inherited from class jade.core.behaviours.Behaviour |
block, block, getBehaviourName, getDataStore, getParent, isRunnable, onEnd, restart, root, setAgent, setBehaviourName, setDataStore |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String AMS_SUBSCRIPTION
public static final java.lang.String AMS_CANCELLATION
public static final java.lang.String PLATFORM_EVENTS
Constructor Detail |
public AMSSubscriber()
public AMSSubscriber(AID ams)
ams
- The AID of the remote platform AMSMethod Detail |
public void onStart()
Behaviour
Behaviour
.
onStart
in class Behaviour
protected abstract void installHandlers(java.util.Map handlersTable)
Map
passed as parameter with
implementations of the EventHandler
interface,
using the name of the event as key (see the Event
interface.
handlersTable
- The table that associates each event name
with a proper handler.public final void action()
Behaviour
Behaviour
subclasses to perform ordinary behaviour
duty. An agent schedules its behaviours calling their
action()
method; since all the behaviours belonging
to the same agent are scheduled cooperatively, this method
must not enter in an endless loop and should return as
soon as possible to preserve agent responsiveness. To split a
long and slow task into smaller section, recursive behaviour
aggregation may be used.
action
in class Behaviour
CompositeBehaviour
public final ACLMessage getSubscribe()
subscribe
ACL message used to subscribe
to the AMS.
This message is automatically sent when this behaviour is added to an
Agent.
public final ACLMessage getCancel()
cancel
ACL message
used to cancel the subscription to the AMS.
Since this behaviour is cyclic (never ends) it is the responsibility
of the agent executing this behaviour to send the cancel
message to the AMS when notifications are no longer required.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |