kaos.autonomy
Class Kaa

java.lang.Object
  extended by kaos.core.service.boot.KAoSAgent
      extended by kaos.autonomy.Kaa
All Implemented Interfaces:
KAoSObserver, FeedbackReceiver, KAoSAgentHelper

public class Kaa
extends KAoSAgent
implements FeedbackReceiver, KAoSObserver


Field Summary
 
Fields inherited from class kaos.core.service.boot.KAoSAgent
_agentDescription, _agentDirectoryService, _agentNamingService, _agentNickname, _lctr, _logger, _messageTransportService, _name, _serviceRoot
 
Constructor Summary
Kaa()
           
 
Method Summary
static java.lang.String addNamePrefix(java.lang.String name)
          Add prefix: Amigo -> urn:kaos#Amigo
protected  TransportMessage buildTransportMessage(AgentDescription agt, java.lang.Object content)
          build transport message given content to be sent
 boolean checkStepByStepIDBuild()
           
 boolean checkUserObservation()
           
 java.lang.String checkUserStatus()
           
 void controlAdjustableAutonomy(java.lang.String appealerName, Locator appealerLocator, java.lang.String failureType, ActionInstanceDescription aid, java.lang.String policyID, java.lang.String policyType, PolicyMsg policyMessage, java.lang.String situation)
          call Kaa decision making module
 void controlAdjustableAutonomyWithBackupPlans(java.lang.String agentID, Locator appealerLocator, java.lang.String failureType, ActionInstanceDescription aid, java.lang.String policyID, java.lang.String policyType, PolicyMsg policyMessage, java.lang.String situation)
           
protected  AgentDescription findAgent(java.lang.String agentName)
          find agent description for a given agent ID
 KAoSAgentDirectoryServiceProxy getDirectoryServiceProxy()
          get directory service proxy
 Locator getGuardLocator(java.lang.String actor)
          get the locator of Guard
 java.lang.String getID()
          Return the unique identifier of this observer.
static void main(java.lang.String[] args)
          main method
 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.
 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 tmsg)
          steps to take when receive message from agent
 void reinstateObligationPolicy(Locator guardLocator, java.lang.String policyID)
          tell a guard to reinstate an obligation policy
protected  void sendMessageToAgent(java.lang.String toWhom, java.lang.Object content)
          send given message content to an agent
protected  void sendMessageToClassifier(Locator appealerLocator, java.lang.String receiverName, java.lang.Object content)
          send given message content to classifier
protected  void sendRequestToGuard(Locator guardLocator, java.lang.String request, java.util.Vector args)
          send a request to the specified guard.
 java.lang.String stripNamePrefix(java.lang.String name)
          Remove the name prefix: urn:kaos#Amigo -> Amigo
 java.lang.String stripOntologyURL(java.lang.String givenAction)
          Remove ontology url prefix: http://....#ClassifyObject -> ClassifyObject
 void suspendObligationPolicy(Locator guardLocator, java.lang.String policyID)
          tell a guard to suspend an obligation policy
 void update(java.lang.String observableID, java.lang.String updateType, java.lang.Object updateCondition, java.lang.Object update)
          Receive an update from the KAoSObservable when the KAoSObservable has a change or event to report.
 
Methods inherited from class kaos.core.service.boot.KAoSAgent
acquireAgentDirectoryService, acquireAgentName, acquireAgentNamingService, acquireMessageTransportService, assertFalse, assertTrue, bindToMessageTransportService, createTransportMessage, equals, establishAgentDescription, findAgentDescriptionForID, findAgentDescriptionForNickname, getAgentID, getKAoSAgentDescription, hashCode, initialize, logMessage, logMessage, printTransportMessage, sendMessage, verifyRegistration
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Kaa

public Kaa()
Method Detail

controlAdjustableAutonomy

public void controlAdjustableAutonomy(java.lang.String appealerName,
                                      Locator appealerLocator,
                                      java.lang.String failureType,
                                      ActionInstanceDescription aid,
                                      java.lang.String policyID,
                                      java.lang.String policyType,
                                      PolicyMsg policyMessage,
                                      java.lang.String situation)
call Kaa decision making module

Parameters:
aid - Action instance description

controlAdjustableAutonomyWithBackupPlans

public void controlAdjustableAutonomyWithBackupPlans(java.lang.String agentID,
                                                     Locator appealerLocator,
                                                     java.lang.String failureType,
                                                     ActionInstanceDescription aid,
                                                     java.lang.String policyID,
                                                     java.lang.String policyType,
                                                     PolicyMsg policyMessage,
                                                     java.lang.String situation)

receiveMessage

public void receiveMessage(TransportMessage tmsg)
steps to take when receive message from agent

Overrides:
receiveMessage in class KAoSAgent
Parameters:
tmsg - Transport message

sendMessageToClassifier

protected void sendMessageToClassifier(Locator appealerLocator,
                                       java.lang.String receiverName,
                                       java.lang.Object content)
send given message content to classifier

Parameters:
content - Message to be sent

sendMessageToAgent

protected void sendMessageToAgent(java.lang.String toWhom,
                                  java.lang.Object content)
send given message content to an agent

Parameters:
toWhom - Agent to receive a message
content - Message to be sent

sendRequestToGuard

protected void sendRequestToGuard(Locator guardLocator,
                                  java.lang.String request,
                                  java.util.Vector args)
send a request to the specified guard.

Parameters:
guardLocator - locator of the guard to whom to send the request
request - Specific request to be sent
args - Necessary arguments for that request.

findAgent

protected AgentDescription findAgent(java.lang.String agentName)
find agent description for a given agent ID

Parameters:
agentName - Actor name
Returns:
Description of the actor

buildTransportMessage

protected TransportMessage buildTransportMessage(AgentDescription agt,
                                                 java.lang.Object content)
build transport message given content to be sent

Parameters:
agt - Description of an agent which will receive a message
content - Content of message to be sent
Returns:
TransportMessage

getGuardLocator

public Locator getGuardLocator(java.lang.String actor)
                        throws DirectoryFailure
get the locator of Guard

Parameters:
actor - A String specifying the name of agent
Returns:
Guard locator
Throws:
DirectoryFailure - If error in the D.S.

suspendObligationPolicy

public void suspendObligationPolicy(Locator guardLocator,
                                    java.lang.String policyID)
tell a guard to suspend an obligation policy

Parameters:
guardLocator - Locator of the guard to whom send the message to
policyID - ID of the policy that is to be suspended.

reinstateObligationPolicy

public void reinstateObligationPolicy(Locator guardLocator,
                                      java.lang.String policyID)
tell a guard to reinstate an obligation policy

Parameters:
guardLocator - Locator of the guard to whom send the message to
policyID - ID of the policy that is to be reinstated.

getDirectoryServiceProxy

public KAoSAgentDirectoryServiceProxy getDirectoryServiceProxy()
get directory service proxy

Returns:
directory service proxy

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.

update

public void update(java.lang.String observableID,
                   java.lang.String updateType,
                   java.lang.Object updateCondition,
                   java.lang.Object update)
Receive an update from the KAoSObservable when the KAoSObservable has a change or event to report.

Specified by:
update in interface KAoSObserver
Parameters:
observableID - String identifying the KAoSObservable sending the update.
updateType - String indicating type of update.
update - Object containing the update.
updateCondition - String describing the condition of the update.

getID

public java.lang.String getID()
Return the unique identifier of this observer.

Specified by:
getID in interface KAoSObserver
Returns:
String containing the unique ID of this observer.

addNamePrefix

public static java.lang.String addNamePrefix(java.lang.String name)
Add prefix: Amigo -> urn:kaos#Amigo

Parameters:
name - agent name
Returns:
name with prefix

stripNamePrefix

public java.lang.String stripNamePrefix(java.lang.String name)
Remove the name prefix: urn:kaos#Amigo -> Amigo

Parameters:
name - agent name
Returns:
name without prefix

stripOntologyURL

public java.lang.String stripOntologyURL(java.lang.String givenAction)
Remove ontology url prefix: http://....#ClassifyObject -> ClassifyObject

Parameters:
givenAction - ontological definitino of an action
Returns:
action without prefix

checkUserObservation

public boolean checkUserObservation()

checkStepByStepIDBuild

public boolean checkStepByStepIDBuild()

checkUserStatus

public java.lang.String checkUserStatus()

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
main method

Parameters:
name - Name of agent
transport - Method of transport
Throws:
java.lang.Exception