kaos.core.example
Class KAoSUsecase20

java.lang.Object
  extended by kaos.core.example.KAoSUsecase10
      extended by kaos.core.example.KAoSUsecase20

public class KAoSUsecase20
extends KAoSUsecase10

$Revision: 1.3 $


Field Summary
 
Fields inherited from class kaos.core.example.KAoSUsecase10
_agentNickname, ads, ans, CONVERSATION_FLAG, lctr, LOGGER, mts, name, sr, STATEMENT
 
Constructor Summary
protected KAoSUsecase20(ServiceRoot sr, java.lang.String nickname)
          Instantiates a new Usecase with the provided ServiceRoot.
 
Method Summary
protected  TransportMessage buildTransportMessage(AgentDescription agt)
          Builds a TransportMessage for delivery to Agent A (Usecase1).
protected  void deregister()
          Deregisters Agent A from the AgentDirectoryService.
protected  AgentDescription findAgentA()
          Utilizes the AgentDirectoryService to "search" for Agent A (recall that Agent A is a synonym for Usecase1).
 AgentDescription getAgentDescription()
          Creates a new AgentDescription for this Usecase.
static void main(java.lang.String[] args)
           
protected  void sendTransportMessage(TransportMessage msg)
          Utilizes the MessageTransportService to send the TransportMessage to Agent A.
 
Methods inherited from class kaos.core.example.KAoSUsecase10
acquireAgentDirectoryService, acquireAgentName, acquireAgentNamingService, acquireMessageTransportService, assertFalse, assertTrue, bindToMessageTransportService, equals, hashCode, initialize, receiveMessage, verifyRegistration
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KAoSUsecase20

protected KAoSUsecase20(ServiceRoot sr,
                        java.lang.String nickname)
Instantiates a new Usecase with the provided ServiceRoot. The ServiceRoot argument is held by the Usecase. Therefore changes to the ServiceRoot, after Usecase instantiation, can affect the use-case behavior.

Parameters:
sr - the instantiating ServiceRoot (a reference is kept).
See Also:
ServiceRoot, "JAS Specification, Section(s) 2.2.2.1, 3.3"
Method Detail

getAgentDescription

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

Overrides:
getAgentDescription in class KAoSUsecase10
Returns:
an AgentDescription for this use-case.
See Also:
AgentDescription, AgentDirectoryService#createAgentDescription, "JAS Specification, Section(s) 2.2.3.1, 4.5.1"

findAgentA

protected AgentDescription findAgentA()
                               throws java.lang.Exception
Utilizes the AgentDirectoryService to "search" for Agent A (recall that Agent A is a synonym for Usecase1).

Returns:
Agent A's AgentDescription (if found), otherwise null.
Throws:
java.lang.Exception - if a DirectoryException occurs.
See Also:
AgentDescription, AgentDirectoryService#search(AgentDescription), "JAS Specification, Section(s) 2.2.3.2, 4.5.1, 4.5.2"

buildTransportMessage

protected TransportMessage buildTransportMessage(AgentDescription agt)
Builds a TransportMessage for delivery to Agent A (Usecase1). Building a TransportMessage consists of several operations: the building of a suitable Envelope and Payload. An empty TransportMessage can be obtained from the MessageTransportService, while the Payload instances can only be acquired from an AcrElementBuilder. Once you have a Payload instance, you need to put some kind of message (ACL Message) into it.

Parameters:
agt - the AgentDescription describing Agent A.
Returns:
TransportMessage the message to send to Agent A.
See Also:
TransportMessage, AcrPayload, ServiceRoot#getAcrElementUtility, AcrElementUtility#getAcrElementBuilder, AcrElementUtility#getAcrElementHelper, AcrElementBuilder#createAcrAclMessage, AcrElementBuilder#createAcrPayload, "JAS Specification, Section(s) 2.2.3.3, 4.3.7, 4.3.8, 4.3.9"

sendTransportMessage

protected void sendTransportMessage(TransportMessage msg)
                             throws java.lang.Exception
Utilizes the MessageTransportService to send the TransportMessage to Agent A.

Parameters:
msg - the TransportMessage to send to Agent A.
Throws:
java.lang.Exception - if anything goes wrong during the send operation.
See Also:
"JAS Specification, Section(s) 2.2.3.4, 4.7.5"

deregister

protected void deregister()
                   throws java.lang.Exception
Deregisters Agent A from the AgentDirectoryService.

Throws:
java.lang.Exception - if the deregistration fails.

main

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