Interface G2Config

  • All Superinterfaces:
    G2Fallible
    All Known Implementing Classes:
    G2ConfigJNI

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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int addDataSource​(long configHandle, String inputJson, StringBuffer response)
      Adds a data source described by the specified JSON to the in-memory configuration associated with the specified config handle.
      int close​(long configHandle)
      Closes the in-memory configuration associated with the specified config handle and cleans up system resources.
      int create​(Result<Long> configHandle)
      Creates a new in-memory configuration using the default template and sets the specified Result parameter with the value of the configuration handle for working with it.
      int deleteDataSource​(long configHandle, String inputJson)
      Deletes the data source described by the specified JSON from the in-memory configuration associated with the specified config handle.
      int destroy()
      Uninitializes the G2 config API and cleans up system resources.
      int init​(String moduleName, String iniParams, boolean verboseLogging)
      Initializes the G2 config API with the specified module name, init parameters and flag indicating verbose logging.
      int listDataSources​(long configHandle, StringBuffer response)
      Extracts the data sources from the in-memory configuration associated with the specified config handle and writes JSON text to the specified StringBuffer describing the data sources from the configuration.
      int load​(String jsonConfig, Result<Long> configHandle)
      Creates a new in-memory configuration using the specified JSON text and sets the specified Result parameter with the value of the configuration handle for working with it.
      int save​(long configHandle, StringBuffer response)
      Writes the JSON text for the configuration associated with the specified configuration handle to the specified StringBuffer.
    • Method Detail

      • init

        int init​(String moduleName,
                 String iniParams,
                 boolean verboseLogging)
        Initializes the G2 config API with the specified module name, init parameters and flag indicating verbose logging.
        Parameters:
        moduleName - A short name given to this instance of the diagnostic object.
        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 API and cleans up system resources.
        Returns:
        Zero (0) on success and non-zero on failure.
      • create

        int create​(Result<Long> configHandle)
        Creates a new in-memory configuration using the default template and sets the specified Result parameter with the value of the configuration handle for working with it.
        Parameters:
        configHandle - The Result object on which to set the value of the configuration handle.
        Returns:
        Zero (0) on success and non-zero on failure.
      • load

        int load​(String jsonConfig,
                 Result<Long> configHandle)
        Creates a new in-memory configuration using the specified JSON text and sets the specified Result parameter with the value of the configuration handle for working with it.
        Parameters:
        jsonConfig - The JSON text for the config.
        configHandle - The Result object on which to set the value of the configuration handle.
        Returns:
        Zero (0) on success and non-zero on failure.
      • save

        int save​(long configHandle,
                 StringBuffer response)
        Writes the JSON text for the configuration associated with the specified configuration handle to the specified StringBuffer.
        Parameters:
        configHandle - The configuration handle to export the JSON text from.
        response - The StringBuffer to write the JSON text to.
        Returns:
        Zero (0) on success and non-zero on failure.
      • close

        int close​(long configHandle)
        Closes the in-memory configuration associated with the specified config handle and cleans up system resources. After calling this method, the configuration handle can no longer be used and becomes invalid.
        Parameters:
        configHandle - The config handle identifying the in-memory configuration to close.
        Returns:
        Zero (0) on success and non-zero on failure.
      • listDataSources

        int listDataSources​(long configHandle,
                            StringBuffer response)
        Extracts the data sources from the in-memory configuration associated with the specified config handle and writes JSON text to the specified StringBuffer describing the data sources from the configuration. The format of the JSON response is as follows:
         {
                "DATA_SOURCES": [
            {
                                "DSRC_ID": 1,
                                "DSRC_CODE": "TEST"
            },
            {
                                "DSRC_ID": 2,
                                "DSRC_CODE": "SEARCH"
            }
                ]
         }
         
        Parameters:
        configHandle - The config handle identifying the in-memory configuration to close.
        response - The StringBuffer to write the JSON response to.
        Returns:
        Zero (0) on success and non-zero on failure.
      • addDataSource

        int addDataSource​(long configHandle,
                          String inputJson,
                          StringBuffer response)
        Adds a data source described by the specified JSON to the in-memory configuration associated with the specified config handle. The response JSON is written to the specified StringBuffer. The input JSON has the following format:
           {
             "DSRC_CODE": "CUSTOMERS"
           }
         
        Optionally, you can specify the data source ID:
           {
             "DSRC_CODE": "CUSTOMERS",
             "DSRC_ID": 410
           }
         

        The response JSON provides the data source ID of the created data source, which is especially useful if the data source ID was not specified in the input:

           {
             "DSRC_ID": 410
           }
         
        Parameters:
        configHandle - The config handle identifying the in-memory configuration to close.
        inputJson - The JSON text describing the data source to create.
        response - The StringBuffer to write the JSON response to.
        Returns:
        Zero (0) on success and non-zero on failure.
      • deleteDataSource

        int deleteDataSource​(long configHandle,
                             String inputJson)
        Deletes the data source described by the specified JSON from the in-memory configuration associated with the specified config handle. The input JSON has the following format:
           {
             "DSRC_CODE": "CUSTOMERS"
           }
         
        Parameters:
        configHandle - The config handle identifying the in-memory configuration to close.
        inputJson - The JSON text describing the data source to delete.
        Returns:
        Zero (0) on success and non-zero on failure.