Class ConfigurationService


  • public class ConfigurationService
    extends Object
    ConfigurationService manages configurations in the ConfigurationAdmin. The config id is the equivalent to the Constants.SERVICE_PID.
    Author:
    Dennis Nobel - Initial contribution
    • Constructor Detail

      • ConfigurationService

        public ConfigurationService()
    • Method Detail

      • get

        public Configuration get​(String configId)
                          throws IOException
        Returns a configuration for a config id.
        Parameters:
        configId - config id
        Returns:
        config or null if no config with the given config id exists
        Throws:
        IOException - if configuration can not be read
      • update

        public Configuration update​(String configId,
                                    Configuration newConfiguration)
                             throws IOException
        Creates or updates a configuration for a config id.
        Parameters:
        configId - config id
        newConfiguration - the configuration
        Returns:
        old config or null if no old config existed
        Throws:
        IOException - if configuration can not be stored
      • update

        public Configuration update​(String configId,
                                    Configuration newConfiguration,
                                    boolean override)
                             throws IOException
        Creates or updates a configuration for a config id.
        Parameters:
        configId - config id
        newConfiguration - the configuration
        override - if true, it overrides the old config completely. means it deletes all parameters even if they are not defined in the given configuration.
        Returns:
        old config or null if no old config existed
        Throws:
        IOException - if configuration can not be stored
      • delete

        public Configuration delete​(String configId)
                             throws IOException
        Deletes a configuration for a config id.
        Parameters:
        configId - config id
        Returns:
        old config or null if no old config existed
        Throws:
        IOException - if configuration can not be removed
      • setConfigurationAdmin

        protected void setConfigurationAdmin​(org.osgi.service.cm.ConfigurationAdmin configurationAdmin)
      • unsetConfigurationAdmin

        protected void unsetConfigurationAdmin​(org.osgi.service.cm.ConfigurationAdmin configurationAdmin)