|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object kaos.core.csi.command.CommandImpl
public class CommandImpl
This class implements the Command interface, which defines sending commands to entities
Nested Class Summary | |
---|---|
protected static class |
CommandImpl.OperationWaiter
This class is used as a helper class to block Threads invoking the synchronous 'requestAction' methods. |
Field Summary | |
---|---|
protected java.util.Hashtable |
_actionRequestors
|
protected Locator |
_myLocator
|
protected java.lang.String |
_nickname
|
protected QueryRegistration |
_query
|
protected TransportSupport |
_transport
|
protected java.lang.String |
_transportName
|
protected java.util.Hashtable |
_waiters
|
Method Summary | |
---|---|
void |
assertNotLocatable(boolean exp,
java.lang.String msg)
|
boolean |
equals(java.lang.Object obj)
Two agents are equal if their respective hash codes are equal. |
static Command |
getInstance(java.lang.String transportName)
Retrieve an instance of Command. |
static Command |
getInstance(java.lang.String transportName,
java.lang.String nickName)
Retrieve a reference to the Command. |
int |
hashCode()
Determines the hash code for the AgentUsecase. |
static void |
main(java.lang.String[] args)
|
void |
onAborted(java.util.Calendar time,
java.lang.Object reason,
java.lang.String actionID,
java.lang.String actionExecutorID)
Forward the action aborted info from the given action executor to the feedback receiver associated with the requested action identified by the given actionID. |
void |
onAccepted(java.util.Calendar time,
java.lang.Object acceptInfo,
java.lang.String actionID,
java.lang.String actionExecutorID)
Forward the accept info by the action executor to the feedback receiver associated with the requested action identified by the given actionID. |
void |
onCompleted(java.util.Calendar time,
java.lang.Object result,
java.lang.String actionID,
java.lang.String actionExecutorID)
Forward the result of the action executed by the given action executor to the feedback receiver associated with the requested action identified by the given actionID. |
void |
onRefused(java.util.Calendar time,
java.lang.Object reason,
java.lang.String actionID,
java.lang.String actionExecutorID)
Forward the reason for refusal by the action executor to the feedback receiver associated with the requested action identified by the given actionID. |
void |
onStarted(java.util.Calendar time,
java.lang.Object startedInfo,
java.lang.String actionID,
java.lang.String actionExecutorID)
Forward the action started info from the given action executor to the feedback receiver associated with the requested action identified by the given actionID. |
protected void |
printDebugString(java.lang.String msg,
int loggerDisplayLevel)
|
void |
receiveMessage(TransportMessage tmsg)
Implements the receiveMessage method mandated by the MessageListener interface. |
protected void |
removeWaiter(java.lang.String id)
|
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)
This method sends a command to an entity identified by the given receiverID to perform an action described by the given String, which is in the OWL format. |
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 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. |
protected MethodCallResultMsg |
satisfyRequest(MethodCallRequestMsg requestMsg)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Locator _myLocator
protected java.lang.String _nickname
protected QueryRegistration _query
protected TransportSupport _transport
protected java.lang.String _transportName
protected java.util.Hashtable _actionRequestors
protected java.util.Hashtable _waiters
Method Detail |
---|
public static Command getInstance(java.lang.String transportName) throws java.lang.Exception
java.lang.Exception
public static Command getInstance(java.lang.String transportName, java.lang.String nickName) throws java.lang.Exception
transportName
- is a String containing the name of the transport to use by the Command.nickName
- is a String containing the nick name of the Command that may be used by certain
transport implementations, or null if not required by the transport.
java.lang.Exception
public java.lang.String requestAction(FeedbackReceiver feedbackReceiver, java.lang.String receiverID, java.lang.String actionName, java.util.HashMap properties) 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.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
- when transport services fail.public java.lang.String requestAction(FeedbackReceiver feedbackReceiver, KAoSEntityDescription receiverDesc, java.lang.String actionName, java.util.HashMap properties) 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.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
- when transport services fail.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 actionname 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
- when transport services fail.public java.lang.String requestAction(FeedbackReceiver feedbackReceiver, KAoSEntityDescription receiverDesc, 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.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
- when transport services fail.public java.lang.Object requestAction(java.lang.String receiverID, java.lang.String actionName, java.util.HashMap properties) throws ActionFailureException, NotLocatableException, TransportFailure
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
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 void receiveMessage(TransportMessage tmsg)
MessageListener
,
TransportMessage
,
"JAS Specification, Section(s) 3.4.2, 4.7.2"public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
hashCode()
,
"JAS Specification, Section(s) 4.7.2"public int hashCode()
super.hashCode()
.
hashCode
in class java.lang.Object
AgentName#hashCode
,
Object.hashCode()
,
"JAS Specification, Section(s) 4.7.2"public void onAccepted(java.util.Calendar time, java.lang.Object acceptInfo, java.lang.String actionID, java.lang.String actionExecutorID)
time
- Calendar time of acceptance.acceptInfo
- Object containing additional (optional) info about the acceptance.actionID
- String containing the id of the requested action/information.actionExecutorID
- 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 actionExecutorID)
time
- Calendar time of refusal.reason
- Object containing the reason for refusing the request.actionID
- String containing the id of the requested action/information.actionExecutorID
- 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 actionExecutorID)
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.actionExecutorID
- 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 actionExecutorID)
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.actionExecutorID
- 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 actionExecutorID)
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.actionExecutorID
- String containing the name of the robot performing the action.protected MethodCallResultMsg satisfyRequest(MethodCallRequestMsg requestMsg)
public void assertNotLocatable(boolean exp, java.lang.String msg) throws NotLocatableException
NotLocatableException
- if exp is true.protected void removeWaiter(java.lang.String id)
protected void printDebugString(java.lang.String msg, int loggerDisplayLevel)
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |