sajas.proto
Class SSContractNetResponder
java.lang.Object
sajas.proto.SSContractNetResponder All Implemented Interfaces:
-
jade.util.leap.Serializable, Serializable
Direct Known Subclasses:
-
public class SSContractNetResponder
Note: this class has been re-implemented to redirect the use of the agent, behaviour and protocol classes to SAJaS versions.
Author:
-
hlc
See Also:
-
jade.proto.SSContractNetResponder
Field Summary |
String |
ACCEPT_PROPOSAL_KEY Key to retrieve from the DataStore of the behaviour the last received ACCEPT_PROPOSAL ACLMessage |
String |
CFP_KEY Key to retrieve from the DataStore of the behaviour the last received CFP ACLMessage |
protected static String |
CHECK_IN_SEQ |
protected static String |
DUMMY_FINAL |
static String |
HANDLE_ACCEPT_PROPOSAL |
static String |
HANDLE_CFP |
protected static String |
HANDLE_OUT_OF_SEQUENCE |
static String |
HANDLE_REJECT_PROPOSAL |
String |
INITIATION_KEY Key to retrieve from the DataStore of the behaviour the initiation ACLMessage that triggered this responder session |
String |
PROPOSE_KEY Key to retrieve from the DataStore of the behaviour the last sent PROPOSE ACLMessage |
protected static String |
RECEIVE_NEXT |
String |
RECEIVED_KEY Key to retrieve from the DataStore of the behaviour the last received ACLMessage |
String |
REJECT_PROPOSAL_KEY Key to retrieve from the DataStore of the behaviour the last received REJECT_PROPOSAL ACLMessage |
String |
REPLY_KEY Key to set into the DataStore of the behaviour the new ACLMessage to be sent back to the initiator as a reply. |
protected static String |
SEND_REPLY |
Constructor Summary |
SSContractNetResponder(Agent a, jade.lang.acl.ACLMessage cfp) Construct a SSContractNetResponder that is activated by the reception of a given initiation CFP message. |
SSContractNetResponder(Agent a, jade.lang.acl.ACLMessage cfp, DataStore store) Construct a SSContractNetResponder that is activated by the reception of a given initiation CFP message and uses a given DataStore. |
Method Summary |
protected void |
afterReply(jade.lang.acl.ACLMessage reply) This method can be redefined by protocol specific implementations to update the status of the protocol just after a reply has been sent. |
protected void |
beforeReply(jade.lang.acl.ACLMessage reply) This method can be redefined by protocol specific implementations to customize a reply that is going to be sent back to the initiator. |
protected boolean |
checkInSequence(jade.lang.acl.ACLMessage received) Check whether a received message complies with the protocol rules. |
protected jade.lang.acl.ACLMessage |
handleAcceptProposal(jade.lang.acl.ACLMessage cfp, jade.lang.acl.ACLMessage propose, jade.lang.acl.ACLMessage accept) This method is called when an ACCEPT_PROPOSAL message is received from the initiator. |
protected jade.lang.acl.ACLMessage |
handleCfp(jade.lang.acl.ACLMessage cfp) This method is called to handle the initial CFP message. |
protected void |
handleOutOfSequence(jade.lang.acl.ACLMessage msg) Redefine this method to call the overloaded version with 3 parameters. |
protected void |
handleOutOfSequence(jade.lang.acl.ACLMessage cfp, jade.lang.acl.ACLMessage propose, jade.lang.acl.ACLMessage msg) This method is called whenever a message is received that does not comply to the protocol rules. |
protected void |
handleRejectProposal(jade.lang.acl.ACLMessage cfp, jade.lang.acl.ACLMessage propose, jade.lang.acl.ACLMessage reject) This method is called when a REJECT_PROPOSAL message is received from the initiator. |
void |
onStart() This method is just an empty placeholders for subclasses. |
protected void |
registerDSState(Behaviour b, String name) Utility method to register a behaviour in a state of the protocol and set the DataStore appropriately |
void |
registerHandleAcceptProposal(Behaviour b) This method allows to register a user defined Behaviour in the HANDLE_ACCEPT_PROPOSAL state. |
void |
registerHandleCfp(Behaviour b) This method allows to register a user defined Behaviour in the HANDLE_CFP state. |
void |
registerHandleOutOfSequence(Behaviour b) This method allows to register a user defined Behaviour in the HANDLE_OUT_OF_SEQ state. |
void |
registerHandleRejectProposal(Behaviour b) This method allows to register a user defined Behaviour in the HANDLE_REJECT_PROPOSAL state. |
protected void |
reinit() Re-initialize the internal state without performing a complete reset. |
void |
reset() Reset this behaviour. |
protected void |
sessionTerminated() This method can be redefined by protocol specific implementations to take proper actions after the completion of the current protocol session. |
Methods inherited from class sajas.core.behaviours.FSMBehaviour |
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 |
Methods inherited from class sajas.core.behaviours.Behaviour |
actionWrapper, block, block, getAgent, getBehaviourName, getDataStore, getExecutionState, getParent, getRestartCounter, isRunnable, restart, root, setBehaviourName, setDataStore, setExecutionState |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ACCEPT_PROPOSAL_KEY
public final String ACCEPT_PROPOSAL_KEY
-
Key to retrieve from the DataStore of the behaviour the last received
ACCEPT_PROPOSAL ACLMessage
CFP_KEY
public final String CFP_KEY
-
Key to retrieve from the DataStore of the behaviour the last received
CFP ACLMessage
CHECK_IN_SEQ
protected static final String CHECK_IN_SEQ
-
See Also:
-
DUMMY_FINAL
protected static final String DUMMY_FINAL
-
See Also:
-
HANDLE_ACCEPT_PROPOSAL
public static final String HANDLE_ACCEPT_PROPOSAL
-
See Also:
-
HANDLE_CFP
public static final String HANDLE_CFP
-
See Also:
-
HANDLE_OUT_OF_SEQUENCE
protected static final String HANDLE_OUT_OF_SEQUENCE
-
See Also:
-
HANDLE_REJECT_PROPOSAL
public static final String HANDLE_REJECT_PROPOSAL
-
See Also:
-
INITIATION_KEY
public final String INITIATION_KEY
-
Key to retrieve from the DataStore of the behaviour the initiation
ACLMessage that triggered this responder session
PROPOSE_KEY
public final String PROPOSE_KEY
-
Key to retrieve from the DataStore of the behaviour the last sent
PROPOSE ACLMessage
RECEIVE_NEXT
protected static final String RECEIVE_NEXT
-
See Also:
-
RECEIVED_KEY
public final String RECEIVED_KEY
-
Key to retrieve from the DataStore of the behaviour the last received
ACLMessage
REJECT_PROPOSAL_KEY
public final String REJECT_PROPOSAL_KEY
-
Key to retrieve from the DataStore of the behaviour the last received
REJECT_PROPOSAL ACLMessage
REPLY_KEY
public final String REPLY_KEY
-
Key to set into the DataStore of the behaviour the new ACLMessage
to be sent back to the initiator as a reply.
SEND_REPLY
protected static final String SEND_REPLY
-
See Also:
-
SSContractNetResponder
public SSContractNetResponder(Agent a, jade.lang.acl.ACLMessage cfp) -
Construct a SSContractNetResponder that is activated
by the reception of a given initiation CFP message.
SSContractNetResponder
public SSContractNetResponder(Agent a, jade.lang.acl.ACLMessage cfp, DataStore store) -
Construct a SSContractNetResponder that is activated
by the reception of a given initiation CFP message and uses
a given DataStore.
handleCfp
protected jade.lang.acl.ACLMessage handleCfp(jade.lang.acl.ACLMessage cfp)
throws jade.domain.FIPAAgentManagement.RefuseException,
jade.domain.FIPAAgentManagement.FailureException,
jade.domain.FIPAAgentManagement.NotUnderstoodException
-
This method is called to handle the initial CFP message.
This default implementation does nothing and returns null.
Programmers have to override it to react to this event.
Parameters:
-
cfp - the initial CFP message to handle.
Returns:
-
the reply message to be sent back to the initiator. Returning
a message different than PROPOSE (or returning null) terminates the protocol.
Throws:
-
jade.domain.FIPAAgentManagement.RefuseException - if the CFP is refused. Throwing a
RefuseException has the same effect as returning a REFUSE message,
but automatically manages the :content
slot.
-
jade.domain.FIPAAgentManagement.FailureException - if there is an error serving the CFP.
Throwing a FailureException has the same effect as returning a FAILURE
message, but automatically manages the :content
slot.
-
jade.domain.FIPAAgentManagement.NotUnderstoodException - if the CFP content is not understood.
Throwing a NotUnderstoodException has the same effect as returning a NOT_UNDERSTOOD
message, but automatically manages the :content
slot.
handleAcceptProposal
protected jade.lang.acl.ACLMessage handleAcceptProposal(jade.lang.acl.ACLMessage cfp,
jade.lang.acl.ACLMessage propose,
jade.lang.acl.ACLMessage accept)
throws jade.domain.FIPAAgentManagement.FailureException
-
This method is called when an ACCEPT_PROPOSAL message is received from the
initiator.
This default implementation does nothing and returns null.
Programmers have to override it to react to this event.
Parameters:
-
cfp - the initial CFP message.
-
propose - the PROPOSE message sent back as reply to the initial
CFP message.
-
accept - the received ACCEPT_PROPOSAL message.
Returns:
-
the reply message to be sent back to the initiator.
Throws:
-
jade.domain.FIPAAgentManagement.FailureException - if there is an error serving the ACCEPT_PROPOSAL.
Throwing a FailureException has the same effect as returning a FAILURE
message, but automatically manages the :content
slot.
handleRejectProposal
protected void handleRejectProposal(jade.lang.acl.ACLMessage cfp,
jade.lang.acl.ACLMessage propose,
jade.lang.acl.ACLMessage reject)
-
This method is called when a REJECT_PROPOSAL message is received from the
initiator.
This default implementation does nothing.
Programmers may override it to react to this event.
Parameters:
-
cfp - the initial CFP message.
-
propose - the PROPOSE message sent back as reply to the initial
CFP message.
-
reject - the received REJECT_PROPOSAL message or null if no
acceptance message is received from the initiator within the timeout
specified in the :reply-by
slot of the PROPOSE message.
handleOutOfSequence
protected void handleOutOfSequence(jade.lang.acl.ACLMessage cfp,
jade.lang.acl.ACLMessage propose,
jade.lang.acl.ACLMessage msg)
-
This method is called whenever a message is received that does
not comply to the protocol rules.
This default implementation does nothing.
Programmers may override it in case they need to react to this event.
Parameters:
-
cfp - the initial CFP message.
-
propose - the PROPOSE message sent back as reply to the initial
CFP message.
-
msg - the received out-of-sequence message.
registerHandleCfp
-
This method allows to register a user defined Behaviour
in the HANDLE_CFP state.
This behaviour would override the homonymous method.
This method also sets the
data store of the registered Behaviour
to the
DataStore of this current behaviour.
The registered behaviour can retrieve the initial CFP
message from the datastore at the CFP_KEY
key.
It is responsibility of the registered behaviour to put the
reply to be sent back to the initiator into the datastore at the
REPLY_KEY
key. Putting a message defferent from PROPOSE
(or putting no message) terminates the protocol.
Parameters:
-
b - the Behaviour that will handle this state
registerHandleAcceptProposal
public void registerHandleAcceptProposal(Behaviour b) -
This method allows to register a user defined Behaviour
in the HANDLE_ACCEPT_PROPOSAL state.
This behaviour would override the homonymous method.
This method also sets the
data store of the registered Behaviour
to the
DataStore of this current behaviour.
The registered behaviour can retrieve the received ACCEPT_PROPOSAL
message from the datastore at the ACCEPT_PROPOSAL_KEY
key, the initial CFP
message at the CFP_KEY
and the previously sent PROPOSE
message at the
PROPOSE_KEY
.
It is responsibility of the registered behaviour to put the
reply to be sent back to the initiator into the datastore at the
REPLY_KEY
key.
Parameters:
-
b - the Behaviour that will handle this state
registerHandleRejectProposal
public void registerHandleRejectProposal(Behaviour b) -
This method allows to register a user defined Behaviour
in the HANDLE_REJECT_PROPOSAL state.
This behaviour would override the homonymous method.
This method also sets the
data store of the registered Behaviour
to the
DataStore of this current behaviour.
The registered behaviour can retrieve the received REJECT_PROPOSAL
message from the datastore at the REJECT_PROPOSAL_KEY
key, the initial CFP
message at the CFP_KEY
and the previously sent PROPOSE
message at the
PROPOSE_KEY
.
Parameters:
-
b - the Behaviour that will handle this state
reinit
protected void reinit()
-
Re-initialize the internal state without performing a complete reset.
handleOutOfSequence
protected void handleOutOfSequence(jade.lang.acl.ACLMessage msg)
-
Redefine this method to call the overloaded version with 3 parameters.
Parameters:
-
msg - the received out-of-sequence message.
checkInSequence
protected boolean checkInSequence(jade.lang.acl.ACLMessage received)
-
Check whether a received message complies with the protocol rules.
beforeReply
protected void beforeReply(jade.lang.acl.ACLMessage reply)
-
This method can be redefined by protocol specific implementations
to customize a reply that is going to be sent back to the initiator.
This default implementation does nothing.
afterReply
protected void afterReply(jade.lang.acl.ACLMessage reply)
-
This method can be redefined by protocol specific implementations
to update the status of the protocol just after a reply has been sent.
This default implementation does nothing.
onStart
public void onStart()
-
This method is just an empty placeholders for subclasses. It is
executed just once before starting behaviour execution.
Therefore, it acts as a prolog to the task
represented by this Behaviour
.
Overrides:
-
registerHandleOutOfSequence
public void registerHandleOutOfSequence(Behaviour b) -
This method allows to register a user defined Behaviour
in the HANDLE_OUT_OF_SEQ state.
This behaviour would override the homonymous method.
This method also sets the
data store of the registered Behaviour
to the
DataStore of this current behaviour.
The registered behaviour can retrieve
the out of sequence
ACLMessage object received
from the datastore at the RECEIVED_KEY
key.
Parameters:
-
b - the Behaviour that will handle this state
reset
public void reset()
-
Reset this behaviour.
Overrides:
-
sessionTerminated
protected void sessionTerminated()
-
This method can be redefined by protocol specific implementations
to take proper actions after the completion of the current protocol
session.
registerDSState
protected void registerDSState(Behaviour b, String name) -
Utility method to register a behaviour in a state of the
protocol and set the DataStore appropriately
DocFlex/Doclet is both a multi-format Javadoc doclet and a free edition of DocFlex/Javadoc, which is a template-driven programming tool for rapid development of any Javadoc-based Java API documentation generators (i.e. doclets). If you need to customize your Javadoc without writing a full-blown doclet from scratch, DocFlex/Javadoc may be the only tool able to help you! Find out more at www.docflex.com