SL-GMS Enterprise RTView Customization

com.sl.gmsjagent
Class RtvAgent

java.lang.Object
  extended by com.sl.gmsjagent.RtvAgent

public class RtvAgent
extends java.lang.Object

Use this class to create an agent that connects and sends data tables to a remote RTVAgent data adapter. An agent can use http or tcp/ip to connect to the RTVAgent data adapter. The RTVAgent data adapter runs within an RTView application such as the RTView Data Server.


Field Summary
static int DEFAULT_PORT
          The default port for socket connections to the RTVAgent data adapter is 5665.
 
Constructor Summary
RtvAgent(java.lang.String agentName, java.lang.String agentClass)
          Construct an RtvAgent object.
 
Method Summary
 boolean connect(java.lang.String connectionString)
          Connect this agent to an RTVAgent data adapter.
 void disconnect()
          Disconnect this agent from the RTVAgent data adapter.
 java.lang.String getConnectionString()
          Return the connection string currently in use by this agent.
 java.lang.String getName()
          Get the name of this agent.
 boolean ready()
          Check if agent is ready to send data to an RTVAgent data adapter.
 boolean sendTable(java.lang.String tableName, GmsTabularData data)
          Send a data table to the RTVAgent data adapter.
 boolean sendTable(java.lang.String tableName, GmsTabularData data, boolean addAgentNameColumn)
          Send a data table to the RTVAgent data adapter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
The default port for socket connections to the RTVAgent data adapter is 5665.

See Also:
Constant Field Values
Constructor Detail

RtvAgent

public RtvAgent(java.lang.String agentName,
                java.lang.String agentClass)
Construct an RtvAgent object.

Parameters:
agentName - The name of this agent. The agentName should be unique among all agents that belong to an agentClass.
agentClass - The name of the class of agents to which this agent belongs. The agentClass should be globally unique.
Method Detail

connect

public boolean connect(java.lang.String connectionString)
Connect this agent to an RTVAgent data adapter.

Parameters:
connectionString - Specifies the connection to the remote RTVAgent data adapter. This string should either specify a hostname:port string for a direct socket connection to the RTVAgent data adapter (for example MyServer:5665) or it should specify a URL for an http connection via the rtvagent servlet (for example http://MyServer/rtvagent).
Returns:
true if the connection was made succefully, otherwise false. If the connection fails initially, or succeeds initially but fails later, the agent will attempt to reconnect every 5 seconds.

disconnect

public void disconnect()
Disconnect this agent from the RTVAgent data adapter.


getConnectionString

public java.lang.String getConnectionString()
Return the connection string currently in use by this agent.

Returns:
The connection string.

getName

public java.lang.String getName()
Get the name of this agent.

Returns:
The agentName specified to the constructor.

ready

public boolean ready()
Check if agent is ready to send data to an RTVAgent data adapter.

Returns:
true if agent is connected to an RTVAgent data adapter.

sendTable

public boolean sendTable(java.lang.String tableName,
                         GmsTabularData data)
Send a data table to the RTVAgent data adapter.

This is equivalent to calling sendTable(tableName, data, false). See RtvAgent.sendTable(String,GmsTabularData,boolean).

Parameters:
tableName - The name of the data table.
data - The data table,
Returns:
True if the table was sent, false if the table could not be sent.

sendTable

public boolean sendTable(java.lang.String tableName,
                         GmsTabularData data,
                         boolean addAgentNameColumn)
Send a data table to the RTVAgent data adapter.

Parameters:
tableName - The name of the data table. The tableName and the agentClass (specified when this agent was constructed) are used by the RTVAgent data adapter to uniquely identify the tables that it receives from agents.
data - The data table to be sent.
addAgentNameColumn - If true, the table is cloned and a string column named AgentName is inserted as first column of the cloned table, and the agentName (specified when this agent was constructed) is set as the value of that column in every row. The cloned table is then sent. If false, then the table is sent without modification. If multiple agents in the same agentClass send tables with the same tableName then it is useful to have a column in each table that contains the agentName, so that filters for specific agents can be applied to RTVAgent data attachments. In that case, a value of false is typically specified for this argument only if the data table already includes a column that contains the agentName.
Returns:
True if the table was sent, false if the table could not be sent because the agent is not connected to an RTVAgent data adapter.

SL-GMS Enterprise RTView Customization

Copyright 2009 Sherrill-Lubinski Corporation, 240 Tamal Vista Blvd
Corte Madera, CA 94925, U.S.A. All Rights Reserved