public class BundleContextServiceLocator extends Object implements ServiceLocator
Constructor and Description |
---|
BundleContextServiceLocator(org.osgi.framework.BundleContext bundleContext) |
Modifier and Type | Method and Description |
---|---|
<T> List<T> |
findServices(Class<T> clazz,
String query)
Find services of class
clazz registered in the OSGI Service Registry. |
<T> T |
findSingleService(Class<T> clazz,
java.util.function.Predicate<T> postFilter,
String bundleContextFilter)
Finds a service registered with the OSGI Service Registry of type
clazz . |
public BundleContextServiceLocator(org.osgi.framework.BundleContext bundleContext)
public <T> T findSingleService(Class<T> clazz, java.util.function.Predicate<T> postFilter, String bundleContextFilter)
ServiceLocator
clazz
.
If a bundleContextFilter
is provided, it is used to query for the service, e.g. "(operation.label=My Label*)".
In addition each clazz of type T found in the OSGI Service Registry must afterwards pass the provided postFilter
.
If multiple services are found, only the first one is returned.findSingleService
in interface ServiceLocator
clazz
or null.public <T> List<T> findServices(Class<T> clazz, String query)
ServiceLocator
clazz
registered in the OSGI Service Registry.
The optional filter criteria query
is used.findServices
in interface ServiceLocator
clazz
.Copyright © 2018. All rights reserved.