TPTP 4.6.0 Platform Project
Internal API Specification

org.eclipse.tptp.platform.execution.client.agent.internal
Class AgentImpl

java.lang.Object
  extended by org.eclipse.tptp.platform.execution.client.agent.internal.AgentImpl
All Implemented Interfaces:
org.eclipse.tptp.platform.execution.client.agent.IAgent, IConnectionListener, IProcessListener
Direct Known Subclasses:
CollectorImpl, FileTransferManagerImpl

public class AgentImpl
extends java.lang.Object
implements org.eclipse.tptp.platform.execution.client.agent.IAgent, IProcessListener, IConnectionListener


Field Summary
protected  AgentState _agentState
           
protected  boolean _autoAttach
           
protected  org.eclipse.tptp.platform.execution.client.core.IDataProcessor _dataProcessor
           
protected  boolean _isActive
           
protected  java.util.Vector _listeners
           
protected  java.lang.String _name
           
protected  org.eclipse.tptp.platform.execution.client.core.IProcess _process
           
protected  java.lang.String _profileFile
           
protected  java.lang.String _type
           
protected  java.lang.String _uuid
           
protected  java.lang.String _version
           
protected  java.lang.String agentMetadata
           
protected  org.eclipse.tptp.platform.execution.util.TPTPAgentAccess agentMode
           
 
Constructor Summary
AgentImpl()
           
AgentImpl(java.lang.String name)
           
AgentImpl(java.lang.String name, java.lang.String type)
           
 
Method Summary
 void addAgentListener(org.eclipse.tptp.platform.execution.client.agent.IAgentListener listener)
           
 int addDataListener(org.eclipse.tptp.platform.execution.client.core.IDataProcessor dataProcessor)
           
 long addEventListener(java.lang.String interfaceID, org.eclipse.tptp.platform.execution.util.ICommandHandler listener)
          Add a listener for agent events
 void attach()
           
 void connectionClosed(IConnection connection)
          Invoked when a connection is lost.
 void detach()
           
 org.eclipse.tptp.platform.execution.client.core.IAgentController getAgentController()
           
 int getAgentInstanceId()
          Retrieve the instance id of this agent.
 java.util.Vector getAgentListener()
           
 java.lang.String getAgentMetaData()
           
 int getAgentMode()
           
 int getAgentTokenId()
          Retrieve the instance id of this agent.
 java.lang.String getName()
           
 org.eclipse.tptp.platform.execution.client.core.IProcess getProcess()
          Get the Process assocites with Agent
 java.lang.String[] getSupportedInterfaces()
           
 java.lang.String getType()
           
 java.lang.String getUUID()
           
 java.lang.String getVersion()
          Retrieve the version of this agent.
 void handleAgentCommand(org.eclipse.tptp.platform.execution.util.ICommandElement command)
          This is the local handler for
 boolean isActive()
           
 boolean isAttached()
           
 boolean isAttached(boolean remote)
           
 boolean isAutoAttach()
           
 boolean isMonitored()
           
 void processExited(org.eclipse.tptp.platform.execution.client.core.IProcess process)
          Invoked when a process that was previously launched exits.The process parameter contains all the information regarding the process.
 void processLaunched(org.eclipse.tptp.platform.execution.client.core.IProcess process)
          Invoked when a process is launched.
 int receiveData(char[] buffer)
           
 void releaseAccess()
           
 void releaseControl()
           
 void removeAgentListener(org.eclipse.tptp.platform.execution.client.agent.IAgentListener listener)
           
 void removeEventListener(java.lang.String interfaceID, long listenerID)
          Remove a listener for agent events
 boolean requestAccess(org.eclipse.tptp.platform.execution.util.TPTPAgentAccess accessMode)
           
 boolean requestControl()
           
 void sendCommand(org.eclipse.tptp.platform.execution.util.ICommandElement outCommand, org.eclipse.tptp.platform.execution.util.ICommandHandler respHandler)
          Send the command
 void sendCommand(java.lang.String outCommand, org.eclipse.tptp.platform.execution.util.ICommandHandler respHandler)
          Send the command
 void sendData(byte[] buffer)
           
 void sendData(byte[] buffer, int bufferLength)
           
 void sendDataWithoutDime(byte[] buffer, int bufferLength)
           
 void setAgentController(org.eclipse.tptp.platform.execution.client.core.IAgentController ac)
           
 void setAgentInstanceId(int id)
          Change the agent instance's id
 void setAgentMode(org.eclipse.tptp.platform.execution.util.TPTPAgentAccess agentMode)
          Get the Agent reference mode - Observer or Controller
 void setAgentTokenId(int id)
          Change the agent instance's id
 void setName(java.lang.String name)
          Change the name of the agent
 void setProcess(org.eclipse.tptp.platform.execution.client.core.IProcess process)
          Set the Process associated with Agent
 void setType(java.lang.String type)
          Change the type of the agent
 void setUUID(java.lang.String uuid)
           
 void setVersion(java.lang.String version)
          Set the Agent version
 void startMonitoring(org.eclipse.tptp.platform.execution.client.core.IDataProcessor processor)
           
 void startMonitoring(org.eclipse.tptp.platform.execution.util.TPTPDataPath direction)
           
 void startMonitoring(org.eclipse.tptp.platform.execution.util.TPTPDataPath direction, org.eclipse.tptp.platform.execution.client.core.IDataProcessor processor)
           
 void stopMonitoring()
           
 void stopMonitoring(org.eclipse.tptp.platform.execution.client.core.IDataProcessor processor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_name

protected java.lang.String _name

_type

protected java.lang.String _type

_uuid

protected java.lang.String _uuid

_version

protected java.lang.String _version

_autoAttach

protected boolean _autoAttach

_isActive

protected boolean _isActive

_profileFile

protected java.lang.String _profileFile

_process

protected org.eclipse.tptp.platform.execution.client.core.IProcess _process

agentMetadata

protected java.lang.String agentMetadata

agentMode

protected org.eclipse.tptp.platform.execution.util.TPTPAgentAccess agentMode

_listeners

protected java.util.Vector _listeners

_agentState

protected AgentState _agentState

_dataProcessor

protected org.eclipse.tptp.platform.execution.client.core.IDataProcessor _dataProcessor
Constructor Detail

AgentImpl

public AgentImpl()

AgentImpl

public AgentImpl(java.lang.String name)

AgentImpl

public AgentImpl(java.lang.String name,
                 java.lang.String type)
Method Detail

getAgentController

public org.eclipse.tptp.platform.execution.client.core.IAgentController getAgentController()

setAgentController

public void setAgentController(org.eclipse.tptp.platform.execution.client.core.IAgentController ac)

addAgentListener

public void addAgentListener(org.eclipse.tptp.platform.execution.client.agent.IAgentListener listener)
Specified by:
addAgentListener in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
See Also:
Agent#addAgentListener(AgentListener)

removeAgentListener

public void removeAgentListener(org.eclipse.tptp.platform.execution.client.agent.IAgentListener listener)
See Also:
Agent#removeAgentListener(AgentListener)

getAgentListener

public java.util.Vector getAgentListener()
Specified by:
getAgentListener in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
See Also:
Agent#removeAgentListener(AgentListener)

setType

public void setType(java.lang.String type)
Change the type of the agent

Parameters:
type - value of the new type

setName

public void setName(java.lang.String name)
Change the name of the agent

Parameters:
name - the new agent's name

getAgentInstanceId

public int getAgentInstanceId()
Retrieve the instance id of this agent.

Returns:
the id of the agent if it is known, negative if it is not assigned yet

setAgentInstanceId

public void setAgentInstanceId(int id)
Change the agent instance's id

Parameters:
uuid - the new uuid's value

getAgentTokenId

public int getAgentTokenId()
Retrieve the instance id of this agent.

Returns:
the id of the agent if it is known, negative if it is not assigned yet

setAgentTokenId

public void setAgentTokenId(int id)
Change the agent instance's id

Parameters:
uuid - the new uuid's value

getVersion

public java.lang.String getVersion()
Retrieve the version of this agent.

Returns:
the version

setVersion

public void setVersion(java.lang.String version)
Set the Agent version

Parameters:
version - the new version number

setProcess

public void setProcess(org.eclipse.tptp.platform.execution.client.core.IProcess process)
Set the Process associated with Agent

Specified by:
setProcess in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
Parameters:
version - the new version number

getProcess

public org.eclipse.tptp.platform.execution.client.core.IProcess getProcess()
Get the Process assocites with Agent

Specified by:
getProcess in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
Parameters:
version - the new version number

addEventListener

public long addEventListener(java.lang.String interfaceID,
                             org.eclipse.tptp.platform.execution.util.ICommandHandler listener)
Add a listener for agent events

Specified by:
addEventListener in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
Parameters:
listener - to handle the event notification

removeEventListener

public void removeEventListener(java.lang.String interfaceID,
                                long listenerID)
Remove a listener for agent events

Specified by:
removeEventListener in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
Parameters:
listener - to handle the event notification

sendCommand

public void sendCommand(org.eclipse.tptp.platform.execution.util.ICommandElement outCommand,
                        org.eclipse.tptp.platform.execution.util.ICommandHandler respHandler)
                 throws org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException
Send the command

Specified by:
sendCommand in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
Parameters:
outCommand - the command to send out
handler - processing the response of the command
Throws:
org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException

sendCommand

public void sendCommand(java.lang.String outCommand,
                        org.eclipse.tptp.platform.execution.util.ICommandHandler respHandler)
                 throws org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException
Send the command

Specified by:
sendCommand in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
Parameters:
outCommand - the command to send out
handler - processing the response of the command
Throws:
org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException

isAutoAttach

public boolean isAutoAttach()
See Also:
Agent#isAutoAttach(boolean)

getType

public java.lang.String getType()
See Also:
Agent#getType()

getName

public java.lang.String getName()
Specified by:
getName in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
See Also:
Agent#getName()

getUUID

public java.lang.String getUUID()
See Also:
Agent#getUUID()

isActive

public boolean isActive()
See Also:
Agent#isActive()

isMonitored

public boolean isMonitored()
Specified by:
isMonitored in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
See Also:
Agent#isMonitored()

addDataListener

public int addDataListener(org.eclipse.tptp.platform.execution.client.core.IDataProcessor dataProcessor)
Specified by:
addDataListener in interface org.eclipse.tptp.platform.execution.client.agent.IAgent

startMonitoring

public void startMonitoring(org.eclipse.tptp.platform.execution.util.TPTPDataPath direction)
Specified by:
startMonitoring in interface org.eclipse.tptp.platform.execution.client.agent.IAgent

startMonitoring

public void startMonitoring(org.eclipse.tptp.platform.execution.util.TPTPDataPath direction,
                            org.eclipse.tptp.platform.execution.client.core.IDataProcessor processor)
                     throws org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException
Specified by:
startMonitoring in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
Throws:
org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException
See Also:
Agent#startMonitoring()

startMonitoring

public void startMonitoring(org.eclipse.tptp.platform.execution.client.core.IDataProcessor processor)
                     throws org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException
Specified by:
startMonitoring in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
Throws:
org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException
See Also:
Agent#startMonitoring()

stopMonitoring

public void stopMonitoring(org.eclipse.tptp.platform.execution.client.core.IDataProcessor processor)
                    throws org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException
Throws:
org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException
See Also:
Agent#startMonitoring()

stopMonitoring

public void stopMonitoring()
                    throws org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException
Specified by:
stopMonitoring in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
Throws:
org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException
See Also:
Agent#stopMonitoring()

sendData

public void sendData(byte[] buffer,
                     int bufferLength)
              throws org.eclipse.tptp.platform.execution.exceptions.DataChannelConnectionException
Throws:
org.eclipse.tptp.platform.execution.exceptions.DataChannelConnectionException

sendDataWithoutDime

public void sendDataWithoutDime(byte[] buffer,
                                int bufferLength)
                         throws org.eclipse.tptp.platform.execution.exceptions.DataChannelConnectionException
Throws:
org.eclipse.tptp.platform.execution.exceptions.DataChannelConnectionException

sendData

public void sendData(byte[] buffer)
              throws org.eclipse.tptp.platform.execution.exceptions.DataChannelConnectionException
Specified by:
sendData in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
Throws:
org.eclipse.tptp.platform.execution.exceptions.DataChannelConnectionException

releaseAccess

public void releaseAccess()
Specified by:
releaseAccess in interface org.eclipse.tptp.platform.execution.client.agent.IAgent

requestControl

public boolean requestControl()
Specified by:
requestControl in interface org.eclipse.tptp.platform.execution.client.agent.IAgent

releaseControl

public void releaseControl()
Specified by:
releaseControl in interface org.eclipse.tptp.platform.execution.client.agent.IAgent

setUUID

public void setUUID(java.lang.String uuid)

handleAgentCommand

public void handleAgentCommand(org.eclipse.tptp.platform.execution.util.ICommandElement command)
This is the local handler for


processLaunched

public void processLaunched(org.eclipse.tptp.platform.execution.client.core.IProcess process)
Description copied from interface: IProcessListener
Invoked when a process is launched. The process parameter contains all the information regarding the process.

Specified by:
processLaunched in interface IProcessListener
See Also:
ProcessListener#processLaunched

processExited

public void processExited(org.eclipse.tptp.platform.execution.client.core.IProcess process)
Description copied from interface: IProcessListener
Invoked when a process that was previously launched exits.The process parameter contains all the information regarding the process.

Specified by:
processExited in interface IProcessListener
See Also:
ProcessListener#processExited

connectionClosed

public void connectionClosed(IConnection connection)
Description copied from interface: IConnectionListener
Invoked when a connection is lost. A connection could be lost due to any number of errors.

Specified by:
connectionClosed in interface IConnectionListener

attach

public void attach()
            throws org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException,
                   org.eclipse.tptp.platform.execution.exceptions.InactiveProcessException
Throws:
org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException
org.eclipse.tptp.platform.execution.exceptions.InactiveProcessException
See Also:
Agent#attach()

detach

public void detach()
            throws org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException,
                   org.eclipse.tptp.platform.execution.exceptions.InactiveProcessException
Throws:
org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException
org.eclipse.tptp.platform.execution.exceptions.InactiveProcessException
See Also:
Agent#detach()

isAttached

public boolean isAttached()
See Also:
Agent#isAttached()

isAttached

public boolean isAttached(boolean remote)
See Also:
Agent#isAttached()

receiveData

public int receiveData(char[] buffer)
                throws org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException,
                       org.eclipse.tptp.platform.execution.exceptions.NotConnectedException
Specified by:
receiveData in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
Throws:
org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException
org.eclipse.tptp.platform.execution.exceptions.NotConnectedException

getSupportedInterfaces

public java.lang.String[] getSupportedInterfaces()
Specified by:
getSupportedInterfaces in interface org.eclipse.tptp.platform.execution.client.agent.IAgent

getAgentMetaData

public java.lang.String getAgentMetaData()
                                  throws org.eclipse.tptp.platform.execution.exceptions.NotConnectedException
Specified by:
getAgentMetaData in interface org.eclipse.tptp.platform.execution.client.agent.IAgent
Throws:
org.eclipse.tptp.platform.execution.exceptions.NotConnectedException

getAgentMode

public int getAgentMode()
Specified by:
getAgentMode in interface org.eclipse.tptp.platform.execution.client.agent.IAgent

setAgentMode

public void setAgentMode(org.eclipse.tptp.platform.execution.util.TPTPAgentAccess agentMode)
Get the Agent reference mode - Observer or Controller


requestAccess

public boolean requestAccess(org.eclipse.tptp.platform.execution.util.TPTPAgentAccess accessMode)
Specified by:
requestAccess in interface org.eclipse.tptp.platform.execution.client.agent.IAgent

TPTP 4.6.0 Platform Project
Internal API Specification