|
Nested Class Summary | ||
static class |
SubscriptionResponder.Subscription Inner calss Subscription |
|
static interface |
SubscriptionResponder.SubscriptionManager Inner interface SubscriptionManager. |
Nested classes/interfaces inherited from class sajas.core.behaviours.Behaviour |
Behaviour.RunnableChangedEvent |
Field Summary | ||
String |
CANCEL_KEY key to retrieve from the DataStore of the behaviour the ACLMessage object sent by the initiator to cancel a subscription. |
|
mySubscriptionManager The SubscriptionManager used by this SubscriptionResponder to register subscriptions |
||
String |
RESPONSE_KEY key to retrieve from the DataStore of the behaviour the ACLMessage object sent as a response to the initiator. |
|
String |
SUBSCRIPTION_KEY key to retrieve from the DataStore of the behaviour the ACLMessage object sent by the initiator as a subscription. |
Fields inherited from class sajas.core.behaviours.FSMBehaviour |
currentName, lastStates |
Fields inherited from class sajas.core.behaviours.CompositeBehaviour |
currentExecuted |
Fields inherited from class sajas.core.behaviours.Behaviour |
myAgent, myEvent, NOTIFY_DOWN, NOTIFY_UP, parent, STATE_BLOCKED, STATE_READY, STATE_RUNNING |
Fields inherited from interface jade.domain.FIPANames.InteractionProtocol |
FIPA_BROKERING, FIPA_CONTRACT_NET, FIPA_DUTCH_AUCTION, FIPA_ENGLISH_AUCTION, FIPA_ITERATED_CONTRACT_NET, FIPA_PROPOSE, FIPA_QUERY, FIPA_RECRUITING, FIPA_REQUEST, FIPA_REQUEST_WHEN, FIPA_SUBSCRIBE, ITERATED_FIPA_REQUEST |
Constructor Summary | ||
SubscriptionResponder(Agent a, jade.lang.acl.MessageTemplate mt) Construct a SubscriptionResponder behaviour that handles subscription messages matching a given template. |
||
SubscriptionResponder(Agent a, jade.lang.acl.MessageTemplate mt, SubscriptionResponder.SubscriptionManager sm) Construct a SubscriptionResponder behaviour that handles subscription messages matching a given template and notifies a given SubscriptionManager about subscription/un-subscription events. |
||
SubscriptionResponder(Agent a, jade.lang.acl.MessageTemplate mt, SubscriptionResponder.SubscriptionManager sm, DataStore store) Construct a SubscriptionResponder behaviour that handles subscription messages matching a given template, notifies a given SubscriptionManager about subscription/un-subscription events and uses a given DataStore. |
Method Summary | ||
static jade.lang.acl.MessageTemplate |
createMessageTemplate(int perf) This static method can be used to set the proper message Template (based on the performative of the subscription message) into the constructor of this behaviour. |
|
createSubscription(jade.lang.acl.ACLMessage subsMsg) Utility method to correctly create a new Subscription object managed by this SubscriptionResponder |
||
getSubscription(jade.lang.acl.ACLMessage msg) Utility method to correctly retrieve the Subscription object that is related to the conversation message msg belongs to. |
||
getSubscription(String convId) Utility method to correctly retrieve the Subscription object that is related a given conversation. |
||
Vector |
getSubscriptions() Utility method that retrieves all Subscription-s managed by this SubscriptionResponder |
|
Vector |
getSubscriptions(AID subscriber) Utility method that retrieves all Subscription-s done by a given agent |
|
protected jade.lang.acl.ACLMessage |
handleCancel(jade.lang.acl.ACLMessage cancel) This method is called when a CANCEL message is received for a previous subscription. |
|
protected jade.lang.acl.ACLMessage |
handleSubscription(jade.lang.acl.ACLMessage subscription) This method is called when a subscription message is received that matches the message template specified in the constructor. |
|
protected jade.lang.acl.ACLMessage |
prepareResponse(jade.lang.acl.ACLMessage subscription) Deprecated. Use handleSubscription() instead |
|
void |
registerHandleCancel(Behaviour b) This method allows to register a user defined Behaviour in the HANDLE_CANCEL state. |
|
void |
registerHandleSubscription(Behaviour b) This method allows to register a user defined Behaviour in the HANDLE_SUBSCRIPTION state. |
|
void |
registerPrepareResponse(Behaviour b) Deprecated. Use registerHandleSubscription() instead. |
|
void |
reset() Reset this behaviour |
|
void |
reset(jade.lang.acl.MessageTemplate mt) This method resets the protocol and allows to change the MessageTemplate that defines what messages this SubscriptionResponder will react to. |
Methods inherited from class sajas.core.behaviours.SerialBehaviour |
handle |
Methods inherited from class sajas.core.behaviours.CompositeBehaviour |
action, done, handleBlockEvent, handleRestartEvent, registerAsChild, resetChildren, setAgent |
Methods inherited from class sajas.core.behaviours.Behaviour |
actionWrapper, block, block, getAgent, getBehaviourName, getDataStore, getExecutionState, getParent, getRestartCounter, isRunnable, onStart, restart, root, setBehaviourName, setDataStore, setExecutionState |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SubscriptionManager
used by this
SubscriptionResponder
to register subscriptionsSubscriptionManager
object that is notified about subscription/un-subscription eventsMessageTemplate
that defines what messages this SubscriptionResponder
will react to.Subscription
object, stores it internally and notify the SubscriptionManager
used by this responder if any. Then it returns null which has
the effect of sending no response. Programmers in general do not need
to override this method. In case they need to manage Subscription objects in an application specific
way they should rather use a SubscriptionManager
with the register()
method properly implemented.
However they could override it in case they need to react to the reception of a
subscription message in a different way, e.g. by sending back an AGREE message.agree, refuse, not-understood
or null if no response must be sent back.Subscription
object the received cancel message refers to, notifies the
SubscriptionManager
used by this responder if any and remove the Subscription from its internal structures.
Then it returns null which has the effect of sending no response.
Programmers in general do not need
to override this method. In case they need to manage Subscription objects in an application specific
way they should rather use a SubscriptionManager
with the deregister()
method properly implemented.
However they could override it in case they need to react to the reception of a
cancel message in a different way, e.g. by sending back an INFORM.inform
and failure
or null if no response must be sent back.Behaviour
in the HANDLE_SUBSCRIPTION state.
This behaviour overrides the homonymous method.
This method also sets the
data store of the registered Behaviour
to the
DataStore of this current behaviour.
It is responsibility of the registered behaviour to put the
response (if any) to be sent back into the datastore at the
RESPONSE_KEY
key.
The incoming subscription message can be retrieved from the
datastore at the SUBSCRIPTION_KEY
keyBehaviour
in the HANDLE_CANCEL state.
This behaviour overrides the homonymous method.
This method also sets the
data store of the registered Behaviour
to the
DataStore of this current behaviour.
It is responsibility of the registered behaviour to put the
response (if any) to be sent back into the datastore at the
RESPONSE_KEY
key.
The incoming CANCEL message can be retrieved from the
datastore at the CANCEL_KEY
keySubscription
object
managed by this SubscriptionResponder
Subscription
object that is related to the conversation
message msg
belongs to.conversation-id
indicates the conversationSubscription
object related to the conversation the given message belongs toSubscription
object that is related a given conversation.Subscription
object related to the given conversationVector
including all Subscription
-s made by the given agentSubscriptionResponder
Vector
including all Subscription
-s managed by this SubscriptionResponder
|