Class FileBasedConfigStore

java.lang.Object
org.apache.tika.pipes.core.config.FileBasedConfigStore
All Implemented Interfaces:
ConfigStore, TikaExtension

public class FileBasedConfigStore extends Object implements ConfigStore
File-based implementation of ConfigStore that persists configurations to a JSON file. This allows multiple JVM processes to share configuration through the filesystem. Thread-safe and suitable for multi-process deployments where PipesClient forks PipesServer.
  • Constructor Details

    • FileBasedConfigStore

      public FileBasedConfigStore(Path configFile)
  • Method Details

    • getExtensionConfig

      public ExtensionConfig getExtensionConfig()
      Specified by:
      getExtensionConfig in interface TikaExtension
    • setExtensionConfig

      public void setExtensionConfig(ExtensionConfig extensionConfig)
    • init

      public void init() throws Exception
      Description copied from interface: ConfigStore
      Initializes the configuration store. This method should be called once before using the store. Implementations may use this to establish connections, initialize caches, etc.
      Specified by:
      init in interface ConfigStore
      Throws:
      Exception - if initialization fails
    • put

      public void put(String id, ExtensionConfig config)
      Description copied from interface: ConfigStore
      Stores a configuration.
      Specified by:
      put in interface ConfigStore
      Parameters:
      id - the configuration ID (must not be null)
      config - the configuration to store (must not be null)
    • get

      public ExtensionConfig get(String id)
      Description copied from interface: ConfigStore
      Retrieves a configuration by ID.
      Specified by:
      get in interface ConfigStore
      Parameters:
      id - the configuration ID (must not be null)
      Returns:
      the configuration, or null if not found
    • containsKey

      public boolean containsKey(String id)
      Description copied from interface: ConfigStore
      Checks if a configuration exists.
      Specified by:
      containsKey in interface ConfigStore
      Parameters:
      id - the configuration ID (must not be null)
      Returns:
      true if the configuration exists
    • keySet

      public Set<String> keySet()
      Description copied from interface: ConfigStore
      Returns all configuration IDs. Implementations should return an immutable snapshot to avoid ConcurrentModificationException during iteration.
      Specified by:
      keySet in interface ConfigStore
      Returns:
      an immutable set of all configuration IDs
    • size

      public int size()
      Description copied from interface: ConfigStore
      Returns the number of stored configurations.
      Specified by:
      size in interface ConfigStore
      Returns:
      the number of configurations
    • remove

      public ExtensionConfig remove(String id)
      Description copied from interface: ConfigStore
      Removes a configuration by ID.
      Specified by:
      remove in interface ConfigStore
      Parameters:
      id - the configuration ID (must not be null)
      Returns:
      the removed configuration, or null if not found