org.springframework.osgi.util
Class OsgiServiceUtils

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

public abstract class OsgiServiceUtils
extends Object

Utility class offering easy access to OSGi services

Author:
Adrian Colyer, Costin Leau

Constructor Summary
OsgiServiceUtils()
           
 
Method Summary
static ServiceReference[] getAllServices(BundleContext context, Class serviceClass, String filter)
          Return all of the service references for services of the given type and matching the given filter.
static Object getService(BundleContext context, ServiceReference reference)
           
static boolean unregisterService(ServiceRegistration registration)
          Unregisters the given service registration from the given bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OsgiServiceUtils

public OsgiServiceUtils()
Method Detail

getAllServices

public static ServiceReference[] getAllServices(BundleContext context,
                                                Class serviceClass,
                                                String filter)
                                         throws IllegalArgumentException
Return all of the service references for services of the given type and matching the given filter. Returned services may use interface versions that are incompatible with the given context.

Parameters:
context -
serviceClass -
filter -
Throws:
IllegalArgumentException - if the filter string is non-null and is not well-formed

getService

public static Object getService(BundleContext context,
                                ServiceReference reference)

unregisterService

public static boolean unregisterService(ServiceRegistration registration)
Unregisters the given service registration from the given bundle. Returns true if the unregistration process succeeded, false otherwise.

Parameters:
registration -
Returns:


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