kaos.core.csi.request
Class ActionMethodRequestHandler

java.lang.Object
  extended by kaos.core.util.MethodCallRequestHandler
      extended by kaos.core.csi.request.ActionMethodRequestHandler
All Implemented Interfaces:
AIDRequestReceiver, HashMapRequestReceiver
Direct Known Subclasses:
RequestReceiverUsecase

public abstract class ActionMethodRequestHandler
extends kaos.core.util.MethodCallRequestHandler
implements HashMapRequestReceiver, AIDRequestReceiver

This class implements the operations to receive and process requests for actions. The operations to receive/process requests are defined in the HashMapRequestReceiver and AIDRequestReceiver. In the case of HashMapRequestReceiver, all requests are received in the form of a String containing the request name, a Hashtable, containing request properties and their values, and in some cases, a callback. In the case of AIDRequestReceiver, requests are received in the form of ActionInstanceDescription. Before a request is executed, a permission is checked to make sure that the request (action) is allowed. Requests are executed using the reflection mechanism. Request name is the name of the method to be invoked; properties and callbakc (if present) are the method's arguments.


Field Summary
protected  PolicyChecking _policyService
           
 
Fields inherited from class kaos.core.util.MethodCallRequestHandler
_agentDescription, _helper, _logger, _mts, _nickName, DEFAULT_NICKNAME, myLocator, myMessageReceiver, myMessageSender
 
Constructor Summary
ActionMethodRequestHandler()
           
 
Method Summary
protected  void bindToPolicyService(java.lang.String transportName)
           
protected  void checkPermissionForAction(java.lang.String actionName, java.util.HashMap properties)
           
protected  java.lang.Object executeHashMapBasedAction(java.lang.String actionName, java.util.HashMap properties, kaos.core.service.ontology.request.ActionStatusCallback statusCallback)
           
 java.util.HashMap getPropertiesFromAID(ActionInstanceDescription aid)
           
 java.lang.Object processAIDRequest(ActionInstanceDescription aid)
          This method accepts a request described in an ActionInstanceDescription to perform an action.
 void processAIDRequest(ActionInstanceDescription aid, kaos.core.service.ontology.request.ActionStatusCallback statusCallback)
          This method accepts a request described by an ActionInstanceDescription to perform an action.
 java.lang.Object processHashMapRequest(java.lang.String actionName)
          This method accepts a request described by the given String containing action name.
 void processHashMapRequest(java.lang.String actionName, kaos.core.service.ontology.request.ActionStatusCallback statusCallback)
          This method accepts a request described by the given String containing the action name.
 java.lang.Object processHashMapRequest(java.lang.String actionName, java.util.HashMap properties)
          This method accepts a request described by the given String and HashMap of properties.
 void processHashMapRequest(java.lang.String actionName, java.util.HashMap properties, kaos.core.service.ontology.request.ActionStatusCallback statusCallback)
          This method accepts a request described by the given String and HashMap of properties.
 
Methods inherited from class kaos.core.util.MethodCallRequestHandler
bindToTransport, handleMsgContent, handleObjContent, initialize, receiveMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_policyService

protected PolicyChecking _policyService
Constructor Detail

ActionMethodRequestHandler

public ActionMethodRequestHandler()
Method Detail

processHashMapRequest

public void processHashMapRequest(java.lang.String actionName,
                                  java.util.HashMap properties,
                                  kaos.core.service.ontology.request.ActionStatusCallback statusCallback)
                           throws ActionFailureException
This method accepts a request described by the given String and HashMap of properties. Feedback from the action execution is sent to the requestor via the given ActionStatusCallback.

Specified by:
processHashMapRequest in interface HashMapRequestReceiver
Parameters:
actionName - is a String representing the name of the action as defined in the associated ontology.
properties - is an HashMap of ontological Strings representing the desired properties of the action and the associated values.
statusCallback - ActionStatusCallback to be called to pass back to the action requestor information about progression of the action execution and the final result.
Throws:
ActionFailureException - containing the reason for failure. See ontology to determine specific reasons available for a given action

processHashMapRequest

public void processHashMapRequest(java.lang.String actionName,
                                  kaos.core.service.ontology.request.ActionStatusCallback statusCallback)
                           throws ActionFailureException
This method accepts a request described by the given String containing the action name. Feedback from the action execution is sent to the requestor via the given ActionStatusCallback.

Specified by:
processHashMapRequest in interface HashMapRequestReceiver
Parameters:
actionName - is a String representing the name of the action as defined in the associated ontology.
statusCallback - ActionStatusCallback to be called to pass back to the action requestor information about progression of the action execution and the final result.
Throws:
ActionFailureException - containing the reason for failure. See ontology to determine specific reasons available for a given action

processHashMapRequest

public java.lang.Object processHashMapRequest(java.lang.String actionName,
                                              java.util.HashMap properties)
                                       throws ActionFailureException
This method accepts a request described by the given String and HashMap of properties. The result is returned synchronously.

Specified by:
processHashMapRequest in interface HashMapRequestReceiver
Parameters:
actionName - is a String representing the name of the action as defined in the associated ontology.
properties - is an HashMap of ontological Strings representing the desired properties of the action and the associated values.
Returns:
Object containing the final result of the action.
Throws:
ActionFailureException - containing the reason for failure. See ontology to determine specific reasons available for a given action

processHashMapRequest

public java.lang.Object processHashMapRequest(java.lang.String actionName)
                                       throws ActionFailureException
This method accepts a request described by the given String containing action name. The result is returned synchronously.

Specified by:
processHashMapRequest in interface HashMapRequestReceiver
Parameters:
actionName - is a String representing the name of the action as defined in the associated ontology.
Returns:
Object containing the final result of the action.
Throws:
ActionFailureException - containing the reason for failure. See ontology to determine specific reasons available for a given action

processAIDRequest

public void processAIDRequest(ActionInstanceDescription aid,
                              kaos.core.service.ontology.request.ActionStatusCallback statusCallback)
                       throws ActionFailureException
This method accepts a request described by an ActionInstanceDescription to perform an action. Feedback from the action execution is sent to the requestor via the given ActionStatusCallback.

Specified by:
processAIDRequest in interface AIDRequestReceiver
Parameters:
aid - is an ActionInstanceDescription that describes the action. It includes the action name and all action properties and their values.
statusCallback - ActionStatusCallback to be called to pass back to the action requestor information about progression of the action execution and the final result.
Throws:
ActionFailureException - containing the reason for failure. See ontology to determine specific reasons available for a given action

processAIDRequest

public java.lang.Object processAIDRequest(ActionInstanceDescription aid)
                                   throws ActionFailureException
This method accepts a request described in an ActionInstanceDescription to perform an action. The result is returned synchronously.

Specified by:
processAIDRequest in interface AIDRequestReceiver
Parameters:
aid - is an ActionInstanceDescription that describes the action. It includes the action name and all action properties and their values.
Returns:
Object containing the final result of the action.
Throws:
ActionFailureException - containing the reason for failure. See ontology to determine specific reasons available for a given action

bindToPolicyService

protected void bindToPolicyService(java.lang.String transportName)
                            throws java.lang.Exception
Throws:
java.lang.Exception

executeHashMapBasedAction

protected java.lang.Object executeHashMapBasedAction(java.lang.String actionName,
                                                     java.util.HashMap properties,
                                                     kaos.core.service.ontology.request.ActionStatusCallback statusCallback)
                                              throws java.lang.Exception
Throws:
java.lang.Exception

checkPermissionForAction

protected void checkPermissionForAction(java.lang.String actionName,
                                        java.util.HashMap properties)
                                 throws ActionFailureException
Throws:
ActionFailureException

getPropertiesFromAID

public java.util.HashMap getPropertiesFromAID(ActionInstanceDescription aid)


Copyright © 2006 IHMC All Rights Reserved.