Class OsgiUtil

java.lang.Object
org.opencastproject.oaipmh.util.OsgiUtil

public final class OsgiUtil extends Object
Collection of utility function around OSGi.
  • Method Details

    • getContextProperty

      public static String getContextProperty(org.osgi.service.component.ComponentContext cc, String key)
      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