public class AgentManager extends java.lang.Object implements MicroAgentServer
The AgentManager itself is both thread-safe and thread-aware.
Using the AgentManager Class
The correct general procedure for using the AgentManager class is:
Constructor and Description |
---|
AgentManager() |
AgentManager(java.util.Map config) |
AgentManager(java.lang.String hawkDomain,
java.lang.String serverURL,
java.util.Hashtable environment) |
AgentManager(java.lang.String hawkDomain,
java.lang.String host,
int port,
int tunnelMode) |
AgentManager(java.lang.String hawkDomain,
java.lang.String rvService,
java.lang.String rvNetwork,
java.lang.String rvDaemon) |
AgentManager(java.lang.String hawkDomain,
java.lang.String serverURL,
java.lang.String clientId,
java.lang.String userName,
java.lang.String password,
java.util.Hashtable environment) |
Modifier and Type | Method and Description |
---|---|
MicroAgentDescriptor |
describe(MicroAgentID id)
This method may be used to retrieve a descriptor for a microagent.
|
MicroAgentID[] |
getMicroAgentIDs(java.lang.String microAgentName)
Queries all agents to learn the id of all microagents matching the
supplied name.
|
MicroAgentID[] |
getMicroAgentIDs(java.lang.String microAgentName,
int minNum)
Queries all agents to learn the id of microagents matching the
supplied name.
|
MicroAgentID[] |
getMicroAgentIDs(java.lang.String agentName,
java.lang.String agentDns,
java.lang.String hawkDomain,
java.lang.String microAgentName,
int minNum)
Queries specific agents to learn the id of microagents matching the
supplied name.
|
MicroAgentData[] |
groupOp(MicroAgentID[] targets,
MethodInvocation mi)
Performs a group operation.
|
void |
initialize()
Initializes an AgentManager.
|
void |
initialize(java.lang.Object securityObj,
int securityMode)
Initializes a secure AgentManager.
|
void |
initialize(java.lang.String securityImpl,
int securityMode)
Initializes a secure AgentManager.
|
MicroAgentData |
invoke(MicroAgentID id,
MethodInvocation mi)
Performs a method invocation on a microagent.
|
void |
shutdown()
Used to gracefully shutdown the AgentManager.
|
Subscription |
subscribe(MicroAgentID id,
MethodSubscription msub,
SubscriptionHandler handler,
java.lang.Object handBack)
Registers a subscription with a microagent.
|
public AgentManager(java.lang.String hawkDomain, java.lang.String rvService, java.lang.String rvNetwork, java.lang.String rvDaemon)
public AgentManager(java.lang.String hawkDomain, java.lang.String serverURL, java.lang.String clientId, java.lang.String userName, java.lang.String password, java.util.Hashtable environment)
public AgentManager(java.lang.String hawkDomain, java.lang.String serverURL, java.util.Hashtable environment)
public AgentManager(java.lang.String hawkDomain, java.lang.String host, int port, int tunnelMode)
public AgentManager()
public AgentManager(java.util.Map config)
public void initialize(java.lang.String securityImpl, int securityMode) throws ConsoleInitializationException
The securityImpl
parameter identifies the
class file that implements the security policy.
The securityMode
parameter signals the contex
of the invoker. Possible contexts are HsConsoleInterface.WINDOW,
HsConsoleInterface.CONSOLE, and HsConsoleInterface.DAEMON.
WINDOW indicates an interactive windowing environment. It is possible to
perform interactive activities from within this context. CONSOLE
indicates an interactive console session. It is also possible to
perform interactive command-line activities from within this context.
DAEMON indicates a non-interactive batch or background
process. It is not possible to perform interactive activites from within
this context.
See the TIB/Hawk Programmer's Guide for information on security policy implementation and security context.
securityImpl
- the name of the class implementing the security policy.securityMode
- the context of the invoker.ConsoleInitializationException
- If some initialization error occurredpublic void initialize(java.lang.Object securityObj, int securityMode) throws ConsoleInitializationException
The securityImpl
parameter identifies the
class file that implements the security policy.
The securityMode
parameter signals the contex
of the invoker. Possible contexts are HsConsoleInterface.WINDOW,
HsConsoleInterface.CONSOLE, and HsConsoleInterface.DAEMON.
WINDOW indicates an interactive windowing environment. It is possible to
perform interactive activities from within this context. CONSOLE
indicates an interactive console session. It is also possible to
perform interactive command-line activities from within this context.
DAEMON indicates a non-interactive batch or background
process. It is not possible to perform interactive activites from within
this context.
See the TIB/Hawk Programmer's Guide for information on security policy implementation and security context.
securityObj
- the security object implementing the interfaces HsConsoleInterface and HsAgentInterfacesecurityMode
- the context of the invoker.ConsoleInitializationException
- If some initialization error occurredpublic void initialize() throws ConsoleInitializationException
ConsoleInitializationException
- If some initialization error occurredpublic void shutdown()
shutdown
in interface MicroAgentServer
public MicroAgentDescriptor describe(MicroAgentID id) throws MicroAgentException
describe
in interface MicroAgentServer
id
- The microagent id of the microagent to describe.java.lang.IllegalArgumentException
- If the argument is null or empty stringMicroAgentException
- If a problem occurred servicing this requestpublic MicroAgentData invoke(MicroAgentID id, MethodInvocation mi) throws MicroAgentException
The results of the invocation are delivered in the data field of the MicroAgentData return.
There are two general types of errors that can occur with method invocations:
Thus, a successful method invocation is one that doesn't throw an exception and does not deliver a MicroAgentException in the data field of its MicroAgentData return.
If the method invocation is successful, the data field of its MicroAgentData return will contain the method's return value or null if the method doesn't return a value.
You should not invoke to methods that are non-open (proprietary) unless you have supporting api and documentation. Doing so will have unpredictable results. Whether or not a method is open is defined by its MethodDescriptor
invoke
in interface MicroAgentServer
id
- The microagent id of the target microagent.mi
- The MethodInvocation object identifying the method to be invoked
and its arguments. May not be null.java.lang.IllegalArgumentException
- If the parameter conditions are violatedMicroAgentException
- If an error occurs during the delivery of a method invocation
to, or the results back from, a microagent.public Subscription subscribe(MicroAgentID id, MethodSubscription msub, SubscriptionHandler handler, java.lang.Object handBack) throws MicroAgentException
Subscriptions are made against microagent methods. Registering a subscription is analogous to registering for events, where a microagent's method is the event source.
The subscribed to data is delivered asynchronously to the supplied SubscriptionHandler.
There are two general types of errors that can occur with method invocations:
subscribe
in interface MicroAgentServer
id
- The microagent id of the target microagent.msub
- Identifies what is being subscribed to.handler
- The object that handles subscription results.handBack
- This Object parameter is accessable in the
resulting Subscription object which is delivered to
the handler along with subscription results.java.lang.IllegalArgumentException
- If the parameter conditions are violatedMicroAgentException
- If an error occurs during the registration of the subscription.public MicroAgentID[] getMicroAgentIDs(java.lang.String microAgentName) throws MicroAgentException
Returns a list of MicroAgentID objects identifying all microagents, bearing that name, that were discovered to be running on all agents.
Note: If your application is also using the AgentMonitor to track agents and their microagents then it is more efficient to use the data supplied by the AgentMonitor rather than this method.
getMicroAgentIDs
in interface MicroAgentServer
microAgentName
- The microagent name.MicroAgentException
- if an error occurs while satisfying the request.public MicroAgentID[] getMicroAgentIDs(java.lang.String microAgentName, int minNum) throws MicroAgentException
This version is faster than the other if the number of actual matching microagents on the network is greater than or equal to the supplied minNum value.
Note: If your application is also using the AgentMonitor to track agents and their microagents then it is more efficient to use the data supplied by the AgentMonitor rather than this method.
getMicroAgentIDs
in interface MicroAgentServer
microAgentName
- The microagent name.minNum
- The minimum number of microagents you want to discover.MicroAgentException
- if an error occurs while satisfying the request.public MicroAgentID[] getMicroAgentIDs(java.lang.String agentName, java.lang.String agentDns, java.lang.String hawkDomain, java.lang.String microAgentName, int minNum) throws MicroAgentException
The first thre parameters (agentName, agentDns, and
hawkDomain) identify the target agent(s). Any or all of these can be null
to indicate a wildcard. Setting all three to null has the same effect
as calling AgentManger.getMicroAgentIDs(String, int)
.
getMicroAgentIDs
in interface MicroAgentServer
agentName
- The name of the targeted agent.
Use null or empty-string to match any agent name.agentDns
- The dns value of the targeted agent.
Use null or empty-string to match any dns value.hawkDomain
- The hawkDomain of the targeted agent.
NOTE: Currently, each instance of AgentManager is bound
to a single hawk domain. Therefore, using any value
other than that specific domain, null, or empty-string
will return without discovering any agents.microAgentName
- The microagent name.minNum
- The minimum number of microagents you want to discover.
Use zero to discover all available microagents (subject
to a timeout interval).MicroAgentException
- if an error occurs while satisfying the request.public MicroAgentData[] groupOp(MicroAgentID[] targets, MethodInvocation mi) throws MicroAgentException
Invokes the supplied method invocation on all target microagents.
groupOp
in interface MicroAgentServer
targets
- The list of MicroAgentID objects identifying which
microagents to perform the invocation on.mi
- The MethodInvocation object identifying the method to be invoked and its arguments. Cannot be null.MicroAgentException
- if an error occurs while satisfying the request.Copyright © 2000-2019 TIBCO Inc. All Rights Reserved.