Overview  Package   Class  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

sajas.proto
Class ProposeResponder
java.lang.Object
  sajas.core.behaviours.Behaviour
      sajas.core.behaviours.CompositeBehaviour
          sajas.core.behaviours.SerialBehaviour
              sajas.core.behaviours.FSMBehaviour
                  sajas.proto.ProposeResponder
All Implemented Interfaces:
jade.domain.FIPANames.InteractionProtocol, jade.util.leap.Serializable, Serializable

public class ProposeResponder
extends FSMBehaviour
implements jade.domain.FIPANames.InteractionProtocol
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.ProposeResponder

Nested classes/interfaces inherited from class sajas.core.behaviours.Behaviour
Behaviour.RunnableChangedEvent
Field Summary
protected static String
PREPARE_RESPONSE
String
PROPOSE_KEY
          key to retrieve from the DataStore of the behaviour the ACLMessage object sent by the initiator.
protected static String
RECEIVE_PROPOSE
String
RESPONSE_KEY
          key to retrieve from the DataStore of the behaviour the ACLMessage object sent as a response to the initiator.
protected static String
SEND_RESPONSE
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
ProposeResponder(Agent a, jade.lang.acl.MessageTemplate mt)
          Constructor of the behaviour that creates a new empty DataStore
ProposeResponder(Agent a, jade.lang.acl.MessageTemplate mt, DataStore store)
          Constructor.
Method Summary
static jade.lang.acl.MessageTemplate
createMessageTemplate(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 jade.lang.acl.ACLMessage
prepareResponse(jade.lang.acl.ACLMessage propose)
          This method is called when the initiator's message is received that matches the message template passed in the constructor.
void
registerPrepareResponse(Behaviour b)
          This method allows to register a user defined Behaviour in the PREPARE_RESPONSE state.
void
reset()
          Reset this behaviour.
void
reset(jade.lang.acl.MessageTemplate mt)
          This method allows to change the MessageTemplate that defines what messages this ProposeResponder will react to and reset the protocol.
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.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
Field Detail
PREPARE_RESPONSE
protected static final String PREPARE_RESPONSE
See Also:
Constant Field Values

PROPOSE_KEY
public final String PROPOSE_KEY
key to retrieve from the DataStore of the behaviour the ACLMessage object sent by the initiator.

RECEIVE_PROPOSE
protected static final String RECEIVE_PROPOSE
See Also:
Constant Field Values

RESPONSE_KEY
public final String RESPONSE_KEY
key to retrieve from the DataStore of the behaviour the ACLMessage object sent as a response to the initiator.

SEND_RESPONSE
protected static final String SEND_RESPONSE
See Also:
Constant Field Values
Constructor Detail
ProposeResponder
public ProposeResponder(Agent a,
                        jade.lang.acl.MessageTemplate mt)
Constructor of the behaviour that creates a new empty DataStore
See Also:
ProposeResponder(Agent a, MessageTemplate mt, DataStore store)

ProposeResponder
public ProposeResponder(Agent a,
                        jade.lang.acl.MessageTemplate mt,
                        DataStore store)
Constructor.
Parameters:
a - is the reference to the Agent object
mt - 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 protocol
Method Detail
createMessageTemplate
public static jade.lang.acl.MessageTemplate createMessageTemplate(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.
See Also:
FIPANames.InteractionProtocol

reset
public void reset()
Reset this behaviour.
Overrides:
reset in class FSMBehaviour

reset
public void reset(jade.lang.acl.MessageTemplate mt)
This method allows to change the MessageTemplate that defines what messages this ProposeResponder will react to and reset the protocol.

prepareResponse
protected jade.lang.acl.ACLMessage prepareResponse(jade.lang.acl.ACLMessage propose)
                                            throws jade.domain.FIPAAgentManagement.NotUnderstoodException,
                                                   jade.domain.FIPAAgentManagement.RefuseException
This method is called when the initiator's message is received that matches the message template passed in the constructor. This default implementation return null which has the effect of sending no reponse. Programmers should override the method in case they need to react to this event.
Parameters:
propose - the received message
Returns:
the ACLMessage to be sent as a response (i.e. one of accept_proposal, reject_proposal, not-understood. Remind to use the method createReply of the class ACLMessage in order to create a good reply message
Throws:
jade.domain.FIPAAgentManagement.NotUnderstoodException
jade.domain.FIPAAgentManagement.RefuseException
See Also:
jade.lang.acl.ACLMessage.createReply()

registerPrepareResponse
public void registerPrepareResponse(Behaviour b)
This method allows to register a user defined 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.
Parameters:
b - the Behaviour that will handle this state

Overview  Package   Class  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Java API documentation generated with DocFlex/Doclet 1.6.1 using JavadocPro template set.
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