public class AchieveREResponder extends FSMBehaviour implements FIPANames.InteractionProtocol
AchieveREInitiator
,
Serialized FormModifier and Type | Field and Description |
---|---|
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.
|
currentName, lastStates
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 and Description |
---|
AchieveREResponder(Agent a,
MessageTemplate mt)
Constructor of the behaviour that creates a new empty DataStore
|
AchieveREResponder(Agent a,
MessageTemplate mt,
DataStore store)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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 |
handleRequest(ACLMessage request)
This method is called when the protocol initiation message (matching the
MessageTemplate specified in the constructor) is received.
|
protected ACLMessage |
prepareResponse(ACLMessage request)
Deprecated.
Use handleRequest() instead
|
protected ACLMessage |
prepareResultNotification(ACLMessage request,
ACLMessage response)
This method is called after the execution of the handleRequest() method if
no response was sent or the response was an
AGREE message. |
void |
registerHandleRequest(Behaviour b)
This method allows to register a user defined
Behaviour
in the HANDLE_REQUEST state. |
void |
registerPrepareResponse(Behaviour b)
Deprecated.
Use registerHandleRequest() instead.
|
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. |
checkTermination, deregisterDefaultTransition, deregisterState, deregisterTransition, forceTransitionTo, getChildren, getCurrent, getLastExitValue, getName, getPrevious, getState, handleInconsistentFSM, handleStateEntered, hasDefaultTransition, onEnd, registerDefaultTransition, registerDefaultTransition, registerFirstState, registerLastState, registerState, registerTransition, registerTransition, resetStates, scheduleFirst, scheduleNext, stringifyTransitionTable
action, done, resetChildren, setAgent
block, block, getAgent, getBehaviourName, getDataStore, getParent, isRunnable, onStart, restart, root, setBehaviourName, setDataStore
public final java.lang.String REQUEST_KEY
public final java.lang.String RESPONSE_KEY
public final java.lang.String RESULT_NOTIFICATION_KEY
public AchieveREResponder(Agent a, MessageTemplate mt)
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 protocolpublic 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 handleRequest(ACLMessage request) throws NotUnderstoodException, RefuseException
request
- the received messageAGREE, REFUSE, NOT_UNDERSTOOD, INFORM
.NotUnderstoodException
RefuseException
protected ACLMessage prepareResponse(ACLMessage request) throws NotUnderstoodException, RefuseException
protected ACLMessage prepareResultNotification(ACLMessage request, ACLMessage response) throws FailureException
AGREE
message.
This default implementation returns 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 messageINFORM, FAILURE
.FailureException
handleRequest(ACLMessage)
public void registerHandleRequest(Behaviour b)
Behaviour
in the HANDLE_REQUEST state.
This behaviour would override the homonymous method.
This method also set the DataStore of the registered Behaviour
to the
DataStore of this AchieveREResponder.
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 registerPrepareResponse(Behaviour b)
public void registerPrepareResultNotification(Behaviour b)
Behaviour
in the PREPARE_RESULT_NOTIFICATION state.
This behaviour would override the homonymous method.
This method also set the DataStore of the registered Behaviour
to the
DataStore of this AchieveREResponder.
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