SMILA 1.0 API documentation

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

java.lang.Object
  extended by org.eclipse.smila.connectivity.framework.impl.AbstractController
Direct Known Subclasses:
AgentControllerImpl, CrawlerControllerImpl

public abstract class AbstractController
extends java.lang.Object

Base class for Crawler- and AgentController. Contains shared functionality.


Field Summary
protected  java.util.concurrent.locks.ReadWriteLock _lock
          service methods use read lock, deactivate needs write lock.
 
Constructor Summary
AbstractController()
           
 
Method Summary
 void addComponentFactory(ComponentFactory factory)
          Adds a ComponentFactory to the internal List of ComponentFactory.
protected  void assertNotEmpty(java.lang.String parameterValue, java.lang.String parameterName)
           
protected  void checkConfiguration(DataSourceConnectionConfig configuration)
          check if configuration contains hash and key attributes.
protected
<T> T
createInstance(java.lang.Class<T> clazz, java.lang.String componentId)
          Returns a new Crawler or Agent instance for the given componentId.
 boolean doCheckForUpdate(DeltaIndexingType deltaIndexingType)
          
 boolean doDeltaDelete(DeltaIndexingType deltaIndexingType)
          
 boolean doDeltaIndexing(DeltaIndexingType deltaIndexingType)
          
protected  java.util.Collection<java.lang.String> getAvailableFactories()
          Returns the component names of all available ComponentFactories.
 CompoundManager getCompoundManager()
           
protected  DataSourceConnectionConfig getConfiguration(java.lang.String bundleId, java.lang.String dataSourceId)
          Returns the DataSourceConnectionConfig for the given dataSourceId.
protected  java.util.Collection<java.lang.String> getConfigurations(java.lang.String bundleId, DataConnectionID.DataConnectionType type)
          Returns the data source ids of all available configurations of a given DataConnectionType.
 ConnectivityManager getConnectivityManager()
           
 DeltaIndexingManager getDeltaIndexingManager()
           
 void removeComponentFactory(ComponentFactory factory)
          Removes a ComponentFactory from the internal List of ComponentFactory.
 void setCompoundManager(CompoundManager compoundManager)
          Sets the compoundManager.
 void setConnectivityManager(ConnectivityManager connectivityManager)
          Sets the ConnectivityManager.
 void setDeltaIndexingManager(DeltaIndexingManager diManager)
          Sets the DeltaIndexingManager.
 void unsetCompoundManager(CompoundManager compoundManager)
          Set the compoundManager to null.
 void unsetConnectivityManager(ConnectivityManager connectivityManager)
          Set the _connectivityManager to null.
 void unsetDeltaIndexingManager(DeltaIndexingManager diManager)
          Unsets the DeltaIndexingManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_lock

protected final java.util.concurrent.locks.ReadWriteLock _lock
service methods use read lock, deactivate needs write lock.

Constructor Detail

AbstractController

public AbstractController()
Method Detail

getConnectivityManager

public ConnectivityManager getConnectivityManager()
Returns:
the connectivityManager

setConnectivityManager

public void setConnectivityManager(ConnectivityManager connectivityManager)
Sets the ConnectivityManager. Used by OSGi Declarative Services.

Parameters:
connectivityManager - the connectivityManager to set

unsetConnectivityManager

public void unsetConnectivityManager(ConnectivityManager connectivityManager)
Set the _connectivityManager to null. Used by OSGi Declarative Services.

Parameters:
connectivityManager - the connectivityManager to unset

getDeltaIndexingManager

public DeltaIndexingManager getDeltaIndexingManager()
Returns:
the DeltaIndexingManager

setDeltaIndexingManager

public void setDeltaIndexingManager(DeltaIndexingManager diManager)
Sets the DeltaIndexingManager. Used by OSGi.

Parameters:
diManager - the DeltaIndexingManager to set

unsetDeltaIndexingManager

public void unsetDeltaIndexingManager(DeltaIndexingManager diManager)
Unsets the DeltaIndexingManager. Used by OSGi.

Parameters:
diManager - the DeltaIndexingManager to unset

getCompoundManager

public CompoundManager getCompoundManager()
Returns:
the compoundManager

setCompoundManager

public void setCompoundManager(CompoundManager compoundManager)
Sets the compoundManager. Used by OSGi Declarative Services.

Parameters:
compoundManager - the compoundManager to set

unsetCompoundManager

public void unsetCompoundManager(CompoundManager compoundManager)
Set the compoundManager to null. Used by OSGi Declarative Services.

Parameters:
compoundManager - the compoundManager to unset

addComponentFactory

public void addComponentFactory(ComponentFactory factory)
Adds a ComponentFactory to the internal List of ComponentFactory. Used by OSGi Declarative Services.

Parameters:
factory - the ComponentFactory to add

removeComponentFactory

public void removeComponentFactory(ComponentFactory factory)
Removes a ComponentFactory from the internal List of ComponentFactory. Used by OSGi Declarative Services.

Parameters:
factory - the ComponentFactory to remove

getAvailableFactories

protected java.util.Collection<java.lang.String> getAvailableFactories()
Returns the component names of all available ComponentFactories.

Returns:
a Collection with the component names of all available ComponentFactories.

createInstance

protected <T> T createInstance(java.lang.Class<T> clazz,
                               java.lang.String componentId)
                    throws ConnectivityException
Returns a new Crawler or Agent instance for the given componentId. Uses a ComponentFactory to create new instances.

Type Parameters:
T - the return type
Parameters:
clazz - the class of the created instance (Agent or Crawler)
componentId - the Id of the Crawler or Agent
Returns:
the an Instance of type T
Throws:
ConnectivityException - if no ComponentFactory instance with the given Id could be created

getConfiguration

protected DataSourceConnectionConfig getConfiguration(java.lang.String bundleId,
                                                      java.lang.String dataSourceId)
                                               throws ConnectivityException
Returns the DataSourceConnectionConfig for the given dataSourceId.

Parameters:
bundleId - the id of the bundle
dataSourceId - the Id of the data source
Returns:
the DataSourceConnectionConfig
Throws:
ConnectivityException - if no DataSource with the given Id exists

checkConfiguration

protected void checkConfiguration(DataSourceConnectionConfig configuration)
                           throws ConnectivityException
check if configuration contains hash and key attributes.

Throws:
ConnectivityException

getConfigurations

protected java.util.Collection<java.lang.String> getConfigurations(java.lang.String bundleId,
                                                                   DataConnectionID.DataConnectionType type)
Returns the data source ids of all available configurations of a given DataConnectionType.

Parameters:
bundleId - the id of the bundle
type - the DataConnectionType
Returns:
a Collection of Strings containing the data source ids

assertNotEmpty

protected void assertNotEmpty(java.lang.String parameterValue,
                              java.lang.String parameterName)
Throws:
java.lang.IllegalArgumentException - if parameter is null or empty

doCheckForUpdate

public boolean doCheckForUpdate(DeltaIndexingType deltaIndexingType)

See Also:
ControllerCallback.doCheckForUpdate(DeltaIndexingType)

doDeltaIndexing

public boolean doDeltaIndexing(DeltaIndexingType deltaIndexingType)

See Also:
ControllerCallback.doDeltaIndexing(DeltaIndexingType)

doDeltaDelete

public boolean doDeltaDelete(DeltaIndexingType deltaIndexingType)

See Also:
ControllerCallback.doDeltaDelete(DeltaIndexingType)

SMILA 1.0 API documentation