public class SimpleAchieveREResponder extends SimpleBehaviour implements FIPANames.InteractionProtocol
AchieveREResponder
.
that does not allow to register Behaviour for the Prepare Response
and Prepare Result Notification states of the protocolSimpleAchieveREInitiator
,
AchieveREInitiator
,
AchieveREResponder
,
Serialized FormModifier and Type | Field and Description |
---|---|
java.lang.String |
REQUEST_KEY |
java.lang.String |
RESPONSE_KEY |
java.lang.String |
RESULT_NOTIFICATION_KEY |
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 |
---|
SimpleAchieveREResponder(Agent a,
MessageTemplate mt)
Constructor of the behaviour that creates a new empty DataStore
|
SimpleAchieveREResponder(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.
|
boolean |
done()
This method checks whether this behaviour has finished or not.
|
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 |
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. |
action, block, block, getAgent, getBehaviourName, getDataStore, getParent, isRunnable, onEnd, onStart, restart, root, setAgent, setBehaviourName, setDataStore
public final java.lang.String REQUEST_KEY
AchieveREResponder.REQUEST_KEY
public final java.lang.String RESPONSE_KEY
AchieveREResponder.RESPONSE_KEY
public final java.lang.String RESULT_NOTIFICATION_KEY
public SimpleAchieveREResponder(Agent a, MessageTemplate mt)
public SimpleAchieveREResponder(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
protected ACLMessage prepareResponse(ACLMessage request) throws NotUnderstoodException, RefuseException
request
- the received messageagree, refuse, not-understood, inform
. Remind to
use the method createReply of the class ACLMessage in order
to create a good reply messageNotUnderstoodException
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 messageinform, failure
. Remind to
use the method createReply of the class ACLMessage in order
to create a good reply messageFailureException
ACLMessage.createReply()
,
prepareResponse(ACLMessage)
public void reset()
reset
in class SimpleBehaviour
public void reset(MessageTemplate mt)
MessageTemplate
that defines what messages this FIPARequestResponder will react to and reset the protocol.