org.springframework.osgi.util
Class OsgiListenerUtils

java.lang.Object
  extended by org.springframework.osgi.util.OsgiListenerUtils

public abstract class OsgiListenerUtils
extends Object

Utility class for various types of listeners used inside Spring/OSGi. This class contains common functionality such as broadcasting events or safely registering an OSGi ServiceListener.

Author:
Costin Leau

Constructor Summary
OsgiListenerUtils()
           
 
Method Summary
static void addServiceListener(BundleContext context, ServiceListener listener, Filter filter)
          Add a service listener to the given application context, under the specified filter.
static void addServiceListener(BundleContext context, ServiceListener listener, String filter)
          Add a service listener to the given application context, under the specified filter given as a String.
static boolean removeServiceListener(BundleContext bundleContext, ServiceListener listener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OsgiListenerUtils

public OsgiListenerUtils()
Method Detail

addServiceListener

public static void addServiceListener(BundleContext context,
                                      ServiceListener listener,
                                      Filter filter)
Add a service listener to the given application context, under the specified filter.

Parameters:
context -
listener -
filter -
See Also:
addServiceListener(BundleContext, ServiceListener, String)

addServiceListener

public static void addServiceListener(BundleContext context,
                                      ServiceListener listener,
                                      String filter)
Add a service listener to the given application context, under the specified filter given as a String. The method will also retrieve the services registered before the listener registration and will inform the listener through service events of type REGISTERED. This might cause problems in case a service is being registered between the listener registration and the retrieval of existing services and thus, can cause event duplication to occur on the listener.

For most implementations this is not a problem; if it is then do not use this method.

Parameters:
context -
listener -
filter -

removeServiceListener

public static boolean removeServiceListener(BundleContext bundleContext,
                                            ServiceListener listener)


Copyright © 2006-2007 Spring Framework. All Rights Reserved.