|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object kaos.robots.core.KAoSRobot
public abstract class KAoSRobot
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 |
---|
protected Logger _logger
protected java.lang.String _actorID
protected MessageTransportService _msgTransportService
protected MessageReceiver _messageReceiver
protected MessageSender _sender
protected Locator _locator
protected java.lang.String _nickName
protected Locator _myLocator
protected KAoSAgentDescription _agentDescription
protected java.util.Vector _classificationListeners
protected RobotEnforcer _enforcer
protected boolean _registeredWithKAoS
public javax.swing.JComboBox _connectToCmb
protected javax.swing.JTextField _address
protected javax.swing.JTextField _port
protected boolean _connected
protected javax.swing.JButton _connectBtn
protected java.util.HashMap _enablingClasses
public java.util.Vector _currentActions
protected java.util.HashMap _listeners
public ActionStatusCallback _reniaCallback
public GPSPosition _gpsOrigin
public boolean _gpsIsAvailable
Constructor Detail |
---|
public KAoSRobot()
Method Detail |
---|
public abstract boolean connect()
public abstract void disconnect()
public void init(java.lang.String[] args)
public java.util.Vector getCurrentActions()
public java.lang.String requestAction(FeedbackReceiver feedbackReceiver, java.lang.String receiverID, java.lang.String owlActionDescription) throws ActionFailureException, NotLocatableException, TransportFailure
requestAction
in interface Command
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.
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
public java.lang.String requestAction(FeedbackReceiver feedbackReceiver, java.lang.String receiverID, java.lang.String actionName, java.util.HashMap properties) throws ActionFailureException, NotLocatableException, TransportFailure
Command
requestAction
in interface Command
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.
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
public java.lang.String requestAction(FeedbackReceiver feedbackReceiver, KAoSEntityDescription receiverDesc, java.lang.String owlActionDescription) throws ActionFailureException, NotLocatableException, TransportFailure
Command
requestAction
in interface Command
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.
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
public java.lang.String requestAction(FeedbackReceiver feedbackReceiver, KAoSEntityDescription receiverDesc, java.lang.String actionName, java.util.HashMap properties) throws ActionFailureException, NotLocatableException, TransportFailure
Command
requestAction
in interface Command
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.
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
public java.lang.Object requestAction(java.lang.String receiverID, java.lang.String actionName, java.util.HashMap properties) throws ActionFailureException, NotLocatableException, TransportFailure
Command
requestAction
in interface Command
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.
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
public java.lang.Object requestAction(KAoSEntityDescription receiverDesc, java.lang.String actionName, java.util.HashMap properties) throws ActionFailureException, NotLocatableException, TransportFailure
Command
requestAction
in interface Command
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.
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
public java.lang.Object requestAction(java.lang.String action, java.util.HashMap properties, ActionStatusCallback callback) throws java.lang.Exception
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.
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.public java.lang.Object requestAction(ActionInstanceDescription aid, ActionStatusCallback callback) throws java.lang.Exception
java.lang.Exception
public java.lang.Object requestAction(java.lang.String action, java.util.HashMap properties) throws java.lang.Exception
java.lang.Exception
public ActionInstanceDescription buildAID(java.lang.String action, java.util.HashMap properties)
String
- action Action nameHashMap
- properties Hashmap of property name-value pairs
public java.lang.Object makeActionAllowable(ActionInstanceDescription aid) throws java.lang.Exception
java.lang.Exception
public void checkObligations(ActionInstanceDescription aid) throws java.lang.Exception
java.lang.Exception
public void receiveMessage(TransportMessage msg)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean initialize(KAoSServiceRoot sr, JasBean robotInitInfo, java.util.Vector domainNames)
public KAoSAgentDescription getAgentDescription()
public boolean isRegisteredWithKAoS()
protected void setRegisteredWithKAoS(boolean registered)
public void registerWithKAoS()
protected java.util.Vector getActions()
public java.util.HashMap getPropertiesFromAID(ActionInstanceDescription aid)
public javax.swing.JPanel buildKAoSPanel()
public javax.swing.JPanel buildConnectPanel()
public MessageTransportService getMTS()
public Locator getLocator()
public java.lang.String getActorID()
public java.util.List getAllAgents() throws SearchException, DirectoryFailure
SearchException
- if an exception is thrown during the search.
DirectoryFailure
- if the directory cannot be found/is not available.public KAoSAgentDescription getAgentDescriptionFromName(java.lang.String name) throws SearchException, DirectoryFailure
SearchException
DirectoryFailure
public int getGPSCommPort()
public int getTimeoutPeriod()
public int updateTimeout()
public void ExtendTimeout(java.util.HashMap properties)
public boolean gpsIsAvailable()
public DetectedObjectObservableImpl getDetectedObjectObservable()
public void registerObserver(KAoSObserver observer, java.lang.String updateType, java.io.Serializable updateCondition, java.lang.String observableGUID) throws NotLocatableException, TransportFailure
ObserverManager
registerObserver
in interface ObserverManager
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.
NotLocatableException
- when the KAoSObservable cannot be located.
TransportFailure
- when transport services fails.public void registerObserver(KAoSObserver observer, java.lang.String updateType, java.io.Serializable updateCondition, KAoSEntityDescription observableDesc) throws NotLocatableException, TransportFailure
ObserverManager
registerObserver
in interface ObserverManager
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.
NotLocatableException
- when the KAoSObservable cannot be located.
TransportFailure
- when transport services fail.public void registerObserver(KAoSObserver observer, java.lang.String updateType, java.io.Serializable updateCondition, java.lang.String observableGUID, java.lang.String brokerGUID) throws NotLocatableException, TransportFailure
ObserverManager
registerObserver
in interface ObserverManager
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.
NotLocatableException
- when the KAoSObservable or broker cannot be located.
TransportFailure
- when transport services fail.
the rgistration will be processed.public void deregisterObserver(KAoSObserver observer, java.lang.String updateType, java.io.Serializable updateCondition, java.lang.String observableGUID) throws NotLocatableException, TransportFailure
ObserverManager
deregisterObserver
in interface ObserverManager
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.
NotLocatableException
- when the KAoSObservable cannot be located.
TransportFailure
- when transport services fail.public void deregisterObserver(KAoSObserver observer, java.lang.String updateType, java.io.Serializable updateCondition, KAoSEntityDescription observableDesc) throws NotLocatableException, TransportFailure
ObserverManager
deregisterObserver
in interface ObserverManager
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.
NotLocatableException
- when the KAoSObservable cannot be located.
TransportFailure
- when transport services fail.public void registerObserver(java.lang.String updateType, java.lang.Object updateCondition, KAoSObserver observer)
registerObserver
in interface KAoSObservable
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.public void deregisterObserver(java.lang.String updateType, java.lang.Object updateCondition, KAoSObserver observer)
deregisterObserver
in interface KAoSObservable
updateType
- String indicating type of update the KAoSObserver is no longer interested in.observer
- KAoSObserver deregistering.public void notify(java.lang.String updateType, java.lang.Object updateCondition, java.lang.Object update)
notify
in interface KAoSObservable
updateType
- String describing the type of update to perform.update
- Object containing the update.public java.lang.String requestAction(java.lang.String action, java.util.HashMap properties, KAoSEntityDescription receiverDesc) throws NotLocatableException, TransportFailure
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.
NotLocatableException
TransportFailure
public void sendMessage(java.lang.String GUID, java.io.Serializable content) throws NotLocatableException, TransportFailure, SearchException, DirectoryFailure
NotLocatableException
TransportFailure
SearchException
DirectoryFailure
public void assertNotLocatable(boolean exp, java.lang.String msg) throws NotLocatableException
NotLocatableException
- if exp is true.public void sendRequestToKaa(java.lang.String action, java.util.HashMap properties) throws java.lang.Exception
java.lang.Exception
public void onAccepted(java.util.Calendar time, java.lang.Object acceptInfo, java.lang.String actionID, java.lang.String robotID)
onAccepted
in interface FeedbackReceiver
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.public void onRefused(java.util.Calendar time, java.lang.Object reason, java.lang.String actionID, java.lang.String robotID)
onRefused
in interface FeedbackReceiver
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.public void onCompleted(java.util.Calendar time, java.lang.Object result, java.lang.String actionID, java.lang.String robotID)
onCompleted
in interface FeedbackReceiver
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.public void onStarted(java.util.Calendar time, java.lang.Object startedInfo, java.lang.String actionID, java.lang.String robotID)
onStarted
in interface FeedbackReceiver
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.public void onAborted(java.util.Calendar time, java.lang.Object reason, java.lang.String actionID, java.lang.String robotID)
onAborted
in interface FeedbackReceiver
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.public void receiveKAoSStatus(java.lang.String statusMsg, java.lang.String actionID, java.lang.String robotID)
receiveKAoSStatus
in interface FeedbackReceiver
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.protected void printDebugString(java.lang.String msg, int loggerDisplayLevel)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |