org.eclipse.corona.tools.osgi
Class ServiceTrackerSinglePropertyFilter

java.lang.Object
  extended by org.eclipse.corona.tools.osgi.ServiceTrackerSinglePropertyFilter
All Implemented Interfaces:
org.osgi.util.tracker.ServiceTrackerCustomizer

public class ServiceTrackerSinglePropertyFilter
extends java.lang.Object
implements org.osgi.util.tracker.ServiceTrackerCustomizer

This service tracker customizer filters services by a single property value. The property must exactly match (equals() returns true) the desired value. No patterns are used.

Author:
Marcin Okraszewski

Constructor Summary
ServiceTrackerSinglePropertyFilter(org.osgi.framework.BundleContext context, java.lang.String key, java.lang.Object value)
          Creats a new filter for service tracker.
 
Method Summary
 java.lang.Object addingService(org.osgi.framework.ServiceReference reference)
          Notification about a new service.
 void modifiedService(org.osgi.framework.ServiceReference reference, java.lang.Object service)
          Does nothing in fact.
 void removedService(org.osgi.framework.ServiceReference reference, java.lang.Object service)
          Unregisters a service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceTrackerSinglePropertyFilter

public ServiceTrackerSinglePropertyFilter(org.osgi.framework.BundleContext context,
                                          java.lang.String key,
                                          java.lang.Object value)
Creats a new filter for service tracker.

Parameters:
context - A bundle context which is used to resolve services.
key - The key of filtering property.
value - The desired value of filtering property.
Method Detail

addingService

public java.lang.Object addingService(org.osgi.framework.ServiceReference reference)
Notification about a new service. It filters the service.

Specified by:
addingService in interface org.osgi.util.tracker.ServiceTrackerCustomizer
Parameters:
refernce - The reference of new service.
Returns:
Object of the new service if fullfills the filter, or null if not.
See Also:
ServiceTrackerCustomizer.addingService(org.osgi.framework.ServiceReference)

modifiedService

public void modifiedService(org.osgi.framework.ServiceReference reference,
                            java.lang.Object service)
Does nothing in fact.

Specified by:
modifiedService in interface org.osgi.util.tracker.ServiceTrackerCustomizer
See Also:
ServiceTrackerCustomizer.modifiedService(org.osgi.framework.ServiceReference, java.lang.Object)

removedService

public void removedService(org.osgi.framework.ServiceReference reference,
                           java.lang.Object service)
Unregisters a service.

Specified by:
removedService in interface org.osgi.util.tracker.ServiceTrackerCustomizer
See Also:
ServiceTrackerCustomizer.removedService(org.osgi.framework.ServiceReference, java.lang.Object)

Copyright 2006 IBM Corporation and others.
All Rights Reserved.