Pages

Monday, 23 December 2013

Reading OSGi Configurations

    @Reference
    ConfigurationAdmin configAdmin;
  
    /*Get the configurations based on the fully qualified name of your Bundle*/
    Configuration config = configAdmin.getConfiguration(Constants.FULLY_QUALIFIED_CLASS_NAME);

    /*Get the configuration properties / returns a Dictionary Object*/
    Dictionary<?, ?> properties = config.getProperties();
  
    /*Iterate through the Dictionary properties to get your configurations*/  
    String item = (String) properties.get(Constants.CONFIG_ITEM);


No comments:

Post a Comment

Converting InputStream to String

    private String convertToString(InputStream inputStreamObj)             throws IOException {         if (inputStreamObj != null) {     ...