SMILA 1.0 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.


Field Summary
protected  org.apache.commons.logging.Log _log
          The logger.
protected  AgentPerformanceCounterHelper<ConnectivityPerformanceAgent> _performanceCounters
          The _counter helper.
 
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  long getAttachmentsByteLength(Record record)
          Gets the attachments bytes length.
protected  DataSourceConnectionConfig getConfig()
          Gets the DataSourceConnectionConfig.
protected  AgentControllerCallback getControllerCallback()
          Gets the AgentControllerCallback.
 AgentPerformanceCounterHelper<ConnectivityPerformanceAgent> getCounterHelper()
           
protected  java.lang.String getSessionId()
          Returns the delta indexing session id.
protected abstract  void initialize()
          Method to contain initialization of the agent.
protected  void initializePerformanceCounterHelper()
          creates a new AgentPerformanceCounterHelper instance.
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
 

Field Detail

_log

protected org.apache.commons.logging.Log _log
The logger.


_performanceCounters

protected AgentPerformanceCounterHelper<ConnectivityPerformanceAgent> _performanceCounters
The _counter helper.

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)

getCounterHelper

public AgentPerformanceCounterHelper<ConnectivityPerformanceAgent> getCounterHelper()
Specified by:
getCounterHelper in interface Agent
Returns:
the AgentPerformanceCounterHelper

initializePerformanceCounterHelper

protected void initializePerformanceCounterHelper()
creates a new AgentPerformanceCounterHelper instance.


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

getSessionId

protected 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

getAttachmentsByteLength

protected long getAttachmentsByteLength(Record record)
Gets the attachments bytes length.

Parameters:
record - the record
Returns:
the attachments size

SMILA 1.0 API documentation