Class RegistryDocumentationGenerator
java.lang.Object
org.gcube.informationsystem.resourceregistry.documentation.RegistryDocumentationGenerator
Renders the live-registry documentation product distinct from the committed static docs (see
the Architectural Decisions Log, "Two distinct documentation products"): the is-model bucket
still comes from the classpath, since
is-model is compile-time and never
runtime-mutable, but the domain-model bucket comes from a SchemaSnapshot via
SchemaSnapshotTypesDiscoverer, so a runtime-registered type is included exactly like a
classpath-declared one.
Writing is atomic with respect to whatever serves outputDirectory: the whole
documentation set is rendered into a fresh temporary directory first, then swapped into place by
two directory renames, so a reader of outputDirectory never observes a partially written
set. Neither the wiring of when this runs (on startup, on schema change) nor how
outputDirectory is exposed to clients is this class's concern.
- Author:
- Luca Frosini (ISTI - CNR)
-
Constructor Summary
ConstructorsConstructorDescriptionRegistryDocumentationGenerator(String format) Creates a generator that renders in the given format. -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerate(SchemaSnapshot snapshot, org.gcube.informationsystem.registry.RegistryMetadata registryMetadata, File outputDirectory) Renders the documentation forsnapshotand atomically publishes it tooutputDirectory, showing the models ofregistryMetadatain the sidebar.
-
Constructor Details
-
RegistryDocumentationGenerator
Creates a generator that renders in the given format.- Parameters:
format- the template format to render (e.g."md")
-
-
Method Details
-
generate
public void generate(SchemaSnapshot snapshot, org.gcube.informationsystem.registry.RegistryMetadata registryMetadata, File outputDirectory) throws Exception Renders the documentation forsnapshotand atomically publishes it tooutputDirectory, showing the models ofregistryMetadatain the sidebar.- Parameters:
snapshot- the schema snapshot to document the domain-model bucket fromregistryMetadata- the record the sidebar shows: one line per model, is-model first and the runtime model last, and the global revision count; it also names the domain-model bucket, after the domain model or, with none, after the runtime modeloutputDirectory- the directory readers observe; replaced atomically on success, left untouched on failure- Throws:
Exception- if building the model knowledge or rendering the templates failsIOException- if the temporary directory cannot be created or the swap fails
-