SMILA (incubation) API documentation

org.eclipse.smila.connectivity.framework
Class AbstractAgent

java.lang.Object
  extended by org.eclipse.smila.connectivity.framework.AbstractAgent
All Implemented Interfaces:
java.lang.Runnable, Agent
Direct Known Subclasses:
FeedAgent, MockAgent

public abstract class AbstractAgent
extends java.lang.Object
implements Agent

Abstract base class for Agent implementations.


Constructor Summary
AbstractAgent()
          Default Constructor.
 
Method Summary
protected  void activate(ComponentContext context)
          Activate the component.
 java.lang.String getAgentId()
          Returns the Agent Id, which is the OSGi DecarativeService Component Name.
 AgentState getAgentState()
          Gets the AgentState.
protected  DataSourceConnectionConfig getConfig()
          Gets the DataSourceConnectionConfig.
protected  AgentControllerCallback getControllerCallback()
          Gets the AgentControllerCallback.
protected  boolean isStopThread()
          Returns the value of the flag _stopThread.
 void start(AgentControllerCallback controllerCallback, AgentState agentState, DataSourceConnectionConfig config)
          Starts the agent using the given configuration, creating a new internal thread.
 void stop()
          Stops the agent.
protected  void stopThread()
          Stops the agent thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Runnable
run
 

Constructor Detail

AbstractAgent

public AbstractAgent()
Default Constructor.

Method Detail

getAgentId

public java.lang.String getAgentId()
                            throws AgentException
Returns the Agent Id, which is the OSGi DecarativeService Component Name.

Specified by:
getAgentId in interface Agent
Returns:
the AgentId
Throws:
AgentException - if any error occurs

getAgentState

public AgentState getAgentState()
Gets the AgentState.

Returns:
the AgentState

start

public void start(AgentControllerCallback controllerCallback,
                  AgentState agentState,
                  DataSourceConnectionConfig config)
           throws AgentException
Starts the agent using the given configuration, creating a new internal thread.

Specified by:
start in interface Agent
Parameters:
controllerCallback - reference to the interface AgentControllerCallback
config - the DataSourceConnectionConfig
Throws:
AgentException - if any error occurs
See Also:
Agent.start(AgentControllerCallback, AgentState, DataSourceConnectionConfig)

stop

public void stop()
          throws AgentException
Stops the agent.

Specified by:
stop in interface Agent
Throws:
AgentException - if any error occurs
See Also:
Agent.stop()

isStopThread

protected boolean isStopThread()
Returns the value of the flag _stopThread.

Returns:
true if the thread is stopped, false otherwise

stopThread

protected void stopThread()
Stops the agent thread.


getControllerCallback

protected AgentControllerCallback getControllerCallback()
Gets the AgentControllerCallback.

Returns:
the AgentControllerCallback

getConfig

protected DataSourceConnectionConfig getConfig()
Gets the DataSourceConnectionConfig.

Returns:
the DataSourceConnectionConfig

activate

protected void activate(ComponentContext context)
Activate the component.

Parameters:
context - the ComponentContext

SMILA (incubation) API documentation