Class SimpleServiceLocator
- java.lang.Object
-
- org.opennms.features.topology.app.internal.service.SimpleServiceLocator
-
- All Implemented Interfaces:
ServiceLocator
public class SimpleServiceLocator extends java.lang.Object implements ServiceLocator
-
-
Constructor Summary
Constructors Constructor Description SimpleServiceLocator(java.lang.Object... services)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addService(java.lang.Object service)
<T> java.util.List<T>
findServices(java.lang.Class<T> clazz, java.lang.String query)
Find services of classclazz
registered in the OSGI Service Registry.<T> T
findSingleService(java.lang.Class<T> clazz, java.util.function.Predicate<T> postFilter, java.lang.String bundleContextFilter)
Finds a service registered with the OSGI Service Registry of typeclazz
.
-
-
-
Method Detail
-
addService
public void addService(java.lang.Object service)
-
findSingleService
public <T> T findSingleService(java.lang.Class<T> clazz, java.util.function.Predicate<T> postFilter, java.lang.String bundleContextFilter)
Description copied from interface:ServiceLocator
Finds a service registered with the OSGI Service Registry of typeclazz
. If abundleContextFilter
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 providedpostFilter
. If multiple services are found, only the first one is returned.- Specified by:
findSingleService
in interfaceServiceLocator
- Returns:
- A object of type
clazz
or null.
-
findServices
public <T> java.util.List<T> findServices(java.lang.Class<T> clazz, java.lang.String query)
Description copied from interface:ServiceLocator
Find services of classclazz
registered in the OSGI Service Registry. The optional filter criteriaquery
is used.- Specified by:
findServices
in interfaceServiceLocator
- Returns:
- All found services registered in the OSGI Service Registry of type
clazz
.
-
-