|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object kaos.core.service.boot.KAoSAgent
public class KAoSAgent
$Revision: 1.5 $
Field Summary | |
---|---|
protected KAoSAgentDescription |
_agentDescription
|
protected AgentDirectoryService |
_agentDirectoryService
|
protected AgentNamingService |
_agentNamingService
|
protected java.lang.String |
_agentNickname
|
protected Locator |
_lctr
|
protected Logger |
_logger
|
protected MessageTransportService |
_messageTransportService
|
protected AgentName |
_name
|
protected KAoSServiceRoot |
_serviceRoot
|
Constructor Summary | |
---|---|
KAoSAgent()
Instantiates a new KAoS-aware agent using JAS services for transport, naming and agent directory. |
Method Summary | |
---|---|
AgentDirectoryService |
acquireAgentDirectoryService()
Acquires the AgentDirectoryService from the ServiceRoot. |
AgentName |
acquireAgentName(boolean useNicknameAsGuid)
Acquires a unique AgentName from the AgentNamingService or, if requested, uses the agent nickname to create the AgentName. |
AgentNamingService |
acquireAgentNamingService()
Acquires the AgentNamingService from the ServiceRoot. |
MessageTransportService |
acquireMessageTransportService()
Acquires a preferred MessageTransportService from the ServiceRoot. |
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. |
Locator |
bindToMessageTransportService(JasBean env)
Returns a new local locator that has been bound with the MessageTransportService. |
void |
checkPermission(java.lang.String action,
java.util.HashMap properties)
/** Check permission for the specified action with given parameters. |
TransportMessage |
createTransportMessage()
|
boolean |
equals(java.lang.Object obj)
Two agents are equal if their respective hash codes are equal. |
protected KAoSAgentDescription |
establishAgentDescription(java.util.Vector domainNames)
Creates a new KAoSAgentDescription for this KAoSAgent. |
KAoSAgentDescription |
findAgentDescriptionForID(java.lang.String agentID)
|
KAoSAgentDescription |
findAgentDescriptionForNickname(java.lang.String nickname)
|
java.lang.String |
getAgentID()
|
KAoSAgentDescription |
getKAoSAgentDescription()
Returns the KAoSAgentDescription created by this helper. |
int |
hashCode()
Determines the hash code for the KAoSAgent. |
void |
initialize(KAoSServiceRoot sr,
JasBean agentInitInfo,
java.util.Vector domainNames,
java.lang.String nickname,
boolean guarded,
boolean useNicknameAsGuid)
Initializes a new KAoSAgent with the provided arguments. |
protected void |
logMessage(java.lang.String msg,
java.lang.Exception e,
int logLevel)
|
protected void |
logMessage(java.lang.String msg,
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 |
sendMessage(TransportMessage message)
|
protected boolean |
verifyRegistration()
Utility method that verifies agent registration by searching the AgentDirectoryService for its AgentDescription. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected AgentName _name
protected Locator _lctr
protected AgentNamingService _agentNamingService
protected AgentDirectoryService _agentDirectoryService
protected MessageTransportService _messageTransportService
protected KAoSServiceRoot _serviceRoot
protected java.lang.String _agentNickname
protected KAoSAgentDescription _agentDescription
protected Logger _logger
Constructor Detail |
---|
public KAoSAgent()
Method Detail |
---|
public void receiveMessage(TransportMessage tmsg)
MessageListener
,
TransportMessage
,
"JAS Specification, Section(s) 3.4.2, 4.7.2"public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
hashCode()
,
"JAS Specification, Section(s) 4.7.2"public int hashCode()
super.hashCode()
.
hashCode
in class java.lang.Object
AgentName#hashCode
,
Object.hashCode()
,
"JAS Specification, Section(s) 4.7.2"public AgentNamingService acquireAgentNamingService() throws java.lang.Exception
java.lang.Exception
- if the AgentNamingService is not null.ServiceRoot#getAgentNamingService
,
"JAS Specification, Section(s) 2.2.2.2, 4.6.1"public AgentDirectoryService acquireAgentDirectoryService() throws java.lang.Exception
java.lang.Exception
- if the AgentDirectoryService is not null.ServiceRoot#getAgentDirectoryService
,
"JAS Specification, Section(s) 2.2.2.5, 4.5.1"public MessageTransportService acquireMessageTransportService() throws java.lang.Exception
java.lang.Exception
- if the MessageTransportService is not null.ServiceRoot#getTransportSystem
,
"JAS Specification, Section(s) 2.2.2.3, 4.7.5, 4.7.6"public Locator bindToMessageTransportService(JasBean env) throws java.lang.Exception
java.lang.Exception
MessageTransportService#newLocalLocator
,
Locator
,
MessageTransportService#newMessageReceiver
,
MessageReceiver
,
MessageListener
,
MessageReceiver#addMessageListener(MessageListener)
,
MessageReceiver#bindToLocalLocator(Locator)
,
"JAS Specification, Section(s) 2.2.2.4, 2.2.2.7, 4.7.3"public AgentName acquireAgentName(boolean useNicknameAsGuid) throws java.lang.Exception
java.lang.Exception
AgentName
,
AgentNamingService#createAgentName
,
"JAS Specification, Section(s) 2.2.2.2, 4.6.1"protected KAoSAgentDescription establishAgentDescription(java.util.Vector domainNames)
AgentDescription
,
AgentDirectoryService#createAgentDescription
,
"JAS Specification, Section(s) 2.2.2.6, 4.5.1"public void initialize(KAoSServiceRoot sr, JasBean agentInitInfo, java.util.Vector domainNames, java.lang.String nickname, boolean guarded, boolean useNicknameAsGuid) throws java.lang.Exception
KAoSServiceRoot
- is the instantiating ServiceRoot (a reference is kept).JasBean
- contains additional information about the agent that
may be passed to the transport system.Vector
- contains names of domains this agent wants to be a member of.String
- agent's nickname (a reference is kept).boolean
- indicates whether the agent is guarded.boolean
- indicates whether to use agent's nickname as its GUID.
java.lang.Exception
ServiceRoot
,
"JAS Specification, Section(s) 2.2.2.1, 3.3",
acquireAgentNamingService()
,
acquireAgentName(boolean)
,
acquireMessageTransportService()
,
bindToMessageTransportService(JasBean)
,
acquireAgentDirectoryService()
,
acquireAgentDirectoryService()
,
establishAgentDescription(java.util.Vector)
,
AgentDirectoryService#register(AgentDescription)
,
"JAS Specification, Section(s) 2.2.2.1 through 2.2.2.7"public void checkPermission(java.lang.String action, java.util.HashMap properties) throws KAoSSecurityException, java.lang.NullPointerException, ServiceFailure
checkPermission
in interface KAoSAgentHelper
action
- Ontological name of the policy action.properties
- HashMap containing the names of properties as defined in ontologies and their
values.
KAoSSecurityException
- if the permission is not granted.
java.lang.NullPointerException
- if the specified action or properties are null.
ServiceFailure
- if some of the security services are not available.public TransportMessage createTransportMessage()
createTransportMessage
in interface KAoSAgentHelper
public java.lang.String getAgentID()
getAgentID
in interface KAoSAgentHelper
public KAoSAgentDescription findAgentDescriptionForNickname(java.lang.String nickname)
findAgentDescriptionForNickname
in interface KAoSAgentHelper
public KAoSAgentDescription findAgentDescriptionForID(java.lang.String agentID)
findAgentDescriptionForID
in interface KAoSAgentHelper
public KAoSAgentDescription getKAoSAgentDescription()
KAoSAgentHelper
getKAoSAgentDescription
in interface KAoSAgentHelper
public void sendMessage(TransportMessage message) throws NotLocatableException, TransportFailure
sendMessage
in interface KAoSAgentHelper
NotLocatableException
TransportFailure
protected void assertTrue(boolean exp, java.lang.String msg) throws java.lang.Exception
java.lang.Exception
- if exp is false.protected void assertFalse(boolean exp, java.lang.String msg) throws java.lang.Exception
java.lang.Exception
- if exp is true.protected boolean verifyRegistration()
protected void printTransportMessage(TransportMessage tmsg)
protected void logMessage(java.lang.String msg, int logLevel)
protected void logMessage(java.lang.String msg, java.lang.Exception e, int logLevel)
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |