TPTP 4.5.0 Platform Project
Public API Specification

org.eclipse.tptp.platform.execution.datacollection
Interface IBaseAgent

All Known Implementing Classes:
BaseAgent, TPTPJavaAgent

public interface IBaseAgent

IBaseAgent provides the interface for development of an Agent. This agent registers with the Agent Controller and provides datacollection services to the client.

Provisional API: This API is subject to change in the next release.

Method Summary
 void addClient(int clientConnId, TPTPAgentAccess accessMode)
          Add the clients that are referecing this agent
 int addEventListener(java.lang.String eventsIID, int listenerID, int replyDest, int replyContext)
           
 int deregister()
          Deregister from the Agent Controller.
 int getAgentID()
          Return the agent connection id
 java.lang.String getAgentName()
          Return the agent name
 java.lang.String getConfigValue()
          Return the agent configuration information.
 long getProcessID()
          Return the agent process id
 java.lang.String[] getSupportedInterfaces()
          Return the list of interfaces serviced by the Agent
 java.lang.String getUUID()
           
 void init()
           
 boolean isRegistered()
          Returns whether the agent registered successfully with Agent Controller
 int preRegisterInitialization()
          Provides data exchange with the Agent Controller prior to Agent Registration
 void processCommand(ICommandFragment command)
          Process the commands recieved by the agent The sub-classes must override this method to provide their command processing functionality
 void processCommandLine(java.lang.String[] argv)
           
 int processDataProviderCommands(ICommandFragment cmd)
          Sub classes should override this class for additional functionality
 int processEventProviderCommands(ICommandFragment cmd)
          Sub classes should override this class for additional functionality
 int receiveData(int sourceId, byte[] buffer, int bufferLength)
          ReceiveData from the Client
 int receiveData(int sourceId, java.lang.String buffer, int bufferLength)
          ReceiveData from the Client
 int register()
          Register the Agent with Agent Controller.
 void removeClient(int clientConnId)
           
 int removeEventListener(java.lang.String eventsIID, int listenerID, int replyDest, int replyContext)
           
 void sendCommand(ICommandFragment outCommand)
           
 void sendCommand(java.lang.String outCommand)
           
 int sendData(int targetInstanceId, byte[] buffer)
          send the given data buffer to the given destination This method is used by the Remote Agent on the AgentController to send the data to the Client
 int sendData(int targetInstanceId, byte[] buffer, int offset, int length)
          send the given data buffer to the given destination This method is used by the Remote Agent on the AgentController to send the data to the Client
 int sendData(int targetInstanceId, char[] buffer)
          send the given data buffer to the given destination This method is used by the Remote Agent on the AgentController to send the data to the Client
 int sendEventNotifications(ICommandFragment cmd)
           
 void setSupportedInterfaces(java.lang.String[] interfaceID)
          Set the list of interfaces supported by the Agent, subclasses should override this method to customize their characteristics
 void waitForTermination()
          This method is invoked by the Agent Controller if there are no referencing clients
 

Method Detail

init

void init()
          throws NativeLibraryNotFound
Throws:
NativeLibraryNotFound

isRegistered

boolean isRegistered()
Returns whether the agent registered successfully with Agent Controller

Returns:
boolean

deregister

int deregister()
               throws AgentControllerUnavailableException
Deregister from the Agent Controller.

Returns:
int
Throws:
AgentControllerUnavailableException

register

int register()
             throws AgentControllerUnavailableException
Register the Agent with Agent Controller.

Returns:
int
Throws:
AgentControllerUnavailableException

preRegisterInitialization

int preRegisterInitialization()
                              throws AgentControllerUnavailableException
Provides data exchange with the Agent Controller prior to Agent Registration

Returns:
int
Throws:
AgentControllerUnavailableException

processCommand

void processCommand(ICommandFragment command)
Process the commands recieved by the agent The sub-classes must override this method to provide their command processing functionality

Parameters:
command -

sendData

int sendData(int targetInstanceId,
             char[] buffer)
             throws DataChannelConnectionException,
                    AgentControllerUnavailableException
send the given data buffer to the given destination This method is used by the Remote Agent on the AgentController to send the data to the Client

Parameters:
targetInstanceId - - send data to the target connection id
buffer - - data to be sent
Returns:
0 successful; non-zero error
Throws:
DataChannelConnectionException
AgentControllerUnavailableException

sendData

int sendData(int targetInstanceId,
             byte[] buffer)
             throws DataChannelConnectionException,
                    AgentControllerUnavailableException
send the given data buffer to the given destination This method is used by the Remote Agent on the AgentController to send the data to the Client

Parameters:
targetInstanceId - - send data to the target connection id
buffer - - data to be sent
Returns:
0 successful; non-zero error
Throws:
DataChannelConnectionException
AgentControllerUnavailableException

sendData

int sendData(int targetInstanceId,
             byte[] buffer,
             int offset,
             int length)
             throws DataChannelConnectionException,
                    AgentControllerUnavailableException
send the given data buffer to the given destination This method is used by the Remote Agent on the AgentController to send the data to the Client

Parameters:
targetInstanceId - - send data to the target connection id
buffer - - data to be sent
offset - - start offset in the data
length - - number of bytes to send
Returns:
0 successful; non-zero error
Throws:
DataChannelConnectionException
AgentControllerUnavailableException

receiveData

int receiveData(int sourceId,
                java.lang.String buffer,
                int bufferLength)
                throws DataChannelConnectionException,
                       AgentControllerUnavailableException
ReceiveData from the Client

Parameters:
sourceId -
buffer -
bufferLength -
Throws:
DataChannelConnectionException, - NotConnectedException
DataChannelConnectionException
AgentControllerUnavailableException

receiveData

int receiveData(int sourceId,
                byte[] buffer,
                int bufferLength)
                throws DataChannelConnectionException,
                       AgentControllerUnavailableException
ReceiveData from the Client

Parameters:
sourceId -
buffer -
bufferLength -
Throws:
DataChannelConnectionException, - NotConnectedException
DataChannelConnectionException
AgentControllerUnavailableException

waitForTermination

void waitForTermination()
This method is invoked by the Agent Controller if there are no referencing clients


getProcessID

long getProcessID()
Return the agent process id

Returns:
long agent process id

getConfigValue

java.lang.String getConfigValue()
Return the agent configuration information. This information is defined in the agent configuration file

Returns:
configuration value

getAgentName

java.lang.String getAgentName()
Return the agent name

Returns:
agent name

getAgentID

int getAgentID()
Return the agent connection id

Returns:
agent connection id

addEventListener

int addEventListener(java.lang.String eventsIID,
                     int listenerID,
                     int replyDest,
                     int replyContext)
Parameters:
eventsIID -
listenerID -
replyDest -
replyContext -
Returns:
int

removeEventListener

int removeEventListener(java.lang.String eventsIID,
                        int listenerID,
                        int replyDest,
                        int replyContext)
Parameters:
eventsIID -
listenerID -
replyDest -
replyContext -
Returns:
success or failure

getSupportedInterfaces

java.lang.String[] getSupportedInterfaces()
Return the list of interfaces serviced by the Agent

Returns:
list of interfaces serviced by the agent

setSupportedInterfaces

void setSupportedInterfaces(java.lang.String[] interfaceID)
Set the list of interfaces supported by the Agent, subclasses should override this method to customize their characteristics

Parameters:
interfaceID - set the interfaces supported by the agent

sendEventNotifications

int sendEventNotifications(ICommandFragment cmd)
                           throws AgentControllerUnavailableException
Parameters:
cmd - containing the command for event notification
Throws:
AgentControllerUnavailableException

processEventProviderCommands

int processEventProviderCommands(ICommandFragment cmd)
Sub classes should override this class for additional functionality

Parameters:
cmd -
Returns:
int

processDataProviderCommands

int processDataProviderCommands(ICommandFragment cmd)
Sub classes should override this class for additional functionality

Parameters:
cmd -
Returns:
int

addClient

void addClient(int clientConnId,
               TPTPAgentAccess accessMode)
Add the clients that are referecing this agent

Parameters:
clientConnId - - Add the client to the listener list
accessMode - - Agent Reference mode of the client

removeClient

void removeClient(int clientConnId)
Parameters:
clientConnId -

sendCommand

void sendCommand(java.lang.String outCommand)
                 throws AgentControllerUnavailableException
Parameters:
outCommand -
respHandler -
Throws:
AgentControllerUnavailableException

sendCommand

void sendCommand(ICommandFragment outCommand)
                 throws AgentControllerUnavailableException
Parameters:
outCommand -
respHandler - - Command handler to process the response
Throws:
AgentControllerUnavailableException

getUUID

java.lang.String getUUID()
Returns:
Agent UUID

processCommandLine

void processCommandLine(java.lang.String[] argv)

TPTP 4.5.0 Platform Project
Public API Specification