Class DefaultFileConfigObjectProvider

java.lang.Object
com.seeq.link.sdk.services.DefaultFileConfigObjectProvider
All Implemented Interfaces:
ConfigObjectProvider, FileConfigObjectProvider, com.seeq.utilities.FileChangeListener

public class DefaultFileConfigObjectProvider extends Object implements FileConfigObjectProvider, com.seeq.utilities.FileChangeListener
See FileConfigObjectProvider for documentation.
  • Constructor Details

    • DefaultFileConfigObjectProvider

      public DefaultFileConfigObjectProvider()
    • DefaultFileConfigObjectProvider

      public DefaultFileConfigObjectProvider(Duration changeDebouncePeriod)
  • Method Details

    • initialize

      public void initialize(Path dataPath)
      Description copied from interface: FileConfigObjectProvider
      Initializes the provider with a data path to persist config objects to.
      Specified by:
      initialize in interface FileConfigObjectProvider
      Parameters:
      dataPath - The data path to persist config objects to.
    • loadConfigObject

      public ConfigObjectWrapper loadConfigObject(String name, ConfigObject[] defaultConfigObjects) throws IOException
      Description copied from interface: ConfigObjectProvider
      Loads a configuration Object from the config data store and retrieves its metadata. This function requires an array of config objects to use as a means of discovering what Object type is encoded in the store.
      Specified by:
      loadConfigObject in interface ConfigObjectProvider
      Parameters:
      name - The name of configuration store, which will normally be the connector name.
      defaultConfigObjects - An array of ConfigObject instances that represent the possible Object types that can be successfully retrieved from the store. If the persisted Object type does not match anything in the list, then the first item in the array is passed back (being effectively a means to have a 'default' config).
      Returns:
      The configuration Object, which must be cast to a ConfigObject-derived class wrapped into a ConfigObjectWrapper together with its metadata.
      Throws:
      IOException - Thrown if JSON file could not be successfully deserialized.
    • loadConfigObject

      public ConfigObjectWrapper loadConfigObject(String name, ConfigObject[] defaultConfigObjects, Map<Class<? extends ConfigObject>,Class<?>[]> configObjectTypeArguments) throws IOException
      This version of the method takes an extra configObjectTypeArguments to work around Java's generic type erasure. This allows ConfigObjects of generic types to be deserialized correctly by specifying the actual values of their type parameters.
      Throws:
      IOException
    • saveConfigObject

      public void saveConfigObject(String name, Object configObject)
      Description copied from interface: ConfigObjectProvider
      Saves a configuration Object to the config data store. The config object's type will be encoded in 'Version' field in the data store.
      Specified by:
      saveConfigObject in interface ConfigObjectProvider
      Parameters:
      name - The name of configuration store, which will normally be the connector name.
      configObject - The configuration Object to serialize to the store.
    • registerChangeCallback

      public void registerChangeCallback(String name, Consumer<String> callback)
      Description copied from interface: FileConfigObjectProvider
      Registers a callback for when the configuration has changed.
      Specified by:
      registerChangeCallback in interface FileConfigObjectProvider
      Parameters:
      name - Name of the configuration object you're interested in.
      callback - Callback function that takes the name as its only parameter.
    • unregisterChangeCallback

      public void unregisterChangeCallback(String name)
      Description copied from interface: FileConfigObjectProvider
      Unregisters a callback previously registered.
      Specified by:
      unregisterChangeCallback in interface FileConfigObjectProvider
      Parameters:
      name - Name of the configuration object you're interested in.
    • onFileModify

      public void onFileModify(Path filePath)
      Specified by:
      onFileModify in interface com.seeq.utilities.FileChangeListener
    • onFileDelete

      public void onFileDelete(Path filePath)
      Specified by:
      onFileDelete in interface com.seeq.utilities.FileChangeListener