Package org.apache.jackrabbit.oak.osgi
Class OsgiUtil
java.lang.Object
org.apache.jackrabbit.oak.osgi.OsgiUtil
Utility methods to use in an OSGi environment.
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.osgi.framework.Filter
Create aFilter
using the passed Class as an objectClass and the map as the filter attributes.static String
Looks a property up by name in the set of framework properties.static String
Looks a property up by name in a component context.static String
lookupConfigurationThenFramework
(org.osgi.service.component.ComponentContext context, String name) Looks a property up by name in the component context first, falling back in the framework properties if not found.static String
lookupConfigurationThenFramework
(org.osgi.service.component.ComponentContext context, String nameInComponent, String nameInFramework) Looks a property up by name in the component context first, falling back in the framework properties if not found.static String
lookupFrameworkThenConfiguration
(org.osgi.service.component.ComponentContext context, String name) Looks a property up by name in the framework properties first, falling back to the component context if not not found.static String
lookupFrameworkThenConfiguration
(org.osgi.service.component.ComponentContext context, String nameInComponent, String nameInFramework) Looks a property up by name in the framework properties first, falling back to the component context if not not found.
-
Method Details
-
lookup
Looks a property up by name in a component context. Returnsnull
if the property is not found or if the property is found but it is an empty string.- Parameters:
context
- Component context.name
- Name of the property.- Returns:
- The property value serialized as a string, or
null
.
-
lookup
Looks a property up by name in the set of framework properties. Returnsnull
if the property is not found or if the property is found but it is an empty string.- Parameters:
context
- Bundle context.name
- Name of the property.- Returns:
- The property value serialized as a string, or
null
.
-
lookupConfigurationThenFramework
public static String lookupConfigurationThenFramework(org.osgi.service.component.ComponentContext context, String name) Looks a property up by name in the component context first, falling back in the framework properties if not found. Returnsnull
if the property is not found or if the property is found but it is an empty string.- Parameters:
context
- Component context.name
- Name of the property.- Returns:
- The property value serialized as a string, or
null
.
-
lookupConfigurationThenFramework
public static String lookupConfigurationThenFramework(org.osgi.service.component.ComponentContext context, String nameInComponent, String nameInFramework) Looks a property up by name in the component context first, falling back in the framework properties if not found. Returnsnull
if the property is not found or if the property is found but it is an empty string.- Parameters:
context
- Component context.nameInComponent
- Name of the property in the component context.nameInFramework
- Name of the property in the framework properties.- Returns:
- The property value serialized as a string, or
null
.
-
lookupFrameworkThenConfiguration
public static String lookupFrameworkThenConfiguration(org.osgi.service.component.ComponentContext context, String name) Looks a property up by name in the framework properties first, falling back to the component context if not not found. Returnsnull
if the property is not found or if the property is found but it is an empty string.- Parameters:
context
- Component context.name
- Name of the property.- Returns:
- The property value serialized as a string, or
null
.
-
lookupFrameworkThenConfiguration
public static String lookupFrameworkThenConfiguration(org.osgi.service.component.ComponentContext context, String nameInComponent, String nameInFramework) Looks a property up by name in the framework properties first, falling back to the component context if not not found. Returnsnull
if the property is not found or if the property is found but it is an empty string.- Parameters:
context
- Component context.nameInComponent
- Name of the property in the component context.nameInFramework
- Name of the property in the framework properties.- Returns:
- The property value serialized as a string, or
null
.
-
getFilter
Create aFilter
using the passed Class as an objectClass and the map as the filter attributes.- Parameters:
clazz
- the target objectClassattributes
- target attributes (null value for the absence)- Returns:
- OSGi filter representing the input
-