Package org.opencastproject.oaipmh.util
Class OsgiUtil
java.lang.Object
org.opencastproject.oaipmh.util.OsgiUtil
Collection of utility function around OSGi.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckDictionary(Dictionary properties, org.osgi.service.component.ComponentContext componentContext) Check the existence of the given dictionary.static StringgetCfg(Dictionary d, String key) Get a mandatory, non-blank value from a dictionary.static intgetCfgAsInt(Dictionary d, String key) Get a mandatory integer from a dictionary.static StringgetContextProperty(org.osgi.service.component.ComponentContext cc, String key) Get a mandatory, non-blank value from the bundle context.
-
Method Details
-
getContextProperty
Get a mandatory, non-blank value from the bundle context.- Throws:
RuntimeException- key does not exist or its value is blank
-
getCfg
public static String getCfg(Dictionary d, String key) throws org.osgi.service.cm.ConfigurationException Get a mandatory, non-blank value from a dictionary.- Throws:
org.osgi.service.cm.ConfigurationException- key does not exist or its value is blank
-
getCfgAsInt
public static int getCfgAsInt(Dictionary d, String key) throws org.osgi.service.cm.ConfigurationException Get a mandatory integer from a dictionary.- Throws:
org.osgi.service.cm.ConfigurationException- key does not exist or is not an integer
-
checkDictionary
public static void checkDictionary(Dictionary properties, org.osgi.service.component.ComponentContext componentContext) throws org.osgi.service.cm.ConfigurationException Check the existence of the given dictionary. Throw an exception if null.- Throws:
org.osgi.service.cm.ConfigurationException
-