SMILA 1.0 API documentation

org.eclipse.smila.processing
Class PipeletTrackerImpl

java.lang.Object
  extended by org.eclipse.smila.processing.PipeletTrackerImpl
All Implemented Interfaces:
PipeletTracker

public class PipeletTrackerImpl
extends java.lang.Object
implements PipeletTracker

Implementation of PipeletTracker service. Registered as a OSGi services by DS. It works as a SynchronousBundleListener to get notified about starting and stopping bundles.

Author:
jschumacher

Field Summary
 
Fields inherited from interface org.eclipse.smila.processing.PipeletTracker
KEY_CLASS, KEY_ERRORS, KEY_PARAMETERS
 
Constructor Summary
PipeletTrackerImpl()
           
 
Method Summary
protected  void activate(ComponentContext componentContext)
          activate declarative service.
 void addListener(PipeletTrackerListener listener)
          add a listener that will be notified about new or deactivated pipelet classes on bundle changes.
 void bundleChanged(BundleEvent event)
          Check newly resolved or stopping bundles for contained Pipelets.
protected  void checkPipeletDescription(java.util.Map<java.lang.String,java.lang.Class<? extends Pipelet>> pipeletClasses, AnyMap pipeletDescriptionAny, java.lang.String pipeletClassName)
          Checks the pipelet descriptions.
protected  void deactivate(ComponentContext componentContext)
          deactivate declarative service.
 java.util.Map<java.lang.String,AnyMap> getRegisteredPipeletDescriptions()
          get the description of all currently registered pipelets.
 java.util.Map<java.lang.String,java.lang.Class<? extends Pipelet>> getRegisteredPipelets()
          get all currently registered pipelets.
 void removeListener(PipeletTrackerListener listener)
          remove a listener that will be notified about new or deactivated pipelet classes on bundle changes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PipeletTrackerImpl

public PipeletTrackerImpl()
Method Detail

getRegisteredPipelets

public java.util.Map<java.lang.String,java.lang.Class<? extends Pipelet>> getRegisteredPipelets()
get all currently registered pipelets.

Specified by:
getRegisteredPipelets in interface PipeletTracker
Returns:
map of class names to pipelet classes.
See Also:
PipeletTracker.getRegisteredPipelets()

getRegisteredPipeletDescriptions

public java.util.Map<java.lang.String,AnyMap> getRegisteredPipeletDescriptions()
get the description of all currently registered pipelets.

Specified by:
getRegisteredPipeletDescriptions in interface PipeletTracker
Returns:
map of class names to pipelet descriptions.

addListener

public void addListener(PipeletTrackerListener listener)
add a listener that will be notified about new or deactivated pipelet classes on bundle changes. This is also set as a service reference bind method in component descriptor, so the suggested way to use this is to register PipeletListener service instead of calling the method directly.

Specified by:
addListener in interface PipeletTracker
Parameters:
listener - a new listener for PipeletTracker events.
See Also:
#addListener(org.eclipse.smila.processing.PipeletTrackerListener)

removeListener

public void removeListener(PipeletTrackerListener listener)
remove a listener that will be notified about new or deactivated pipelet classes on bundle changes. This is also set as a service reference unbind method in component descriptor, so the suggested way to use this is to register PipeletListener service instead of calling the method directly.

Specified by:
removeListener in interface PipeletTracker
Parameters:
listener - an obsolete listener for PipeletTracker events.
See Also:
#removeListener(org.eclipse.smila.processing.PipeletTrackerListener)

activate

protected void activate(ComponentContext componentContext)
activate declarative service. It registers the services a bundle listener and searches all currently active bundles for pipelets and notifies all currently known listeners.

Parameters:
componentContext - service component context.

deactivate

protected void deactivate(ComponentContext componentContext)
deactivate declarative service. Removes this as a bundle listener.

Parameters:
componentContext - service component context.

bundleChanged

public void bundleChanged(BundleEvent event)
Check newly resolved or stopping bundles for contained Pipelets.

See Also:
org.osgi.framework.BundleListener#bundleChanged(org.osgi.framework.BundleEvent)

checkPipeletDescription

protected void checkPipeletDescription(java.util.Map<java.lang.String,java.lang.Class<? extends Pipelet>> pipeletClasses,
                                       AnyMap pipeletDescriptionAny,
                                       java.lang.String pipeletClassName)
Checks the pipelet descriptions. If they define pipelets that could not be loaded or if the parameters section has invalid syntax a sequence of "errors" is attached to the description.

Parameters:
pipeletClasses - the map of detected and loaded pipelet classes (up to now)
pipeletDescriptionAny - the pipelet's description
pipeletClassName - the class name of the pipelet

SMILA 1.0 API documentation