org.ops4j.pax.coin.repository
Class AbstractTracker<T,U>

java.lang.Object
  extended by org.ops4j.pax.coin.repository.AbstractTracker<T,U>
Direct Known Subclasses:
ConfigPluginTracker, ConfigProviderTracker, ResourceScannerTracker

public class AbstractTracker<T,U>
extends Object

Tracks services in OSGi Service Registry and registers/unregisters them with a configured repository.

Since:
0.3.0, February 27, 2008
Author:
Alin Dreghiciu

Constructor Summary
AbstractTracker(org.osgi.framework.BundleContext bundleContext, Repository<T> repository, Class<U> clazz, String name)
          Constructor.
 
Method Summary
protected  T create(org.osgi.framework.ServiceReference reference, Object service)
          Creates the object of repository type from the service.
 void start()
          Starts tracking.
 void stop()
          Stops tracking.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTracker

public AbstractTracker(org.osgi.framework.BundleContext bundleContext,
                       Repository<T> repository,
                       Class<U> clazz,
                       String name)
Constructor.

Parameters:
bundleContext - bundle context
repository - repository
clazz - class of tracked services
name - name tracked service type.
Throws:
org.ops4j.lang.NullArgumentException - - If bundle context is null - If repository is null - If clazz is null - If name is null or empty
Method Detail

start

public void start()
Starts tracking.


stop

public void stop()
Stops tracking.


create

protected T create(org.osgi.framework.ServiceReference reference,
                   Object service)
Creates the object of repository type from the service.

Parameters:
reference - service refrence of the tracked service
service - tracked service
Returns:
created object


Copyright © 2006-2012 OPS4J - Open Participation Software for Java. All Rights Reserved.