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 SimpleAchieveREResponder
java.lang.Object
  sajas.core.behaviours.Behaviour
      sajas.core.behaviours.SimpleBehaviour
          sajas.proto.SimpleAchieveREResponder
All Implemented Interfaces:
jade.domain.FIPANames.InteractionProtocol, jade.util.leap.Serializable, Serializable

public class SimpleAchieveREResponder
extends SimpleBehaviour
implements jade.domain.FIPANames.InteractionProtocol
Note: this class has been re-implemented to redirect the use of the agent and behaviour classes to SAJaS versions.
Author:
hlc
See Also:
jade.proto.SimpleAchieveREResponder

Nested classes/interfaces inherited from class sajas.core.behaviours.Behaviour
Behaviour.RunnableChangedEvent
Field Summary
String
REQUEST_KEY
String
RESPONSE_KEY
String
RESULT_NOTIFICATION_KEY
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
SimpleAchieveREResponder(Agent a, jade.lang.acl.MessageTemplate mt)
          Constructor of the behaviour that creates a new empty DataStore
SimpleAchieveREResponder(Agent a, jade.lang.acl.MessageTemplate mt, DataStore store)
          Constructor.
Method Summary
void
action()
          Runs the behaviour.
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.
boolean
done()
          This method checks whether this behaviour has finished or not.
protected jade.lang.acl.ACLMessage
prepareResponse(jade.lang.acl.ACLMessage request)
          This method is called when the initiator's message is received that matches the message template passed in the constructor.
protected jade.lang.acl.ACLMessage
prepareResultNotification(jade.lang.acl.ACLMessage request, jade.lang.acl.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(jade.lang.acl.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 sajas.core.behaviours.Behaviour
actionWrapper, block, block, getAgent, getBehaviourName, getDataStore, getExecutionState, getParent, getRestartCounter, handle, handleBlockEvent, handleRestartEvent, isRunnable, onEnd, onStart, restart, root, setAgent, setBehaviourName, setDataStore, setExecutionState
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail
REQUEST_KEY
public final String REQUEST_KEY
See Also:
AchieveREResponder.REQUEST_KEY

RESPONSE_KEY
public final String RESPONSE_KEY
See Also:
AchieveREResponder.RESPONSE_KEY

RESULT_NOTIFICATION_KEY
public final String RESULT_NOTIFICATION_KEY
See Also:
AchieveREResponder.RESULT_NOTIFICATION_KEY
Constructor Detail
SimpleAchieveREResponder
public SimpleAchieveREResponder(Agent a,
                                jade.lang.acl.MessageTemplate mt)
Constructor of the behaviour that creates a new empty DataStore

SimpleAchieveREResponder
public SimpleAchieveREResponder(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

action
public final void action()
Description copied from class: Behaviour
Runs the behaviour. This abstract method must be implemented by Behavioursubclasses to perform ordinary behaviour duty. An agent schedules its behaviours calling their action() method; since all the behaviours belonging to the same agent are scheduled cooperatively, this method must not enter in an endless loop and should return as soon as possible to preserve agent responsiveness. To split a long and slow task into smaller section, recursive behaviour aggregation may be used.
Overrides:
action in class Behaviour

prepareResponse
protected jade.lang.acl.ACLMessage prepareResponse(jade.lang.acl.ACLMessage request)
                                            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:
request - the received message
Returns:
the ACLMessage to be sent as a response (i.e. one of agree, refuse, not-understood, inform. 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()

prepareResultNotification
protected jade.lang.acl.ACLMessage prepareResultNotification(jade.lang.acl.ACLMessage request,
                                                             jade.lang.acl.ACLMessage response)
                                                      throws jade.domain.FIPAAgentManagement.FailureException
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. 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.
Parameters:
request - the received message
response - the previously sent response message
Returns:
the ACLMessage to be sent as a result notification (i.e. one of inform, failure. Remind to use the method createReply of the class ACLMessage in order to create a good reply message
Throws:
jade.domain.FIPAAgentManagement.FailureException
See Also:
jade.lang.acl.ACLMessage.createReply(), prepareResponse(ACLMessage)

reset
public void reset()
Reset this behaviour using the same MessageTemplate.
Overrides:
reset in class SimpleBehaviour

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

done
public boolean done()
This method checks whether this behaviour has finished or not.
Overrides:
done in class Behaviour
Returns:
true if this behaviour has completed its task, false otherwise.

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