Package jade.domain
Class RequestManagementBehaviour
- java.lang.Object
-
- jade.core.behaviours.Behaviour
-
- jade.core.behaviours.SimpleBehaviour
-
- jade.proto.SimpleAchieveREResponder
-
- jade.domain.RequestManagementBehaviour
-
- All Implemented Interfaces:
FIPANames.InteractionProtocol,Serializable,Serializable
public abstract class RequestManagementBehaviour extends SimpleAchieveREResponder
Base class for AMS and DF behaviours managing requests from agents. This class handles the FIPA-request protocol and in particular prepares the response taking into account all possible exceptions. The preparation of the result notification is delegated to subclasses as its form (RESULT or DONE) and sending time (i.e. whether it can be sent immediately or must be delayed at a later time) depends on the specific action.- Author:
- Giovanni Caire - Tilab
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jade.core.behaviours.Behaviour
Behaviour.RunnableChangedEvent
-
-
Field Summary
Fields Modifier and Type Field Description protected LoggermyLogger-
Fields inherited from class jade.proto.SimpleAchieveREResponder
REQUEST_KEY, RESPONSE_KEY, RESULT_NOTIFICATION_KEY
-
Fields inherited from class jade.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
Constructors Modifier Constructor Description protectedRequestManagementBehaviour(Agent a, MessageTemplate mt)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidonStart()This method is just an empty placeholders for subclasses.protected abstract ACLMessageperformAction(Action slAction, ACLMessage request)protected ACLMessageprepareResponse(ACLMessage request)This method is called when the initiator's message is received that matches the message template passed in the constructor.protected ACLMessageprepareResultNotification(ACLMessage request, ACLMessage response)Just return the (already prepared) notification message (if any).voidreset()Reset this behaviour using the same MessageTemplate.-
Methods inherited from class jade.proto.SimpleAchieveREResponder
action, createMessageTemplate, done, reset
-
Methods inherited from class jade.core.behaviours.Behaviour
actionWrapper, block, block, getAgent, getBehaviourName, getDataStore, getExecutionState, getParent, getRestartCounter, handle, handleBlockEvent, handleRestartEvent, isRunnable, onEnd, restart, root, setAgent, setBehaviourName, setDataStore, setExecutionState
-
-
-
-
Field Detail
-
myLogger
protected Logger myLogger
-
-
Constructor Detail
-
RequestManagementBehaviour
protected RequestManagementBehaviour(Agent a, MessageTemplate mt)
-
-
Method Detail
-
onStart
public void onStart()
Description copied from class:BehaviourThis 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 thisBehaviour.
-
performAction
protected abstract ACLMessage performAction(Action slAction, ACLMessage request) throws JADESecurityException, FIPAException
- Throws:
JADESecurityExceptionFIPAException
-
prepareResponse
protected ACLMessage prepareResponse(ACLMessage request) throws NotUnderstoodException, RefuseException
Description copied from class:SimpleAchieveREResponderThis 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.- Overrides:
prepareResponsein classSimpleAchieveREResponder- Parameters:
request- the received message- Returns:
- null when the AGREE message can be skipper, the AGREE message otherwise.
- Throws:
NotUnderstoodExceptionRefuseException- See Also:
ACLMessage.createReply()
-
prepareResultNotification
protected ACLMessage prepareResultNotification(ACLMessage request, ACLMessage response) throws FailureException
Just return the (already prepared) notification message (if any).- Overrides:
prepareResultNotificationin classSimpleAchieveREResponder- Parameters:
request- the received messageresponse- 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:
FailureException- See Also:
ACLMessage.createReply(),SimpleAchieveREResponder.prepareResponse(ACLMessage)
-
reset
public void reset()
Description copied from class:SimpleAchieveREResponderReset this behaviour using the same MessageTemplate.- Overrides:
resetin classSimpleAchieveREResponder
-
-