|
|||||||||||
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.CompositeBehaviour | +--jade.core.behaviours.SerialBehaviour | +--jade.core.behaviours.FSMBehaviour | +--jade.proto.AchieveREResponder
This is a single homogeneous and effective implementation of all the FIPA-Request-like interaction protocols defined by FIPA, that is all those protocols where the initiator sends a single message (i.e. it performs a single communicative act) within the scope of an interaction protocol in order to verify if the RE (Rational Effect) of the communicative act has been achieved or not.
AchieveREInitiator
,
Serialized FormField Summary | |
java.lang.String |
REQUEST_KEY
key to retrieve from the DataStore of the behaviour the ACLMessage object sent by the initiator. |
java.lang.String |
RESPONSE_KEY
key to retrieve from the DataStore of the behaviour the ACLMessage object sent as a response to the initiator. |
java.lang.String |
RESULT_NOTIFICATION_KEY
key to retrieve from the DataStore of the behaviour the ACLMessage object sent as a result notification to the initiator. |
Fields inherited from class jade.core.behaviours.FSMBehaviour |
currentName, lastStates, previousName |
Fields inherited from class jade.core.behaviours.Behaviour |
myAgent |
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 |
Constructor Summary | |
AchieveREResponder(Agent a,
MessageTemplate mt)
Constructor of the behaviour that creates a new empty DataStore |
|
AchieveREResponder(Agent a,
MessageTemplate mt,
DataStore store)
Constructor. |
Method Summary | |
static MessageTemplate |
createMessageTemplate(java.lang.String iprotocol)
This static method can be used to set the proper message Template (based on the interaction protocol and the performative) into the constructor of this behaviour. |
protected ACLMessage |
prepareResponse(ACLMessage request)
This method is called when the initiator's message is received that matches the message template passed in the constructor. |
protected ACLMessage |
prepareResultNotification(ACLMessage request,
ACLMessage response)
This method is called after the response has been sent and only when one of the folliwing two cases arise: the response was an agree message OR no response
message was sent.
|
void |
registerPrepareResponse(Behaviour b)
This method allows to register a user defined Behaviour
in the PREPARE_RESPONSE state.
|
void |
registerPrepareResultNotification(Behaviour b)
This method allows to register a user defined Behaviour
in the PREPARE_RESULT_NOTIFICATION state.
|
void |
reset()
Reset this behaviour using the same MessageTemplate. |
void |
reset(MessageTemplate mt)
This method allows to change the MessageTemplate
that defines what messages this FIPARequestResponder will react to and reset the protocol. |
Methods inherited from class jade.core.behaviours.FSMBehaviour |
checkTermination, deregisterState, forceTransitionTo, getChildren, getCurrent, getLastExitValue, getName, getPrevious, getState, handleInconsistentFSM, handleStateEntered, onEnd, registerDefaultTransition, registerDefaultTransition, registerFirstState, registerLastState, registerState, registerTransition, registerTransition, resetStates, scheduleFirst, scheduleNext |
Methods inherited from class jade.core.behaviours.CompositeBehaviour |
action, block, done, resetChildren, restart, setAgent |
Methods inherited from class jade.core.behaviours.Behaviour |
block, getBehaviourName, getDataStore, getParent, isRunnable, onStart, root, setBehaviourName, setDataStore |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public final java.lang.String REQUEST_KEY
public final java.lang.String RESPONSE_KEY
public final java.lang.String RESULT_NOTIFICATION_KEY
Constructor Detail |
public AchieveREResponder(Agent a, MessageTemplate mt)
AchieveREResponder(Agent a, MessageTemplate mt, DataStore store)
public AchieveREResponder(Agent a, MessageTemplate mt, DataStore store)
a
- is the reference to the Agent objectmt
- is the MessageTemplate that must be used to match
the initiator message. Take care that
if mt is null every message is consumed by this protocol.store
- the DataStore for this protocolMethod Detail |
public static MessageTemplate createMessageTemplate(java.lang.String iprotocol)
FIPANames.InteractionProtocol
public void reset()
reset
in class FSMBehaviour
public void reset(MessageTemplate mt)
MessageTemplate
that defines what messages this FIPARequestResponder will react to and reset the protocol.
protected ACLMessage prepareResponse(ACLMessage request) throws NotUnderstoodException, RefuseException
request
- the received message
agree, refuse, not-understood, inform
. Remind to
use the method createReply of the class ACLMessage in order
to create a good reply message
NotUnderstoodException
RefuseException
ACLMessage.createReply()
protected ACLMessage prepareResultNotification(ACLMessage request, ACLMessage response) throws FailureException
agree
message OR no response
message was sent.
This default implementation return null which has
the effect of sending no result notification. Programmers should
override the method in case they need to react to this event.
request
- the received messageresponse
- the previously sent response message
inform, failure
. Remind to
use the method createReply of the class ACLMessage in order
to create a good reply message
FailureException
ACLMessage.createReply()
,
prepareResponse(ACLMessage)
public void registerPrepareResponse(Behaviour b)
Behaviour
in the PREPARE_RESPONSE state.
This behaviour would override the homonymous method.
This method also set 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 to be sent into the datastore at the RESPONSE_KEY
key.
b
- the Behaviour that will handle this statepublic void registerPrepareResultNotification(Behaviour b)
Behaviour
in the PREPARE_RESULT_NOTIFICATION state.
This behaviour would override the homonymous method.
This method also set the
data store of the registered Behaviour
to the
DataStore of this current behaviour.
It is responsibility of the registered behaviour to put the
result notification message to be sent into the datastore at the
RESULT_NOTIFICATION_KEY
key.
b
- the Behaviour that will handle this state
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |