Class ResourceRegistrySchemaClientImpl

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected String address
      The base address URL for the Resource Registry Schema service endpoint.
      protected Map<String,​String> headers
      HTTP headers to be included in requests to the Resource Registry Schema service.
      protected boolean includeMeta
      Tracks whether the client must request to include Metadata.
      protected org.gcube.informationsystem.types.knowledge.TypesKnowledge typesKnowledge
      Cached knowledge about types and their relationships within the Information System.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      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.
      void addHeader​(String name, boolean value)
      Adds a custom HTTP header to be included in requests.
      void addHeader​(String name, String value)
      Adds a custom HTTP header to be included in requests.
      <ME extends org.gcube.informationsystem.model.reference.ModelElement>
      org.gcube.informationsystem.types.reference.Type
      create​(Class<ME> clz)
      Creates or idempotently confirms a type definition derived from a model element class.
      String create​(String typeDefinition)
      Creates or idempotently confirms a type definition using its complete JSON representation.
      <ME extends org.gcube.informationsystem.model.reference.ModelElement>
      boolean
      delete​(Class<ME> clz)
      Type-safe counterpart of ResourceRegistrySchemaClient.delete(String) using the class-derived exact Type name.
      boolean delete​(String typeName)
      Deletes an uninstantiated, childless, and unreferenced Type through DELETE /types/{type-name} and lazily invalidates initialized local knowledge.
      <ME extends org.gcube.informationsystem.model.reference.ModelElement>
      boolean
      exist​(Class<ME> clazz)
      Checks if a type definition exists in the Information System using a model element class.
      boolean exist​(String typeName)
      Checks if a type definition exists in the Information System using the type name.
      boolean existTypeFromServer​(String typeName)
      Checks if a type exists directly on the server using a HEAD request.
      protected org.gcube.common.gxhttp.request.GXRequest getGXRequest()
      Creates and configures a GXRequest with authentication headers and custom headers.
      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.
      <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.
      Use getTypeFromServer(Class, int) with depth instead.
      String getTypeFromServer​(String typeName, int depth)
      Reads GET /types/{type-name} directly with depth and metadataPolicy; invocation metadata policy overrides client configuration.
      String getTypeFromServer​(String typeName, Boolean polymorphic)
      Deprecated.
      Use getTypeFromServer(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.
      <ME extends org.gcube.informationsystem.model.reference.ModelElement>
      org.gcube.informationsystem.dag.Node<org.gcube.informationsystem.types.reference.Type>
      getTypeTreeNode​(Class<ME> clz)
      Deprecated.
      org.gcube.informationsystem.dag.Node<org.gcube.informationsystem.types.reference.Type> getTypeTreeNode​(String typeName)
      Deprecated.
      boolean includeMeta()
      Returns whether metadata should be included in schema requests.
      String query​(String jsonQuery)
      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>
      read​(Class<ME> clazz, int level)
      Type-safe counterpart of ResourceRegistrySchemaClient.read(String, int) using the class-derived type name.
      <ME extends org.gcube.informationsystem.model.reference.ModelElement>
      List<org.gcube.informationsystem.types.reference.Type>
      read​(Class<ME> clazz, Boolean polymorphic)
      Type-safe counterpart of ResourceRegistrySchemaClient.read(String, Boolean) using the class-derived type name.
      String read​(String typeName, int level)
      Reads a case-sensitive type from the local snapshot with breadth-first depth 0, a positive depth, or -1; values below -1 fall back to root-only depth 0.
      String read​(String typeName, Boolean polymorphic)
      Reads a case-sensitive type from the local type snapshot; true includes every descendant, while false or null returns only the requested type.
      void renewModelKnowledge()
      Forces a renewal of the cached model knowledge by fetching the latest version from the Resource Registry.
      void setIncludeMeta​(boolean includeMeta)
      Sets whether metadata should be included in schema requests.
    • Field Detail

      • address

        protected final String address
        The base address URL for the Resource Registry Schema service endpoint.
      • headers

        protected Map<String,​String> headers
        HTTP headers to be included in requests to the Resource Registry Schema service.
      • typesKnowledge

        protected org.gcube.informationsystem.types.knowledge.TypesKnowledge typesKnowledge
        Cached knowledge about types and their relationships within the Information System.
      • includeMeta

        protected boolean includeMeta
        Tracks whether the client must request to include Metadata.
    • Constructor Detail

      • ResourceRegistrySchemaClientImpl

        public ResourceRegistrySchemaClientImpl​(String address)
        Creates a new ResourceRegistrySchemaClient instance with shared model knowledge. This constructor delegates to ResourceRegistrySchemaClientImpl(String, boolean) with sharedModelKnowledge=true.
        Parameters:
        address - the base address of the Resource Registry service
      • ResourceRegistrySchemaClientImpl

        public ResourceRegistrySchemaClientImpl​(String address,
                                                boolean sharedModelKnowledge)
        Creates a new ResourceRegistrySchemaClient instance.
        Parameters:
        address - the base address of the Resource Registry service
        sharedModelKnowledge - whether to use shared TypesKnowledge instance (true) or create a new one (false)
    • Method Detail

      • getGXRequest

        protected org.gcube.common.gxhttp.request.GXRequest getGXRequest()
        Creates and configures a GXRequest with authentication headers and custom headers. This method sets up the basic HTTP request infrastructure needed for all REST API calls.
        Returns:
        a configured GXRequest 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:
        getModelKnowledge in interface ResourceRegistrySchemaClient
        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:
        renewModelKnowledge in interface ResourceRegistrySchemaClient
      • 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:
        create in interface ResourceRegistrySchemaClient
        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 fails
        org.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-M or Infra-M role. 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 (201 for creation or 200 for an identical retry), Content-Location, and any warnings are available through ResourceRegistrySchemaClient.serverResponses().

        Specified by:
        create in interface ResourceRegistrySchemaClient
        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 definition
        org.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 ResourceRegistrySchemaClient.serverResponses().

        This method is a type-safe wrapper that delegates to exist(String) for implementation details.
        Specified by:
        exist in interface ResourceRegistrySchemaClient
        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:
        exist in interface ResourceRegistrySchemaClient
        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 retrieve
        polymorphic - 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 found
        org.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 to getTypeFromTypesKnowledge(String, Boolean, int) with polymorphic=true.
        Parameters:
        typeName - the name of the type to retrieve
        level - 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 found
        org.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 hierarchy
        types - the accumulator list for type results
        currentLevel - the current recursion level
        maxLevel - 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 retrieve
        polymorphic - whether to include subtypes
        level - 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 found
        org.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; true includes every descendant, while false or null returns only the requested type.

        Each type occurs once in breadth-first order. A fully cached call reports the CACHE origin through ResourceRegistrySchemaClient.serverResponses() and has no HTTP response metadata.

        Specified by:
        read in interface ResourceRegistrySchemaClient
        Parameters:
        typeName - the exact type name
        polymorphic - whether to include all descendants; null means false
        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 snapshot
        org.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 of ResourceRegistrySchemaClient.read(String, Boolean) using the class-derived type name. This method is a type-safe wrapper that delegates to getTypeFromTypesKnowledge(String, Boolean) for implementation details.
        Specified by:
        read in interface ResourceRegistrySchemaClient
        Type Parameters:
        ME - the model element type
        Parameters:
        clazz - the class whose exact type name is read
        polymorphic - whether to include all descendants; null means false
        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 snapshot
        org.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 depth 0, a positive depth, or -1; values below -1 fall back to root-only depth 0.
        Specified by:
        read in interface ResourceRegistrySchemaClient
        Parameters:
        typeName - the exact type name
        level - 0 for the root, a positive descendant depth, or -1 for 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 snapshot
        org.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 of ResourceRegistrySchemaClient.read(String, int) using the class-derived type name. This method is a type-safe wrapper that delegates to getTypeFromTypesKnowledge(String, int) for implementation details.
        Specified by:
        read in interface ResourceRegistrySchemaClient
        Type Parameters:
        ME - the model element type
        Parameters:
        clazz - the class whose exact type name is read
        level - 0 for the root, a positive descendant depth, or -1 for 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 snapshot
        org.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:
        getTypeDagNode in interface ResourceRegistrySchemaClient
        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 schema
        org.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 ResourceRegistrySchemaClient.serverResponses().

        This method is a type-safe wrapper that delegates to getTypeDagNode(String) for implementation details.
        Specified by:
        getTypeDagNode in interface ResourceRegistrySchemaClient
        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 schema
        org.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:
        existTypeFromServer in interface ResourceRegistrySchemaClient
        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.
        Use getTypeFromServer(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 to getTypeFromServer(Class, int) for implementation details.
        Specified by:
        getTypeFromServer in interface ResourceRegistrySchemaClient
        Type Parameters:
        ME - the model element type parameter
        Parameters:
        clz - the class of the model element type to retrieve
        polymorphic - 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 server
        org.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:
        getTypeFromServer in interface ResourceRegistrySchemaClient
        Type Parameters:
        ME - the model element type parameter
        Parameters:
        clz - the class of the model element type to retrieve
        depth - 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 server
        org.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.
        Use getTypeFromServer(String, int) with depth instead.
        Reads GET /types/{type-name} directly; true maps to depth -1, while false or null maps to depth 0.
        Specified by:
        getTypeFromServer in interface ResourceRegistrySchemaClient
        Parameters:
        typeName - the exact, case-sensitive type name
        polymorphic - whether to request every descendant; null means false
        Returns:
        the non-null JSON response array
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException - if the server returns not found
        org.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
        Reads GET /types/{type-name} directly with depth and metadataPolicy; invocation metadata policy overrides client configuration. A successful response exposes Content-Location, direct-supertype links, and warnings through ResourceRegistrySchemaClient.serverResponses(); an unknown exact name maps to 404.
        Specified by:
        getTypeFromServer in interface ResourceRegistrySchemaClient
        Parameters:
        typeName - the exact, case-sensitive type name
        depth - 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 found
        org.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 through DELETE /types/{type-name} and lazily invalidates initialized local knowledge.

        No query parameter or Prefer option is sent. A successful bodyless 204 returns true; response status and warnings are available through ResourceRegistrySchemaClient.serverResponses() without being replaced by cache-refresh requests.

        Specified by:
        delete in interface ResourceRegistrySchemaClient
        Parameters:
        typeName - the exact, case-sensitive Type name; UUID addressing is unsupported
        Returns:
        true after a successful 204 No Content
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException - if the exact Type name does not exist
        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException - if concrete instances, subtypes, or Type references remain
        org.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 of ResourceRegistrySchemaClient.delete(String) using the class-derived exact Type name. This method is a type-safe wrapper that delegates to delete(String) for implementation details.
        Specified by:
        delete in interface ResourceRegistrySchemaClient
        Type Parameters:
        ME - the model element type
        Parameters:
        clz - the class whose Type definition is deleted
        Returns:
        true after a successful 204 No Content
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException - if the class-derived Type name does not exist
        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException - if concrete instances, subtypes, or Type references remain
        org.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 targeting ResourceSchema, FacetSchema, IsRelatedToSchema, ConsistsOfSchema, or PropertySchema. Every authenticated role may invoke the operation and no Context-scoped token is required.

        ResourceRegistryRequestOptions may set limit (default 10, maximum 50), offset (default 0), depth (default -1), and metadataPolicy (default none) for one invocation. Plain name, source, and target filters use depth. An _emit payload returns flat, native-typed aliases and supersedes metadata inclusion. Per-request options take precedence over the metadata default configured through ResourceRegistrySchemaClient.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 through ResourceRegistrySchemaClient.serverResponses().

        Specified by:
        query in interface ResourceRegistrySchemaClient
        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 category
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if request construction, transport, response processing, or server-side persistence fails
      • getTypeTreeNode

        @Deprecated
        public org.gcube.informationsystem.dag.Node<org.gcube.informationsystem.types.reference.Type> getTypeTreeNode​(String typeName)
                                                                                                               throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException,
                                                                                                                      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Deprecated.
        Retrieves the type node for the given type name.
        Specified by:
        getTypeTreeNode in interface ResourceRegistrySchemaClient
        Parameters:
        typeName - the name of the type
        Returns:
        the DAG node containing the type and its hierarchical information
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException - if the type does not exist
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if an error occurs during the operation
      • getTypeTreeNode

        @Deprecated
        public <ME extends org.gcube.informationsystem.model.reference.ModelElement> org.gcube.informationsystem.dag.Node<org.gcube.informationsystem.types.reference.Type> getTypeTreeNode​(Class<ME> clz)
                                                                                                                                                                                     throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException,
                                                                                                                                                                                            org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
        Deprecated.
        Retrieves the type node for the given model element class.
        Specified by:
        getTypeTreeNode in interface ResourceRegistrySchemaClient
        Type Parameters:
        ME - the model element type parameter
        Parameters:
        clz - the class of the model element type
        Returns:
        the DAG node containing the type and its hierarchical information
        Throws:
        org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException - if the type does not exist
        org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if an error occurs during the operation