Package org.apache.jackrabbit.oak.osgi
Class OsgiUtil
- java.lang.Object
-
- org.apache.jackrabbit.oak.osgi.OsgiUtil
-
public class OsgiUtil extends Object
Utility methods to use in an OSGi environment.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.osgi.framework.FiltergetFilter(Class<?> clazz, Map<String,String> attributes)Create aFilterusing the passed Class as an objectClass and the map as the filter attributes.static Stringlookup(org.osgi.framework.BundleContext context, String name)Looks a property up by name in the set of framework properties.static Stringlookup(org.osgi.service.component.ComponentContext context, String name)Looks a property up by name in a component context.static StringlookupConfigurationThenFramework(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 StringlookupConfigurationThenFramework(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 StringlookupFrameworkThenConfiguration(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 StringlookupFrameworkThenConfiguration(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 Detail
-
lookup
public static String lookup(org.osgi.service.component.ComponentContext context, String name)
Looks a property up by name in a component context. Returnsnullif 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
public static String lookup(org.osgi.framework.BundleContext context, String name)
Looks a property up by name in the set of framework properties. Returnsnullif 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. Returnsnullif 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. Returnsnullif 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. Returnsnullif 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. Returnsnullif 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
public static org.osgi.framework.Filter getFilter(Class<?> clazz, Map<String,String> attributes)
Create aFilterusing 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
-
-