kaos.notification
Class NotifyAgent

java.lang.Object
  extended by kaos.core.csi.KAoSActorImpl
      extended by kaos.core.csi.request.ObligationRequestReceiverImpl
          extended by kaos.notification.NotifyAgent
All Implemented Interfaces:
KAoSExtensionComponent, KAoSActor, Enforcer, ObligationRequestReceiver

public class NotifyAgent
extends ObligationRequestReceiverImpl
implements Enforcer

Author:
lbunch Any agent can request notification by sending a Message to this agent that contains a NotifyRequest object. The NotifyRequest contains an ActionInstanceDescription of the action about which the notification is sent and optionally the subject and message body text for the notification. If the subject or message body are not provided they will be created automatically from the ActionInstanceDescription. The recipient and mode of notification can be specified by either the calling agent or obligation policies applied to this NotificationAgent. case 1: NotifyRequest specifies a mode (e.g. Email, TextPager, InstantMessage) and a recipient address (e.g. lbunch@ihmc.us) - Notify Agent just sends the requested message case 2: NotifyRequest specifies a mode (e.g. Email, TextPager, InstantMessage) and a recipient instance of daml Human class - Notify Agent looks up the recipient address for the given mode and sends the message case 3: NotifyRequest does not specify a mode and/or recipient - policies applied to the NotificationAgent provide the mode and/or recipient

Field Summary
protected  java.util.Vector _controlledActions
           
protected  EmailClient _emailClient
           
protected  boolean _enforcerEnabled
           
protected  JabberClient _imClient
           
protected  NotifyWnd _notifyWnd
           
protected  PagerClient _pagerClient
           
protected  PolicyChecking _policyChecking
           
protected  java.util.Vector _policyTriggerActions
           
protected  QueryState _queryState
           
protected  java.util.Hashtable _sentNotifications
           
static java.lang.String DEFAULT_PORT
           
static java.lang.String LOCAL_HOST
           
static java.lang.String TRANSPORT_PROPERTY_KEY
           
 
Fields inherited from class kaos.core.csi.KAoSActorImpl
_actorDesc, _autoCommit, _lctr, _logger, _preferredTransportName, _propertiesToModify, _registered, _registration, _transports, _transportSupport
 
Constructor Summary
NotifyAgent(java.lang.String[] args)
           
 
Method Summary
 void addEnforcedAction(java.lang.String actionClassDaml)
           
 void addOntologicalAttribute(java.lang.String ontAttribute)
          Add an ontological attribute the component is associated with.
 boolean checkObligations(ActionInstanceDescription aid)
          This method checks whether any obligation policies are triggered by the aid
 boolean getEnabledStatus()
          Return 'true/false', indicating the 'enabled/disabled' status of the component.
 java.lang.String getName()
          Return the (unique) name of this KAoSExtensionComponent object.
 java.util.List getOntologicalAttributes()
          Return the associated ontological concepts for the KAoSExtensionComponent object.
static java.lang.String lookupAgentNickname(java.lang.String agentUUID)
           
static void main(java.lang.String[] args)
          Start the NotificationAgent in a specified domain with the given agent nickname.
 void NotificationAction(ActionInstanceDescription obligationAID, ActionInstanceDescription triggerAID)
          Implements the receiveMessage method mandated by the MessageListener interface.
 void notify(NotifyRequest nReq)
          Entry point to the notification process.
protected  boolean recipientIsURI(NotifyRequest nReq)
          returns true if the recipient in the NotifyRequest is a URI, implying an ontology ref.
protected  void removeAgent()
          Called to perform cleanup activities before the agent is terminated.
protected  void removeAgentFromKAoS()
           
protected  void sendDefaultNotification(NotifyRequest nReq)
          Called when the NotifyReqest includes both a recipient and a mode Sends the requested notification without checking obligation policies
 void setEnabledStatus(boolean status)
          Set 'true/false', indicating the 'enabled/disabled' status of the component.
 void setName(java.lang.String name)
          Set the (unique) name of this KAoSExtensionComponents object.
 void setOntologicalConcepts(java.util.Vector concepts)
          Set the associated ontological concepts for the KAoSExtensionComponent object.
 void setProperties(ServiceProperties props)
          Set the properties of this component, if there are any.
 void start()
           
 void updateTriggerCondition(ActionInfo triggerCondition)
           
 
Methods inherited from class kaos.core.csi.request.ObligationRequestReceiverImpl
processObligationRequest, receiveMessage
 
Methods inherited from class kaos.core.csi.KAoSActorImpl
addCapability, addOntologicalType, addOntologicalType, addProperty, addProperty, addPropertyValue, addTransport, commitPropertyValues, deregisterFromKAoS, equals, getAgentDescription, getCapabilities, getConceptMappingName, getDomainNames, getEntityOntologicalTypeNames, getEntityOntologicalTypes, getGUID, getProperties, getProperty, getPropertyValue, getTransport, getTransports, hashCode, initialize, initialize, initialize, isAutoPropertyValueCommit, isGuarded, isRegistered, logMessage, logMessage, printTransportMessage, receiveMessage, registerWithKAoS, removeCapability, removeOntologicalType, removeProperty, removePropertyValue, removeTransport, sendMessage, sendMessage, setAutoPropertyValueCommit, setCapabilities, setConceptMappingName, setGUID, setMyDescription, setOntologicalTypes, setPropertyValue, setRegistered
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRANSPORT_PROPERTY_KEY

public static final java.lang.String TRANSPORT_PROPERTY_KEY
See Also:
Constant Field Values

LOCAL_HOST

public static final java.lang.String LOCAL_HOST
See Also:
Constant Field Values

DEFAULT_PORT

public static final java.lang.String DEFAULT_PORT
See Also:
Constant Field Values

_emailClient

protected EmailClient _emailClient

_imClient

protected JabberClient _imClient

_pagerClient

protected PagerClient _pagerClient

_sentNotifications

protected java.util.Hashtable _sentNotifications

_notifyWnd

protected NotifyWnd _notifyWnd

_queryState

protected QueryState _queryState

_controlledActions

protected java.util.Vector _controlledActions

_policyTriggerActions

protected java.util.Vector _policyTriggerActions

_enforcerEnabled

protected boolean _enforcerEnabled

_policyChecking

protected PolicyChecking _policyChecking
Constructor Detail

NotifyAgent

public NotifyAgent(java.lang.String[] args)
            throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getOntologicalAttributes

public java.util.List getOntologicalAttributes()
Return the associated ontological concepts for the KAoSExtensionComponent object.

Specified by:
getOntologicalAttributes in interface KAoSExtensionComponent
Returns:
List containing names of the concepts the KAoSExtensionComponent is associated with.

addOntologicalAttribute

public void addOntologicalAttribute(java.lang.String ontAttribute)
Add an ontological attribute the component is associated with.

Specified by:
addOntologicalAttribute in interface KAoSExtensionComponent
Parameters:
ontAttribute - String containing the name of the ontological attribute.

setOntologicalConcepts

public void setOntologicalConcepts(java.util.Vector concepts)
Set the associated ontological concepts for the KAoSExtensionComponent object.

Parameters:
concepts - Vector containing names of the concepts the KAoSExtensionComponent is associated with.

getName

public java.lang.String getName()
Return the (unique) name of this KAoSExtensionComponent object.

Specified by:
getName in interface KAoSExtensionComponent
Specified by:
getName in interface KAoSActor
Overrides:
getName in class KAoSActorImpl
Returns:
name of this component.

setName

public void setName(java.lang.String name)
Set the (unique) name of this KAoSExtensionComponents object.

Specified by:
setName in interface KAoSExtensionComponent
Overrides:
setName in class KAoSActorImpl
Parameters:
name - String containing the name of this component.

setEnabledStatus

public void setEnabledStatus(boolean status)
Set 'true/false', indicating the 'enabled/disabled' status of the component.

Specified by:
setEnabledStatus in interface KAoSExtensionComponent
Parameters:
status - boolean parameter to set the 'enabled/disabled' status to

getEnabledStatus

public boolean getEnabledStatus()
Return 'true/false', indicating the 'enabled/disabled' status of the component.

Specified by:
getEnabledStatus in interface KAoSExtensionComponent
Returns:
a boolean parameter indicating the 'enabled/disabled' status of this component.

setProperties

public void setProperties(ServiceProperties props)
Set the properties of this component, if there are any.

Specified by:
setProperties in interface KAoSExtensionComponent
Overrides:
setProperties in class KAoSActorImpl
Parameters:
props - ServiceProperties (optionally) specifying additional ontological properties of the component.

addEnforcedAction

public void addEnforcedAction(java.lang.String actionClassDaml)

checkObligations

public boolean checkObligations(ActionInstanceDescription aid)
This method checks whether any obligation policies are triggered by the aid

Parameters:
aid - ActionInstanceDescription to check obligations about
Returns:
Vector Vector of obligation AIDs

main

public static void main(java.lang.String[] args)
Start the NotificationAgent in a specified domain with the given agent nickname. args - domainName, agentNickname, [host, port, [parentDomain]]


start

public void start()
           throws java.lang.Exception
Throws:
java.lang.Exception

removeAgentFromKAoS

protected void removeAgentFromKAoS()

removeAgent

protected void removeAgent()
Called to perform cleanup activities before the agent is terminated.


NotificationAction

public void NotificationAction(ActionInstanceDescription obligationAID,
                               ActionInstanceDescription triggerAID)
Implements the receiveMessage method mandated by the MessageListener interface. This method requires the TransportMessage contain a NotifyMessage object.

See Also:
MessageListener, TransportMessage, "JAS Specification, Section(s) 3.4.2, 4.7.2"

notify

public void notify(NotifyRequest nReq)
Entry point to the notification process. Checks whether the request included both a recipient and a mode to send a notification without obligation policies Then checks for policies obliging NotificationActions and fulfills those obligations as well

Parameters:
nReq -

sendDefaultNotification

protected void sendDefaultNotification(NotifyRequest nReq)
Called when the NotifyReqest includes both a recipient and a mode Sends the requested notification without checking obligation policies

Parameters:
nReq -

updateTriggerCondition

public void updateTriggerCondition(ActionInfo triggerCondition)

recipientIsURI

protected boolean recipientIsURI(NotifyRequest nReq)
returns true if the recipient in the NotifyRequest is a URI, implying an ontology ref. to a Human Instance

Parameters:
nReq -

lookupAgentNickname

public static java.lang.String lookupAgentNickname(java.lang.String agentUUID)