Package com.tnsai.rag
Class ContentExtractorRegistry
java.lang.Object
com.tnsai.rag.ContentExtractorRegistry
Deterministic registry of installed
ContentExtractor providers.
Provider order never decides a collision: providers and duplicate names are sorted by implementation class name. A framework default yields any format a consumer extractor also claims; two non-default claims for one format still fail construction. Missing formats fail when requested.
- Since:
- 0.13.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longDefault wall-clock bound on one provider call.static final StringExtractionContext.attributes()key for a per-call timeout. -
Method Summary
Modifier and TypeMethodDescriptionstatic ContentExtractorRegistrydiscover()Discovers providers visible to the core contract's defining classloader.extract(DocumentInput input, ExtractionContext context) Resolves and invokes the extractor for one detected document.extractorId(DocumentFormat format) Returns the registered extractor implementation name for a concrete format.static ContentExtractorRegistryof(Collection<? extends ContentExtractor> providers) Creates an explicit registry, primarily for application registration and deterministic contract tests.Returns the concrete formats registered in this immutable snapshot.version(DocumentFormat format) Returns the registered extractor version for a concrete format.version(DocumentInput input, ExtractionContext context) Returns the registered provider version for a concrete input format.
-
Field Details
-
DEFAULT_EXTRACT_TIMEOUT_MILLIS
public static final long DEFAULT_EXTRACT_TIMEOUT_MILLISDefault wall-clock bound on one provider call.- See Also:
-
EXTRACT_TIMEOUT_ATTRIBUTE
ExtractionContext.attributes()key for a per-call timeout. Value must be a positiveNumberof milliseconds.- See Also:
-
-
Method Details
-
discover
Discovers providers visible to the core contract's defining classloader. Provider construction and contract-inspection failures use a framework-controlled message while retaining the original provider throwable in the cause chain.- Returns:
- immutable deterministic registry
-
of
Creates an explicit registry, primarily for application registration and deterministic contract tests.- Parameters:
providers- extractor providers- Returns:
- immutable deterministic registry
-
extract
Resolves and invokes the extractor for one detected document.The provider runs on a worker whose
Futureis retained. Timeout or caller interrupt cancel(true) that worker. Admission is released exactly once when the worker honours interrupt; a provider that ignores interrupt is quarantined after a bounded grace so ingest is not starved.- Parameters:
input- detected document inputcontext- source declaration context- Returns:
- normalized extracted document
-
version
Returns the registered provider version for a concrete input format. -
extractorId
Returns the registered extractor implementation name for a concrete format.- Parameters:
format- detected or declared concrete format- Returns:
- implementation class name used in index fingerprints
-
version
Returns the registered extractor version for a concrete format.- Parameters:
format- detected or declared concrete format- Returns:
- provider version used in index fingerprints
-
registeredFormats
Returns the concrete formats registered in this immutable snapshot.
-