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:
HashMapRequestReceiver
Direct Known Subclasses:
RequestReceiverUsecase

public abstract class ActionMethodRequestHandler
extends MethodCallRequestHandler
implements HashMapRequestReceiver


Field Summary
protected  PolicyChecking _policyService
           
 
Fields inherited from class kaos.core.util.MethodCallRequestHandler
_agentDescription, _locator, _logger, _mts, _nickName
 
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, 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, 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, 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, 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, initialize, receiveMessage, satisfyRequest
 
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,
                                  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,
                                  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,
                              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.

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.

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,
                                                     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)