Interface ConfigStore
- All Superinterfaces:
TikaExtension
- All Known Implementing Classes:
FileBasedConfigStore,IgniteConfigStore,InMemoryConfigStore
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 Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(String id) Checks if a configuration exists.Retrieves a configuration by ID.default voidinit()Initializes the configuration store.keySet()Returns all configuration IDs.voidput(String id, ExtensionConfig config) Stores a configuration.Removes a configuration by ID.intsize()Returns the number of stored configurations.Methods inherited from interface org.apache.tika.plugins.TikaExtension
getExtensionConfig
-
Method Details
-
init
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
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
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
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
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
-