Class RegistryMetadataStore
java.lang.Object
org.gcube.informationsystem.resourceregistry.persistence.orientdb.types.RegistryMetadataStore
Reads and changes the
RegistryMetadata singleton at runtime, each operation in a session
of its own, with the Type environment's users: whoever works on types reads the schema version
with them. Every change is a single server-side update of the fields it touches.- Author:
- Luca Frosini (ISTI - CNR)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanalignRuntimeType(String typeName, String version) Aligns the version of a runtime type, if the type is one: the types of the classpath models are a snapshot of their libraries and never change at runtime.incrementRevisionCount(String modelName) Advances the globalrevisionCount, and the given model's, by one.Returns the model a type belongs to.booleanputRuntimeType(String typeName, String version) Records a type created at runtime in the runtime model.org.gcube.informationsystem.registry.RegistryMetadataread()Reads the whole record.ReadsrevisionCount.booleanremoveRuntimeType(String typeName) Removes a runtime type, if the type is one.
-
Constructor Details
-
RegistryMetadataStore
public RegistryMetadataStore()
-
-
Method Details
-
read
public org.gcube.informationsystem.registry.RegistryMetadata read() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionReads the whole record.- Returns:
- the record, or
nullif none exists - Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the database cannot be read
-
readRevisionCount
public Long readRevisionCount() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionReadsrevisionCount.- Returns:
- the current value, or
nullif no record exists - Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the database cannot be read
-
incrementRevisionCount
public Long incrementRevisionCount(String modelName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Advances the globalrevisionCount, and the given model's, by one.- Parameters:
modelName- the model the written type belongs to, ornullfor the global counter alone- Returns:
- the new global value, or
nullif no record exists - Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the database cannot be written
-
modelOf
public String modelOf(String typeName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Returns the model a type belongs to.- Parameters:
typeName- the type name- Returns:
- the model name, or
nullif no model holds the type or no record exists - Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the database cannot be read
-
putRuntimeType
public boolean putRuntimeType(String typeName, String version) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Records a type created at runtime in the runtime model.- Parameters:
typeName- the type nameversion- the type version- Returns:
trueif recorded,falseif no record or no runtime model exists- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the database cannot be written
-
alignRuntimeType
public boolean alignRuntimeType(String typeName, String version) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Aligns the version of a runtime type, if the type is one: the types of the classpath models are a snapshot of their libraries and never change at runtime.- Parameters:
typeName- the type nameversion- the type version- Returns:
trueif the type is a runtime type and its version was aligned- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the database cannot be written
-
removeRuntimeType
public boolean removeRuntimeType(String typeName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Removes a runtime type, if the type is one.- Parameters:
typeName- the type name- Returns:
trueif the type was a runtime type and was removed- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the database cannot be written
-