Class Access
/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
FieldsModifier and TypeFieldDescriptionstatic final StringConstant representing the method name for executing json queries.static final StringConstant representing the method name for executing prepared queries.static final StringConstant representing the reference type name path parameter.static final StringConstant representing the relation type name path parameter.static final StringConstant representing the resource type name path parameter. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetInstanceContexts(String type, String instanceId) Returns the Context membership map of an exact instance, looked up as a point read.jakarta.ws.rs.core.ResponseExecutes a role-filtered, paginated JSON Query-By-Example over Instances.jakarta.ws.rs.core.ResponseReturns the paginated list of visible Contexts for the current caller through the read-only access facade.jakarta.ws.rs.core.ResponselistInstances(String type) Returns a role-filtered, paginated list for a concrete or abstract instance Type.jakarta.ws.rs.core.ResponseReturns the paginated list of Query Templates for the current caller.jakarta.ws.rs.core.ResponsequeryContexts(String jsonQuery) Executes a JSON Query-By-Example request for Contexts through the read-only access facade.jakarta.ws.rs.core.ResponsequeryQueryTemplates(String jsonQuery) Returns the paginated result of executing a JSON query against the Query Template collection.jakarta.ws.rs.core.ResponsequeryTypes(String jsonQuery) Executes a paginated JSON Query-By-Example against the Types collection.jakarta.ws.rs.core.ResponsereadContext(String uuid) Returns the Context identified by UUID through the read-only access facade.readContextHistory(String uuid) Returns the reverse-chronological Event history of the Context identified by UUID through the read-only access facade.jakarta.ws.rs.core.ResponseReturns the Context associated with the caller's token through the read-only access facade.jakarta.ws.rs.core.ResponseDeprecated.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.ResponserunQueryTemplate(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
-
Field Details
-
RESOURCE_TYPE_PATH_PARAMETER
Constant representing the resource type name path parameter.- See Also:
-
RELATION_TYPE_PATH_PARAMETER
Constant representing the relation type name path parameter.- See Also:
-
REFERENCE_TYPE_PATH_PARAMETER
Constant representing the reference type name path parameter.- See Also:
-
JSON_QUERY_METHOD
Constant representing the method name for executing json queries.- See Also:
-
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.ResourceRegistryExceptionReturns 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/contextsendpoint 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/contextsendpoint prefix (POST /access/contexts/querywithX-HTTP-Method-Override: QUERYaccepted 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 invalidorg.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.ResourceRegistryExceptionReturns 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/@currentendpoint 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 Contextorg.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.ResourceRegistryExceptionDeprecated.UseGET /access/contexts/@currentinstead.Backward-compatible alias forGET /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 Contextorg.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 existsorg.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}/historyendpoint 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/typesendpoint prefix (POST /access/types/querywithX-HTTP-Method-Override: QUERYaccepted 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 invalidorg.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 foundorg.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.ResourceRegistryExceptionReturns the paginated list of Query Templates for the current caller.Facade of
QueryTemplateManager.all(), re-exposed under the public/access/query-templatesendpoint 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/{name}") @Produces("application/json") public String readQueryTemplate(@PathParam("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/{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 existorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- If an error occurs during query template retrieval
-
runQueryTemplate
@Path("query-templates/{name}") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response runQueryTemplate(@PathParam("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/{name}endpoint prefix.- Parameters:
queryTemplateName- the name of the query template to executeparams- 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 existorg.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException- if the query execution fails due to invalid parameters or query structureorg.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-templatesendpoint 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 invalidorg.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 foundorg.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 instanceuuid- 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 foundorg.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 Context membership map of an exact instance, looked up as a point read.Facade of
InstancesManager.getInstanceContexts(String, String), re-exposed under the public/access/instances/{type-name}/{instance-uuid}/contextsendpoint prefix.- Parameters:
type- the exact concrete Entity or Relation type name of the instanceinstanceId- 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/instancesendpoint 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 invalidorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if a registry database error occurs
-
GET /access/contexts/@currentinstead.