Package org.apache.tika.metadata.schema
Class SchemaGenerator
java.lang.Object
org.apache.tika.metadata.schema.SchemaGenerator
Generates the machine-readable metadata key registry (
metadata-keys.json) from the live
Property declarations. Dependency-free: it scans the runtime classpath for classes that
declare a Property field, force-loads them (their static init registers into the global
Property table), then serializes that table as stable, sorted JSON.
The generated file is committed; MetadataSchemaTest regenerates and asserts no diff,
so the registry can never drift from the declarations.
TIKA-4797: fieldTable() additionally emits a {class, field, key} table (the
field provenance that Property.PROPERTIES discards) so the 3.x→4.x key migration can
be built by a field-identity join. Synthesized keys with no declaring field (digests) are absent
from that table by design; they migrate by prefix rule.
-
Method Details
-
generate
- Returns:
- the registry as stable JSON (sorted by key).
- Throws:
Exception
-
fieldTable
TIKA-4797. @return the field-attributed table[{class, field, key}]as stable JSON, sorted byclass#field— one record per staticPropertyconstant. Aliases (two fields, same key) are distinct records; that is what lets the migration join detect renames.- Throws:
Exception
-
passthroughJson
Declared passthrough prefixes as stable JSON. Call aftergenerate()has loaded classes (and populatedlastPrefixModules). -
main
- Throws:
Exception
-