kaos.notification
Class KaosAgent

java.lang.Object
  extended by kaos.notification.KaosAgent
Direct Known Subclasses:
KaosEnforcerAgent, TestMonitor

public class KaosAgent
extends java.lang.Object


Field Summary
protected  AgentDirectoryService _ads
           
protected  KAoSAgentDescription _agentDesc
           
protected  AgentName _agentName
           
protected  java.lang.String _agentNickname
           
protected  AgentNamingService _ans
           
protected  java.lang.String _domainName
           
protected  Guard _guard
           
protected  KAoSAgentDirectoryServiceProxy _kadsp
           
protected  boolean _kaosEnabled
           
protected  Locator _lctr
           
protected  Logger _logger
           
protected  int _msgTransport
           
protected  MessageTransportService _mts
           
protected  KAoSServiceRoot _sr
           
static int COABSGRID_TRANSPORT
           
static int CORBA_TRANSPORT
           
static int TCP_TRANSPORT
           
static java.lang.String TRANSPORT_PROPERTY_KEY
           
 
Constructor Summary
KaosAgent()
           
 
Method Summary
protected  void assertFalse(boolean exp, java.lang.String msg)
          Utility method: if exp is not false, then an Exception is generated using the provided message (msg) and then thrown.
protected  void assertTrue(boolean exp, java.lang.String msg)
          Utility method: if exp is not true, then an Exception is generated using the provided message (msg) and then thrown.
 boolean equals(java.lang.Object obj)
          Two use-cases are equal if their respective hash codes are equal.
protected  KAoSAgentDescription getAgentDescription()
          Creates a new AgentDescription for this Usecase.
 KAoSAgentDirectoryServiceProxy getDirectoryService()
           
 java.lang.String getDomainName()
           
 int hashCode()
          Determines the hash code for the use-case.
 void initialize(java.lang.String domainName, java.lang.String agentNickname, java.lang.String parentDomainName)
           
protected  void logMessage(java.lang.String msg, int logLevel)
           
protected  void logMessage(java.lang.String msg, java.lang.Throwable t, int logLevel)
           
static void main(java.lang.String[] args)
           
protected  void printTransportMessage(TransportMessage tmsg)
           
 void receiveMessage(TransportMessage tmsg)
          Implements the receiveMessage method mandated by the MessageListener interface.
 void registerWithKaos()
          This method registers with KAoS
protected  void removeAgent()
           
 void sendMessageTo(java.lang.String receiverName, java.lang.Object message)
           
 void start(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_sr

protected KAoSServiceRoot _sr

_ans

protected AgentNamingService _ans

_agentName

protected AgentName _agentName

_mts

protected MessageTransportService _mts

_ads

protected AgentDirectoryService _ads

_kadsp

protected KAoSAgentDirectoryServiceProxy _kadsp

_agentDesc

protected KAoSAgentDescription _agentDesc

_agentNickname

protected java.lang.String _agentNickname

_logger

protected Logger _logger

_kaosEnabled

protected boolean _kaosEnabled

_guard

protected Guard _guard

_domainName

protected java.lang.String _domainName

_lctr

protected Locator _lctr

_msgTransport

protected int _msgTransport

CORBA_TRANSPORT

public static final int CORBA_TRANSPORT
See Also:
Constant Field Values

COABSGRID_TRANSPORT

public static final int COABSGRID_TRANSPORT
See Also:
Constant Field Values

TCP_TRANSPORT

public static final int TCP_TRANSPORT
See Also:
Constant Field Values

TRANSPORT_PROPERTY_KEY

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

KaosAgent

public KaosAgent()
Method Detail

main

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

start

public void start(java.lang.String[] args)

getDomainName

public java.lang.String getDomainName()

initialize

public void initialize(java.lang.String domainName,
                       java.lang.String agentNickname,
                       java.lang.String parentDomainName)
                throws java.lang.Exception
Throws:
java.lang.Exception

registerWithKaos

public void registerWithKaos()
                      throws java.lang.Exception
This method registers with KAoS

Throws:
java.lang.Exception

equals

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

Overrides:
equals in class java.lang.Object
Returns:
true if obj equals this Usecase.
See Also:
hashCode(), "JAS Specification, Section(s) 4.7.2"

hashCode

public int hashCode()
Determines the hash code for the use-case. The use-case 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 Usecase.
See Also:
AgentName#hashCode, Object.hashCode(), "JAS Specification, Section(s) 4.7.2"

getAgentDescription

protected KAoSAgentDescription getAgentDescription()
Creates a new AgentDescription for this Usecase. Utilizing the AgentDirectoryService an empty AgentDescription is obtained and then populated with various key-value pairs.

Returns:
an AgentDescription for this use-case.
See Also:
AgentDescription, AgentDirectoryService#createAgentDescription, "JAS Specification, Section(s) 2.2.2.6, 4.5.1"

getDirectoryService

public KAoSAgentDirectoryServiceProxy getDirectoryService()

removeAgent

protected void removeAgent()

receiveMessage

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

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

sendMessageTo

public void sendMessageTo(java.lang.String receiverName,
                          java.lang.Object message)

assertTrue

protected void assertTrue(boolean exp,
                          java.lang.String msg)
                   throws java.lang.Exception
Utility method: if exp is not true, then an Exception is generated using the provided message (msg) and then thrown.

Throws:
java.lang.Exception - if exp is false.

assertFalse

protected void assertFalse(boolean exp,
                           java.lang.String msg)
                    throws java.lang.Exception
Utility method: if exp is not false, then an Exception is generated using the provided message (msg) and then thrown.

Throws:
java.lang.Exception - if exp is true.

printTransportMessage

protected void printTransportMessage(TransportMessage tmsg)

logMessage

protected void logMessage(java.lang.String msg,
                          int logLevel)

logMessage

protected void logMessage(java.lang.String msg,
                          java.lang.Throwable t,
                          int logLevel)