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, AgentControllerCallback, ControllerCallback

public class AgentControllerImpl
extends AbstractController
implements AgentController, AgentControllerCallback

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)
          Add the given record.
protected  void deactivate(ComponentContext context)
          DS deactivate method.
 void delete(java.lang.String sessionId, DeltaIndexingType deltaIndexingType, ConnectivityId id)
          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.
 boolean hasActiveAgents()
          Checks if there are any active agents.
 int startAgent(java.lang.String dataSourceId)
          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)
          Removes the Agent using the given DataSourceId from the list of active Agents.
 
Methods inherited from class org.eclipse.smila.connectivity.framework.impl.AbstractController
addComponentFactory, 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
 
Methods inherited from interface org.eclipse.smila.connectivity.framework.util.ControllerCallback
doCheckForUpdate, doDeltaDelete, doDeltaIndexing
 

Constructor Detail

AgentControllerImpl

public AgentControllerImpl()
Default Constructor.

Method Detail

startAgent

public int startAgent(java.lang.String dataSourceId)
               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 job, the hashCode of the agent instance used for performance counter.

Specified by:
startAgent in interface AgentController
Parameters:
dataSourceId - the ID of the data source
Returns:
- the jobId (hashcode of the agent instance as int value)
Throws:
ConnectivityException - if any error occurs
See Also:
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)
Add the given record.

Specified by:
add in interface AgentControllerCallback
Parameters:
sessionId - the delta indexing session Id
deltaIndexingType - the DeltaIndexingType
record - the record to add
hash - the hash value used for delta indexing
See Also:
AgentControllerCallback.add(String, DeltaIndexingType, Record, String)

delete

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

Specified by:
delete in interface AgentControllerCallback
Parameters:
sessionId - the delta indexing session Id
deltaIndexingType - the DeltaIndexingType
id - the id of the record to delete
See Also:
org.eclipse.smila.connectivity.framework.util.AgentControllerCallback#delete(String, DeltaIndexingType, Id)

unregister

public void unregister(java.lang.String sessionId,
                       DeltaIndexingType deltaIndexingType,
                       java.lang.String dataSourceId)
Removes the Agent using the given DataSourceId from the list of active Agents.

Specified by:
unregister in interface AgentControllerCallback
Parameters:
sessionId - the delta indexing session Id
deltaIndexingType - the DeltaIndexingType
dataSourceId - the ID of the data source used by the crawl
See Also:
AgentControllerCallback.unregister(String, DeltaIndexingType, String)

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