org.apache.felix.example.servicebased.host
Class ShapeTracker

java.lang.Object
  extended by org.osgi.util.tracker.ServiceTracker
      extended by org.apache.felix.example.servicebased.host.ShapeTracker
All Implemented Interfaces:
org.osgi.util.tracker.ServiceTrackerCustomizer

public class ShapeTracker
extends org.osgi.util.tracker.ServiceTracker

Extends the ServiceTracker to create a tracker for SimpleShape services. The tracker is responsible for listener for the arrival/departure of SimpleShape services and informing the application about the availability of shapes. This tracker forces all notifications to be processed on the Swing event thread to avoid synchronization and redraw issues.


Field Summary
 
Fields inherited from class org.osgi.util.tracker.ServiceTracker
context, filter
 
Constructor Summary
ShapeTracker(org.osgi.framework.BundleContext context, DrawingFrame frame)
          Constructs a tracker that uses the specified bundle context to track services and notifies the specified application object about changes.
 
Method Summary
 java.lang.Object addingService(org.osgi.framework.ServiceReference ref)
          Overrides the ServiceTracker functionality to inform the application object about the added service.
 void modifiedService(org.osgi.framework.ServiceReference ref, java.lang.Object svc)
          Overrides the ServiceTracker functionality to inform the application object about the modified service.
 void removedService(org.osgi.framework.ServiceReference ref, java.lang.Object svc)
          Overrides the ServiceTracker functionality to inform the application object about the removed service.
 
Methods inherited from class org.osgi.util.tracker.ServiceTracker
close, finalize, getService, getService, getServiceReference, getServiceReferences, getServices, getTrackingCount, open, open, remove, size, waitForService
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeTracker

public ShapeTracker(org.osgi.framework.BundleContext context,
                    DrawingFrame frame)
Constructs a tracker that uses the specified bundle context to track services and notifies the specified application object about changes.

Parameters:
context - The bundle context to be used by the tracker.
frame - The application object to notify about service changes.
Method Detail

addingService

public java.lang.Object addingService(org.osgi.framework.ServiceReference ref)
Overrides the ServiceTracker functionality to inform the application object about the added service.

Specified by:
addingService in interface org.osgi.util.tracker.ServiceTrackerCustomizer
Overrides:
addingService in class org.osgi.util.tracker.ServiceTracker
Parameters:
ref - The service reference of the added service.
Returns:
The service object to be used by the tracker.

modifiedService

public void modifiedService(org.osgi.framework.ServiceReference ref,
                            java.lang.Object svc)
Overrides the ServiceTracker functionality to inform the application object about the modified service.

Specified by:
modifiedService in interface org.osgi.util.tracker.ServiceTrackerCustomizer
Overrides:
modifiedService in class org.osgi.util.tracker.ServiceTracker
Parameters:
ref - The service reference of the modified service.
svc - The service object of the modified service.

removedService

public void removedService(org.osgi.framework.ServiceReference ref,
                           java.lang.Object svc)
Overrides the ServiceTracker functionality to inform the application object about the removed service.

Specified by:
removedService in interface org.osgi.util.tracker.ServiceTrackerCustomizer
Overrides:
removedService in class org.osgi.util.tracker.ServiceTracker
Parameters:
ref - The service reference of the removed service.
svc - The service object of the removed service.