SMILA (incubation) API documentation

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

java.lang.Object
  extended by org.eclipse.smila.connectivity.framework.impl.AbstractController
      extended by org.eclipse.smila.connectivity.framework.impl.CrawlerControllerImpl
All Implemented Interfaces:
CrawlerController, ControllerCallback, CrawlerControllerCallback

public class CrawlerControllerImpl
extends AbstractController
implements CrawlerController, CrawlerControllerCallback

Basic Implementation of a CrawlerController.


Field Summary
 
Fields inherited from class org.eclipse.smila.connectivity.framework.impl.AbstractController
_lock
 
Fields inherited from interface org.eclipse.smila.connectivity.framework.CrawlerController
PERFORMANCE_AGENT_LOCATION
 
Constructor Summary
CrawlerControllerImpl()
          Default Constructor.
 
Method Summary
protected  void deactivate(ComponentContext context)
          DS deactivate method.
 java.util.Collection<java.lang.String> getAvailableConfigurations()
          returns all available Crawler data source configurations.
 java.util.Collection<java.lang.String> getAvailableCrawlers()
          returns the CrawlerController known Crawlers.
 CrawlerPerformanceCounterHelper<? extends ConnectivityPerformanceAgent> getCrawlerCounterHelper(java.lang.String dataSourceId)
           
 java.util.Map<java.lang.String,CrawlState> getCrawlerTasksState()
          Gets the status of all crawler tasks as a map of data source id and crawler state.
 boolean hasActiveCrawls()
          Checks if there are any active crawls.
 int startCrawl(java.lang.String dataSourceId, java.lang.String jobName)
          Starts a crawl of the given dataSourceId.
 void stopCrawl(java.lang.String dataSourceId)
          Stops an active crawl of the given dataSourceId.
 void unregister(java.lang.String dataSourceId)
          Removes a CrawlThread for the given DataSourceId from the list of active CrawlThreads.
 
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
 
Methods inherited from interface org.eclipse.smila.connectivity.framework.util.ControllerCallback
doCheckForUpdate, doDeltaDelete, doDeltaIndexing
 

Constructor Detail

CrawlerControllerImpl

public CrawlerControllerImpl()
Default Constructor.

Method Detail

getCrawlerCounterHelper

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

startCrawl

public int startCrawl(java.lang.String dataSourceId,
                      java.lang.String jobName)
               throws ConnectivityException
Starts a crawl of the given dataSourceId. This method creates a new Thread. If it is called for a dataSourceId that is currently crawled a ConnectivityException is thrown. Returns an id for this job, the hashCode of the crawler instance used for performance counter.

Specified by:
startCrawl in interface CrawlerController
Parameters:
dataSourceId - the ID of the data source to crawl
jobName - name of the job to push the crawled content to
Returns:
the crawl import run ID
Throws:
ConnectivityException - if any error occurs
See Also:
org.eclipse.smila.connectivity.framework.CrawlerController#startCrawl()

stopCrawl

public void stopCrawl(java.lang.String dataSourceId)
               throws ConnectivityException
Stops an active crawl of the given dataSourceId.

Specified by:
stopCrawl in interface CrawlerController
Parameters:
dataSourceId - the ID of the data source to stop the crawl
Throws:
ConnectivityException - if any error occurs
See Also:
CrawlerController.stopCrawl(java.lang.String)

hasActiveCrawls

public boolean hasActiveCrawls()
                        throws ConnectivityException
Checks if there are any active crawls.

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

getCrawlerTasksState

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

Specified by:
getCrawlerTasksState in interface CrawlerController
Returns:
a map of data source id and crawler state.
See Also:
org.eclipse.smila.connectivity.framework.CrawlerController#getAgentTasksState()

unregister

public void unregister(java.lang.String dataSourceId)
Removes a CrawlThread for the given DataSourceId from the list of active CrawlThreads.

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

getAvailableCrawlers

public java.util.Collection<java.lang.String> getAvailableCrawlers()
returns the CrawlerController known Crawlers.

Specified by:
getAvailableCrawlers in interface CrawlerController
Returns:
Collection with Strings
See Also:
CrawlerController.getAvailableCrawlers()

getAvailableConfigurations

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

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

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