|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.able.AbleObject | +--com.ibm.able.AbleDefaultAgent | +--com.ibm.able.AbleRemoteDefaultAgent | +--com.ibm.able.platform.AblePlatformDefaultAgent
This class provides an enhanced implementation of a JSR 87 (Java Agent Services or JAS) compliant agent, but also inherits all the capabilities of an AbleDefaultAgent; as a JAS agent, the agent obtains a globally unique AgentName from the Agent Naming Service, registers a description with the Agent Directory Service, and is able to send and receive messages through the Message Transport System.
Typically, an agent's lifecycle is as follws:
preInit()
method, which causes the agent
to look up several platform Services and obtain a unique AgentName
for itself from the Agent Naming Service.
Note that if the agent is created by something other than the
Agent Lifecycle Service, preInit()
must be called
immediately after creation, but if security is on,
setPrincipal(String)
must be called first.
initializeAgent(AbleSecureKey)
method. This causes the
agent to obtain an AgentDescription, load it up with the attributes
and Locators it wants to advertise, and registers the description
with the Agent Directory Service. The agent may also, if
configured to do so, bind with RMI.
quitAgent(AbleSecureKey)
method, at which time the agent
will free its resources.
Field Summary | |
---|---|
protected java.util.Date |
agentLastUpdate
The date and time when the agent's description was last updated with the Agent Directory Service. |
protected boolean |
agentMovable
Specifies whether the agent is movable from one agent pool to another; must be set before the agent is initialized, at which time it is placed into the agent's registered description. |
protected java.lang.String |
agentStatus
The agent's status at the last time the agent's description was updated with the Agent Directory Service. |
protected AbleMessageContainer |
agentSummary
The agent's last set summary text. |
protected boolean |
agentToAutoRegister
Specifies whether the agent is to register an AgentDescription of itself with the Agent Directory Service; must be set before the agent is initialized. |
protected boolean |
agentToBindToRmi
Specifies whether the agent is to bind itself to the RMI Naming service; must be set before the agent is initialized. |
protected java.lang.String |
agentType
The textual description of the type of agent; must be set before the agent is initialized, at which time it is placed into the agent's registered description; for documentation only. |
protected java.lang.String |
agentVendor
The agent's vendor; must be set before the agent is initialized, at which time it is placed into the agent's registered description; for documentation only. |
protected java.lang.String |
agentVersion
The agent's current version; must be set before the agent is initialized, at which time it is placed into the agent's registered description; for documentation only. |
protected java.util.Vector |
myAgentInboxes
Locators/MessageListeners/Inboxes for this agent. |
protected javax.agent.Locator |
myJasAbleLocator
An ABLE direct communication locator that contains an RMI reference to this agent so that methods on the agent can be called directly. |
protected java.util.Hashtable |
myJasAgentAttributes
User-defined attributes for this agent. |
protected javax.agent.service.directory.AgentDescription |
myJasAgentDescription
The JAS description for this agent, set at initialization time. |
protected javax.agent.service.directory.AgentDirectoryService |
myJasAgentDirectoryService
A cached reference to the JAS Agent Directory service for this agent, set during pre-initialization. |
protected javax.agent.AgentName |
myJasAgentName
The JAS globally unique Id for this agent, set during pre-initialization. |
protected javax.agent.service.naming.AgentNamingService |
myJasAgentNamingService
A cached reference to the JAS Agent Naming service for this agent, set during pre-initialization. |
protected javax.agent.Locator |
myJasDefaultLocator
A default locator, set by init() to the first of the generated Locators. |
protected javax.agent.service.transport.MessageTransportService |
myJasMessageTransportService
A cached reference to the JAS Message Transport Service, if there is one; set at initialization time. |
protected javax.agent.service.ServiceRoot |
myJasServiceRoot
A cached reference to the JAS Service Root for this agent, from which other services can be obtained; set during pre-initialization. |
protected javax.agent.service.transport.TransportSystem |
myJasTransportSystem
The JAS Transport System for this agent, set during pre-initialization. |
protected VerifiableAgentDirectoryService |
myJasVerifiableDirectoryService
The IBM Verifiable Agent Directory service for this agent, set during pre-initialization. |
protected VerifiableAgentNamingService |
myJasVerifiableNamingService
The IBM Verifiable Agent Naming service for this agent, set during pre-initialization. |
protected java.security.KeyPair |
myKeyPair
Public and Private keys, created by the constructors, but only if security is on. |
protected java.lang.String |
myPrincipal
This field is used ONLY in a secure environment and ONLY when the agent is not started through the Agent Lifecycle Service; that is, the agent is started through a command line or by another agent. |
protected AbleUserDefinedFunction |
myReceiveMessageMethod
The encapsulated default "receiveMessage()" method; this is the default method called by JAS Message Transport Service when a message arrives for the agent, but the agent can change this to some other method before init() is called. |
protected AbleSecureKey |
myRequestKey
On secure platforms, having a loaded key of the Platform Support code that created an agent is very important to the agent. |
protected AbleSecuritySupport |
mySecSppt
A helper object to assist with security related matters. |
protected java.lang.String |
myTrustLevel
The Trust Level cached from the VerifiableAgentName (VAN) for this agent; set during pre-initialization. |
protected VerifiableAgentName |
myVerifiableAgentName
A globally unique verifiable Id for this agent, set during pre-initialization. |
Fields inherited from class com.ibm.able.AbleRemoteDefaultAgent |
---|
agentAddr, agentHost, agentName, defaultName, myRemoteStub |
Fields inherited from class com.ibm.able.AbleDefaultAgent |
---|
activeDataSource, eventConnections, myBeans, numEpochs, processList, processListOK, userDefinedFunctions |
Fields inherited from class com.ibm.able.AbleObject |
---|
changed, chgSupport, comment, dataFlowEnabled, destBufferConnections, eventQueue, fileName, inputBuffer, listeners, logger, name, outputBuffer, parent, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport, trace |
Constructor Summary | |
---|---|
AblePlatformDefaultAgent()
Creates a new platform agent. |
|
AblePlatformDefaultAgent(java.lang.String theName)
Creates a new platform agent with the specified display name (not to be confused with the agent's globally unique AgentName). |
|
AblePlatformDefaultAgent(java.lang.String theName,
java.lang.String theComment)
Creates a new platform agent with the specified display name (not to be confused with the agent's globally unique AgentName) and comment. |
Method Summary | |
---|---|
protected void |
_init()
Performs the actual work of initialization. |
protected void |
_init(java.lang.Object theArg)
Does all the initial Java Agent Services (JAS) housekeeping in a manner identical to _init() , but the specified argument
is passed to the super class for handling. |
protected void |
_quitAll()
Performs the actual work of destroying this agent; this method must be used only when security is off, or only when security is on AND an Able SecureKey has already been verified. |
protected void |
_reset()
Performs the actual work of resetting the agent; this method must be used only when security is off, or only when security is on AND an Able SecureKey has already been verified. |
protected void |
_resumeAll()
Performs the actual work of resuming this agent; this method must be used only when security is off, or only when security is on AND an Able SecureKey has already been verified. |
protected void |
_suspendAll()
Performs the actual work of suspending this agent; this method must be used only when security is off, or only when security is on AND an Able SecureKey has already been verified. |
void |
addAgentInbox(java.lang.Object[] theProtocol)
|
void |
addJasAgentAttribute(java.lang.String theKey,
java.lang.Object theAttribute)
Adds a named attribute to the agent's set of attributes. |
protected void |
broadcastTransportMessage(java.util.Vector theDestinations,
java.lang.Object theMessageToSend)
Sends a message to a list of agents. |
static java.lang.String |
Copyright()
Gets the copyright statement of this class. |
protected javax.agent.Locator |
createLocatorAndBindToMethod(java.lang.String theProtocol,
AbleUserDefinedFunction theUserDefinedFunction)
This is a helper method for loadAgentDescriptionWithBaseLocators() . |
int |
getAgentAutonomyLevel()
Gets the agent's autonomy level. |
java.util.Vector |
getAgentInboxes()
|
java.util.Date |
getAgentLastUpdate()
Gets the date and time when the agent's description was last updated with the Agent Directory Service.. |
java.lang.String |
getAgentStatus()
Gets the agent's current real time status (state). |
AbleMessageContainer |
getAgentSummary()
Gets the agent's current summary text. |
java.lang.String |
getAgentType()
Gets the agent's type description. |
java.lang.String |
getAgentVendor()
Gets the agent's vendor. |
java.lang.String |
getAgentVersion()
Gets the agent's version. |
protected void |
getAndSetAgentDescription()
Calls getNewAgentDescription() to get a new, empty Agent
Description and then
Calls loadAgentDescriptionWithAgentName() to set
the agent's names into the description
Calls loadAgentDescriptionWithPublicKey() to set
the agent's public key into the description
Calls loadAgentDescriptionWithAbleAttributes() to set
built-in Able attributes into the description
Calls loadAgentDescriptionWithUserAttributes() to set
any user-defined attributes into the description. |
protected void |
getAndSetAgentNames()
Gets this agent's Globally Unique ID (GUID or AgentName) from the Agent Naming Service and saves it away in the data member myJasAgentName ; additionally, if security is on, a
verifiable agent name is obtained and saved in the data
member myVerifiableAgentName , and the data members
myTrustLevel ,
myPrincipal , and
mySecSppt
are also set. |
protected void |
getAndSetTransportServices()
Gets all available Message Transport Services from the Message Transport System, selects the first one, and saves it away in the data member myJasMessageTransportService . |
protected void |
getAndValidateServiceRoot()
Gets addressability to the JAS Service Root, and makes sure the Agent Naming Service, the Agent Directory Service, and the Message Transport System are all available. |
java.util.Hashtable |
getJasAgentAttributes()
Gets the agent's JAS attributes. |
java.lang.String |
getJasAgentName()
Gets the agent's globally unique ID (GUID or AgentName) in text form. |
protected void |
getNewAgentDescription()
Gets a new, empty Agent Description and saves it away in the data member myJasAgentDescription . |
java.lang.String |
getPrincipal()
|
protected java.lang.Object |
getTransportMessageContent(javax.agent.TransportMessage theTransportMessage)
Extracts and returns the content of the specified transport message. |
protected java.lang.Object |
getTransportMessageContent2(javax.agent.TransportMessage theTransportMessage)
Extracts and returns the content of the specified transport message. |
void |
init()
Initializes and configures the bean, but only if security is off; when security is on, calls to this method are ignored -- the method initializeAgent(AbleSecureKey)
must be used instead. |
void |
init(java.lang.Object theArg)
Initializes and configures the bean, using the specified Object, but only if security is off; when security is on, calls to this method are ignored -- the method initializeAgent(Object,AbleSecureKey)
must be used instead. |
void |
initializeAgent(AbleSecureKey theSecureKey)
Initializes and configures the agent. |
void |
initializeAgent(java.lang.Object theInitArg,
AbleSecureKey theSecureKey)
Initializes and configures the agent using the specified parameter, which is typically an Object[], but may be anything that the agent is coded to expect. |
boolean |
isAgentMovable()
Determines whether the agent is movable from one agent pool to another. |
boolean |
isAgentToAutoRegister()
Determines whether the agent is to register with an RMI Registry at initialization time. |
boolean |
isAgentToBindToRmi()
Determines whether the agent is to bind to RMI Naming at initialization time. |
protected void |
loadAgentDescriptionWithAbleAttributes()
Loads this agent's description with the built-in Able attributes, which must be set before initialization time. |
protected void |
loadAgentDescriptionWithAbleLocator()
Loads this agent's description with a special Able Locator, found in the data member myJasAbleLocator , which is a locator
that contains an RMI reference to this agent, and which can be
used to call those public, "remotable" methods found in this
agent. |
protected void |
loadAgentDescriptionWithAgentName()
Loads this agent's description with the agent's Globally Unique ID (GUID) or AgentName as contained in the data member myJasAgentName . |
protected void |
loadAgentDescriptionWithBaseLocators()
Loads this agent's description with Locators created from the selected Message Transport Service. |
protected void |
loadAgentDescriptionWithPublicKey()
Loads this agent's description with the agent's public key, but only if security is on. |
protected void |
loadAgentDescriptionWithUserAttributes()
Loads this agent's description with those user-defined attributes that have been placed into the data member myJasAgentAttributes . |
protected void |
logException(java.lang.String theMethodName,
java.lang.Exception theException)
Logs an exception. |
protected javax.agent.service.directory.AgentDescription[] |
lookUpAgent(java.util.Hashtable theSearchAttributesAndValues)
Finds all agents registered with the Agent Directory whose agent description contains the specified attributes and values. |
protected javax.agent.service.directory.AgentDescription[] |
lookUpAgent(java.lang.String theSearchAttribute,
java.lang.Object theSearchValue)
Finds all agents registered with the Agent Directory whose agent description contains the specified attribute and value. |
static void |
main(java.lang.String[] args)
|
protected void |
maybeDeregisterWithAgentDirectoryService()
Deregisters this agent with the Agent Directory Service, depending on whether the agent is registered. |
protected void |
maybeRebindToRmi(boolean theBindToRmiFlag)
(Re)binds this agent to RMI Naming lookup service, depending on the value of the specified flag. |
protected void |
maybeRegisterWithAgentDirectoryService(boolean theRegisterFlag)
Registers this agent with the Agent Directory Service, depending on the value of the specified flag. |
protected void |
maybeUnbindFromRmi()
Unbinds this agent from RMI Naming, depending on whether it has been bound to RMI. |
void |
preInit()
Pre-initializes the agent immediately after creation, causing the agent to find the Service Root, extract references to various services, obtain a unique AgentName from the Agent Naming Service, and, when security is on, a VerifiableAgentName (VAN). |
java.lang.Object |
process(java.lang.Object theArg)
Performs the main, standard processing function of this platform agent, using the argument. |
void |
quitAgent(AbleSecureKey theSecureKey)
Quits the agent, which typically quits all contained beans and agents. |
void |
quitAll()
Stops all of the bean's asynchronous threads of control, but only if security is off; when security is on, calls to this method are ignored -- the method quitAgent(AbleSecureKey)
must be used instead. |
void |
receiveMessage(javax.agent.TransportMessage theTransportMessage)
Receives and handles a message from the JAS Message Transport Service. |
void |
removeAgentInbox(java.lang.Object[] theProtocol)
|
void |
removeAgentInboxes()
|
void |
removeJasAgentAttribute(java.lang.String theKey)
Removes a named attribute from the agent's set of attributes. |
void |
reset()
Resets the bean, but only if security is off; when security is on, calls to this method are ignored -- the method resetAgent(AbleSecureKey)
must be used instead. |
void |
resetAgent(AbleSecureKey theSecureKey)
Resets the agent to its "initialized" state. |
void |
resumeAgent(AbleSecureKey theSecureKey)
Resumes all asynchronous threads of control, typically including those in any contained beans and agents. |
void |
resumeAll()
Resumes all of the bean's asynchronous threads of control, but only if security is off; when security is on, calls to this method are ignored -- the method resumeAgent(AbleSecureKey)
must be used instead. |
protected void |
sendTransportMessage(javax.agent.Locator theDestinationLocator,
javax.agent.AgentName theDestinationAgentName,
java.lang.Object theMessageToSend)
Sends a message to the specified agent. |
protected void |
sendTransportMessage(javax.agent.Locator theOriginationLocator,
javax.agent.Locator theDestinationLocator,
javax.agent.AgentName theDestinationAgentName,
java.lang.Object theMessageToSend)
Sends an ACL message to the specified agent. |
protected void |
setAgentAutonomyLevel(int theAgentAutonomyLevel)
Sets the agent's autonomy level. |
void |
setAgentAutonomyLevel(int theAgentAutonomyLevel,
AbleSecureKey theSecureKey)
Sets the agent's autonomy level. |
void |
setAgentMovable(boolean theAgentMovableFlag)
Sets whether the agent is movable from one agent pool to another. |
void |
setAgentSummary(AbleMessageContainer theAgentSummary)
Sets the agent's current summary text. |
void |
setAgentToAutoRegister(boolean theAgentToAutoRegisterFlag)
Sets whether the agent is to register with the Agent Directory Service at initialization time. |
void |
setAgentToBindToRmi(boolean theAgentToBindToRmiFlag)
Sets whether the agent is to bind to the RMI Naming service at initialization time. |
void |
setAgentType(java.lang.String theAgentType)
Sets the agent's type description. |
void |
setAgentVendor(java.lang.String theAgentVendor)
Sets the agent's vendor. |
void |
setAgentVersion(java.lang.String theAgentVersion)
Sets the agent's version. |
void |
setPrincipal(java.lang.String thePrincipal)
|
void |
setRequestKey(AbleSecureKey theRequestKey)
Sets the AbleSecureKey this agent will use to make a VAN request to the VerifiableAgentNamingService. |
void |
suspendAgent(AbleSecureKey theSecureKey)
Temporarily suspends all asynchronous threads of control, typically including those in any contained beans and agents. |
void |
suspendAll()
Suspends all of the bean's asynchronous threads of control, but only if security is off; when security is on, calls to this method are ignored -- the method suspendAgent(AbleSecureKey)
must be used instead. |
java.lang.String |
toString()
Gets a string describing (the contents of) the object. |
protected void |
updateDescriptionWithAgentDirectoryService()
Updates this agent's description with the Agent Directory Service. |
Methods inherited from class com.ibm.able.AbleRemoteDefaultAgent |
---|
getAgentAddr, getAgentHost, getAgentName, rmiRebind, rmiUnbind |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.ibm.able.AbleRemoteAgent |
---|
addEventConnection, getAgentAddr, getAgentHost, getAgentName, getDataSource, isActiveDataSource, removeEventConnection, setActiveDataSource |
Methods inherited from interface com.ibm.able.AbleRemoteBean |
---|
getName, getState, process |
Methods inherited from interface com.ibm.able.AbleRemoteEventListener |
---|
handleAbleEvent |
Methods inherited from interface com.ibm.able.AbleEventListenerRemoteManager |
---|
addAbleEventListener, notifyAbleEventListeners, removeAbleEventListener |
Methods inherited from interface com.ibm.able.AbleBeanRemoteContainer |
---|
addBean, containsBean, containsBean, getBean, getBeans, removeAllBeans, removeBean, removeBean |
Methods inherited from interface com.ibm.able.AbleUserDefinedFunctionRemoteManager |
---|
addUserDefinedFunction, containsUserDefinedFunction, getUserDefinedFunction, getUserDefinedFunctions, invokeUserDefinedFunction, removeUserDefinedFunction, setUserDefinedFunctions |
Methods inherited from interface javax.agent.service.transport.MessageListener |
---|
equals, hashCode |
Methods inherited from interface com.ibm.able.AbleBean |
---|
getComment, getLogger, getName, getParent, getState, getTraceLogger, isChanged, setChanged, setComment, setLogger, setName, setParent, setState, setTraceLogger |
Methods inherited from interface com.ibm.able.AbleEventListenerManager |
---|
addAbleEventListener, dataChanged, getAbleEventListeners, notifyAbleEventListeners, removeAbleEventListener |
Methods inherited from interface com.ibm.able.AbleEventQueueProcessor |
---|
processAbleEvent, processNoEventProcessingEnabledSituation, processTimerEvent |
Methods inherited from interface com.ibm.able.AblePropertyChangeManager |
---|
addPropertyChangeListener, addPropertyConnection, getPropertyConnectionManager, removeAllPropertyConnections, removePropertyChangeListener, removePropertyConnection |
Methods inherited from interface com.ibm.able.AbleSerializable |
---|
getFileName, restoreFromFile, restoreFromFile, saveToFile, saveToFile, setFileName |
Methods inherited from interface com.ibm.able.AbleBeanContainer |
---|
getName |
Field Detail |
protected java.util.Date agentLastUpdate
protected java.lang.String agentStatus
protected AbleMessageContainer agentSummary
protected java.lang.String agentType
protected java.lang.String agentVendor
protected java.lang.String agentVersion
protected boolean agentToAutoRegister
protected boolean agentToBindToRmi
protected boolean agentMovable
protected java.util.Hashtable myJasAgentAttributes
protected java.util.Vector myAgentInboxes
This field must be set before the agent is initialized. At
initialization time, one Locator/AbleJasMessageListener pair is
created for each entry found in this collection and the Locater
is added to the agent's AgentDescription. The first entry here
becomes a "default" Locator. If there are no entries here, a
default Locator, tied to this agent's
receiveMessage(TransportMessage)
method is created.
Each element of the inbox collection is an array of Object[2]. The first element (index 0) of each subarray is the protocol designated for that inbox; this is simply a string that will appear in the Locator and its associated AbleJasMessageListener. Specify the empty string ("") if the agent doesn't care about tagging each inbox with a protocol. The second element (index 1) is the UDF the message listener will call when a message arrives. For example,
( ( "carBuyerSeller" UDF:receiveCarBuyerSellerMsg(TransportMessage) ) ( "creditCheck" UDF:receiveCreditCheckMsg(TransportMessage) ) )
AbleJasMessageListener
protected java.lang.String myPrincipal
protected javax.agent.service.ServiceRoot myJasServiceRoot
preInit()
protected javax.agent.service.directory.AgentDirectoryService myJasAgentDirectoryService
preInit()
protected VerifiableAgentDirectoryService myJasVerifiableDirectoryService
myJasAgentDirectoryService
, but
with additional methods.preInit()
protected javax.agent.service.naming.AgentNamingService myJasAgentNamingService
preInit()
protected VerifiableAgentNamingService myJasVerifiableNamingService
myJasAgentNamingService
, but with additional
methods.preInit()
protected javax.agent.service.transport.TransportSystem myJasTransportSystem
preInit()
protected javax.agent.AgentName myJasAgentName
preInit()
protected VerifiableAgentName myVerifiableAgentName
myJasAgentName
. When security is off, the field is
null.preInit()
protected java.lang.String myTrustLevel
preInit()
protected javax.agent.service.directory.AgentDescription myJasAgentDescription
myJasAgentAttributes
.protected javax.agent.service.transport.MessageTransportService myJasMessageTransportService
protected javax.agent.Locator myJasDefaultLocator
myAgentInboxes
protected javax.agent.Locator myJasAbleLocator
protected AbleUserDefinedFunction myReceiveMessageMethod
protected java.security.KeyPair myKeyPair
protected AbleSecureKey myRequestKey
This field tells the agent what AbleSecureKey to use to request a VAN.
protected transient AbleSecuritySupport mySecSppt
This object is null unless security is on.
When security is on, this object is created during the preinitialization process, and thereafter is used as a helper object to generate and verify secure keys and trust levels.
On deserialization, this object must be recreated!
Constructor Detail |
public AblePlatformDefaultAgent() throws java.rmi.RemoteException, AbleException
java.rmi.RemoteException
- On any RMI error.AbleException
- On any error.public AblePlatformDefaultAgent(java.lang.String theName) throws java.rmi.RemoteException, AbleException
theName
- A string containing the Able display name of this new
agent.
java.rmi.RemoteException
- On any RMI error.AbleException
- On any error.public AblePlatformDefaultAgent(java.lang.String theName, java.lang.String theComment) throws java.rmi.RemoteException, AbleException
theName
- A string containing the Able display name of this new
agent.
theComment
- A string containing a comment for this new agent.
java.rmi.RemoteException
- On any RMI error.AbleException
- On any error.Method Detail |
public int getAgentAutonomyLevel() throws AbleException
AblePlatformAgent
getAgentAutonomyLevel
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
AblePlatform
.java.rmi.RemoteException
- On any RMI error.public void setAgentAutonomyLevel(int theAgentAutonomyLevel, AbleSecureKey theSecureKey) throws AbleException, javax.agent.service.naming.NamingException
setAgentAutonomyLevel
in interface AblePlatformAgent
theAgentAutonomyLevel
- An autonomy level as defined in AblePlatform
.
theSecureKey
- If security is on, a key that can be used to authenticate
and authorize the caller; otherwise, may be null.
AbleException
- If the specified autonomy level isn't a level defined in
AblePlatform
or if the caller isn't authorized.javax.agent.service.naming.NamingException
- If the caller is not authenticated.protected void setAgentAutonomyLevel(int theAgentAutonomyLevel) throws AbleException
theAgentAutonomyLevel
- An autonomy level as defined in AblePlatform
.
AbleException
- If the specified autonomy level isn't a level defined in
AblePlatform
.public java.util.Date getAgentLastUpdate() throws AbleException
AblePlatformAgent
getAgentLastUpdate
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
java.rmi.RemoteException
- On any RMI error.public java.lang.String getAgentStatus() throws AbleException
AblePlatformAgent
getAgentStatus
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
java.rmi.RemoteException
- On any RMI error.public void setAgentSummary(AbleMessageContainer theAgentSummary)
theAgentSummary
- The agent's summary text.public AbleMessageContainer getAgentSummary() throws AbleException
AblePlatformAgent
getAgentSummary
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
java.rmi.RemoteException
- On any RMI error.public void setAgentType(java.lang.String theAgentType)
theAgentType
- The agent's type description.public java.lang.String getAgentType() throws AbleException
AblePlatformAgent
getAgentType
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
java.rmi.RemoteException
- On any RMI error.public void setAgentVendor(java.lang.String theAgentVendor)
theAgentVendor
- The agent's vendor.public java.lang.String getAgentVendor() throws AbleException
AblePlatformAgent
getAgentVendor
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
java.rmi.RemoteException
- On any RMI error.public void setAgentVersion(java.lang.String theAgentVersion)
theAgentVersion
- The agent's version.public java.lang.String getAgentVersion() throws AbleException
AblePlatformAgent
getAgentVersion
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
java.rmi.RemoteException
- On any RMI error.public void setAgentToAutoRegister(boolean theAgentToAutoRegisterFlag)
theAgentToAutoRegisterFlag
- Use true (default) if the agent is to register an
AgentDescription with the Agent Directory Service;
false otherwise.public boolean isAgentToAutoRegister() throws AbleException
AblePlatformAgent
isAgentToAutoRegister
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
java.rmi.RemoteException
- On any RMI error.public void setAgentToBindToRmi(boolean theAgentToBindToRmiFlag)
theAgentToBindToRmiFlag
- Use true if the agent is to bind to RMI
Naming;
false (default) otherwise.public boolean isAgentToBindToRmi() throws AbleException
AblePlatformAgent
isAgentToBindToRmi
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
java.rmi.RemoteException
- On any RMI error.public void setAgentMovable(boolean theAgentMovableFlag)
theAgentMovableFlag
- Use true if the agent is movable;
false otherwise.public boolean isAgentMovable() throws AbleException
AblePlatformAgent
isAgentMovable
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
java.rmi.RemoteException
- On any RMI error.public void addJasAgentAttribute(java.lang.String theKey, java.lang.Object theAttribute)
theKey
- the name of the attribute.theAttribute
- the attribute to add to the set.public void removeJasAgentAttribute(java.lang.String theKey)
theKey
- the name of the attribute to remove.public java.util.Hashtable getJasAgentAttributes() throws AbleException
AblePlatformAgent
getJasAgentAttributes
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
java.rmi.RemoteException
- On any RMI error.public java.lang.String getJasAgentName() throws AbleException
AblePlatformAgent
getJasAgentName
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
toString()
version of the agent's unique
AgentName.java.rmi.RemoteException
- On any RMI error.public java.util.Vector getAgentInboxes()
public void addAgentInbox(java.lang.Object[] theProtocol)
public void removeAgentInbox(java.lang.Object[] theProtocol)
public void removeAgentInboxes()
public void setPrincipal(java.lang.String thePrincipal)
public java.lang.String getPrincipal()
public void preInit() throws AbleException
AblePlatformAgent
preInit
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
java.rmi.RemoteException
- On any remote error.public void initializeAgent(AbleSecureKey theSecureKey) throws AbleException, javax.agent.service.naming.NamingException
AblePlatformAgent
initializeAgent
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
theSecureKey
- When security if off, this may be null as the
parameter is ignored; when security is on the security
key must be from an object with equal or greater
authority in order for the operation to proceed.
java.rmi.RemoteException
- On any remote error.javax.agent.service.naming.NamingException
- On any naming error.public void initializeAgent(java.lang.Object theInitArg, AbleSecureKey theSecureKey) throws AbleException, javax.agent.service.naming.NamingException
AblePlatformAgent
initializeAgent
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
theInitArg
- Argument to the initialization method.
theSecureKey
- When security if off, this may be null as the
parameter is ignored; when security is on the security
key must be from an object with equal or greater
authority in order for the operation to proceed.
java.rmi.RemoteException
- On any remote error.javax.agent.service.naming.NamingException
- On any naming error.public void quitAgent(AbleSecureKey theSecureKey) throws AbleException, javax.agent.service.naming.NamingException
AblePlatformAgent
quitAgent
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
theSecureKey
- When security if off, this may be null as the
parameter is ignored; when security is on the security
key must be from an object with equal or greater
authority in order for the operation to proceed.
java.rmi.RemoteException
- On any remote error.javax.agent.service.naming.NamingException
- On any naming error.public void suspendAgent(AbleSecureKey theSecureKey) throws AbleException, javax.agent.service.naming.NamingException
AblePlatformAgent
suspendAgent
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
theSecureKey
- When security if off, this may be null as the
parameter is ignored; when security is on the security
key must be from an object with equal or greater
authority in order for the operation to proceed.
java.rmi.RemoteException
- On any remote error.javax.agent.service.naming.NamingException
- On any naming error.public void resumeAgent(AbleSecureKey theSecureKey) throws AbleException, javax.agent.service.naming.NamingException
AblePlatformAgent
resumeAgent
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
theSecureKey
- When security if off, this may be null as the
parameter is ignored; when security is on the security
key must be from an object with equal or greater
authority in order for the operation to proceed.
java.rmi.RemoteException
- On any remote error.javax.agent.service.naming.NamingException
- On any naming error.public void resetAgent(AbleSecureKey theSecureKey) throws AbleException, javax.agent.service.naming.NamingException
AblePlatformAgent
resetAgent
in interface AblePlatformAgent
com.ibm.able.platform.AblePlatformAgent
theSecureKey
- When security if off, this may be null as the
parameter is ignored; when security is on the security
key must be from an object with equal or greater
authority in order for the operation to proceed.
java.rmi.RemoteException
- On any remote error.javax.agent.service.naming.NamingException
- On any naming error.public void receiveMessage(javax.agent.TransportMessage theTransportMessage)
In this implementation, the process(Object)
method
is called to process the received message.
receiveMessage
in interface javax.agent.service.transport.MessageListener
theTransportMessage
- A message from the Message Transport Service.
public void init() throws AbleException
initializeAgent(AbleSecureKey)
must be used instead.init
in interface AbleRemoteBean
init
in class AbleRemoteDefaultAgent
AbleException
- On any error.public void init(java.lang.Object theArg) throws AbleException
initializeAgent(Object,AbleSecureKey)
must be used instead.
In this implementation, the argument parameter is not used, but is passed on up to the super classes.
init
in interface AbleRemoteBean
init
in class AbleRemoteDefaultAgent
theArg
- An Object used to initialize the bean.
AbleException
- On any error.public void reset() throws AbleException
resetAgent(AbleSecureKey)
must be used instead.reset
in interface AbleRemoteBean
reset
in class AbleDefaultAgent
AbleException
- On any error.public java.lang.Object process(java.lang.Object theArg) throws AbleException
Agents derived from this default platform agent must
override this method in order to do anything useful. The default
receiveMessage(TransportMessage)
calls this method when
a message is received by the Message Transport Service, but this
method does nothing.
process
in interface AbleRemoteBean
process
in class AbleObject
theArg
- The Object should be a JAS TransportMessage as
received by the receiveMessage() method.
AbleException
- In any error situation.public void quitAll() throws AbleException
quitAgent(AbleSecureKey)
must be used instead.quitAll
in interface AbleRemoteBean
quitAll
in class AbleDefaultAgent
AbleDefaultAgent.quitEnabledEventProcessing()
public void suspendAll() throws AbleException
suspendAgent(AbleSecureKey)
must be used instead.suspendAll
in interface AbleRemoteBean
suspendAll
in class AbleDefaultAgent
com.ibm.able.AbleRemoteBean
java.rmi.RemoteException
- If an error occurs.public void resumeAll() throws AbleException
resumeAgent(AbleSecureKey)
must be used instead.resumeAll
in interface AbleRemoteBean
resumeAll
in class AbleDefaultAgent
com.ibm.able.AbleRemoteBean
java.rmi.RemoteException
- If an error occurs.protected void _init() throws AbleException
preInit()
, in case it has not been called
before, which, depending on need,
getAndValidateServiceRoot()
to get
addressability to the ServiceRoot. All services must be up and
running. If the Naming Service, Directory Service, or the
Transport System is not available, an exception is thrown.getAndSetAgentNames()
to get the Globally
Unique ID (GUID, or AgentName) of this agent from the Agent
Naming Service.getAndSetAgentDescription()
to get a new,
empty Agent Description and then load it with both the built-in
Able attributes and any user-defined agent attributes as found in
the data member myJasAgentAttributes
. getAndSetTransportServices()
to get the
Message Transport Services from the Transport System, and then
selects one to use.loadAgentDescriptionWithBaseLocators()
to add
Locators to the AgentDescription. The number of locators created
depends on the data member myAgentInboxes
, but at least
one locator is always created.loadAgentDescriptionWithAbleLocator()
to add
a special Able Locator to the Agent Description. See the data
member myJasAbleLocator
.maybeRegisterWithAgentDirectoryService(boolean)
to register the Agent Description with the Agent Directory
Service. See the data member agentToAutoRegister
.maybeRebindToRmi(boolean)
to (re)bind the
agent to an RMI Naming service, so that the agent can be located
by RMI lookup. See the data member agentToBindToRmi
.super.init()
to allow the super classes
to initialize.updateAgentDescription()
to cause the
agent's AgentDescription to be refreshed with the Agent Directory
Service.
AbleException
- In any error situation.protected void _init(java.lang.Object theArg) throws AbleException
_init()
, but the specified argument
is passed to the super class for handling.AbleException
- In any error situation.protected void _reset() throws AbleException
reset()
in condition 1. resetAgent(AbleSecureKey)
in conditions 1 and 2. This method can be overridden, but must not be exposed to the public.
AbleException
- In any error situation.protected void _quitAll()
quitAll()
in condition 1. quitAgent(AbleSecureKey)
in conditions 1 and 2. This method can be overridden, but must not be exposed to the public.
As needed:
super.quitAll()
to stop all threads
maybeDeregisterWithAgentDirectoryService()
to
deregister from the Agent Directory Service
maybeUnbindFromRmi()
to unbind from the RMI
Naming service
protected void _suspendAll() throws AbleException
suspendAll()
in condition 1. suspendAgent(AbleSecureKey)
in conditions 1 and 2. This method can be overridden, but must not be exposed to the public.
AbleException
- In any error situation.protected void _resumeAll() throws AbleException
resumeAll()
in condition 1. resumeAgent(AbleSecureKey)
in conditions 1 and 2. This method can be overridden, but must not be exposed to the public.
AbleException
- In any error situation.protected void getAndValidateServiceRoot() throws AbleException
AbleException
- In any error situation.protected void getAndSetAgentNames() throws AbleException
myJasAgentName
; additionally, if security is on, a
verifiable agent name is obtained and saved in the data
member myVerifiableAgentName
, and the data members
myTrustLevel
,
myPrincipal
, and
mySecSppt
are also set.AbleException
- In any error situation.protected void getAndSetAgentDescription() throws AbleException
getNewAgentDescription()
to get a new, empty Agent
Description and then
loadAgentDescriptionWithAgentName()
to set
the agent's names into the description
loadAgentDescriptionWithPublicKey()
to set
the agent's public key into the description
loadAgentDescriptionWithAbleAttributes()
to set
built-in Able attributes into the description
loadAgentDescriptionWithUserAttributes()
to set
any user-defined attributes into the description.
AbleException
- In any error situation.protected void getNewAgentDescription() throws AbleException
myJasAgentDescription
.AbleException
- In any error situation.protected void loadAgentDescriptionWithAgentName() throws AbleException
myJasAgentName
.AbleException
- In any error situation.protected void loadAgentDescriptionWithPublicKey()
protected void loadAgentDescriptionWithAbleAttributes() throws AbleException
Note that the agent's built-in attributes, those data members
named with the pattern agentXxxx
, can be set
programatically, for example,
setAgentVersion("1.2.3")
or through a graphical
customizer (not provided).
Attributes set include
AblePlatform.AbleAgentAutonomyLevel
from AblePlatform
JasConstants.AGENT_DISPLAY_NAME
from AbleObject.name
AblePlatform.AbleAgentDescription
from AbleObject.comment
AblePlatform.AbleAgentMovable
from agentMovable
AblePlatform.AbleAgentLastUpdate
from agentLastUpdate
AblePlatform.AbleAgentSummary
from agentSummary
AblePlatform.AbleAgentType
from agentType
AblePlatform.AbleAgentVendor
from agentVendor
AblePlatform.AbleAgentVersion
from agentVersion
AbleException
- In any error situation.protected void loadAgentDescriptionWithUserAttributes() throws AbleException
myJasAgentAttributes
.AbleException
- In any error situation.protected void getAndSetTransportServices() throws AbleException
myJasMessageTransportService
.AbleException
- In any error situation.protected void loadAgentDescriptionWithBaseLocators() throws AbleException
At least one Locator, perhaps bound to this agent's
receiveMessage(TransportMessage)
method is created.
Note, however, that any number of Locators can be created, and
they can be bound to callback methods other than
receiveMessage()
.
The number of Locators (inboxes) and the methods to which
they are bound is customizable through the data member
myAgentInboxes
. If myAgentInboxes
is
empty, then the default Locator is created.
AbleException
- In any error situation.protected javax.agent.Locator createLocatorAndBindToMethod(java.lang.String theProtocol, AbleUserDefinedFunction theUserDefinedFunction) throws AbleException
loadAgentDescriptionWithBaseLocators()
.theProtocol
- The protocol is simply passed to an
AbleJasMessageListener, and set as an identifiable
property in the Locator.
theUserDefinedFunction
- The method that is to receive the callback when a
message arrives through the created Locator.
AbleException
- In any error situation.protected void loadAgentDescriptionWithAbleLocator() throws AbleException
myJasAbleLocator
, which is a locator
that contains an RMI reference to this agent, and which can be
used to call those public, "remotable" methods found in this
agent.AbleException
- In any error situation.protected void maybeRegisterWithAgentDirectoryService(boolean theRegisterFlag) throws AbleException
This method can also be used to update the agent's already registered agent description.
theRegisterFlag
- If true, the agent will register with the
Directory Service. Otherwise, nothing happens.
AbleException
- In any error situation.protected void maybeDeregisterWithAgentDirectoryService() throws AbleException
AbleException
- In any error situation.protected void updateDescriptionWithAgentDirectoryService() throws AbleException
AbleException
- In any error situation.protected void maybeRebindToRmi(boolean theBindToRmiFlag) throws AbleException
theBindToRmiFlag
- If true, the agent will rebind itself to RMI
Naming. Otherwise, nothing happens.
AbleException
- In any error situation.protected void maybeUnbindFromRmi() throws AbleException
AbleException
- In any error situation.protected javax.agent.service.directory.AgentDescription[] lookUpAgent(java.lang.String theSearchAttribute, java.lang.Object theSearchValue) throws AbleException
theSearchAttribute
- The name of the attribute in the agent description to
search.
theSearchValue
- The value that the specified attribute must match.
The equals() method is used.
AbleException
- In any error situation.protected javax.agent.service.directory.AgentDescription[] lookUpAgent(java.util.Hashtable theSearchAttributesAndValues) throws AbleException
theSearchAttributesAndValues
- A set of attributes and associated values for which to
search.
AbleException
- In any error situation.protected void logException(java.lang.String theMethodName, java.lang.Exception theException)
theException
- The exception to log.
protected void broadcastTransportMessage(java.util.Vector theDestinations, java.lang.Object theMessageToSend) throws AbleException
theDestinations
- A vector of vectors: ( (Locator AgentName) (Locator AgentName) ... )
theMessageToSend
- An Object containing the contents of the message to send.
AbleException
- In any error situation.sendTransportMessage(Locator, Locator, AgentName, Object)
protected void sendTransportMessage(javax.agent.Locator theDestinationLocator, javax.agent.AgentName theDestinationAgentName, java.lang.Object theMessageToSend) throws AbleException
theDestinationLocator
- The Locator of the destination agent.
theDestinationAgentName
- The globally unique ID (Agent Name) of the destination agent.
theMessageToSend
- An Object containing the contents of the message to send.
AbleException
- In any error situation.sendTransportMessage(Locator, Locator, AgentName, Object)
protected void sendTransportMessage(javax.agent.Locator theOriginationLocator, javax.agent.Locator theDestinationLocator, javax.agent.AgentName theDestinationAgentName, java.lang.Object theMessageToSend) throws AbleException
theOriginationLocator
- One of my own Locators, selected by the caller.
theDestinationLocator
- The Locator of the destination agent.
theDestinationAgentName
- The globally unique ID (Agent Name) of the destination
agent.
theMessageToSend
- An Object containing the contents of the message to
send.
The message to send can be any of:
AbleException
- In any error situation.protected java.lang.Object getTransportMessageContent(javax.agent.TransportMessage theTransportMessage) throws AbleException
Important!
This method assumes that the content of the transport
message's inner ACL message is wrapped in either an AcrObject or
an AcrString object. If the transport message was sent with this
class's implementation of the sendTransportMessage()
method, that will indeed be the case. If the transport message
was sent from some non-Able agent or from an overridden
sendTransportMessage()
method, this assumption may
be false, and this method may return an AcrNode that you will
have to decode yourself.
theTransportMessage
- The message from which the ACL message and its inner
content is to be extracted.
AbleException
- In any error situation.protected java.lang.Object getTransportMessageContent2(javax.agent.TransportMessage theTransportMessage) throws AbleException
Important!
This method assumes that the content of the transport
message's inner ACL message is wrapped in either an AcrObject or
an AcrString object. If the transport message was sent with this
class's implementation of the sendTransportMessage()
method, that will indeed be the case. If the transport message
was sent from some non-Able agent or from an overridden
sendTransportMessage()
method, this assumption may
be false, and this method may return an AcrNode that you will
have to decode yourself.
theTransportMessage
- The message from which the ACL message and its inner
content is to be extracted.
AbleException
- In any error situation.public void setRequestKey(AbleSecureKey theRequestKey)
public static void main(java.lang.String[] args) throws AbleException
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String Copyright()
|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |