Class SzCoreConfigManager

java.lang.Object
com.senzing.sdk.core.SzCoreConfigManager
All Implemented Interfaces:
SzConfigManager

public class SzCoreConfigManager extends Object implements SzConfigManager
The package-protected implementation of SzConfigManager that works with the SzCoreEnvironment class.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    addConfig(String configDefinition, String configComment)
    Adds the configuration described by the specified JSON to the repository with the specified comment and returns the identifier for referencing the the config in the entity repository.
    getConfig(long configId)
    Gets the configuration with the specified config ID and returns the configuration defintion as a String.
    Gets the list of saved configuration ID's with their comments and timestamps and return the JSON String describing them.
    long
    Gets the configuration ID of the default configuration for the repository and returns it.
    protected boolean
    Checks if this instance has been destroyed by the associated SzCoreEnvironment.
    void
    replaceDefaultConfigId(long currentDefaultConfigId, long newDefaultConfigId)
    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.
    void
    setDefaultConfigId(long configId)
    Sets the default configuration for the repository to the specified configuration ID.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isDestroyed

      protected boolean isDestroyed()
      Checks if this instance has been destroyed by the associated SzCoreEnvironment.
      Returns:
      true if this instance has been destroyed, otherwise false.
    • addConfig

      public long addConfig(String configDefinition, String configComment) throws SzException
      Adds the configuration described by the specified JSON to the repository with the specified comment and returns the identifier for referencing the the config in the entity repository.

      Implemented to call the underlying native function.

      Specified by:
      addConfig in interface SzConfigManager
      Parameters:
      configDefinition - The JSON text describing the configuration.
      configComment - The comments for the configuration.
      Returns:
      The identifier for referncing the config in the entity repository.
      Throws:
      SzException - If a failure occurs.
    • getConfig

      public String getConfig(long configId) throws SzException
      Gets the configuration with the specified config ID and returns the configuration defintion as a String.

      Implemented to call the underlying native function.

      Specified by:
      getConfig in interface SzConfigManager
      Parameters:
      configId - The configuration ID of the configuration to retrieve.
      Returns:
      The configuration definition as a String.
      Throws:
      SzException - If a failure occurs.
    • getConfigs

      public String getConfigs() throws SzException
      Gets the list of saved configuration ID's with their comments and timestamps and return the JSON String describing them. An example format for 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"
           },
           . . .
         ]
       }
       

      Implemented to call the underlying native function.

      Specified by:
      getConfigs in interface SzConfigManager
      Returns:
      The JSON String describing the configurations registered in the entity repository with their identifiers, timestamps and comments.
      Throws:
      SzException - If a failure occurs.
    • getDefaultConfigId

      public long getDefaultConfigId() throws SzException
      Gets the configuration ID of the default configuration for the repository and returns it. If the entity repository is in the initial state and the default configuration ID has not yet been set, then zero (0) is returned.

      Implemented to call the underlying native function.

      Specified by:
      getDefaultConfigId in interface SzConfigManager
      Returns:
      The current default cofiguration ID in the repository, or zero (0) if the entity repository is in the initial state with no default configuration ID having yet been set.
      Throws:
      SzException - If a failure occurs.
    • replaceDefaultConfigId

      public void replaceDefaultConfigId(long currentDefaultConfigId, long newDefaultConfigId) throws SzException
      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 and an SzReplaceConflictException is thrown.

      Implemented to call the underlying native function.

      Specified by:
      replaceDefaultConfigId in interface SzConfigManager
      Parameters:
      currentDefaultConfigId - The configuration ID that is believed to be the current default configuration ID.
      newDefaultConfigId - The new configuration ID for the repository.
      Throws:
      SzReplaceConflictException - If the default configuration ID was not updated to the specified new value because the current default configuration ID found in the repository was not equal to the specified expected current default configuration ID value.
      SzException - If a failure occurs.
    • setDefaultConfigId

      public void setDefaultConfigId(long configId) throws SzException
      Sets the default configuration for the repository to the specified configuration ID.

      Implemented to call the underlying native function.

      Specified by:
      setDefaultConfigId in interface SzConfigManager
      Parameters:
      configId - The configuration ID to set as the default configuration.
      Throws:
      SzException - If a failure occurs.