Package jade.domain
Class RequestFIPAServiceBehaviour
- java.lang.Object
-
- jade.core.behaviours.Behaviour
-
- jade.core.behaviours.SimpleBehaviour
-
- jade.proto.SimpleAchieveREInitiator
-
- jade.domain.RequestFIPAServiceBehaviour
-
- All Implemented Interfaces:
Serializable,Serializable
public class RequestFIPAServiceBehaviour extends SimpleAchieveREInitiator
This class extends theFipaRequestIntiatorBehaviourin order to request an agent, e.g. DF or AMS to perform a specific action.
This class implements all the abstract method of the super classes, therefore the behaviour can be immediately added to an agent.
In some cases, it might be usefull to extend this class to override some of its methods and react to the received messages in an application-specific manner.
The class has two constructor. The first generic constructor can be used for all the action an agent can perform. In the case of a a search action the default search constraints are used.
The second constructor is specific for a search action and it allows to specify additional search constraints.- Version:
- $Date$ $Revision$
- Author:
- Fabio Bellifemine (CSELT S.p.A.)
- See Also:
DFService,AMSService, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRequestFIPAServiceBehaviour.NotYetReadyException class for timeouts.-
Nested classes/interfaces inherited from class jade.core.behaviours.Behaviour
Behaviour.RunnableChangedEvent
-
-
Field Summary
-
Fields inherited from class jade.proto.SimpleAchieveREInitiator
ALL_RESPONSES_KEY, ALL_RESULT_NOTIFICATIONS_KEY, REQUEST_KEY, REQUEST_SENT_KEY, SECOND_REPLY_KEY
-
Fields inherited from class jade.core.behaviours.Behaviour
myAgent, myEvent, NOTIFY_DOWN, NOTIFY_UP, parent, STATE_BLOCKED, STATE_READY, STATE_RUNNING
-
-
Constructor Summary
Constructors Constructor Description RequestFIPAServiceBehaviour(Agent a, AID receiver, String actionName, Object agentDescription)Create a behaviour to request an agent to perform a specific action.RequestFIPAServiceBehaviour(Agent a, AID receiver, String actionName, Object agentDescription, SearchConstraints constraints)Create a behaviour to request an agent to perform a specific action.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ACLMessagegetLastMsg()This public method allows to get the INFORM message received in the final state of this FIPA-Request protocol.ListgetSearchResult()Deprecated.Use getSearchResults() instead.Object[]getSearchResults()This public method allows to get the results of a search operation.protected voidhandleAgree(ACLMessage reply)Method to handleagreereplies.protected voidhandleAllResponses(Vector reply)This method handle is called after receiving all the responses and when the timeout is expired( in this case no reply has been received.protected voidhandleFailure(ACLMessage reply)Method to handlefailurereplies.protected voidhandleInform(ACLMessage reply)Method to handleinformreplies.protected voidhandleNotUnderstood(ACLMessage reply)Method to handlenot-understoodreplies.protected voidhandleOutOfSequence(ACLMessage reply)Method to handle out of sequence replies.protected voidhandleRefuse(ACLMessage reply)Method to handlerefusereplies.-
Methods inherited from class jade.proto.SimpleAchieveREInitiator
action, done, handleAllResultNotifications, onStart, prepareRequest, reset, 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
-
-
-
-
Constructor Detail
-
RequestFIPAServiceBehaviour
public RequestFIPAServiceBehaviour(Agent a, AID receiver, String actionName, Object agentDescription, SearchConstraints constraints) throws FIPAException
Create a behaviour to request an agent to perform a specific action. Using this constructor, is possible to pass all information necessary to request a search operation.- Parameters:
a- The agent this behaviour belongs to, i.e. the agent who is interested in the search result.receiver- The agent who will be requested to perform the action.agentDescription- An agent descriptor used according to the action required.constraints- The search contraints for the search action.- Throws:
FIPAException- A suitable exception can be thrown when the method locally discovers that the passed parameters are not valid.- See Also:
SearchConstraints
-
RequestFIPAServiceBehaviour
public RequestFIPAServiceBehaviour(Agent a, AID receiver, String actionName, Object agentDescription) throws FIPAException
Create a behaviour to request an agent to perform a specific action. The default search constraints are used.- Parameters:
a- The agent this behaviour belongs to, i.e the agent who is interested in the action.dfName- The DF who will perform the action.dfAction- The action requested to the DF.dfd- An agent descriptor that will be use according to the action required to the DF.- Throws:
FIPAException- See Also:
RequestFIPAServiceBehaviour(Agent a, AID receiver, String actionName, Object agentDescription, SearchConstraints constraints)
-
-
Method Detail
-
handleNotUnderstood
protected void handleNotUnderstood(ACLMessage reply)
Method to handlenot-understoodreplies.- Overrides:
handleNotUnderstoodin classSimpleAchieveREInitiator- Parameters:
reply- The actual ACL message received. It is ofnot-understoodtype and matches the conversation template.
-
handleRefuse
protected void handleRefuse(ACLMessage reply)
Method to handlerefusereplies.- Overrides:
handleRefusein classSimpleAchieveREInitiator- Parameters:
reply- The actual ACL message received. It is ofrefusetype and matches the conversation template.
-
handleAgree
protected void handleAgree(ACLMessage reply)
Method to handleagreereplies.- Overrides:
handleAgreein classSimpleAchieveREInitiator- Parameters:
reply- The actual ACL message received. It is ofagreetype and matches the conversation template.
-
handleFailure
protected void handleFailure(ACLMessage reply)
Method to handlefailurereplies.- Overrides:
handleFailurein classSimpleAchieveREInitiator- Parameters:
reply- The actual ACL message received. It is offailuretype and matches the conversation template.
-
handleInform
protected void handleInform(ACLMessage reply)
Method to handleinformreplies.- Overrides:
handleInformin classSimpleAchieveREInitiator- Parameters:
reply- The actual ACL message received. It is ofinformtype and matches the conversation template.
-
handleOutOfSequence
protected void handleOutOfSequence(ACLMessage reply)
Method to handle out of sequence replies.- Overrides:
handleOutOfSequencein classSimpleAchieveREInitiator- Parameters:
reply- The actual ACL message received.
-
handleAllResponses
protected void handleAllResponses(Vector reply)
This method handle is called after receiving all the responses and when the timeout is expired( in this case no reply has been received.- Overrides:
handleAllResponsesin classSimpleAchieveREInitiator
-
getLastMsg
public ACLMessage getLastMsg() throws FIPAException, RequestFIPAServiceBehaviour.NotYetReady
This public method allows to get the INFORM message received in the final state of this FIPA-Request protocol.- Returns:
- the ACLMessage received
- Throws:
FIPAException- A suitable exception can be thrown when the protocol was finished with a FAILURE/REFUSE or NOT-UNDERSTOOD performative.RequestFIPAServiceBehaviour.NotYetReady- is thrown if the protocol is not yet finished.
-
getSearchResult
public List getSearchResult() throws FIPAException, RequestFIPAServiceBehaviour.NotYetReady
Deprecated.Use getSearchResults() instead.This public method allows to get the results of a search operation.- Returns:
- the List of Objects received an a result of the search.
- Throws:
FIPAException- A suitable exception can be thrown when the protocol was finished with a FAILURE/REFUSE or NOT-UNDERSTOOD performative.RequestFIPAServiceBehaviour.NotYetReady- is thrown if the protocol is not yet finished.
-
getSearchResults
public Object[] getSearchResults() throws FIPAException, RequestFIPAServiceBehaviour.NotYetReady
This public method allows to get the results of a search operation.- Returns:
- An array of Objects containing the items found as the result of the search.
- Throws:
FIPAException- A suitable exception can be thrown when the protocol was finished with a FAILURE/REFUSE or NOT-UNDERSTOOD performative.RequestFIPAServiceBehaviour.NotYetReady- is thrown if the protocol is not yet finished.
-
-