kaos.core.service.boot.usecase
Class KAoSUsecase20New

java.lang.Object
  extended by kaos.core.service.boot.KAoSAgent
      extended by kaos.core.service.boot.usecase.KAoSUsecase10New
          extended by kaos.core.service.boot.usecase.KAoSUsecase20New
All Implemented Interfaces:
KAoSAgentHelper

public class KAoSUsecase20New
extends KAoSUsecase10New

$Revision: 1.2 $


Field Summary
 
Fields inherited from class kaos.core.service.boot.usecase.KAoSUsecase10New
CONVERSATION_FLAG, LOGGER, myDomain, STATEMENT
 
Fields inherited from class kaos.core.service.boot.KAoSAgent
_agentDescription, _agentDirectoryService, _agentNamingService, _agentNickname, _lctr, _logger, _messageTransportService, _name, _serviceRoot
 
Constructor Summary
KAoSUsecase20New()
          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).
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.service.boot.usecase.KAoSUsecase10New
receiveMessage
 
Methods inherited from class kaos.core.service.boot.KAoSAgent
acquireAgentDirectoryService, acquireAgentName, acquireAgentNamingService, acquireMessageTransportService, assertFalse, assertTrue, bindToMessageTransportService, checkPermission, 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

KAoSUsecase20New

public KAoSUsecase20New()
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

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