java.lang.Object
org.gcube.informationsystem.resourceregistry.rest.base.BaseRest
org.gcube.informationsystem.resourceregistry.rest.core.Access

@Path("access") public class Access extends BaseRest
Read-only public REST facade under /access, mirroring the read endpoints of ContextManager, TypeManager, InstancesManager and QueryTemplateManager for callers that only need query/read access. Every method here delegates exclusively to the same PolicyEnforcementPoint used by its corresponding management-class method, so authorization and behavior stay identical between the two entry points; only the exposed path and OpenAPI grouping differ.
Author:
Luca Frosini (ISTI - CNR)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Constant representing the method name for executing json queries.
    static final String
    Constant representing the method name for executing prepared queries.
    static final String
    Constant representing the reference type name path parameter.
    static final String
    Constant representing the relation type name path parameter.
    static final String
    Constant representing the resource type name path parameter.

    Fields inherited from class org.gcube.informationsystem.resourceregistry.rest.base.BaseRest

    logger, uriInfo
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor for the Access class.
  • Method Summary

    Modifier and Type
    Method
    Description
    getInstanceContexts(String type, String instanceId)
    Returns the token-subtree-filtered Context membership map for an exact instance.
    jakarta.ws.rs.core.Response
    jsonQuery(String jsonQuery)
    Executes a role-filtered, paginated JSON Query-By-Example over Instances.
    jakarta.ws.rs.core.Response
    Returns the paginated list of visible Contexts for the current caller through the read-only access facade.
    jakarta.ws.rs.core.Response
    Returns a role-filtered, paginated list for a concrete or abstract instance Type.
    jakarta.ws.rs.core.Response
    Returns the paginated list of Query Templates for the current caller.
    jakarta.ws.rs.core.Response
    queryContexts(String jsonQuery)
    Executes a JSON Query-By-Example request for Contexts through the read-only access facade.
    jakarta.ws.rs.core.Response
    Returns the paginated result of executing a JSON query against the Query Template collection.
    jakarta.ws.rs.core.Response
    queryTypes(String jsonQuery)
    Executes a paginated JSON Query-By-Example against the Types collection.
    jakarta.ws.rs.core.Response
    Returns the Context identified by UUID through the read-only access facade.
    Returns the reverse-chronological Event history of the Context identified by UUID through the read-only access facade.
    jakarta.ws.rs.core.Response
    Returns the Context associated with the caller's token through the read-only access facade.
    jakarta.ws.rs.core.Response
    Deprecated.
    Use GET /access/contexts/@current instead.
    readInstance(String type, String uuid)
    Reads one visible instance using its exact concrete Type and UUID.
    readQueryTemplate(String queryTemplateName)
    Retrieves a specific query template by its name from the Resource Registry.
    Reads a Type definition and its requested descendant closure by case-sensitive name.
    jakarta.ws.rs.core.Response
    runQueryTemplate(String queryTemplateName, String params)
    Returns the paginated result of executing the query template with the specified name and parameters.

    Methods inherited from class org.gcube.informationsystem.resourceregistry.rest.base.BaseRest

    buildResponse, buildResponse, setAccountingMethod, setAccountingMethod

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • RESOURCE_TYPE_PATH_PARAMETER

      public static final String RESOURCE_TYPE_PATH_PARAMETER
      Constant representing the resource type name path parameter.
      See Also:
    • RELATION_TYPE_PATH_PARAMETER

      public static final String RELATION_TYPE_PATH_PARAMETER
      Constant representing the relation type name path parameter.
      See Also:
    • REFERENCE_TYPE_PATH_PARAMETER

      public static final String REFERENCE_TYPE_PATH_PARAMETER
      Constant representing the reference type name path parameter.
      See Also:
    • JSON_QUERY_METHOD

      public static final String JSON_QUERY_METHOD
      Constant representing the method name for executing json queries.
      See Also:
    • PREPARED_QUERY_METHOD

      public static final String PREPARED_QUERY_METHOD
      Constant representing the method name for executing prepared queries.
      See Also:
  • Constructor Details

    • Access

      public Access()
      Default constructor for the Access class. Initializes a new instance of the Access class.
  • Method Details

    • listContexts

      @GET @Path("contexts") @Produces("application/json") public jakarta.ws.rs.core.Response listContexts() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the paginated list of visible Contexts for the current caller through the read-only access facade.

      Facade of ContextManager.listContexts(), re-exposed under the public /access/contexts endpoint prefix.

      Returns:
      JAX-RS response containing the paginated JSON array of Contexts
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails
    • queryContexts

      @Path("contexts") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response queryContexts(String jsonQuery) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Executes a JSON Query-By-Example request for Contexts through the read-only access facade.

      Facade of ContextManager.query(String), re-exposed under the public /access/contexts endpoint prefix (POST /access/contexts/query with X-HTTP-Method-Override: QUERY accepted as a network-compatibility fallback).

      Parameters:
      jsonQuery - JSON object describing the Context Query-By-Example structure to search for
      Returns:
      JAX-RS response containing the paginated JSON array of matching Contexts
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException - if the query syntax is invalid
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails
    • readCurrentContext

      @GET @Path("contexts/@current") @Produces("application/json") public jakarta.ws.rs.core.Response readCurrentContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the Context associated with the caller's token through the read-only access facade.

      Facade of ContextManager.readCurrentContext(), re-exposed under the public /access/contexts/@current endpoint prefix.

      Returns:
      JAX-RS response containing the JSON representation of the current Context
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException - if the caller's token resolves to no live or cemetery Context
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails
    • readCurrentContextLegacy

      @GET @Path("contexts/CURRENT_CONTEXT") @Produces("application/json") @Deprecated public jakarta.ws.rs.core.Response readCurrentContextLegacy() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Deprecated.
      Use GET /access/contexts/@current instead.
      Backward-compatible alias for GET /access/contexts/@current.
      Returns:
      JAX-RS response containing the JSON representation of the current Context
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException - if the caller's token resolves to no live or cemetery Context
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails
    • readContext

      @GET @Path("contexts/{context-uuid}") @Produces("application/json") public jakarta.ws.rs.core.Response readContext(@PathParam("context-uuid") String uuid) throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the Context identified by UUID through the read-only access facade.

      Facade of ContextManager.read(String), re-exposed under the public /access/contexts/{context-uuid} endpoint prefix.

      Parameters:
      uuid - the UUID of the Context to retrieve
      Returns:
      JAX-RS response containing the JSON representation of the Context
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextNotFoundException - if no Context with the specified UUID exists
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails
    • readContextHistory

      @GET @Path("contexts/{context-uuid}/history") @Produces("application/json") public String readContextHistory(@PathParam("context-uuid") String uuid) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the reverse-chronological Event history of the Context identified by UUID through the read-only access facade.

      Facade of ContextManager.readHistory(String), re-exposed under the public /access/contexts/{context-uuid}/history endpoint prefix.

      Parameters:
      uuid - the UUID of the Context whose history to read
      Returns:
      the JSON array of Event objects, newest first
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails
    • queryTypes

      @Path("types") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response queryTypes(String jsonQuery) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Executes a paginated JSON Query-By-Example against the Types collection.

      Facade of TypeManager.query(String), re-exposed under the public /access/types endpoint prefix (POST /access/types/query with X-HTTP-Method-Override: QUERY accepted as a network-compatibility fallback).

      Parameters:
      jsonQuery - JSON object describing the Type definition structure to search for
      Returns:
      JAX-RS response containing the JSON array of matching Type definitions
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException - if the query syntax is invalid
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails
    • readType

      @GET @Path("types/{type-name}") @Produces("application/json") public String readType(@PathParam("type-name") String type) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Reads a Type definition and its requested descendant closure by case-sensitive name.

      Facade of TypeManager.read(String), re-exposed under the public /access/types/{type-name} endpoint prefix.

      Parameters:
      type - the case-sensitive name of the type to retrieve
      Returns:
      the JSON representation of the type definition
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException - if the type is not found
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if a registry database error occurs
    • listQueryTemplates

      @GET @Path("query-templates") @Produces("application/json") public jakarta.ws.rs.core.Response listQueryTemplates() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the paginated list of Query Templates for the current caller.

      Facade of QueryTemplateManager.all(), re-exposed under the public /access/query-templates endpoint prefix.

      Returns:
      JAX-RS response containing the JSON array of Query Template definitions
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails
    • readQueryTemplate

      @GET @Path("query-templates/{query-template-name}") @Produces("application/json") public String readQueryTemplate(@PathParam("query-template-name") String queryTemplateName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Retrieves a specific query template by its name from the Resource Registry.

      Facade of QueryTemplateManager.read(String), re-exposed under the public /access/query-templates/{query-template-name} endpoint prefix.

      Parameters:
      queryTemplateName - The name of the query template to retrieve
      Returns:
      JSON object containing the requested query template with its properties and metadata (if requested)
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException - If the query template with the specified name does not exist
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - If an error occurs during query template retrieval
    • runQueryTemplate

      @Path("query-templates/{query-template-name}") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response runQueryTemplate(@PathParam("query-template-name") String queryTemplateName, String params) throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the paginated result of executing the query template with the specified name and parameters.

      Facade of QueryTemplateManager.run(String, String), re-exposed under the public /access/query-templates/{query-template-name} endpoint prefix.

      Parameters:
      queryTemplateName - the name of the query template to execute
      params - JSON object containing parameter values for template substitution
      Returns:
      JAX-RS response containing the JSON array of query results
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException - if the query template with the specified name does not exist
      org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException - if the query execution fails due to invalid parameters or query structure
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if an error occurs during query template execution
    • queryQueryTemplates

      @Path("query-templates") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response queryQueryTemplates(String jsonQuery) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the paginated result of executing a JSON query against the Query Template collection.

      Facade of QueryTemplateManager.query(String), re-exposed under the public /access/query-templates endpoint prefix.

      Parameters:
      jsonQuery - JSON object describing the Query Template structure to search for
      Returns:
      JAX-RS response containing the JSON array of matching Query Template definitions
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException - if the query syntax is invalid
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails
    • listInstances

      @GET @Path("instances/{type-name}") @Produces("application/json") public jakarta.ws.rs.core.Response listInstances(@PathParam("type-name") String type) throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns a role-filtered, paginated list for a concrete or abstract instance Type.

      Facade of InstancesManager.readAll(String), re-exposed under the public /access/instances/{type-name} endpoint prefix.

      Parameters:
      type - the case-sensitive name of a Resource, Facet, IsRelatedTo, or ConsistsOf Type
      Returns:
      a JAX-RS response containing the JSON array of instances
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException - if the type is not found
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if a registry database error occurs
    • readInstance

      @GET @Path("instances/{type-name}/{instance-uuid}") @Produces("application/json") public String readInstance(@PathParam("type-name") String type, @PathParam("instance-uuid") String uuid) throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Reads one visible instance using its exact concrete Type and UUID.

      Facade of InstancesManager.read(String, String), re-exposed under the public /access/instances/{type-name}/{instance-uuid} endpoint prefix.

      Parameters:
      type - the exact concrete Information System Type of the instance
      uuid - the UUID of the instance to retrieve
      Returns:
      the JSON representation of the retrieved instance
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException - if the type or instance is not found
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if a registry database error occurs
    • getInstanceContexts

      @GET @Path("instances/{type-name}/{instance-uuid}/contexts") @Produces("application/json") public String getInstanceContexts(@PathParam("type-name") String type, @PathParam("instance-uuid") String instanceId) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the token-subtree-filtered Context membership map for an exact instance.

      Facade of InstancesManager.getInstanceContexts(String, String), re-exposed under the public /access/instances/{type-name}/{instance-uuid}/contexts endpoint prefix.

      Parameters:
      type - the exact concrete Entity or Relation type name of the instance
      instanceId - the UUID of the instance whose Context memberships are requested
      Returns:
      the JSON object mapping visible Context UUIDs to current paths
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database lookup fails
    • jsonQuery

      @Path("instances") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response jsonQuery(String jsonQuery) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Executes a role-filtered, paginated JSON Query-By-Example over Instances.

      Facade of InstancesManager.query(String), re-exposed under the public /access/instances endpoint prefix.

      Parameters:
      jsonQuery - the JSON query specification
      Returns:
      a JAX-RS response containing the JSON array of matching instances
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException - if the query syntax or structure is invalid
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if a registry database error occurs