Class ServiceHelper
- java.lang.Object
-
- org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper
-
public final class ServiceHelper extends Object
The class helps to register and retrieve OSGi service registry.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
overrideGlobalInstance
public static <T> void overrideGlobalInstance(Class<T> clazz, T instance)
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
public static Object getGlobalInstance(Class<?> clazz, Object bundle)
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
public 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. 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
-
-