public final class OsgiUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
checkDictionary(Dictionary properties,
org.osgi.service.component.ComponentContext componentContext)
Check the existence of the given dictionary.
|
static Map<String,String> |
filterByPrefix(Dictionary d,
String prefix)
Filter a dictionary by key prefix.
|
static String |
getCfg(Dictionary d,
String key)
Get a mandatory, non-blank value from a dictionary.
|
static boolean |
getCfgAsBoolean(Dictionary d,
String key)
Get a mandatory boolean from a dictionary.
|
static int |
getCfgAsInt(Dictionary d,
String key)
Get a mandatory integer from a dictionary.
|
static String |
getComponentContextProperty(org.osgi.service.component.ComponentContext cc,
String key)
Get a mandatory, non-blank value from the component context.
|
static String |
getContextProperty(org.osgi.service.component.ComponentContext cc,
String key)
Get a mandatory, non-blank value from the bundle context.
|
static Option<String> |
getOptCfg(Dictionary d,
String key)
Get a value from a dictionary.
|
static Option<Boolean> |
getOptCfgAsBoolean(Dictionary d,
String key)
Get an optional boolean from a dictionary.
|
static Option<Integer> |
getOptCfgAsInt(Dictionary d,
String key)
Get a value from a dictionary.
|
static Option<String> |
getOptContextProperty(org.osgi.service.component.ComponentContext cc,
String key)
Get an optional, non-blank value from the bundle context.
|
static org.osgi.framework.ServiceRegistration<?> |
registerServlet(org.osgi.framework.BundleContext bundleContext,
Object service,
String alias) |
static String |
showConfig(Tuple<String,?>... cfg)
Create a config info string suitable for logging purposes.
|
public static String getContextProperty(org.osgi.service.component.ComponentContext cc, String key)
RuntimeException - key does not exist or its value is blankpublic static Option<String> getOptContextProperty(org.osgi.service.component.ComponentContext cc, String key)
RuntimeException - key does not exist or its value is blankpublic static String getComponentContextProperty(org.osgi.service.component.ComponentContext cc, String key)
RuntimeException - key does not exist or its value is blankpublic static String getCfg(Dictionary d, String key) throws org.osgi.service.cm.ConfigurationException
ConfigurationException - key does not exist or its value is blankorg.osgi.service.cm.ConfigurationExceptionpublic static Option<String> getOptCfg(Dictionary d, String key)
public static Option<Integer> getOptCfgAsInt(Dictionary d, String key)
public static Map<String,String> filterByPrefix(Dictionary d, String prefix)
{w.p.key1: "value1", w.p.key2: "value2", x: "1"} filtered by filterByPrefix(d, "w.p.")
returns {key1: "value1", key2: "value"}.public static Option<Boolean> getOptCfgAsBoolean(Dictionary d, String key)
public static int getCfgAsInt(Dictionary d, String key) throws org.osgi.service.cm.ConfigurationException
ConfigurationException - key does not exist or is not an integerorg.osgi.service.cm.ConfigurationExceptionpublic static boolean getCfgAsBoolean(Dictionary d, String key) throws org.osgi.service.cm.ConfigurationException
ConfigurationException - key does not existorg.osgi.service.cm.ConfigurationExceptionpublic static void checkDictionary(Dictionary properties, org.osgi.service.component.ComponentContext componentContext) throws org.osgi.service.cm.ConfigurationException
org.osgi.service.cm.ConfigurationExceptionpublic static String showConfig(Tuple<String,?>... cfg)
Copyright © 2009–2020 Opencast Project. All rights reserved.