Package com.tnsai.rag

Class ContentExtractorRegistry

java.lang.Object
com.tnsai.rag.ContentExtractorRegistry

public final class ContentExtractorRegistry extends Object
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 Details

  • Method Details

    • discover

      public static ContentExtractorRegistry 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

      public static ContentExtractorRegistry of(Collection<? extends ContentExtractor> providers)
      Creates an explicit registry, primarily for application registration and deterministic contract tests.
      Parameters:
      providers - extractor providers
      Returns:
      immutable deterministic registry
    • extract

      public ExtractedDocument extract(DocumentInput input, ExtractionContext context)
      Resolves and invokes the extractor for one detected document.

      The provider runs on a worker whose Future is 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 input
      context - source declaration context
      Returns:
      normalized extracted document
    • version

      public String version(DocumentInput input, ExtractionContext context)
      Returns the registered provider version for a concrete input format.
    • extractorId

      public String extractorId(DocumentFormat format)
      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

      public String version(DocumentFormat format)
      Returns the registered extractor version for a concrete format.
      Parameters:
      format - detected or declared concrete format
      Returns:
      provider version used in index fingerprints
    • registeredFormats

      public Set<DocumentFormat> registeredFormats()
      Returns the concrete formats registered in this immutable snapshot.