Interface ConfigStore

All Superinterfaces:
TikaExtension
All Known Implementing Classes:
FileBasedConfigStore, IgniteConfigStore, InMemoryConfigStore

public interface ConfigStore extends TikaExtension
Interface for storing and retrieving component configurations. Implementations can provide different storage backends (in-memory, database, distributed cache, etc.).

Thread-safety: Implementations of this interface may or may not be thread-safe. If an implementation is thread-safe, it should be clearly documented as such. Callers must not assume thread-safety unless it is explicitly documented by the implementation. The default in-memory implementation (InMemoryConfigStore) is thread-safe.

Performance considerations: The keySet() method should be an inexpensive operation as it may be called in error message generation and other scenarios where performance matters.

  • Method Details

    • init

      default void init() throws Exception
      Initializes the configuration store. This method should be called once before using the store. Implementations may use this to establish connections, initialize caches, etc.
      Throws:
      Exception - if initialization fails
    • put

      void put(String id, ExtensionConfig config)
      Stores a configuration.
      Parameters:
      id - the configuration ID (must not be null)
      config - the configuration to store (must not be null)
      Throws:
      NullPointerException - if id or config is null
    • get

      Retrieves a configuration by ID.
      Parameters:
      id - the configuration ID (must not be null)
      Returns:
      the configuration, or null if not found
      Throws:
      NullPointerException - if id is null
    • containsKey

      boolean containsKey(String id)
      Checks if a configuration exists.
      Parameters:
      id - the configuration ID (must not be null)
      Returns:
      true if the configuration exists
      Throws:
      NullPointerException - if id is null
    • keySet

      Set<String> keySet()
      Returns all configuration IDs. Implementations should return an immutable snapshot to avoid ConcurrentModificationException during iteration.
      Returns:
      an immutable set of all configuration IDs
    • size

      int size()
      Returns the number of stored configurations.
      Returns:
      the number of configurations
    • remove

      ExtensionConfig remove(String id)
      Removes a configuration by ID.
      Parameters:
      id - the configuration ID (must not be null)
      Returns:
      the removed configuration, or null if not found
      Throws:
      NullPointerException - if id is null