Previous Topic: Developing Against the Java AgentNext Topic: Agent Discovery APIs


Agent General APIs

Note: You can view detailed information about the interface and class that this topic describes in the JavaDocs for the agent. The JavaDocs are located in the LISA_HOME\doc directory.

Most of the client APIs must specify an agent as their target. This specification is accomplished by passing a parameter of type com.itko.lisa.remote.IAgentInfo. This parameter represents an object that uniquely identifies an agent and some of its basic information.

/** A unique identifier for this agent or console. If it is named the guid is persistent across VM lifespans */
 public long getGuid();
 public void setGuid(long guid);
 
 /** A human-readable name to identify this agent, manually given or generated from system properties */
 public String getName();
 public void setName(String name);
 
 /** The name of the machine this object was generated on (if available) */
 public String getMachine();
 public void setMachine(String machine);
 
 /** The IP of the machine this object was generated on (if available) */
 public String getIp();
 public void setIp(String ip);
 
 /** The working directory of the JVM this object runs in */
 public String getWorkingDir();
 public void setWorkingDir(String workingDir);
 
 /** The classpath as it is returned by the java.class.path property */
 public String getClasspath();
 public void setClasspath(String classpath);
 
 /** The library path as it is returned by the java.library.path property */
 public String getLibpath();
 public void setLibpath(String libpath);
 
 /** For agents, returns the java class containing the main method that was invoked */
 public String getMainClass();
 public void setMainClass(String mainClass);
 
 /** A short-hand version of the command-line (for representation purposes as it may not be accurate) */
 public String getCommandLine();
 
 /** Transient field to keep track of when this object is sent or received */
 public Date getGenerationTime();
 public void setGenerationTime(Date time);
 
 /** Transient field to keep track of a required password to invoke APIs on this agent over JMS */
 public String getToken();
 public void setToken(String token);

We can now look at some of the APIs directly off com.itko.lisa.remote.client.AgentClient. This list is not exhaustive but covers most of the needs of most clients.

/** Gets the class responsible for all discovery and information for a given agent */
 public DiscoveryClient getDiscoveryClient();
 
 /** Gets the class responsible for all transaction related operations */
 public TransactionsClient getTransactionClient();
 
 /** Gets the class responsible for all VSE related operations */
 public VSEClient getVSEClient();
 
 /**
  * Get all the discovered agents - this is the main API to get IAgentInfos used in all other API calls
  * @param tokens a map of agent guids or names to tokens, null if no agent has token-enabled security
  * @return a set of IAgentInfo objects representing agents that are currently online
  */
  public Set getRemoteAgentInfos(Map tokens);
 
 /**
  * Forward agent online information to registered listeners
  * @param info the agent that was just detected to come online
  */
  public void onAgentOnline(IAgentInfo info);
 
 /**
  * Forward agent offline information to registered listeners
  * @param info the agent that was just detected to go offline
  */
  public void onAgentOffline(IAgentInfo info);
 
 /**
  * Evaluate arbitrary code on the specified agent
  * @param info the agent this code will be evaluated against
  * @param input the code to execute. The variable '_agent' represents the Agent instance.
  * @return the value returned by the code
  * @throws JMSInvocationExceptionthrown if the code throws on the agent
  */
 public Object eval(IAgentInfo info, String input) throws JMSInvocationException