SMILA (incubation) API documentation

org.eclipse.smila.connectivity.framework.impl
Class AgentControllerImpl

java.lang.Object
  extended by org.eclipse.smila.connectivity.framework.impl.AbstractController
      extended by org.eclipse.smila.connectivity.framework.impl.AgentControllerImpl
All Implemented Interfaces:
AgentController

public class AgentControllerImpl
extends AbstractController
implements AgentController

Basic Implementation of a AgentController.


Field Summary
 
Fields inherited from class org.eclipse.smila.connectivity.framework.impl.AbstractController
_lock
 
Fields inherited from interface org.eclipse.smila.connectivity.framework.AgentController
PERFORMANCE_AGENT_LOCATION
 
Constructor Summary
AgentControllerImpl()
          Default Constructor.
 
Method Summary
 void add(java.lang.String sessionId, DeltaIndexingType deltaIndexingType, Record record, java.lang.String hash, java.lang.String jobName)
          Add the given record.
protected  void deactivate(ComponentContext context)
          DS deactivate method.
 void delete(java.lang.String sessionId, DeltaIndexingType deltaIndexingType, ConnectivityId id, java.lang.String jobName)
          Delete the given id.
 java.util.Map<java.lang.String,AgentState> getAgentTasksState()
          Gets the status of all agent tasks as a map of data source id and agent state.
 java.util.Collection<java.lang.String> getAvailableAgents()
          returns the AgentController known Agents.
 java.util.Collection<java.lang.String> getAvailableConfigurations()
          returns all available Agent data source configurations.
 AgentPerformanceCounterHelper<? extends ConnectivityPerformanceAgent> getPerformanceCounterHelper(java.lang.String dataSourceId)
           
 boolean hasActiveAgents()
          Checks if there are any active agents.
 int startAgent(java.lang.String dataSourceId, java.lang.String jobName)
          Starts an Agent using the given dataSourceId.
 void stopAgent(java.lang.String dataSourceId)
          Stops an active agent using the given dataSourceId.
 void unregister(java.lang.String sessionId, DeltaIndexingType deltaIndexingType, java.lang.String dataSourceId)
          
 
Methods inherited from class org.eclipse.smila.connectivity.framework.impl.AbstractController
addComponentFactory, assertNotEmpty, checkConfiguration, createInstance, doCheckForUpdate, doDeltaDelete, doDeltaIndexing, getAvailableFactories, getCompoundManager, getConfiguration, getConfigurations, getConnectivityManager, getDeltaIndexingManager, removeComponentFactory, setCompoundManager, setConnectivityManager, setDeltaIndexingManager, unsetCompoundManager, unsetConnectivityManager, unsetDeltaIndexingManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentControllerImpl

public AgentControllerImpl()
Default Constructor.

Method Detail

getPerformanceCounterHelper

public AgentPerformanceCounterHelper<? extends ConnectivityPerformanceAgent> getPerformanceCounterHelper(java.lang.String dataSourceId)
Specified by:
getPerformanceCounterHelper in interface AgentController
Returns:
CrawlerPerformanceCounterHelper for given data source id.

startAgent

public int startAgent(java.lang.String dataSourceId,
                      java.lang.String jobName)
               throws ConnectivityException
Starts an Agent using the given dataSourceId. This method creates a new Thread. If it is called for a dataSourceId that is currently used by another agent a ConnectivityException is thrown. Returns an id for this agent instance that can be used to identify the performance counters agents.

Specified by:
startAgent in interface AgentController
Parameters:
dataSourceId - the ID of the data source
jobName - name of the JobManager job to submit the records to.
Returns:
the agent import run ID.
Throws:
ConnectivityException - if any error occurs
See Also:
org.eclipse.smila.connectivity.framework.AgentController#startAgent(String)

stopAgent

public void stopAgent(java.lang.String dataSourceId)
               throws ConnectivityException
Stops an active agent using the given dataSourceId.

Specified by:
stopAgent in interface AgentController
Parameters:
dataSourceId - the ID of the data source
Throws:
ConnectivityException - if any error occurs
See Also:
AgentController.stopAgent(String)

hasActiveAgents

public boolean hasActiveAgents()
                        throws ConnectivityException
Checks if there are any active agents.

Specified by:
hasActiveAgents in interface AgentController
Returns:
true if there are active agents, false otherwise
Throws:
ConnectivityException - if any error occurs
See Also:
AgentController.hasActiveAgents()

getAgentTasksState

public java.util.Map<java.lang.String,AgentState> getAgentTasksState()
Gets the status of all agent tasks as a map of data source id and agent state.

Specified by:
getAgentTasksState in interface AgentController
Returns:
a map of data source id and agent state.
See Also:
AgentController.getAgentTasksState()

getAvailableAgents

public java.util.Collection<java.lang.String> getAvailableAgents()
returns the AgentController known Agents.

Specified by:
getAvailableAgents in interface AgentController
Returns:
Collection with Strings
See Also:
AgentController.getAvailableAgents()

getAvailableConfigurations

public java.util.Collection<java.lang.String> getAvailableConfigurations()
returns all available Agent data source configurations.

Specified by:
getAvailableConfigurations in interface AgentController
Returns:
List with Strings of all available Agent data source configurations
See Also:
AgentController.getAvailableConfigurations()

add

public void add(java.lang.String sessionId,
                DeltaIndexingType deltaIndexingType,
                Record record,
                java.lang.String hash,
                java.lang.String jobName)
         throws AgentCriticalException
Add the given record.

Parameters:
sessionId - the delta indexing session Id
deltaIndexingType - the DeltaIndexingType
record - the record to add
hash - the hash value used for delta indexing
jobName - JobManager job to submit record to.
Throws:
AgentCriticalException

delete

public void delete(java.lang.String sessionId,
                   DeltaIndexingType deltaIndexingType,
                   ConnectivityId id,
                   java.lang.String jobName)
            throws AgentCriticalException
Delete the given id.

Parameters:
sessionId - the delta indexing session Id
deltaIndexingType - the DeltaIndexingType
id - the id of the record to delete
jobName - JobManager job to submit record to.
Throws:
AgentCriticalException

unregister

public void unregister(java.lang.String sessionId,
                       DeltaIndexingType deltaIndexingType,
                       java.lang.String dataSourceId)


deactivate

protected void deactivate(ComponentContext context)
                   throws java.lang.Exception
DS deactivate method.

Parameters:
context - the ComponentContext
Throws:
java.lang.Exception - if any error occurs

SMILA (incubation) API documentation