ibspan.tss.agents.rsa.handlers
Class FindRestaurantHandler

java.lang.Object
  extended by jade.core.behaviours.Behaviour
      extended by jade.core.behaviours.SimpleBehaviour
          extended by jade.core.behaviours.OneShotBehaviour
              extended by ibspan.tss.messaging.RequestHandler
                  extended by ibspan.tss.agents.rsa.handlers.FindRestaurantHandler
All Implemented Interfaces:
Serializable

public class FindRestaurantHandler
extends RequestHandler

This behaviour prepare response with list of restaurants fulfilling constraints given in the user request. More precisely, these constrains are given as the map of predicates (properties mapped into possible values -- one-to-one relation) passed as UserContext. Property should be defined as resource URI, whereas values as resource URI or simple literal.

The behaviour should be provided with two OntModels: model describing ontology of Restaurant domain and model containing database with restaurants to retrieve.

Author:
Maciej Gawinecki
See Also:
RestaurantServiceAgent, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class jade.core.behaviours.Behaviour
Behaviour.RunnableChangedEvent
 
Field Summary
static int DEFAULT_MAX_RESULTS
           
protected  RestaurantServiceAgent myAgent
           
 
Fields inherited from class jade.core.behaviours.Behaviour
myEvent, NOTIFY_DOWN, NOTIFY_UP, parent, STATE_BLOCKED, STATE_READY, STATE_RUNNING
 
Constructor Summary
FindRestaurantHandler(Agent a, DataStore ds, Object requestKey, Object actKey, Object notificationKey)
          Constructs FindRestaurantHandler.
 
Method Summary
protected  ACLMessage prepareResponse(ACLMessage request, Action act)
          Returns response to the request.
 
Methods inherited from class ibspan.tss.messaging.RequestHandler
action
 
Methods inherited from class jade.core.behaviours.OneShotBehaviour
done
 
Methods inherited from class jade.core.behaviours.SimpleBehaviour
reset
 
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
 

Field Detail

DEFAULT_MAX_RESULTS

public static final int DEFAULT_MAX_RESULTS
See Also:
Constant Field Values

myAgent

protected RestaurantServiceAgent myAgent
Constructor Detail

FindRestaurantHandler

public FindRestaurantHandler(Agent a,
                             DataStore ds,
                             Object requestKey,
                             Object actKey,
                             Object notificationKey)
Constructs FindRestaurantHandler.

Parameters:
a - owner agent
ds - data store
actKey - key for accessing action of user request from local Data Store
requestKey - key for accessing user request ACL message from local Data Store
notificationKey - key, pointing the place in local Data Store, where result of the Behaviour should put at
Method Detail

prepareResponse

protected final ACLMessage prepareResponse(ACLMessage request,
                                           Action act)
                                    throws FailureException
Description copied from class: RequestHandler
Returns response to the request. Programmers should implenets this method in order process given request.

Specified by:
prepareResponse in class RequestHandler
Parameters:
request - is message.
act - is Action concept extracted previously from request object.
Returns:
response; null means failure.
Throws:
FailureException