kaos.robots.core
Class KAoSRobot

java.lang.Object
  extended by kaos.robots.core.KAoSRobot
All Implemented Interfaces:
Command, FeedbackReceiver, KAoSObservable, ObserverManager
Direct Known Subclasses:
ActivMedia, BreveBot, ER1, KAoSPlayer, KAoSRobotExample, KAoSRobotTest, KBot, MinimalStubBot, StubBot

public abstract class KAoSRobot
extends java.lang.Object
implements KAoSObservable, FeedbackReceiver, Command, ObserverManager


Nested Class Summary
 class KAoSRobot.RequestHandlerThread
           
 
Field Summary
protected  java.lang.String _actorID
           
protected  javax.swing.JTextField _address
           
protected  KAoSAgentDescription _agentDescription
           
protected  java.util.Vector _classificationListeners
           
protected  javax.swing.JButton _connectBtn
           
protected  boolean _connected
           
 javax.swing.JComboBox _connectToCmb
           
 java.util.Vector _currentActions
           
protected  java.util.HashMap _enablingClasses
           
protected  RobotEnforcer _enforcer
           
 boolean _gpsIsAvailable
           
 GPSPosition _gpsOrigin
           
protected  java.util.HashMap _listeners
           
protected  Locator _locator
           
protected  Logger _logger
           
protected  MessageReceiver _messageReceiver
           
protected  MessageTransportService _msgTransportService
           
protected  Locator _myLocator
           
protected  java.lang.String _nickName
           
protected  javax.swing.JTextField _port
           
protected  boolean _registeredWithKAoS
           
 ActionStatusCallback _reniaCallback
           
protected  MessageSender _sender
           
 
Constructor Summary
KAoSRobot()
           
 
Method Summary
 void assertNotLocatable(boolean exp, java.lang.String msg)
           
 ActionInstanceDescription buildAID(java.lang.String action, java.util.HashMap properties)
          buildAID Utility for turning string-hashmaps into ActionInstanceDeescriptions
 javax.swing.JPanel buildConnectPanel()
           
 javax.swing.JPanel buildKAoSPanel()
           
 void checkObligations(ActionInstanceDescription aid)
           
abstract  boolean connect()
          This function is used to connect to robot
 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 GUID 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.
abstract  void disconnect()
          This function is used to disconnect from robot
 boolean equals(java.lang.Object obj)
           
 void ExtendTimeout(java.util.HashMap properties)
           
protected  java.util.Vector getActions()
          getActions retrieves all implemented interfaces.
 java.lang.String getActorID()
           
 KAoSAgentDescription getAgentDescription()
          Creates a new AgentDescription for this KAoSRobot.
 KAoSAgentDescription getAgentDescriptionFromName(java.lang.String name)
           
 java.util.List getAllAgents()
          Return all agent ids stored in the KAoS directory.
 java.util.Vector getCurrentActions()
           
 DetectedObjectObservableImpl getDetectedObjectObservable()
           
 int getGPSCommPort()
           
 Locator getLocator()
           
 MessageTransportService getMTS()
           
 java.util.HashMap getPropertiesFromAID(ActionInstanceDescription aid)
           
 int getTimeoutPeriod()
           
 boolean gpsIsAvailable()
           
 int hashCode()
           
 void init(java.lang.String[] args)
           
 boolean initialize(KAoSServiceRoot sr, JasBean robotInitInfo, java.util.Vector domainNames)
          Obtain a reference to the Guard and ask Guard to register robot with the KAoS Directory Service.
 boolean isRegisteredWithKAoS()
           
 java.lang.Object makeActionAllowable(ActionInstanceDescription aid)
           
 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.
 void onAborted(java.util.Calendar time, java.lang.Object reason, java.lang.String actionID, java.lang.String robotID)
          This method is invoked when the requested action is aborted.
 void onAccepted(java.util.Calendar time, java.lang.Object acceptInfo, java.lang.String actionID, java.lang.String robotID)
          This method is invoked when the request is accepted by the robot.
 void onCompleted(java.util.Calendar time, java.lang.Object result, java.lang.String actionID, java.lang.String robotID)
          This method is invoked upon completion of the request byt the requested robot.
 void onRefused(java.util.Calendar time, java.lang.Object reason, java.lang.String actionID, java.lang.String robotID)
          This method is invoked when the request is refused by the robot.
 void onStarted(java.util.Calendar time, java.lang.Object startedInfo, java.lang.String actionID, java.lang.String robotID)
          This method is invoked when the robot starts the requested action.
protected  void printDebugString(java.lang.String msg, int loggerDisplayLevel)
           
 void receiveKAoSStatus(java.lang.String statusMsg, java.lang.String actionID, java.lang.String robotID)
          Receive a status message describing the execution of the requested action.
 void receiveMessage(TransportMessage msg)
           
 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.Object requestAction(ActionInstanceDescription aid, ActionStatusCallback callback)
           
 java.lang.String requestAction(FeedbackReceiver feedbackReceiver, KAoSEntityDescription receiverDesc, java.lang.String owlActionDescription)
          This method sends a command to an entity identified by the given receiverDesc to perform an action described by the given String, which is in the OWL format.
 java.lang.String requestAction(FeedbackReceiver feedbackReceiver, KAoSEntityDescription receiverDesc, java.lang.String actionName, java.util.HashMap properties)
          This method sends a command to an entity identified by the given receiverDesc to perform an action described by the given action name and properties.
 java.lang.String requestAction(FeedbackReceiver feedbackReceiver, java.lang.String receiverID, java.lang.String owlActionDescription)
          Command Interface Implementation
 java.lang.String requestAction(FeedbackReceiver feedbackReceiver, java.lang.String receiverID, java.lang.String actionName, java.util.HashMap properties)
          This method sends a command to an entity identified by the given receiverID to perform an action described by the given action name and properties.
 java.lang.Object requestAction(KAoSEntityDescription receiverDesc, java.lang.String actionName, java.util.HashMap properties)
          This method sends a command to an entity identified by the given receiverDesc to perform an action described by the given action name and roperties.
 java.lang.Object requestAction(java.lang.String action, java.util.HashMap properties)
           
 java.lang.Object requestAction(java.lang.String action, java.util.HashMap properties, ActionStatusCallback callback)
          Request an action whose name and properties are specified.
 java.lang.String requestAction(java.lang.String action, java.util.HashMap properties, KAoSEntityDescription receiverDesc)
          Request a given action/information with the described properties from a robot whose KAoS agent description is given.
 java.lang.Object requestAction(java.lang.String receiverID, java.lang.String actionName, java.util.HashMap properties)
          This method sends a command to an entity identified by the given receiverID to perform an action described by the given action name and properties.
 void sendMessage(java.lang.String GUID, java.io.Serializable content)
           
 void sendRequestToKaa(java.lang.String action, java.util.HashMap properties)
           
protected  void setRegisteredWithKAoS(boolean registered)
           
 int updateTimeout()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_logger

protected Logger _logger

_actorID

protected java.lang.String _actorID

_msgTransportService

protected MessageTransportService _msgTransportService

_messageReceiver

protected MessageReceiver _messageReceiver

_sender

protected MessageSender _sender

_locator

protected Locator _locator

_nickName

protected java.lang.String _nickName

_myLocator

protected Locator _myLocator

_agentDescription

protected KAoSAgentDescription _agentDescription

_classificationListeners

protected java.util.Vector _classificationListeners

_enforcer

protected RobotEnforcer _enforcer

_registeredWithKAoS

protected boolean _registeredWithKAoS

_connectToCmb

public javax.swing.JComboBox _connectToCmb

_address

protected javax.swing.JTextField _address

_port

protected javax.swing.JTextField _port

_connected

protected boolean _connected

_connectBtn

protected javax.swing.JButton _connectBtn

_enablingClasses

protected java.util.HashMap _enablingClasses

_currentActions

public java.util.Vector _currentActions

_listeners

protected java.util.HashMap _listeners

_reniaCallback

public ActionStatusCallback _reniaCallback

_gpsOrigin

public GPSPosition _gpsOrigin

_gpsIsAvailable

public boolean _gpsIsAvailable
Constructor Detail

KAoSRobot

public KAoSRobot()
Method Detail

connect

public abstract boolean connect()
This function is used to connect to robot

Returns:
boolean indicating true if successful and false if failed

disconnect

public abstract void disconnect()
This function is used to disconnect from robot


init

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

getCurrentActions

public java.util.Vector getCurrentActions()

requestAction

public java.lang.String requestAction(FeedbackReceiver feedbackReceiver,
                                      java.lang.String receiverID,
                                      java.lang.String owlActionDescription)
                               throws ActionFailureException,
                                      NotLocatableException,
                                      TransportFailure
Command Interface Implementation

Specified by:
requestAction in interface Command
Parameters:
feedbackReceiver - is the FeedbackReceiver requesting the action. All feedback from the action execution will be sent to it.
receiverID - is the String that identifies the entity, which is requested to perform the action. The receiverID is the one that the action executor has registered with KAoS.
owlActionDescription - is an OWL String that describes the action. It includes the action name and all action properties and their values.
Returns:
String containing the unique id of the requested action. This id will be used by the FeedbackReceiver to track the status of action execution.
Throws:
ActionFailureException - containing the reason for failure. See ontology to determine specific reasons available for a given action
NotLocatableException - when the entity reqested to perform the action cannot be located.
TransportFailure

requestAction

public java.lang.String requestAction(FeedbackReceiver feedbackReceiver,
                                      java.lang.String receiverID,
                                      java.lang.String actionName,
                                      java.util.HashMap properties)
                               throws ActionFailureException,
                                      NotLocatableException,
                                      TransportFailure
Description copied from interface: Command
This method sends a command to an entity identified by the given receiverID to perform an action described by the given action name and properties. Feedback from the action execution is sent to the given feedbackReceiver.

Specified by:
requestAction in interface Command
Parameters:
feedbackReceiver - is the FeedbackReceiver requesting the action. All feedback from the action execution will be sent to it.
receiverID - is the String that identifies the entity, which is requested to perform the action. The receiverID is the one that the action executor has registered with KAoS.
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:
String containing the unique id of the requested action. This id will be used by the FeedbackReceiver to track the status of action execution.
Throws:
ActionFailureException - containing the reason for failure. See ontology to determine specific reasons available for a given action
NotLocatableException - when the entity reqested to perform the action cannot be located.
TransportFailure

requestAction

public java.lang.String requestAction(FeedbackReceiver feedbackReceiver,
                                      KAoSEntityDescription receiverDesc,
                                      java.lang.String owlActionDescription)
                               throws ActionFailureException,
                                      NotLocatableException,
                                      TransportFailure
Description copied from interface: Command
This method sends a command to an entity identified by the given receiverDesc to perform an action described by the given String, which is in the OWL format. Feedback from the action execution is sent to the given feedbackReceiver.

Specified by:
requestAction in interface Command
Parameters:
feedbackReceiver - is the FeedbackReceiver requesting the action. All feedback from the action execution will be sent to it.
receiverDesc - is KAosEntityDescription of the entity, which is requested to perform the action.
owlActionDescription - is an OWL String that describes the action. It includes the action name and all action properties and their values.
Returns:
String containing the unique id of the requested action. This id will be used by the FeedbackReceiver to track the status of action execution.
Throws:
ActionFailureException - containing the reason for failure. See ontology to determine specific reasons available for a given action
NotLocatableException - when the entity reqested to perform the action cannot be located.
TransportFailure

requestAction

public java.lang.String requestAction(FeedbackReceiver feedbackReceiver,
                                      KAoSEntityDescription receiverDesc,
                                      java.lang.String actionName,
                                      java.util.HashMap properties)
                               throws ActionFailureException,
                                      NotLocatableException,
                                      TransportFailure
Description copied from interface: Command
This method sends a command to an entity identified by the given receiverDesc to perform an action described by the given action name and properties. Feedback from the action execution is sent to the given feedbackReceiver.

Specified by:
requestAction in interface Command
Parameters:
feedbackReceiver - is the FeedbackReceiver requesting the action. All feedback from the action execution will be sent to it.
receiverDesc - is KAosEntityDescription of the entity, which is requested to perform the action.
actionName - is a String representing the name of the action as defined in the associated (with the action) ontology.
properties - is an HashMap of ontological Strings representing the desired properties of the action and the associated values.
Returns:
String containing the unique id of the requested action. This id will be used by the FeedbackReceiver to track the status of action execution.
Throws:
ActionFailureException - containing the reason for failure. See ontology to determine specific reasons available for a given action
NotLocatableException - when the entity reqested to perform the action cannot be located.
TransportFailure

requestAction

public java.lang.Object requestAction(java.lang.String receiverID,
                                      java.lang.String actionName,
                                      java.util.HashMap properties)
                               throws ActionFailureException,
                                      NotLocatableException,
                                      TransportFailure
Description copied from interface: Command
This method sends a command to an entity identified by the given receiverID to perform an action described by the given action name and properties. The result is returned synchronously to the caller.

Specified by:
requestAction in interface Command
Parameters:
receiverID - is the String that identifies the entity, which is requested to perform the action. The receiverID is the one that the action executor has registered with KAoS.
actionName - is a String representing the name of the action as defined in the associated ontology.
properties - is a HashMap of Strings representing names of the desired properties as defined in the associated ontology and their values.
Returns:
Object containing the result of the requested action.
Throws:
ActionFailureException - containing the reason for failure. See ontology to determine specific reasons available for a given action
NotLocatableException - when the entity reqested to perform the action cannot be located.
TransportFailure

requestAction

public java.lang.Object requestAction(KAoSEntityDescription receiverDesc,
                                      java.lang.String actionName,
                                      java.util.HashMap properties)
                               throws ActionFailureException,
                                      NotLocatableException,
                                      TransportFailure
Description copied from interface: Command
This method sends a command to an entity identified by the given receiverDesc to perform an action described by the given action name and roperties. The result will be returned synchronously.

Specified by:
requestAction in interface Command
Parameters:
receiverDesc - is KAosEntityDescription of the entity, which is requested to perform the action.
actionName - is a String representing the name of the action as defined in the associated ontology.
properties - is a HashMap of Strings representing names of the desired properties as defined in the associated ontology and their values.
Returns:
Object containing result of the requested action.
Throws:
ActionFailureException - containing the reason for failure. See ontology to determine specific reasons available for a given action
NotLocatableException - when the entity reqested to perform the action cannot be located.
TransportFailure

requestAction

public java.lang.Object requestAction(java.lang.String action,
                                      java.util.HashMap properties,
                                      ActionStatusCallback callback)
                               throws java.lang.Exception
Request an action whose name and properties are specified. Before the action is executed, permissions are checked to see whether the requested action is authorized. If the action is not authorized, an Exception is thrown. This is a synchronous version of the 'requestAction' method.

Parameters:
actionName - String indicating the name of the action as it is defined in an ontology supporting the action. Also, a corresponding method (exactly the same as the actionName) has to be implemented in the class, whose instance is executing the action.
properties - HashMap containing action properties and values. The name of properties have to be the same as defined in the action's ontology. Each method implemented should document the available properties, their type and range of values.
statusCallback - ActionStatusCallback to be called to pass back to the action requestor info about progression of action execution and the final result.
Returns:
Object containing the result of action execution.
Throws:
java.lang.Exception - if the action is not authorized, the Guard is not available, or an exception is thrown during the execution of the action.

requestAction

public java.lang.Object requestAction(ActionInstanceDescription aid,
                                      ActionStatusCallback callback)
                               throws java.lang.Exception
Throws:
java.lang.Exception

requestAction

public java.lang.Object requestAction(java.lang.String action,
                                      java.util.HashMap properties)
                               throws java.lang.Exception
Throws:
java.lang.Exception

buildAID

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

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

makeActionAllowable

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

checkObligations

public void checkObligations(ActionInstanceDescription aid)
                      throws java.lang.Exception
Throws:
java.lang.Exception

receiveMessage

public void receiveMessage(TransportMessage msg)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

initialize

public boolean initialize(KAoSServiceRoot sr,
                          JasBean robotInitInfo,
                          java.util.Vector domainNames)
Obtain a reference to the Guard and ask Guard to register robot with the KAoS Directory Service.


getAgentDescription

public KAoSAgentDescription getAgentDescription()
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.

isRegisteredWithKAoS

public boolean isRegisteredWithKAoS()

setRegisteredWithKAoS

protected void setRegisteredWithKAoS(boolean registered)

registerWithKAoS

public void registerWithKAoS()

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)

buildKAoSPanel

public javax.swing.JPanel buildKAoSPanel()

buildConnectPanel

public javax.swing.JPanel buildConnectPanel()

getMTS

public MessageTransportService getMTS()

getLocator

public Locator getLocator()

getActorID

public java.lang.String getActorID()

getAllAgents

public java.util.List getAllAgents()
                            throws SearchException,
                                   DirectoryFailure
Return all agent ids stored in the KAoS directory.

Returns:
List of all agent unique IDs in the agent directory, or null, if there aren't any.
Throws:
SearchException - if an exception is thrown during the search.
DirectoryFailure - if the directory cannot be found/is not available.

getAgentDescriptionFromName

public KAoSAgentDescription getAgentDescriptionFromName(java.lang.String name)
                                                 throws SearchException,
                                                        DirectoryFailure
Throws:
SearchException
DirectoryFailure

getGPSCommPort

public int getGPSCommPort()

getTimeoutPeriod

public int getTimeoutPeriod()

updateTimeout

public int updateTimeout()

ExtendTimeout

public void ExtendTimeout(java.util.HashMap properties)

gpsIsAvailable

public boolean gpsIsAvailable()

getDetectedObjectObservable

public DetectedObjectObservableImpl getDetectedObjectObservable()

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.
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.
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 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.
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.

requestAction

public java.lang.String requestAction(java.lang.String action,
                                      java.util.HashMap properties,
                                      KAoSEntityDescription receiverDesc)
                               throws NotLocatableException,
                                      TransportFailure
Request a given action/information with the described properties from a robot whose KAoS agent description is given.

Parameters:
action - String containing the name of the requested action. *** Important: the name has to be defined in the ontology describing robot's actions.
properties - HashMap containing the properties of the requested action. *** Important: the names of properties have to be defined in the ontology describing robot's actions.
receiverDesc - KAoSEntityDescription of the robot to send the request to.
Returns:
String uniquely identifying the requested action. It can be used for matching with the returned results.
Throws:
NotLocatableException
TransportFailure

sendMessage

public void sendMessage(java.lang.String GUID,
                        java.io.Serializable content)
                 throws NotLocatableException,
                        TransportFailure,
                        SearchException,
                        DirectoryFailure
Throws:
NotLocatableException
TransportFailure
SearchException
DirectoryFailure

assertNotLocatable

public void assertNotLocatable(boolean exp,
                               java.lang.String msg)
                        throws NotLocatableException
Throws:
NotLocatableException - if exp is true.

sendRequestToKaa

public void sendRequestToKaa(java.lang.String action,
                             java.util.HashMap properties)
                      throws java.lang.Exception
Throws:
java.lang.Exception

onAccepted

public void onAccepted(java.util.Calendar time,
                       java.lang.Object acceptInfo,
                       java.lang.String actionID,
                       java.lang.String robotID)
This method is invoked when the request is accepted by the robot.

Specified by:
onAccepted in interface FeedbackReceiver
Parameters:
time - Calendar time of acceptance.
acceptInfo - Object containing additional (optional) info about the acceptance.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

onRefused

public void onRefused(java.util.Calendar time,
                      java.lang.Object reason,
                      java.lang.String actionID,
                      java.lang.String robotID)
This method is invoked when the request is refused by the robot.

Specified by:
onRefused in interface FeedbackReceiver
Parameters:
time - Calendar time of refusal.
reason - Object containing the reason for refusing the request.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

onCompleted

public void onCompleted(java.util.Calendar time,
                        java.lang.Object result,
                        java.lang.String actionID,
                        java.lang.String robotID)
This method is invoked upon completion of the request byt the requested robot.

Specified by:
onCompleted in interface FeedbackReceiver
Parameters:
time - Calendar time of information/action completion.
result - Object containing the result of the requested action.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

onStarted

public void onStarted(java.util.Calendar time,
                      java.lang.Object startedInfo,
                      java.lang.String actionID,
                      java.lang.String robotID)
This method is invoked when the robot starts the requested action.

Specified by:
onStarted in interface FeedbackReceiver
Parameters:
time - Calendar time of starting an action.
startedInfo - Object containing additional (optional) info about the start of the action.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

onAborted

public void onAborted(java.util.Calendar time,
                      java.lang.Object reason,
                      java.lang.String actionID,
                      java.lang.String robotID)
This method is invoked when the requested action is aborted.

Specified by:
onAborted in interface FeedbackReceiver
Parameters:
time - Calendar time of aborting an action.
reason - Object containing the reason for aborting an action.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

receiveKAoSStatus

public void receiveKAoSStatus(java.lang.String statusMsg,
                              java.lang.String actionID,
                              java.lang.String robotID)
Receive a status message describing the execution of the requested action. There maybe several status messages sent during action execution.

Specified by:
receiveKAoSStatus in interface FeedbackReceiver
Parameters:
statusMsg - Object containing the result of the requested action/information.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

printDebugString

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