Class ServiceHelper
java.lang.Object
org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper
The class helps to register and retrieve OSGi service registry.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
getGlobalInstance
(Class<?> clazz, Object bundle) Retrieve global instance of a class via OSGI registry, if there are many only the first is returned.static Object
getGlobalInstance
(Class<?> clazz, Object bundle, String serviceFilter) Retrieve global instance of a class via OSGI registry, if there are many only the first is returned.static <T> void
overrideGlobalInstance
(Class<T> clazz, T instance) Override a global instance.
-
Method Details
-
overrideGlobalInstance
Override a global instance. This should generally only be used for testing.- Parameters:
clazz
- The target class.instance
- The instance to return for the class.
-
getGlobalInstance
Retrieve global instance of a class via OSGI registry, if there are many only the first is returned.- Parameters:
clazz
- The target classbundle
- The caller
-
getGlobalInstance
Retrieve global instance of a class via OSGI registry, if there are many only the first is returned. On this version an LDAP type of filter is applied- Parameters:
clazz
- The target classbundle
- The callerserviceFilter
- LDAP filter to be applied in the search
-