Interface ConfigurationManagerService

  • All Known Implementing Classes:
    ConfigurationManagerServiceImpl, ConfigurationManagerServiceMock

    public interface ConfigurationManagerService
    Responsible for managing Schemas and Configurations. A Schema is a set of rules that constrain the data of a Configuration. A Configuration is the data that defines the runtime behaviour of a service together with the code of that service.
    • Method Detail

      • registerConfigDefinition

        void registerConfigDefinition​(String configName,
                                      ConfigDefinition configDefinition)
        Registers a ConfigDefinition under a unique configName. If the schema id is present it will throw an IllegalArgumentException.
      • changeConfigDefinition

        void changeConfigDefinition​(String configName,
                                    ConfigDefinition configDefinition)
        Changes a ConfigDefinition. If the configName is not present it will throw an IllegalArgumentException.
      • registerConfiguration

        void registerConfiguration​(String configName,
                                   String configId,
                                   JsonAsString configObject)
        register a new configuration by config object. It will make sure the configId is not duplicated !!!
        Parameters:
        configName -
        configId -
        configObject - (config object / JSONObject)
      • unregisterConfiguration

        void unregisterConfiguration​(String configName,
                                     String configId)
        remove configure from service
        Parameters:
        configId -
      • updateConfiguration

        void updateConfiguration​(String configName,
                                 String configId,
                                 JsonAsString configObject,
                                 boolean isReplace)
        update config to a registered service name. It can be partial data and copy into existing config. The flow of update 1. reading the config by configName & configId 2. if replace is true, the whole new config will be replaced directly if replace is false, the new config will copy to existing database config by its property keys to config in database 3. validate 4. update db
        Parameters:
        configName -
        configId -
        configObject -
        isReplace -
        Throws:
        ValidationException
      • getJSONConfiguration

        Optional<org.json.JSONObject> getJSONConfiguration​(String configName,
                                                           String configId)
        get config as json by configName, configId
        Parameters:
        configName -
        configId -
        Returns:
        JSONObject
      • getConfigData

        Optional<ConfigData<org.json.JSONObject>> getConfigData​(String configName)
        get whole ConfigData by configName
        Parameters:
        configName -
        Returns:
        ConfigData
      • getConfigNames

        Set<String> getConfigNames()
        get a list of registered configName
        Returns:
        configName set
      • unregisterSchema

        void unregisterSchema​(String configName)
        it will remove both config and schema
        Parameters:
        configName -
      • getConfigIds

        Set<String> getConfigIds​(String configName)
        return configIds by configName
        Parameters:
        configName -