org.apache.felix.http.whiteboard.internal.tracker
Class AbstractTracker<T>

java.lang.Object
  extended by org.osgi.util.tracker.ServiceTracker
      extended by org.apache.felix.http.whiteboard.internal.tracker.AbstractTracker<T>
All Implemented Interfaces:
ServiceTrackerCustomizer
Direct Known Subclasses:
FilterTracker, HttpContextTracker, HttpServiceTracker, ServletTracker

public abstract class AbstractTracker<T>
extends ServiceTracker


Field Summary
 
Fields inherited from class org.osgi.util.tracker.ServiceTracker
context, filter
 
Constructor Summary
AbstractTracker(BundleContext context, Class clz)
           
 
Method Summary
protected abstract  void added(T service, ServiceReference ref)
           
 Object addingService(ServiceReference ref)
          Default implementation of the ServiceTrackerCustomizer.addingService method.
protected abstract  void modified(T service, ServiceReference ref)
           
 void modifiedService(ServiceReference ref, Object service)
          Default implementation of the ServiceTrackerCustomizer.modifiedService method.
protected abstract  void removed(T service)
           
 void removedService(ServiceReference ref, Object service)
          Default implementation of the ServiceTrackerCustomizer.removedService method.
 
Methods inherited from class org.osgi.util.tracker.ServiceTracker
close, getService, getService, getServiceReference, getServiceReferences, getServices, getTrackingCount, open, open, remove, size, waitForService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTracker

public AbstractTracker(BundleContext context,
                       Class clz)
Method Detail

addingService

public final Object addingService(ServiceReference ref)
Description copied from class: ServiceTracker
Default implementation of the ServiceTrackerCustomizer.addingService method.

This method is only called when this ServiceTracker has been constructed with a null ServiceTrackerCustomizer argument.

This implementation returns the result of calling getService on the BundleContext with which this ServiceTracker was created passing the specified ServiceReference.

This method can be overridden in a subclass to customize the service object to be tracked for the service being added. In that case, take care not to rely on the default implementation of removedService to unget the service.

Specified by:
addingService in interface ServiceTrackerCustomizer
Overrides:
addingService in class ServiceTracker
Parameters:
ref - The reference to the service being added to this ServiceTracker.
Returns:
The service object to be tracked for the service added to this ServiceTracker.
See Also:
ServiceTrackerCustomizer.addingService(ServiceReference)

modifiedService

public final void modifiedService(ServiceReference ref,
                                  Object service)
Description copied from class: ServiceTracker
Default implementation of the ServiceTrackerCustomizer.modifiedService method.

This method is only called when this ServiceTracker has been constructed with a null ServiceTrackerCustomizer argument.

This implementation does nothing.

Specified by:
modifiedService in interface ServiceTrackerCustomizer
Overrides:
modifiedService in class ServiceTracker
Parameters:
ref - The reference to modified service.
service - The service object for the modified service.
See Also:
ServiceTrackerCustomizer.modifiedService(ServiceReference, Object)

removedService

public final void removedService(ServiceReference ref,
                                 Object service)
Description copied from class: ServiceTracker
Default implementation of the ServiceTrackerCustomizer.removedService method.

This method is only called when this ServiceTracker has been constructed with a null ServiceTrackerCustomizer argument.

This implementation calls ungetService, on the BundleContext with which this ServiceTracker was created, passing the specified ServiceReference.

This method can be overridden in a subclass. If the default implementation of addingService method was used, this method must unget the service.

Specified by:
removedService in interface ServiceTrackerCustomizer
Overrides:
removedService in class ServiceTracker
Parameters:
ref - The reference to removed service.
service - The service object for the removed service.
See Also:
ServiceTrackerCustomizer.removedService(ServiceReference, Object)

modified

protected abstract void modified(T service,
                                 ServiceReference ref)

added

protected abstract void added(T service,
                              ServiceReference ref)

removed

protected abstract void removed(T service)


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.