Class ResourceRegistrySchemaClientImpl
- All Implemented Interfaces:
ResourceRegistrySchemaClient
ResourceRegistrySchemaClient, backed by HTTP calls to the
Resource Registry service and a local TypesKnowledge cache (shared or per-instance)
used to serve type reads without a round-trip whenever possible.- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StringThe base address URL for the Resource Registry Schema service endpoint.HTTP headers to be included in requests to the Resource Registry Schema service.protected booleanTracks whether the client must request to includeMetadata.protected org.gcube.informationsystem.types.knowledge.TypesKnowledgeCached knowledge about types and their relationships within the Information System. -
Constructor Summary
ConstructorsConstructorDescriptionResourceRegistrySchemaClientImpl(String address) Creates a new ResourceRegistrySchemaClient instance with shared model knowledge.ResourceRegistrySchemaClientImpl(String address, boolean sharedModelKnowledge) Creates a new ResourceRegistrySchemaClient instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected List<org.gcube.informationsystem.types.reference.Type>addChildren(org.gcube.informationsystem.dag.Node<org.gcube.informationsystem.types.reference.Type> node, List<org.gcube.informationsystem.types.reference.Type> types, int currentLevel, int maxLevel) Adds child types in stable breadth-first order, once per type name.voidAdds a custom HTTP header to be included in requests.voidAdds a custom HTTP header to be included in requests.<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 ofResourceRegistrySchemaClient.delete(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 exists directly on the server using a HEAD request.protected org.gcube.common.gxhttp.request.GXHTTPStringRequestCreates and configures a GXHTTPStringRequest with authentication headers and custom headers.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> clazz) 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.getTypeFromServer(String typeName, int depth) ReadsGET /types/{type-name}directly withdepthandmetadataPolicy; invocation metadata policy overrides client configuration.getTypeFromServer(String typeName, Boolean polymorphic) Deprecated.UsegetTypeFromServer(String, int)with depth instead.List<org.gcube.informationsystem.types.reference.Type>getTypeFromTypesKnowledge(String typeName, int level) Retrieves type information from the local TypesKnowledge cache with level-based filtering.List<org.gcube.informationsystem.types.reference.Type>getTypeFromTypesKnowledge(String typeName, Boolean polymorphic) Retrieves type information from the local TypesKnowledge cache.List<org.gcube.informationsystem.types.reference.Type>getTypeFromTypesKnowledge(String typeName, Boolean polymorphic, int level) Retrieves type information from the local TypesKnowledge cache with full filtering options.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 ofResourceRegistrySchemaClient.read(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 ofResourceRegistrySchemaClient.read(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.voidsetIncludeMeta(boolean includeMeta) Sets whether metadata should be included in schema requests.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gcube.informationsystem.resourceregistry.schema.ResourceRegistrySchemaClient
serverResponses
-
Field Details
-
address
The base address URL for the Resource Registry Schema service endpoint. -
headers
HTTP headers to be included in requests to the Resource Registry Schema service. -
typesKnowledge
protected org.gcube.informationsystem.types.knowledge.TypesKnowledge typesKnowledgeCached knowledge about types and their relationships within the Information System. -
includeMeta
protected boolean includeMetaTracks whether the client must request to includeMetadata.
-
-
Constructor Details
-
ResourceRegistrySchemaClientImpl
Creates a new ResourceRegistrySchemaClient instance with shared model knowledge. This constructor delegates toResourceRegistrySchemaClientImpl(String, boolean)with sharedModelKnowledge=true.- Parameters:
address- the base address of the Resource Registry service
-
ResourceRegistrySchemaClientImpl
Creates a new ResourceRegistrySchemaClient instance.- Parameters:
address- the base address of the Resource Registry servicesharedModelKnowledge- whether to use shared TypesKnowledge instance (true) or create a new one (false)
-
-
Method Details
-
includeMeta
public boolean includeMeta()Returns whether metadata should be included in schema requests.Invocation-specific options and immutable response metadata are available through
ResourceRegistrySchemaClient.serverResponses().- Specified by:
includeMetain interfaceResourceRegistrySchemaClient- Returns:
- true if metadata should be included, false otherwise
-
setIncludeMeta
public void setIncludeMeta(boolean includeMeta) Sets whether metadata should be included in schema requests.Invocation-specific options and immutable response metadata are available through
ResourceRegistrySchemaClient.serverResponses().- Specified by:
setIncludeMetain interfaceResourceRegistrySchemaClient- Parameters:
includeMeta- true to include metadata, false to exclude it
-
addHeader
Adds a custom HTTP header to be included in requests.Invocation-specific options and immutable response metadata are available through
ResourceRegistrySchemaClient.serverResponses().- Specified by:
addHeaderin interfaceResourceRegistrySchemaClient- Parameters:
name- Header namevalue- Header value
-
addHeader
Adds a custom HTTP header to be included in requests.Invocation-specific options and immutable response metadata are available through
ResourceRegistrySchemaClient.serverResponses().- Specified by:
addHeaderin interfaceResourceRegistrySchemaClient- Parameters:
name- Header namevalue- boolean value
-
getGXHTTPStringRequest
protected org.gcube.common.gxhttp.request.GXHTTPStringRequest getGXHTTPStringRequest()Creates and configures a GXHTTPStringRequest with authentication headers and custom headers. This method sets up the basic HTTP request infrastructure needed for all REST API calls.- Returns:
- a configured GXHTTPStringRequest ready for API calls
-
getModelKnowledge
public 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
ResourceRegistrySchemaClient.serverResponses().- Specified by:
getModelKnowledgein interfaceResourceRegistrySchemaClient- Returns:
- the model knowledge containing type definitions and information
-
renewModelKnowledge
public 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
ResourceRegistrySchemaClient.serverResponses().- Specified by:
renewModelKnowledgein interfaceResourceRegistrySchemaClient
-
create
public <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
ResourceRegistrySchemaClient.create(String)with exactly the same authorization, idempotency, response-metadata, and failure semantics.- Specified by:
createin interfaceResourceRegistrySchemaClient- 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
-
create
public 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 throughResourceRegistrySchemaClient.serverResponses().- Specified by:
createin interfaceResourceRegistrySchemaClient- 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
-
exist
public <ME extends org.gcube.informationsystem.model.reference.ModelElement> boolean exist(Class<ME> clazz) 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
This method is a type-safe wrapper that delegates toResourceRegistrySchemaClient.serverResponses().exist(String)for implementation details.- Specified by:
existin interfaceResourceRegistrySchemaClient- Type Parameters:
ME- the model element type parameter- Parameters:
clazz- 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
-
exist
public 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
ResourceRegistrySchemaClient.serverResponses().- Specified by:
existin interfaceResourceRegistrySchemaClient- 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
-
getTypeFromTypesKnowledge
public List<org.gcube.informationsystem.types.reference.Type> getTypeFromTypesKnowledge(String typeName, Boolean polymorphic) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Retrieves type information from the local TypesKnowledge cache. This method supports both polymorphic and level-based filtering.- Parameters:
typeName- the name of the type to retrievepolymorphic- whether to include subtypes- Returns:
- list of Type objects matching the criteria
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the type is not foundorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- for other retrieval errors
-
getTypeFromTypesKnowledge
public List<org.gcube.informationsystem.types.reference.Type> getTypeFromTypesKnowledge(String typeName, int level) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Retrieves type information from the local TypesKnowledge cache with level-based filtering. This method delegates togetTypeFromTypesKnowledge(String, Boolean, int)with polymorphic=true.- Parameters:
typeName- the name of the type to retrievelevel- the maximum hierarchy level to include- Returns:
- list of Type objects matching the criteria
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the type is not foundorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- for other retrieval errors
-
addChildren
protected List<org.gcube.informationsystem.types.reference.Type> addChildren(org.gcube.informationsystem.dag.Node<org.gcube.informationsystem.types.reference.Type> node, List<org.gcube.informationsystem.types.reference.Type> types, int currentLevel, int maxLevel) Adds child types in stable breadth-first order, once per type name.- Parameters:
node- the current node in the type hierarchytypes- the accumulator list for type resultscurrentLevel- the current recursion levelmaxLevel- the maximum level to recurse to (-1 for unlimited)- Returns:
- the updated list of types including children
-
getTypeFromTypesKnowledge
public List<org.gcube.informationsystem.types.reference.Type> getTypeFromTypesKnowledge(String typeName, Boolean polymorphic, int level) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Retrieves type information from the local TypesKnowledge cache with full filtering options. This is the main implementation method that supports both polymorphic and level-based filtering.- Parameters:
typeName- the name of the type to retrievepolymorphic- whether to include subtypeslevel- the maximum hierarchy level to include (-1 for unlimited)- Returns:
- list of Type objects matching the criteria
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the type is not foundorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- for other retrieval errors
-
read
public 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 throughResourceRegistrySchemaClient.serverResponses()and has no HTTP response metadata.- Specified by:
readin interfaceResourceRegistrySchemaClient- 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
public <ME extends org.gcube.informationsystem.model.reference.ModelElement> List<org.gcube.informationsystem.types.reference.Type> read(Class<ME> clazz, Boolean polymorphic) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Type-safe counterpart ofResourceRegistrySchemaClient.read(String, Boolean)using the class-derived type name. This method is a type-safe wrapper that delegates togetTypeFromTypesKnowledge(String, Boolean)for implementation details.- Specified by:
readin interfaceResourceRegistrySchemaClient- Type Parameters:
ME- the model element type- Parameters:
clazz- 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
public 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.- Specified by:
readin interfaceResourceRegistrySchemaClient- 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
public <ME extends org.gcube.informationsystem.model.reference.ModelElement> List<org.gcube.informationsystem.types.reference.Type> read(Class<ME> clazz, int level) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Type-safe counterpart ofResourceRegistrySchemaClient.read(String, int)using the class-derived type name. This method is a type-safe wrapper that delegates togetTypeFromTypesKnowledge(String, int)for implementation details.- Specified by:
readin interfaceResourceRegistrySchemaClient- Type Parameters:
ME- the model element type- Parameters:
clazz- 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
-
getTypeDagNode
public 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
ResourceRegistrySchemaClient.serverResponses().- Specified by:
getTypeDagNodein interfaceResourceRegistrySchemaClient- 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
public <ME extends org.gcube.informationsystem.model.reference.ModelElement> org.gcube.informationsystem.dag.Node<org.gcube.informationsystem.types.reference.Type> getTypeDagNode(Class<ME> clazz) 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
This method is a type-safe wrapper that delegates toResourceRegistrySchemaClient.serverResponses().getTypeDagNode(String)for implementation details.- Specified by:
getTypeDagNodein interfaceResourceRegistrySchemaClient- Type Parameters:
ME- the model element type parameter- Parameters:
clazz- 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
-
existTypeFromServer
public boolean existTypeFromServer(String typeName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Checks if a type exists directly on the server using a HEAD request. This method bypasses the local cache and queries the server directly.- Specified by:
existTypeFromServerin interfaceResourceRegistrySchemaClient- Parameters:
typeName- the name of the type to check- 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 public <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. This method bypasses the local cache and queries the server directly. This method is a type-safe wrapper that delegates togetTypeFromServer(Class, int)for implementation details.- Specified by:
getTypeFromServerin interfaceResourceRegistrySchemaClient- 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
public <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. This method bypasses the local cache and queries the server directly.- Specified by:
getTypeFromServerin interfaceResourceRegistrySchemaClient- 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
-
getTypeFromServer
@Deprecated public 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;truemaps to depth-1, whilefalseornullmaps to depth0.- Specified by:
getTypeFromServerin interfaceResourceRegistrySchemaClient- 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
public 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 withdepthandmetadataPolicy; invocation metadata policy overrides client configuration. A successful response exposesContent-Location, direct-supertype links, and warnings throughResourceRegistrySchemaClient.serverResponses(); an unknown exact name maps to404.- Specified by:
getTypeFromServerin interfaceResourceRegistrySchemaClient- 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
-
delete
public 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 throughResourceRegistrySchemaClient.serverResponses()without being replaced by cache-refresh requests.- Specified by:
deletein interfaceResourceRegistrySchemaClient- Parameters:
typeName- the exact, case-sensitive Type name; UUID addressing is unsupported- Returns:
trueafter a successful204 No Content- Throws:
org.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
public <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 ofResourceRegistrySchemaClient.delete(String)using the class-derived exact Type name. This method is a type-safe wrapper that delegates todelete(String)for implementation details.- Specified by:
deletein interfaceResourceRegistrySchemaClient- Type Parameters:
ME- the model element type- Parameters:
clz- the class whose Type definition is deleted- Returns:
trueafter a successful204 No Content- Throws:
org.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
public 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 throughResourceRegistrySchemaClient.setIncludeMeta(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 throughResourceRegistrySchemaClient.serverResponses().- Specified by:
queryin interfaceResourceRegistrySchemaClient- 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
-
getTypeFromServer(Class, int)with depth instead.