kaos.core.csi.usecase
Class SimpleGuardedSender

java.lang.Object
  extended by kaos.core.csi.usecase.SimpleGuardedSender

public class SimpleGuardedSender
extends java.lang.Object

$Revision: 1.6 $


Field Summary
protected  kaos.core.service.directory.KAoSAgentDescription _agentDescription
          This class llustrates an implementation of a SimpleGuardedSender: an entity registered with KAoS via its Guard and capable of sending messages to other entities registered in the KAoS Directory Service.
protected  PolicyChecking _policyChecking
           
protected  QueryRegistration _query
           
protected  TransportSupport _transportSupport
           
 
Constructor Summary
SimpleGuardedSender()
           
 
Method Summary
 void authorizeCommunicationAction(java.lang.String performedBy, java.lang.String hasDestination, java.lang.String carriesMessage, java.lang.String hasPartner, java.lang.String dsTransportName)
          Authorize a communication action described by properties expressed by the arguments to this method.
 boolean equals(java.lang.Object obj)
          Two agents are equal if their respective hash codes are equal.
 int hashCode()
          Determines the hash code for the SimpleGuardedSender.
 void initialize(java.lang.String name, java.lang.String transportName, java.util.Vector domainNames)
           
static void main(java.lang.String[] args)
           
 void receiveMessage(TransportMessage tmsg)
          Implements the receiveMessage method mandated by the MessageListener interface.
 void sendMessageTo(java.lang.String receiverName)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_agentDescription

protected kaos.core.service.directory.KAoSAgentDescription _agentDescription
This class llustrates an implementation of a SimpleGuardedSender: an entity registered with KAoS via its Guard and capable of sending messages to other entities registered in the KAoS Directory Service. Each message send is authorized according to the current set of policies stored by the Guard. Configuration data includes: nickname, the name of the entity to send a message to, names of kaos domains it will register in, name of a transport to use for communication within KAoS. Bootstrapping steps: - obtains a reference to CSI Registration - binds itself to CSI Transport - asks CSI Registration to create a KAoSAgentDescription for itself - asks CSI Registration to register with KAoS Running - looks up another agent, whose name is given - sends a message to it


_transportSupport

protected TransportSupport _transportSupport

_query

protected QueryRegistration _query

_policyChecking

protected PolicyChecking _policyChecking
Constructor Detail

SimpleGuardedSender

public SimpleGuardedSender()
Method Detail

initialize

public void initialize(java.lang.String name,
                       java.lang.String transportName,
                       java.util.Vector domainNames)
                throws java.lang.Exception
Throws:
java.lang.Exception

receiveMessage

public void receiveMessage(TransportMessage tmsg)
Implements the receiveMessage method mandated by the MessageListener interface. This method prints the incoming TransportMessage to System.out.


equals

public boolean equals(java.lang.Object obj)
Two agents are equal if their respective hash codes are equal.

Overrides:
equals in class java.lang.Object
Returns:
true if obj equals this SimpleGuardedSender.

hashCode

public int hashCode()
Determines the hash code for the SimpleGuardedSender. The SimpleGuardedSender hash code is simply the hash code of the represented agents AgentName. If the AgentName field has not yet been set, then the hash code is found from super.hashCode() .

Overrides:
hashCode in class java.lang.Object
Returns:
int the hashCode for this SimpleGuardedSender.

sendMessageTo

public void sendMessageTo(java.lang.String receiverName)
                   throws SearchException,
                          NotLocatableException,
                          KAoSSecurityException,
                          java.lang.NullPointerException,
                          ServiceFailure
Throws:
SearchException
NotLocatableException
KAoSSecurityException
java.lang.NullPointerException
ServiceFailure

authorizeCommunicationAction

public void authorizeCommunicationAction(java.lang.String performedBy,
                                         java.lang.String hasDestination,
                                         java.lang.String carriesMessage,
                                         java.lang.String hasPartner,
                                         java.lang.String dsTransportName)
                                  throws KAoSSecurityException,
                                         java.lang.NullPointerException,
                                         ServiceFailure
Authorize a communication action described by properties expressed by the arguments to this method. Authorization is based on the current set of policies stored in the Guard. All arguments, except for the dsTransportName, contain the values of properties with the same name as the name of the given argument. Those names are defined in the ontology for CommunicationAction.

Parameters:
performedBy - String containing the name of the actor performing the CommunicationAction.
hasDestination - String containing the name of the entity receiving the CommunicationAction.
carriesMessage - String containing the content of the CommunicationAction.
hasPartner - String containing the name of the partner in the CommunicationAction.
dsTransportName - String containing the name of the transport used by KAoS Policy service and other KAoS services to communicate with each other.
Throws:
KAoSSecurityException - when the CommunicationAction is forbidden by the current policies.
java.lang.NullPointerException - when performedBy is null.
ServiceFailure - when the Policy service cannot be obtained, or fails durin action authorization.

main

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


Copyright © 2006 IHMC All Rights Reserved.