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, CrawlerControllerCallback

public class CrawlerControllerImpl
extends AbstractController
implements CrawlerController, CrawlerControllerCallback

Basic Implementation of a CrawlerController.


Field Summary
 
Fields inherited from interface org.eclipse.smila.connectivity.framework.CrawlerController
PERFORMANCE_AGENT_LOCATION
 
Constructor Summary
CrawlerControllerImpl()
          Default Constructor.
 
Method Summary
 java.util.Collection<java.lang.String> getActiveCrawls()
          Returns a Collection of Strings containing the dataSourceIds of the currently active crawls.
 java.util.Collection<java.lang.String> getAvailableCrawlers()
          returns the CrawlerController known Crawlers.
 CrawlState getState(java.lang.String dataSourceId)
          Returns the CrawlState of the crawl with the given dataSourceId.
 boolean hasActiveCrawls()
          Checks if there are any active crawls.
 int startCrawl(java.lang.String dataSourceId)
          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, 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

CrawlerControllerImpl

public CrawlerControllerImpl()
Default Constructor.

Method Detail

startCrawl

public int startCrawl(java.lang.String dataSourceId)
               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 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
Returns:
- the hashcode of the crawler instance as int value
Throws:
ConnectivityException - if any error occurs
See Also:
CrawlerController.startCrawl(java.lang.String)

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

getActiveCrawls

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

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

getState

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

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

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

SMILA (incubation) API documentation