ibspan.tss.messaging
Class RequestHandler
java.lang.Object
jade.core.behaviours.Behaviour
jade.core.behaviours.SimpleBehaviour
jade.core.behaviours.OneShotBehaviour
ibspan.tss.messaging.RequestHandler
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- FindRestaurantHandler, GetDomainOntologyHandler, GetRestaurantsDetailsHandler, GetUserProfileHandler, InitUserProfileHandler, LogoutHandler, ViewTransformer
public abstract class RequestHandler
- extends OneShotBehaviour
This is simple behaviour class for responding to the requests with defined
Action
object. The behaviours: (1) prepares the response by invoking
prepareResponse()
method (which should be implemented by the
developer) and (2) put it in local datastore.
- Author:
- Maciej Gawinecki
- See Also:
ActionDispatcher
,
Serialized Form
Method Summary |
void |
action()
Two-stepped behaviour: (1) invokes and
#prepareResponse(ACLMessage,Action method (2) puts returned
response in local datastore. |
protected abstract ACLMessage |
prepareResponse(ACLMessage request,
Action act)
Returns response to the request. |
Methods inherited from class jade.core.behaviours.Behaviour |
actionWrapper, block, block, getBehaviourName, getDataStore, getExecutionState, getParent, handle, 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 |
RequestHandler
public RequestHandler(Agent a,
DataStore ds,
Object requestKey,
Object actKey,
Object resultNotificationKey)
- Constructs
RequestHandler
.
- Parameters:
a
- is the agent owning this behaviour.ds
- is the Datastore for this RequestHandler.requestKey
- is key pointing the place in local datastore, where incoming
request can be found.actKey
- is key in the DataStore where the Action concept extracted by the
action dispatcher from current request can be found.resultNotificationKey
- is key to retrieve from the DataStore of the behaviour the
ACLMessage object sent as a result notification to the
initiator.
action
public final void action()
- Two-stepped behaviour: (1) invokes and
#prepareResponse(ACLMessage,Action
method (2) puts returned
response in local datastore.
- Specified by:
action
in class Behaviour
prepareResponse
protected abstract ACLMessage prepareResponse(ACLMessage request,
Action act)
throws NotUnderstoodException,
FailureException
- Returns response to the request. Programmers should implenets this method
in order process given request.
- Parameters:
request
- is message.act
- is Action
concept extracted previously from
request
object.
- Returns:
- response;
null
means failure.
- Throws:
NotReadableRequestException
- when it is not possible to parse request message.
NotFormableResponseException
- when it is not possible to form response message.
NotUnderstoodException
FailureException