Interface G2ConfigMgr

  • All Superinterfaces:
    G2Fallible
    All Known Implementing Classes:
    G2ConfigMgrJNI

    public interface G2ConfigMgr
    extends G2Fallible
    Defines the Java interface to the G2 configuration management functions.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int addConfig​(String configStr, String configComments, Result<Long> configID)
      Adds the configuration described by the specified JSON to the repository with the specified comments and returns the ID of the config in the specified Result object.
      int destroy()
      Uninitializes the G2 config manager API.
      int getConfig​(long configID, StringBuffer response)
      Gets the configuration with the specified config ID and writes the JSON text of configuration to the specified StringBuffer.
      int getConfigList​(StringBuffer response)
      Gets the list of saved configuration IDs with their comments and timestamps and writes the JSON text describing the configurations to the specified StringBuffer.
      int getDefaultConfigID​(Result<Long> configID)
      Gets the configuration ID of the default configuration for the repository and sets the value in the specified Result object.
      int initV2​(String moduleName, String iniParams, boolean verboseLogging)
      Initializes the G2 config manager API with the specified module name, init parameters and flag indicating verbose logging.
      int replaceDefaultConfigID​(long oldConfigID, long newConfigID)
      Replaces the current configuration ID of the repository with the specified new configuration ID providing the current configuration ID of the repository is equal to the specified old configuration ID.
      int setDefaultConfigID​(long configID)
      Sets the default configuration for the repository to the specified configuration ID.
    • Method Detail

      • initV2

        int initV2​(String moduleName,
                   String iniParams,
                   boolean verboseLogging)
        Initializes the G2 config manager API with the specified module name, init parameters and flag indicating verbose logging.
        Parameters:
        moduleName - A short name given to this instance of the config manager API.
        iniParams - A JSON string containing configuration parameters.
        verboseLogging - Enable diagnostic logging which will print a massive amount of information to stdout.
        Returns:
        Zero (0) on success and non-zero on failure.
      • destroy

        int destroy()
        Uninitializes the G2 config manager API.
        Returns:
        Zero (0) on success and non-zero on failure.
      • addConfig

        int addConfig​(String configStr,
                      String configComments,
                      Result<Long> configID)
        Adds the configuration described by the specified JSON to the repository with the specified comments and returns the ID of the config in the specified Result object.
        Parameters:
        configStr - The JSON text describing the configuration.
        configComments - The comments for the configuration.
        configID - The configuration ID for the registered config.
        Returns:
        Zero (0) on success and non-zero on failure.
      • getConfig

        int getConfig​(long configID,
                      StringBuffer response)
        Gets the configuration with the specified config ID and writes the JSON text of configuration to the specified StringBuffer.
        Parameters:
        configID - The configuration ID of the configuration to retrieve.
        response - The StringBuffer to write the JSON text of the configuration to.
        Returns:
        Zero (0) on success and non-zero on failure.
      • getConfigList

        int getConfigList​(StringBuffer response)
        Gets the list of saved configuration IDs with their comments and timestamps and writes the JSON text describing the configurations to the specified StringBuffer. The format of the response is:
         {
           "CONFIGS": [
             {
                  "CONFIG_ID": 12345678912345,
                  "SYS_CREATE_DT": "2021-03-25 18:35:00.743",
                  "CONFIG_COMMENTS": "Added EMPLOYEES data source."
             },
             {
                  "CONFIG_ID": 23456789123456,
                  "SYS_CREATE_DT": "2021-02-08 23:27:09.876",
                  "CONFIG_COMMENTS": "Added CUSTOMERS data source."
             },
             {
                  "CONFIG_ID": 34567891234567,
                  "SYS_CREATE_DT": "2021-02-08 23:27:05.212",
                  "CONFIG_COMMENTS": "Initial Config"
             },
             . . .
           ]
         }
         
        Parameters:
        response - The StringBuffer to write the JSON text of the configuration list to.
        Returns:
        Zero (0) on success and non-zero on failure.
      • setDefaultConfigID

        int setDefaultConfigID​(long configID)
        Sets the default configuration for the repository to the specified configuration ID.
        Parameters:
        configID - The configuration ID to set as the default configuration.
        Returns:
        Zero (0) on success and non-zero on failure.
      • getDefaultConfigID

        int getDefaultConfigID​(Result<Long> configID)
        Gets the configuration ID of the default configuration for the repository and sets the value in the specified Result object.
        Parameters:
        configID - The Result object on which to set the default configuration ID.
        Returns:
        Zero (0) on success and non-zero on failure.
      • replaceDefaultConfigID

        int replaceDefaultConfigID​(long oldConfigID,
                                   long newConfigID)
        Replaces the current configuration ID of the repository with the specified new configuration ID providing the current configuration ID of the repository is equal to the specified old configuration ID. If the current configuration ID is not the same as the specified old configuration ID then this method fails to replace the default configuration ID with the new value.
        Parameters:
        oldConfigID - The configuration ID that is believed to be the current default configuration ID.
        newConfigID - The new configuration ID for the repository.
        Returns:
        Zero (0) on success and non-zero on failure