Class TypePolicyEnforcementPoint

java.lang.Object
org.gcube.informationsystem.resourceregistry.pep.PolicyEnforcementPoint
org.gcube.informationsystem.resourceregistry.types.TypePolicyEnforcementPoint

public class TypePolicyEnforcementPoint extends PolicyEnforcementPoint
Policy Enforcement Point (PEP) for the Schema Type collection.

Enforces role-based endpoint access control, executes declarative validation of query parameters, and delegates database and cache operations to TypeRepository.

Following a strict layered architecture, this class acts as the single entry point for REST-facing type operations.

Author:
Luca Frosini (ISTI - CNR)
  • Constructor Details

    • TypePolicyEnforcementPoint

      public TypePolicyEnforcementPoint(jakarta.ws.rs.container.ContainerRequestContext requestContext)
      Creates a new TypePolicyEnforcementPoint instance associated with the current JAX-RS request context.
      Parameters:
      requestContext - the JAX-RS container request context
  • Method Details

    • read

      public String read(String typeName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Reads the serialized JSON schema of the requested Type and optionally its subtypes.
      Parameters:
      typeName - the case-sensitive type name to read
      Returns:
      serialized JSON array representing the type schema(s)
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the lookup fails
    • create

      public TypeCreationResult create(String typeName, String json) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Creates a new Type definition, enforcing global administrative write-permission rules. Returns a TypeCreationResult containing the final representation and the creation flag.
      Parameters:
      typeName - the name of the type to create
      json - the raw type JSON definition to register
      Returns:
      the TypeCreationResult wrapping the schema and creation outcome
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the creation fails
    • update

      public String update(String typeName, String json, boolean skipVersionCheckOnUpdate) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Updates an existing Type definition, enforcing global administrative write-permission rules.
      Parameters:
      typeName - the name of the type to update
      json - the raw updated type JSON definition
      skipVersionCheckOnUpdate - true to skip schema version increment checks, false to enforce them
      Returns:
      the serialized JSON representation of the updated type
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the update fails
    • query

      public PageResult query(String jsonQuery) throws org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Executes a JSON query against the Types collection (schema definitions) under authorized constraints.
      Parameters:
      jsonQuery - the JSON query payload describing the Type definition search criteria
      Returns:
      a paginated page of matching Type definitions
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.queries.InvalidQueryException - if the query is invalid or syntactically incorrect
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database or processing failure
    • delete

      public boolean delete(String typeName) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Deletes the specified type schema, enforcing global administrative write-permission rules.
      Parameters:
      typeName - the name of the type to delete
      Returns:
      true if deletion succeeded, false otherwise
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if deletion fails