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, JobFileAgent, 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.
protected  void deactivate(ComponentContext context)
          Deactivate 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  java.lang.String getSessionId()
          Returns the delta indexing session id.
protected abstract  void initialize()
          Method to contain initialization of the agent.
protected  boolean isStopThread()
          Returns the value of the flag _stopThread.
 void start(AgentControllerCallback controllerCallback, AgentState agentState, DataSourceConnectionConfig config, java.lang.String sessionId)
          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,
                  java.lang.String sessionId)
           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
agentState - the AgentState
config - the DataSourceConnectionConfig
sessionId - the delta indexing session id
Throws:
AgentException - if any error occurs
See Also:
Agent.start(AgentControllerCallback, AgentState, DataSourceConnectionConfig, String)

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 final AgentControllerCallback getControllerCallback()
Gets the AgentControllerCallback.

Returns:
the AgentControllerCallback

getConfig

protected final DataSourceConnectionConfig getConfig()
Gets the DataSourceConnectionConfig.

Returns:
the DataSourceConnectionConfig

getSessionId

protected final java.lang.String getSessionId()
Returns the delta indexing session id.

Returns:
the delta indexing session id

activate

protected void activate(ComponentContext context)
Activate the component.

Parameters:
context - the ComponentContext

deactivate

protected void deactivate(ComponentContext context)
Deactivate the component.

Parameters:
context - the ComponentContext

initialize

protected abstract void initialize()
                            throws AgentException
Method to contain initialization of the agent. Must be implemented by subclasses. This method is called just before the AgentThread is started.

Throws:
AgentException - if any error occurs

SMILA (incubation) API documentation