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

public class AgentControllerImpl
extends AbstractController
implements AgentController, AgentControllerCallback

Basic Implementation of a AgentController.


Field Summary
 
Fields inherited from interface org.eclipse.smila.connectivity.framework.AgentController
PERFORMANCE_AGENT_LOCATION
 
Constructor Summary
AgentControllerImpl()
          Default Constructor.
 
Method Summary
 void add(Record[] records)
          Add the given records.
 void delete(Id[] ids)
          Delete the given ids.
 java.util.Collection<java.lang.String> getActiveAgents()
          Returns a Collection of Strings containing the dataSourceIds of the currently active agents.
 java.util.Collection<java.lang.String> getAvailableAgents()
          returns the AgentController known Agents.
 AgentState getState(java.lang.String dataSourceId)
          Returns the AgentState of the agent with the given dataSourceId.
 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 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, getAvailableFactories, getCompoundManager, getConfiguration, getConnectivityManager, removeComponentFactory, setCompoundManager, setConnectivityManager, unsetCompoundManager, unsetConnectivityManager
 
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

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 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 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()

getActiveAgents

public java.util.Collection<java.lang.String> getActiveAgents()
                                                       throws ConnectivityException
Returns a Collection of Strings containing the dataSourceIds of the currently active agents.

Specified by:
getActiveAgents in interface AgentController
Returns:
a Collection of Strings containing the dataSourceIds
Throws:
ConnectivityException - if any error occurs
See Also:
AgentController.getActiveAgents()

getState

public AgentState getState(java.lang.String dataSourceId)
                    throws ConnectivityException
Returns the AgentState of the agent with the given dataSourceId.

Specified by:
getState in interface AgentController
Parameters:
dataSourceId - the ID of the data source to get the state
Returns:
the AgentState
Throws:
ConnectivityException - if any error occurs
See Also:
AgentController.getState(String)

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()

add

public void add(Record[] records)
Add the given records.

Specified by:
add in interface AgentControllerCallback
Parameters:
records - the records to add
See Also:
org.eclipse.smila.connectivity.framework.util.AgentControllerCallback#add(Record)

delete

public void delete(Id[] ids)
Delete the given ids.

Specified by:
delete in interface AgentControllerCallback
Parameters:
ids - the ids of the records to delete
See Also:
org.eclipse.smila.connectivity.framework.util.AgentControllerCallback#delete(Id)

unregister

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

Specified by:
unregister in interface AgentControllerCallback
Parameters:
dataSourceId - the ID of the data source used by the crawl
See Also:
AgentControllerCallback.unregister(java.lang.String)

SMILA (incubation) API documentation