Interface ConfigurationManagement


  • public interface ConfigurationManagement
    Configuration Management service interface. This interface defines how the rest of the system interacts with the configuration subsystem.
    Author:
    arjansc
    • Method Detail

      • addConfigurationSetDefinition

        void addConfigurationSetDefinition​(org.osgi.service.metatype.ObjectClassDefinition configurationDefinition)
        Add the definition of a new ConfigurationSet. This definition is based on the OSGi MetaType specification.
        Parameters:
        configurationDefinition - MetaType ObjectClass definition.
      • addConfigurationSetDefinition

        void addConfigurationSetDefinition​(URL configurationDefinition)
        Add the definitino of a new ConfigurationSet based on the supplied MetaType xml document.
        Parameters:
        configurationDefinition - Path the MetaType XML document.
      • parseAndAddConfigurationSets

        void parseAndAddConfigurationSets​(File path,
                                          boolean overwrite)
        This method reads and parses an XML document given a File containing default configuration sets for a particular configuration set definition.
        Parameters:
        path - Path of the file with default configuration sets to load
        overwrite - Indicates if configuration entries that have already a value should be overwritten or not. Configuration entries do not have a value yet for example if the corresponding property definition is just created.
      • parseAndAddConfigurationSets

        void parseAndAddConfigurationSets​(URL path,
                                          boolean overwrite)
        This method reads and parses an XML document given a URL to a file containing default configuration sets for a particular configuration set definition.
        Parameters:
        path - Path of the file with default configuration sets to load
        overwrite - Indicates if configuration entries that have already a value should be overwritten or not. Configuration entries do not have a value yet for example if the corresponding property definition is just created.
      • getConfigurationSetDefinitions

        String[] getConfigurationSetDefinitions()
        Returns an array of the names of all registered ConfigurationSet definitions.
        Returns:
        array of all ConfigurationSet definition names.
      • getConfigurationSetTemplate

        ConfigurationSet getConfigurationSetTemplate​(String configurationDefinition)
        Return an empty ConfigurationSet based on the given definition.
        Parameters:
        configurationDefinition - Relative path identifying the definition of the required ConfigurationSet
        Returns:
      • addConfigurationSet

        void addConfigurationSet​(ConfigurationSet set,
                                 String setName,
                                 String configurationDefinition)
        Add a ConfigurationSet to the persistent storage. The set is stored at the location of its ConfigurationSet definition under the given set name.
        Parameters:
        set - The ConfigurationSet containing the configuration data.
        setName - The name under which the set should be stored.
        configurationDefinition - The definition dictating the structure of the ConfigurationSet.
      • removeConfigurationSet

        void removeConfigurationSet​(String relativePath)
        Remove a ConfigurationSet from the persistent storage. The set at the given (relative to the configuration path) path is deleted.
        Parameters:
        relativePath - The path to the set, relative to the configuration path.
      • updateConfigurationSet

        void updateConfigurationSet​(ConfigurationSet set,
                                    String relativePath)
        Updates the contents of the ConfigurationSet stored in the persistent storage.
        Parameters:
        relativePath - The path to the set, relative to the configuration path.
      • getConfigurationSet

        ConfigurationSet getConfigurationSet​(String relativePath)
        Returns the ConfigurationSet, if available, on the relative path.
        Parameters:
        relativePath - The path to the set, relative to the configuration path.
      • getConfigurationSets

        ConfigurationSet[] getConfigurationSets​(String definition,
                                                Map<String,​String> context)
        Returns the ConfigurationSets, if available, of the requested definition, whose criteria match the context.
        Parameters:
        definition - the definition type of the set
        context - the context to be applied when matching for criteria
        Returns:
        a set matching the context or null if none was found
      • getConfigurationSets

        ConfigurationSet[] getConfigurationSets​(String relativePath)
        Returns all configuration sets under the relative path. Meaning all sets of a giving configuration definition (linked to the relative path) are returned.
        Parameters:
        relativePath - The path to the set, relative to the configuration path.
      • getConfigurationEntry

        ConfigurationEntry getConfigurationEntry​(String entryPath)
        Return a configuration entry given a dot expression. The expression must follow the syntax configurationsetdefinitionname.configurationsetname.configurationentryname
        Parameters:
        propertyPath - Expression to retrieve entry for
        Returns:
        ConfigurationEntry that meets the expression
      • setConfigurationEntry

        void setConfigurationEntry​(String entryPath,
                                   String[] value)
        Update the configurationentry with the given path with the given value. The path must follow the syntax configurationsetdefinitionname.configurationsetname.configurationentryname
        Parameters:
        entryPath - Expression to retrieve entry for
        value - String array of values to set
      • addListener

        void addListener​(ConfigurationManagementListener listener,
                         String relativePath)
                  throws ConfigurationManagementException
        Add a listener to (a subset of) the configuration data. Any changes in the stored configuration data will result in a notification of the relevant listeners.
        Parameters:
        listener - ConfigurationManagementListener to add to the set of listeners.
        relativePath - The subtree of configuration data, relative to the configuration path.
        Throws:
        ConfigurationManagementException
      • removeListener

        void removeListener​(ConfigurationManagementListener listener)
        Removes the ConfigurationManagementListener from the administration of listeners.
        Parameters:
        listener - ConfigurationManagementListener to remove.