Class TypePolicyEnforcementPoint
java.lang.Object
org.gcube.informationsystem.resourceregistry.pep.PolicyEnforcementPoint
org.gcube.informationsystem.resourceregistry.types.TypePolicyEnforcementPoint
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)
-
Nested Class Summary
Nested classes/interfaces inherited from class org.gcube.informationsystem.resourceregistry.pep.PolicyEnforcementPoint
PolicyEnforcementPoint.EndpointPolicySpec, PolicyEnforcementPoint.QueryParamSpec, PolicyEnforcementPoint.TokenScopeRule -
Field Summary
Fields inherited from class org.gcube.informationsystem.resourceregistry.pep.PolicyEnforcementPoint
ALL_ADMIN_ROLES, ALL_OPERATIONAL_ROLES, CONTEXT_MANAGER, DEPTH_DEFAULT, GLOBAL_PRIVILEGED_ROLES, INFRASTRUCTURE_MANAGER, IS_ADMIN, IS_CONTRIBUTOR, IS_EDITOR, IS_MANAGER, IS_MEMBER, LEGACY_ALL_META_QUERY_PARAMETER, LEGACY_INCLUDE_META_QUERY_PARAMETER, LIMIT_DEFAULT, LIMIT_MAX, OFFSET_DEFAULT, requestContext, SUBTREE_ADMIN_ROLES -
Constructor Summary
ConstructorsConstructorDescriptionTypePolicyEnforcementPoint(jakarta.ws.rs.container.ContainerRequestContext requestContext) Creates a newTypePolicyEnforcementPointinstance associated with the current JAX-RS request context. -
Method Summary
Modifier and TypeMethodDescriptionCreates a new Type definition, enforcing global administrative write-permission rules.booleanDeletes the specified type schema, enforcing global administrative write-permission rules.Executes a JSON query against the Types collection (schema definitions) under authorized constraints.Reads the serialized JSON schema of the requested Type and optionally its subtypes.Updates an existing Type definition, enforcing global administrative write-permission rules.Methods inherited from class org.gcube.informationsystem.resourceregistry.pep.PolicyEnforcementPoint
addContentWarning, addIgnoredFieldsWarning, addLink, addPaginationLinks, addPreferenceApplied, addQueryParameterWarning, addResultScope, buildUri, enforcePolicy, enforceTargetContextWithinTokenSubtree, getAllWarnings, getContentLocation, getContentWarnings, getIgnoredFieldsWarnings, getLinks, getPreferenceApplied, getQueryParameterWarnings, getResolvedContextPath, getResultScopes, getUriInfo, hasNonActiveDescendant, isAdministrativeUser, isPrivilegedUser, isUserAllowed, resolveAllMeta, resolveBoolean, resolveBypassHierarchyCheck, resolveDepth, resolveDepth, resolveDryRun, resolveHierarchical, resolveIncludeContexts, resolveIncludeMeta, resolveLimit, resolveMetadataPolicy, resolveOffset, resolvePolymorphic, resolvePropagationMode, resolveRawResult, resolveSyncExistingHierarchy, resolveTokenContextUuid, setContentLocation, validateQueryParameters, warnEnrichmentParametersIgnoredByEmitProjection
-
Constructor Details
-
TypePolicyEnforcementPoint
public TypePolicyEnforcementPoint(jakarta.ws.rs.container.ContainerRequestContext requestContext) Creates a newTypePolicyEnforcementPointinstance 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 aTypeCreationResultcontaining the final representation and the creation flag.- Parameters:
typeName- the name of the type to createjson- the raw type JSON definition to register- Returns:
- the
TypeCreationResultwrapping 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 updatejson- the raw updated type JSON definitionskipVersionCheckOnUpdate-trueto skip schema version increment checks,falseto 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 incorrectorg.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:
trueif deletion succeeded,falseotherwise- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if deletion fails
-