Interface ResourceRegistrySchemaClient
- All Known Implementing Classes:
ResourceRegistrySchemaClientImpl
The interface is the authoritative caller-facing contract. Stable invocation options are represented by immutable request options, while HTTP metadata is available through the opt-in response executor without changing ordinary domain-oriented return values.
- Author:
- Luca Frosini (ISTI - CNR)
-
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.voidDeprecated.use per-request custom headers fromResourceRegistryRequestOptions<ME extends org.gcube.informationsystem.model.reference.ModelElement>
org.gcube.informationsystem.types.reference.TypeCreates or idempotently confirms a type definition derived from a model element class.Creates or idempotently confirms a type definition using its complete JSON representation.<ME extends org.gcube.informationsystem.model.reference.ModelElement>
booleanType-safe counterpart ofdelete(String)using the class-derived exact Type name.booleanDeletes an uninstantiated, childless, and unreferenced Type throughDELETE /types/{type-name}and lazily invalidates initialized local knowledge.<ME extends org.gcube.informationsystem.model.reference.ModelElement>
booleanChecks if a type definition exists in the Information System using a model element class.booleanChecks if a type definition exists in the Information System using the type name.booleanexistTypeFromServer(String typeName) Checks if a type definition exists on the server throughHEAD /types/{type-name}.org.gcube.informationsystem.model.knowledge.ModelKnowledge<org.gcube.informationsystem.types.reference.Type,org.gcube.informationsystem.types.knowledge.SchemaTypeInformation> Retrieves the complete model knowledge containing type definitions and their information.<ME extends org.gcube.informationsystem.model.reference.ModelElement>
org.gcube.informationsystem.dag.Node<org.gcube.informationsystem.types.reference.Type>getTypeDagNode(Class<ME> clz) Retrieves the type DAG node for a specific type identified by its model element class.org.gcube.informationsystem.dag.Node<org.gcube.informationsystem.types.reference.Type>getTypeDagNode(String typeName) Retrieves the type DAG node for a specific type identified by its name.<ME extends org.gcube.informationsystem.model.reference.ModelElement>
List<org.gcube.informationsystem.types.reference.Type>getTypeFromServer(Class<ME> clz, int depth) Retrieves type definitions directly from the server using a model element class and depth.<ME extends org.gcube.informationsystem.model.reference.ModelElement>
List<org.gcube.informationsystem.types.reference.Type>getTypeFromServer(Class<ME> clz, Boolean polymorphic) Deprecated.UsegetTypeFromServer(Class, int)with depth instead.getTypeFromServer(String typeName, int depth) ReadsGET /types/{type-name}directly from the server withdepthandmetadataPolicy; invocation metadata policy overrides client configuration.getTypeFromServer(String typeName, Boolean polymorphic) Deprecated.UsegetTypeFromServer(String, int)with depth instead.booleanReturns whether metadata should be included in schema requests.Executes a read-only JSON Query-By-Example payload against the global Types collection.<ME extends org.gcube.informationsystem.model.reference.ModelElement>
List<org.gcube.informationsystem.types.reference.Type>Type-safe counterpart ofread(String, int)using the class-derived type name.<ME extends org.gcube.informationsystem.model.reference.ModelElement>
List<org.gcube.informationsystem.types.reference.Type>Type-safe counterpart ofread(String, Boolean)using the class-derived type name.Reads a case-sensitive type from the local snapshot with breadth-first depth0, a positive depth, or-1; values below-1fall back to root-only depth0.Reads a case-sensitive type from the local type snapshot;trueincludes every descendant, whilefalseornullreturns only the requested type.voidForces a renewal of the cached model knowledge by fetching the latest version from the Resource Registry.default org.gcube.informationsystem.resourceregistry.api.client.ResourceRegistryResponsesReturns the opt-in response executor for associating operation values with immutable HTTP metadata captured from the same transport execution.voidsetIncludeMeta(boolean includeMeta) Sets whether metadata should be included in schema requests.
-
Method Details
-
serverResponses
default org.gcube.informationsystem.resourceregistry.api.client.ResourceRegistryResponses serverResponses()Returns the opt-in response executor for associating operation values with immutable HTTP metadata captured from the same transport execution.- Returns:
- stateless response executor
-
includeMeta
boolean includeMeta()Returns whether metadata should be included in schema requests.Invocation-specific options and immutable response metadata are available through
serverResponses().- Returns:
- true if metadata should be included, false otherwise
-
setIncludeMeta
void setIncludeMeta(boolean includeMeta) Sets whether metadata should be included in schema requests.Invocation-specific options and immutable response metadata are available through
serverResponses().- Parameters:
includeMeta- true to include metadata, false to exclude it
-
getModelKnowledge
org.gcube.informationsystem.model.knowledge.ModelKnowledge<org.gcube.informationsystem.types.reference.Type,org.gcube.informationsystem.types.knowledge.SchemaTypeInformation> getModelKnowledge()Retrieves the complete model knowledge containing type definitions and their information. The model knowledge provides access to all registered types and their hierarchical relationships.Invocation-specific options and immutable response metadata are available through
serverResponses().- Returns:
- the model knowledge containing type definitions and information
-
renewModelKnowledge
void renewModelKnowledge()Forces a renewal of the cached model knowledge by fetching the latest version from the Resource Registry. This method should be called when the schema has been modified and the local cache needs to be updated.Invocation-specific options and immutable response metadata are available through
serverResponses(). -
getTypeDagNode
org.gcube.informationsystem.dag.Node<org.gcube.informationsystem.types.reference.Type> getTypeDagNode(String typeName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Retrieves the type DAG node for a specific type identified by its name. The DAG node contains the type definition and its hierarchical position within the type system.Invocation-specific options and immutable response metadata are available through
serverResponses().- Parameters:
typeName- the name of the type to retrieve- Returns:
- the DAG node containing the type and its hierarchical information
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the specified type name does not exist in the schemaorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if an error occurs during the operation
-
getTypeDagNode
<ME extends org.gcube.informationsystem.model.reference.ModelElement> org.gcube.informationsystem.dag.Node<org.gcube.informationsystem.types.reference.Type> getTypeDagNode(Class<ME> clz) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Retrieves the type DAG node for a specific type identified by its model element class. The DAG node contains the type definition and its hierarchical position within the type system.Invocation-specific options and immutable response metadata are available through
serverResponses().- Type Parameters:
ME- the model element type parameter- Parameters:
clz- the class of the model element type to retrieve- Returns:
- the DAG node containing the type and its hierarchical information
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the specified type does not exist in the schemaorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if an error occurs during the operation
-
addHeader
Deprecated.use per-request custom headers fromResourceRegistryRequestOptionsAdds a custom HTTP header to be included in requests.Invocation-specific options and immutable response metadata are available through
serverResponses().- Parameters:
name- Header namevalue- Header value
-
addHeader
Deprecated.use per-request custom headers fromResourceRegistryRequestOptionsAdds a custom HTTP header to be included in requests.Invocation-specific options and immutable response metadata are available through
serverResponses().- Parameters:
name- Header namevalue- boolean value
-
create
String create(String typeDefinition) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Creates or idempotently confirms a type definition using its complete JSON representation.The operation is global and requires an
IS-MorInfra-Mrole. It accepts no query parameters. A structurally identical retry is an idempotent no-op; a different definition with the same name is rejected. The returned JSON is always the persisted representation, whether newly created or already present.HTTP status (
201for creation or200for an identical retry),Content-Location, and any warnings are available throughserverResponses().- Parameters:
typeDefinition- the non-null, complete JSON schema definition to create- Returns:
- the persisted JSON representation; never
null - Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException- if the definition is malformed, violates schema constraints, uses a conflicting name or UUID, or is structurally different from an existing definitionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if authorization, transport, response processing, or another registry operation fails
-
create
<ME extends org.gcube.informationsystem.model.reference.ModelElement> org.gcube.informationsystem.types.reference.Type create(Class<ME> clz) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Creates or idempotently confirms a type definition derived from a model element class.This overload serializes the supplied class and delegates to
create(String)with exactly the same authorization, idempotency, response-metadata, and failure semantics.- Type Parameters:
ME- the model element type parameter- Parameters:
clz- the non-null model element class to create- Returns:
- the persisted Type definition; never
null - Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException- if the class definition is invalid or schema generation failsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if serialization, authorization, transport, response processing, or another registry operation fails
-
exist
boolean exist(String typeName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Checks if a type definition exists in the Information System using the type name.Invocation-specific options and immutable response metadata are available through
serverResponses().- Parameters:
typeName- the name of the type to check for existence (case-sensitive)- Returns:
- true if the type exists in the system, false if not found
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if an error occurs during the existence check
-
exist
<ME extends org.gcube.informationsystem.model.reference.ModelElement> boolean exist(Class<ME> clz) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Checks if a type definition exists in the Information System using a model element class.Invocation-specific options and immutable response metadata are available through
serverResponses().- Type Parameters:
ME- the model element type parameter- Parameters:
clz- the class of the model element type to check for existence- Returns:
- true if the type corresponding to the class exists in the system, false if not found
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if an error occurs during the existence check
-
read
String read(String typeName, Boolean polymorphic) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Reads a case-sensitive type from the local type snapshot;trueincludes every descendant, whilefalseornullreturns only the requested type.Each type occurs once in breadth-first order. A fully cached call reports the
CACHEorigin throughserverResponses()and has no HTTP response metadata.- Parameters:
typeName- the exact type namepolymorphic- whether to include all descendants;nullmeansfalse- Returns:
- a non-null JSON array containing the selected cached type definitions
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the requested type is absent from the snapshotorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if cache initialization, serialization, or retrieval fails
-
read
<ME extends org.gcube.informationsystem.model.reference.ModelElement> List<org.gcube.informationsystem.types.reference.Type> read(Class<ME> clz, Boolean polymorphic) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Type-safe counterpart ofread(String, Boolean)using the class-derived type name.- Type Parameters:
ME- the model element type- Parameters:
clz- the class whose exact type name is readpolymorphic- whether to include all descendants;nullmeansfalse- Returns:
- a non-null breadth-first list with each cached type exactly once
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the class-derived type is absent from the snapshotorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if cache initialization or retrieval fails
-
read
String read(String typeName, int level) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Reads a case-sensitive type from the local snapshot with breadth-first depth0, a positive depth, or-1; values below-1fall back to root-only depth0.- Parameters:
typeName- the exact type namelevel-0for the root, a positive descendant depth, or-1for all descendants- Returns:
- a non-null JSON array with each selected cached type exactly once
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the requested type is absent from the snapshotorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if cache initialization, serialization, or retrieval fails
-
read
<ME extends org.gcube.informationsystem.model.reference.ModelElement> List<org.gcube.informationsystem.types.reference.Type> read(Class<ME> clz, int level) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Type-safe counterpart ofread(String, int)using the class-derived type name.- Type Parameters:
ME- the model element type- Parameters:
clz- the class whose exact type name is readlevel-0for the root, a positive descendant depth, or-1for all descendants- Returns:
- a non-null breadth-first list with each cached type exactly once
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the class-derived type is absent from the snapshotorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if cache initialization or retrieval fails
-
existTypeFromServer
boolean existTypeFromServer(String typeName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Checks if a type definition exists on the server throughHEAD /types/{type-name}.Invocation-specific options and immutable response metadata are available through
serverResponses().- Parameters:
typeName- the exact, case-sensitive type name- Returns:
- true if the type exists on the server, false otherwise
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- for server communication errors
-
getTypeFromServer
@Deprecated String getTypeFromServer(String typeName, Boolean polymorphic) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Deprecated.UsegetTypeFromServer(String, int)with depth instead.ReadsGET /types/{type-name}directly from the server;truemaps to depth-1, whilefalseornullmaps to depth0.- Parameters:
typeName- the exact, case-sensitive type namepolymorphic- whether to request every descendant;nullmeansfalse- Returns:
- the non-null JSON response array
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the server returns not foundorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if authorization, transport, or response processing fails
-
getTypeFromServer
String getTypeFromServer(String typeName, int depth) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException ReadsGET /types/{type-name}directly from the server withdepthandmetadataPolicy; invocation metadata policy overrides client configuration. A successful response exposesContent-Location, direct-supertype links, and warnings throughserverResponses(); an unknown exact name maps to404.- Parameters:
typeName- the exact, case-sensitive type namedepth-0, a positive descendant depth, or-1- Returns:
- the non-null JSON response array
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the server returns not foundorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if authorization, transport, or response processing fails
-
getTypeFromServer
@Deprecated <ME extends org.gcube.informationsystem.model.reference.ModelElement> List<org.gcube.informationsystem.types.reference.Type> getTypeFromServer(Class<ME> clz, Boolean polymorphic) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Deprecated.UsegetTypeFromServer(Class, int)with depth instead.Retrieves type definitions directly from the server using a model element class.- Type Parameters:
ME- the model element type parameter- Parameters:
clz- the class of the model element type to retrievepolymorphic- whether to include subtypes- Returns:
- list of Type objects retrieved from the server
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the type is not found on the serverorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- for server communication errors
-
getTypeFromServer
<ME extends org.gcube.informationsystem.model.reference.ModelElement> List<org.gcube.informationsystem.types.reference.Type> getTypeFromServer(Class<ME> clz, int depth) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Retrieves type definitions directly from the server using a model element class and depth.- Type Parameters:
ME- the model element type parameter- Parameters:
clz- the class of the model element type to retrievedepth- the depth of subclass expansion- Returns:
- list of Type objects retrieved from the server
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the type is not found on the serverorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- for server communication errors
-
delete
boolean delete(String typeName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Deletes an uninstantiated, childless, and unreferenced Type throughDELETE /types/{type-name}and lazily invalidates initialized local knowledge.No query parameter or
Preferoption is sent. A successful bodyless204returnstrue; response status and warnings are available throughserverResponses()without being replaced by cache-refresh requests.- Parameters:
typeName- the exact, case-sensitive Type name; UUID addressing is unsupported- Returns:
trueafter a successful204 No Content- Throws:
jakarta.ws.rs.ForbiddenException- if the caller is not anIS-MorInfra-Morg.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the exact Type name does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException- if concrete instances, subtypes, or Type references remainorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if transport or response processing fails
-
delete
<ME extends org.gcube.informationsystem.model.reference.ModelElement> boolean delete(Class<ME> clz) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Type-safe counterpart ofdelete(String)using the class-derived exact Type name.- Type Parameters:
ME- the model element type- Parameters:
clz- the class whose Type definition is deleted- Returns:
trueafter a successful204 No Content- Throws:
jakarta.ws.rs.ForbiddenException- if the caller is not anIS-MorInfra-Morg.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the class-derived Type name does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException- if concrete instances, subtypes, or Type references remainorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if transport or response processing fails
-
query
String query(String jsonQuery) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Executes a read-only JSON Query-By-Example payload against the global Types collection. The payload must be a non-null JSON object targetingResourceSchema,FacetSchema,IsRelatedToSchema,ConsistsOfSchema, orPropertySchema. Every authenticated role may invoke the operation and no Context-scoped token is required.ResourceRegistryRequestOptionsmay setlimit(default 10, maximum 50),offset(default 0),depth(default -1), andmetadataPolicy(default none) for one invocation. Plainname,source, andtargetfilters usedepth. An_emitpayload returns flat, native-typed aliases and supersedes metadata inclusion. Per-request options take precedence over the metadata default configured throughsetIncludeMeta(boolean).The method has no local cache or mutation side effects. It returns
[]when no definition matches. Pagination links and parameter/projection warnings are available throughserverResponses().- Parameters:
jsonQuery- non-null JSON object describing the Type definitions to search for- Returns:
- JSON array string containing full Type definitions or flat projection rows; never
null - Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException- if the payload is malformed, structurally invalid, or targets an unsupported Type categoryorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if request construction, transport, response processing, or server-side persistence fails
-
ResourceRegistryRequestOptions