kaos.robots.core
Class ExecutionManager

java.lang.Object
  extended by kaos.core.util.MethodCallRequestHandler
      extended by kaos.robots.core.ExecutionManager
All Implemented Interfaces:
KAoSObservable, ObserverManager, HashMapRequestReceiver, OWLRequestReceiver
Direct Known Subclasses:
KAoSAriaRobot, KAoSTBot02, Tbot

public abstract class ExecutionManager
extends MethodCallRequestHandler
implements HashMapRequestReceiver, KAoSObservable, ObserverManager, OWLRequestReceiver


Nested Class Summary
 class ExecutionManager.RequestHandlerThread
           
 
Field Summary
protected  java.lang.String _actorID
           
protected  KAoSAgentDescription _agentDescription
           
protected  java.util.Vector _classificationListeners
           
protected  boolean _connected
           
 java.util.Vector _currentActions
           
protected  java.util.HashMap _enablingClasses
           
protected  RobotEnforcer _enforcer
           
protected  java.lang.String _ihmcDomain
           
protected  boolean _kaosEnabled
           
protected  java.util.HashMap _learnedTasks
           
protected  java.util.HashMap _learnedTaskVariables
           
protected  boolean _learning
           
protected  java.util.HashMap _listeners
           
protected  Logger _logger
           
protected  java.lang.String _nickName
           
protected  PolicyAdvice _policyAdvice
           
protected  PolicyChecking _policyService
           
protected  QueryRegistration _query
           
protected  boolean _registeredWithKAoS
           
protected  Registration _registration
           
 ActionStatusCallback _reniaCallback
           
 boolean _spatialReasoning
           
protected  java.util.Vector _subtasks
           
protected  java.lang.String _taskName
           
protected  java.lang.String _transportName
           
protected  java.lang.String myTeam
           
 
Fields inherited from class kaos.core.util.MethodCallRequestHandler
_helper, _mts, DEFAULT_NICKNAME, myLocator, myMessageReceiver, myMessageSender
 
Constructor Summary
ExecutionManager()
           
 
Method Summary
 void AssignLeader(java.util.HashMap properties)
           
 ActionInstanceDescription buildAID(java.lang.String action, java.util.HashMap properties)
          buildAID Utility for turning string-hashmaps into ActionInstanceDeescriptions
 java.util.List<ActionInstanceDescription> checkObligations(ActionInstanceDescription aid)
           
 void checkPermissionForAction(ActionInstanceDescription aid)
           
 KAoSAgentDescription createMyOwnAgentDescription()
          Creates a new AgentDescription for this KAoSRobot.
 void deregisterObserver(KAoSObserver observer, java.lang.String updateType, java.io.Serializable updateCondition, KAoSEntityDescription observableDesc)
          Deregister the given KAoSObserver from the registry of observers asoociated with the KAoSObservable, whose KAoSEntityDescription is given.
 void deregisterObserver(KAoSObserver observer, java.lang.String updateType, java.io.Serializable updateCondition, java.lang.String observableGUID)
          Deregister the given KAoSObserver from the registry of observers associated with the KAoSObservable, whose GUID is given.
 void deregisterObserver(java.lang.String updateType, java.lang.Object updateCondition, KAoSObserver observer)
          Deregister the given KAoSObserver for the given update type from the registry of observers associated with this KAoSObservable.
 java.lang.Object executeLearnedAction(ActionInstanceDescription aid)
           
protected  java.util.Vector getActions()
          getActions retrieves all implemented interfaces.
 java.lang.String getActorID()
           
 java.util.Vector getAdjustedMoveToActions(ActionInstanceDescription aid)
           
 java.util.List<AgentCapability> getAgentCapabilities()
           
 KAoSAgentDescription getAgentDescription()
           
static Coordinate getCoordinateFromPointInstance(OntInstanceDescriptionImpl point)
           
 java.util.List GetLeadersOfTeam(java.util.HashMap properties)
           
 java.util.HashMap getPropertiesFromAID(ActionInstanceDescription aid)
           
protected  Area getRestrictedAreas(ActionInstanceDescription aid)
           
 java.util.List GetTeamMembers(java.util.HashMap properties)
           
protected  java.util.List getTeamMembers(java.lang.String teamName)
           
 void init(java.lang.String[] args)
           
 boolean isRegisteredWithKAoS()
           
protected  boolean isWithinRestrictedArea(ActionInstanceDescription aid, Area area)
           
 void JoinTeam(java.util.HashMap properties)
           
 void LeaveTeam(java.util.HashMap properties)
           
 java.util.Vector makeActionAllowable(ActionInstanceDescription aid)
           
 void modifySpatialProperties(Location3D location, Orientation3D orientation, Block3D block)
           
 void notify(java.lang.String updateType, java.lang.Object updateCondition, java.lang.Object update)
          Notify observers interested in the given updateType wiht the given update object.
protected  void printDebugString(java.lang.String msg, int loggerDisplayLevel)
           
 java.lang.Object processAIDRequest(ActionInstanceDescription actionDescription)
           
 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.
 java.lang.Object processOWLRequest(java.lang.String owlActionDescription)
          This method accepts a request described by an OWL String to perform an action.
 void processOWLRequest(java.lang.String owlActionDescription, ActionStatusCallback statusCallback)
          This method accepts a request described by an OWL String to perform an action.
 void registerObserver(KAoSObserver observer, java.lang.String updateType, java.io.Serializable updateCondition, KAoSEntityDescription observableDesc)
          Register the given KAoSObserver with the KAoSObservable, whose KAoSEntityDescription is given, for updates described by the updateType and updateConstraints.
 void registerObserver(KAoSObserver observer, java.lang.String updateType, java.io.Serializable updateCondition, java.lang.String observableGUID)
          Register the given KAoSObserver with the KAoSObservable, whose GUID is given for updates described by the updateType and updateConditions.
 void registerObserver(KAoSObserver observer, java.lang.String updateType, java.io.Serializable updateCondition, java.lang.String observableGUID, java.lang.String brokerGUID)
          Register the given KAoSObserver with the KAoSObservable, whose GUID is given for updates described by the updateType and updateConditions.
 void registerObserver(java.lang.String updateType, java.lang.Object updateCondition, KAoSObserver observer)
          Register the given KAoSObserver with this KAoSObservable for updates described by the updateType and updateConstraints.
 void registerWithKAoS(java.lang.String teamName)
           
 void registerWithSpatialProperties(Location3D location, Orientation3D orientation, Block3D block)
           
 KAoSAgentDescription searchForAgentDescription(java.lang.String agentName)
           
protected  void setRegisteredWithKAoS(boolean registered)
           
 void shutdown()
           
 void startLearning(java.util.HashMap properties)
           
 void stopLearning()
           
 void UnassignLeader(java.util.HashMap 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
 
Methods inherited from interface kaos.core.csi.observe.ObserverManager
registerKAoSExtensionComponentObserver
 

Field Detail

_logger

protected Logger _logger

_actorID

protected java.lang.String _actorID

_nickName

protected java.lang.String _nickName

_agentDescription

protected KAoSAgentDescription _agentDescription

_classificationListeners

protected java.util.Vector _classificationListeners

_ihmcDomain

protected java.lang.String _ihmcDomain

_kaosEnabled

protected boolean _kaosEnabled

_enforcer

protected RobotEnforcer _enforcer

_registeredWithKAoS

protected boolean _registeredWithKAoS

_connected

protected boolean _connected

_enablingClasses

protected java.util.HashMap _enablingClasses

_currentActions

public java.util.Vector _currentActions

_listeners

protected java.util.HashMap _listeners

_reniaCallback

public ActionStatusCallback _reniaCallback

_spatialReasoning

public boolean _spatialReasoning

_transportName

protected java.lang.String _transportName

_registration

protected Registration _registration

_query

protected QueryRegistration _query

_learning

protected boolean _learning

_subtasks

protected java.util.Vector _subtasks

_taskName

protected java.lang.String _taskName

_learnedTasks

protected java.util.HashMap _learnedTasks

_learnedTaskVariables

protected java.util.HashMap _learnedTaskVariables

_policyService

protected PolicyChecking _policyService

_policyAdvice

protected PolicyAdvice _policyAdvice

myTeam

protected java.lang.String myTeam
Constructor Detail

ExecutionManager

public ExecutionManager()
Method Detail

init

public void init(java.lang.String[] args)

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

processOWLRequest

public void processOWLRequest(java.lang.String owlActionDescription,
                              ActionStatusCallback statusCallback)
                       throws ActionFailureException
Description copied from interface: OWLRequestReceiver
This method accepts a request described by an OWL String to perform an action. Feedback from the action execution is sent to the requestor via the given ActionStatusCallback.

Specified by:
processOWLRequest in interface OWLRequestReceiver
Parameters:
owlActionDescription - is an OWL String 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

processOWLRequest

public java.lang.Object processOWLRequest(java.lang.String owlActionDescription)
                                   throws ActionFailureException
Description copied from interface: OWLRequestReceiver
This method accepts a request described by an OWL String to perform an action. The result is returned synchronously.

Specified by:
processOWLRequest in interface OWLRequestReceiver
Parameters:
owlActionDescription - is an OWL String 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

processAIDRequest

public java.lang.Object processAIDRequest(ActionInstanceDescription actionDescription)
                                   throws ActionFailureException
Throws:
ActionFailureException

registerObserver

public void registerObserver(KAoSObserver observer,
                             java.lang.String updateType,
                             java.io.Serializable updateCondition,
                             java.lang.String observableGUID)
                      throws NotLocatableException,
                             TransportFailure
Description copied from interface: ObserverManager
Register the given KAoSObserver with the KAoSObservable, whose GUID is given for updates described by the updateType and updateConditions.

Specified by:
registerObserver in interface ObserverManager
Parameters:
observer - KAoSObserver requesting registration for updates.
updateType - String indicating type of update the KAoSObserver is interested in.
updateCondition - Serializable describing the conditions under which to send the update.
observableGUID - String containing the GUID of the KAoSObservable to register with.
Throws:
NotLocatableException - when the KAoSObservable cannot be located.
TransportFailure - when transport services fails.

registerObserver

public void registerObserver(KAoSObserver observer,
                             java.lang.String updateType,
                             java.io.Serializable updateCondition,
                             KAoSEntityDescription observableDesc)
                      throws NotLocatableException,
                             TransportFailure
Description copied from interface: ObserverManager
Register the given KAoSObserver with the KAoSObservable, whose KAoSEntityDescription is given, for updates described by the updateType and updateConstraints.

Specified by:
registerObserver in interface ObserverManager
Parameters:
observer - KAoSObserver registering with for updates.
updateType - String indicating type of update the KAoSObserver is interested in.
updateCondition - Object describing the conditions under which to send the update.
observableDesc - KAoSEntityDescription describing the observable.
Throws:
NotLocatableException - when the KAoSObservable cannot be located.
TransportFailure - when transport services fail.

registerObserver

public void registerObserver(KAoSObserver observer,
                             java.lang.String updateType,
                             java.io.Serializable updateCondition,
                             java.lang.String observableGUID,
                             java.lang.String brokerGUID)
                      throws NotLocatableException,
                             TransportFailure
Description copied from interface: ObserverManager
Register the given KAoSObserver with the KAoSObservable, whose GUID is given for updates described by the updateType and updateConditions.

Specified by:
registerObserver in interface ObserverManager
Parameters:
observer - KAoSObserver requesting registration for updates.
updateType - String indicating type of update the KAoSObserver is interested in.
updateCondition - Serializable describing the conditions under which to send the update.
observableGUID - String containing the GUID of the KAoSObservable to register with.
brokerGUID - String containing the GUID of the broker, through which to reach the observable.
Throws:
NotLocatableException - when the KAoSObservable or broker cannot be located.
TransportFailure - when transport services fail. the rgistration will be processed.

deregisterObserver

public void deregisterObserver(KAoSObserver observer,
                               java.lang.String updateType,
                               java.io.Serializable updateCondition,
                               java.lang.String observableGUID)
                        throws NotLocatableException,
                               TransportFailure
Description copied from interface: ObserverManager
Deregister the given KAoSObserver from the registry of observers associated with the KAoSObservable, whose GUID is given.

Specified by:
deregisterObserver in interface ObserverManager
Parameters:
observer - KAoSObserver deregistering.
updateType - String indicating type of update the KAoSObserver is no longer interested in.
updateCondition - Serializable containing the condition the KAoSObserver is no longer interested in.
observableGUID - String specifying the GUID of the observable, from which to deregister for the given update type.
Throws:
NotLocatableException - when the KAoSObservable cannot be located.
TransportFailure - when transport services fail.

deregisterObserver

public void deregisterObserver(KAoSObserver observer,
                               java.lang.String updateType,
                               java.io.Serializable updateCondition,
                               KAoSEntityDescription observableDesc)
                        throws NotLocatableException,
                               TransportFailure
Description copied from interface: ObserverManager
Deregister the given KAoSObserver from the registry of observers asoociated with the KAoSObservable, whose KAoSEntityDescription is given.

Specified by:
deregisterObserver in interface ObserverManager
Parameters:
observer - KAoSObserver deregistering.
updateType - String indicating type of update the KAoSObserver is no longer interested in.
updateCondition - Serializable containing the condition the KAoSObserver is no longer interested in.
observableDesc - KAoSEntityDescription of the observable, from which to deregister for the given update type.
Throws:
NotLocatableException - when the KAoSObservable cannot be located.
TransportFailure - when transport services fail.

registerObserver

public void registerObserver(java.lang.String updateType,
                             java.lang.Object updateCondition,
                             KAoSObserver observer)
Register the given KAoSObserver with this KAoSObservable for updates described by the updateType and updateConstraints.

Specified by:
registerObserver in interface KAoSObservable
Parameters:
updateType - String indicating type of update the KAoSObserver is interested in.
updateCondition - Object describing the conditions under which to send the update.
observer - KAoSObserver registering with for updates.

deregisterObserver

public void deregisterObserver(java.lang.String updateType,
                               java.lang.Object updateCondition,
                               KAoSObserver observer)
Deregister the given KAoSObserver for the given update type from the registry of observers associated with this KAoSObservable.

Specified by:
deregisterObserver in interface KAoSObservable
Parameters:
updateType - String indicating type of update the KAoSObserver is no longer interested in.
observer - KAoSObserver deregistering.

notify

public void notify(java.lang.String updateType,
                   java.lang.Object updateCondition,
                   java.lang.Object update)
Notify observers interested in the given updateType wiht the given update object.

Specified by:
notify in interface KAoSObservable
Parameters:
updateType - String describing the type of update to perform.
update - Object containing the update.

buildAID

public ActionInstanceDescription buildAID(java.lang.String action,
                                          java.util.HashMap properties)
buildAID Utility for turning string-hashmaps into ActionInstanceDeescriptions

Parameters:
action - Action name
properties - Hashmap of property name-value pairs
Returns:
ActionInstanceDescription

startLearning

public void startLearning(java.util.HashMap properties)

stopLearning

public void stopLearning()

makeActionAllowable

public java.util.Vector makeActionAllowable(ActionInstanceDescription aid)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

getRestrictedAreas

protected Area getRestrictedAreas(ActionInstanceDescription aid)

isWithinRestrictedArea

protected boolean isWithinRestrictedArea(ActionInstanceDescription aid,
                                         Area area)

getAdjustedMoveToActions

public java.util.Vector getAdjustedMoveToActions(ActionInstanceDescription aid)

getCoordinateFromPointInstance

public static Coordinate getCoordinateFromPointInstance(OntInstanceDescriptionImpl point)
                                                 throws ValueNotSet
Throws:
ValueNotSet

checkObligations

public java.util.List<ActionInstanceDescription> checkObligations(ActionInstanceDescription aid)
                                                           throws java.lang.Exception
Throws:
java.lang.Exception

getAgentDescription

public KAoSAgentDescription getAgentDescription()

createMyOwnAgentDescription

public KAoSAgentDescription createMyOwnAgentDescription()
Creates a new AgentDescription for this KAoSRobot. Utilizing the AgentDirectoryService an empty AgentDescription is obtained and then populated with the robot's name.

Returns:
an AgentDescription for this robot.

getAgentCapabilities

public java.util.List<AgentCapability> getAgentCapabilities()

isRegisteredWithKAoS

public boolean isRegisteredWithKAoS()

setRegisteredWithKAoS

protected void setRegisteredWithKAoS(boolean registered)

registerWithKAoS

public void registerWithKAoS(java.lang.String teamName)

searchForAgentDescription

public KAoSAgentDescription searchForAgentDescription(java.lang.String agentName)

getActions

protected java.util.Vector getActions()
getActions retrieves all implemented interfaces. it provides a list of actions that this agent can execute

Returns:
Vector Vector of actions available to this agent

getPropertiesFromAID

public java.util.HashMap getPropertiesFromAID(ActionInstanceDescription aid)

executeLearnedAction

public java.lang.Object executeLearnedAction(ActionInstanceDescription aid)
                                      throws java.lang.Exception
Throws:
java.lang.Exception

getActorID

public java.lang.String getActorID()

registerWithSpatialProperties

public void registerWithSpatialProperties(Location3D location,
                                          Orientation3D orientation,
                                          Block3D block)

modifySpatialProperties

public void modifySpatialProperties(Location3D location,
                                    Orientation3D orientation,
                                    Block3D block)

checkPermissionForAction

public void checkPermissionForAction(ActionInstanceDescription aid)
                              throws ActionFailureException
Throws:
ActionFailureException

JoinTeam

public void JoinTeam(java.util.HashMap properties)
              throws DirectoryFailure,
                     QueryFailure
Throws:
DirectoryFailure
QueryFailure

LeaveTeam

public void LeaveTeam(java.util.HashMap properties)
               throws DirectoryFailure,
                      QueryFailure,
                      NotRegisteredException
Throws:
DirectoryFailure
QueryFailure
NotRegisteredException

GetTeamMembers

public java.util.List GetTeamMembers(java.util.HashMap properties)
                              throws DirectoryFailure,
                                     QueryFailure
Throws:
DirectoryFailure
QueryFailure

getTeamMembers

protected java.util.List getTeamMembers(java.lang.String teamName)
                                 throws DirectoryFailure,
                                        QueryFailure
Throws:
DirectoryFailure
QueryFailure

AssignLeader

public void AssignLeader(java.util.HashMap properties)
                  throws NotRegisteredException,
                         DirectoryFailure,
                         ModificationException
Throws:
NotRegisteredException
DirectoryFailure
ModificationException

UnassignLeader

public void UnassignLeader(java.util.HashMap properties)
                    throws NotRegisteredException,
                           DirectoryFailure,
                           ModificationException
Throws:
NotRegisteredException
DirectoryFailure
ModificationException

GetLeadersOfTeam

public java.util.List GetLeadersOfTeam(java.util.HashMap properties)
                                throws QueryFailure,
                                       DirectoryFailure
Throws:
QueryFailure
DirectoryFailure

printDebugString

protected void printDebugString(java.lang.String msg,
                                int loggerDisplayLevel)

shutdown

public void shutdown()