Class TypeManager
java.lang.Object
org.gcube.informationsystem.resourceregistry.rest.BaseRest
org.gcube.informationsystem.resourceregistry.rest.TypeManager
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstant representing the type name path parameter. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponseClean the types cachejakarta.ws.rs.core.ResponseCreates a new type definition in the Information System.Retrieves the schema definition(s) for the specified type.Methods inherited from class org.gcube.informationsystem.resourceregistry.rest.BaseRest
initRequestInfo, initRequestInfo, setAccountingMethod, setAccountingMethod
-
Field Details
-
TYPE_PATH_PARAMETER
Constant representing the type name path parameter.- See Also:
-
-
Constructor Details
-
TypeManager
public TypeManager()
-
-
Method Details
-
cleanCache
public jakarta.ws.rs.core.Response cleanCache()Clean the types cache- Returns:
-
create
@PUT @Path("{type-name}") @Consumes({"text/plain","application/json;charset=UTF-8"}) @Produces("application/json;charset=UTF-8") public jakarta.ws.rs.core.Response create(@PathParam("type-name") String typeName, String json) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Creates a new type definition in the Information System. Only the highest level administrative users can perform this operation due to its system-wide impact. REST Endpoint:PUT /types/{type-name}Request Examples:- PUT /types/ContactFacet (creates a new ContactFacet type definition)
- PUT /types/MyCustomResource (creates a new custom resource type).
- type-name: The name of the type to create (e.g., "ContactFacet", "MyCustomResource").
- JSON representation of the type definition
- Must conform to the Information System type schema.
- Can create any type definition without restrictions
- Has full administrative privileges across the entire Information System.
- Can create any type definition without restrictions
- Has full administrative privileges across the entire Information System.
- Cannot create type definitions
- Will receive authorization errors if attempting these operations
- Type creation is restricted to prevent system-wide compatibility issues.
- Although the underlying code supports type updates, the update functionality is intentionally NOT exposed via REST API
- Type modifications can break compatibility across the entire Information System
- Examples of breaking changes:
- Type updates must be performed offline after careful impact assessment
- Changes require evaluation of all existing instances and dependent systems
- Updates are applied through controlled maintenance procedures
- This ensures system stability and prevents breaking existing client applications.
- 201 Created: Type successfully created
- 409 Conflict: Type already exists with the given name
- 400 Bad Request: Invalid JSON schema or malformed request
- 403 Forbidden: User lacks authorization to create types.
- Content-Type: application/json
- Body: Complete type definition including metadata and schema information.
- Parameters:
typeName- the name of the type to create (must be unique in the system)json- the JSON schema definition of the type to create- Returns:
- HTTP 201 Created response with the complete type definition
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException- if the provided schema is invalid or malformedorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- for creation errors or authorization failures
-
read
@GET @Path("{type-name}") @Produces("application/json;charset=UTF-8") public String read(@PathParam("type-name") String type, @QueryParam("polymorphic") @DefaultValue("false") Boolean polymorphic) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Retrieves the schema definition(s) for the specified type. The response can include subtypes and metadata based on query parameters and user authorization. REST Endpoint:GET /types/{type-name}[?polymorphic={true|false}&includeMeta={true|false}]Request Examples:- GET /types/ContactFacet (returns basic ContactFacet type definition only)
- GET /types/ContactFacet?polymorphic=true (returns ContactFacet and all its subtypes)
- GET /types/ContactFacet?includeMeta=true (returns ContactFacet with metadata for authorized users)
- GET /types/ContactFacet?polymorphic=true&includeMeta=true (returns ContactFacet, subtypes, and metadata).
- type-name: The name of the type to retrieve (case-sensitive).
- Whether to include subtypes in the response
- Default value: false (returns only the specified type)
- When true: returns the specified type AND all its existing subtypes
- When false: returns only the specified type definition
- Note: No pagination is applied - ALL subtypes are returned when polymorphic=true
- Example: ?polymorphic=true (includes all subtypes of the requested type).
- Whether to include metadata in the response
- Default value: false (basic type information only)
- Values: true|false
- Example: ?includeMeta=true (includes metadata based on user authorization).
- Receive basic type information by default
- Can explicitly request metadata via includeMeta=true query parameter
- When metadata is requested, receive complete type definitions with full metadata
- All metadata fields are included when includeMeta=true
- No obfuscation or filtering of sensitive information.
- Receive basic type information by default
- Can explicitly request metadata via includeMeta=true query parameter
- When metadata is requested, receive complete type definitions with full metadata
- All metadata fields are included when includeMeta=true
- No obfuscation or filtering of sensitive information.
- Receive basic type information by default
- Can explicitly request metadata via includeMeta=true query parameter
- When metadata is requested, receive metadata with sensitive information filtered:
- 200 OK: Type successfully retrieved
- 404 Not Found: Type with the specified name does not exist
- 403 Forbidden: User lacks authorization to access type information.
- Content-Type: application/json
- Body: Type schema definition(s) with authorization-appropriate detail level
- When polymorphic=false: single type definition object
- When polymorphic=true: array of type definitions (parent + all subtypes).
- Parameters:
type- the name of the type to retrieve (case-sensitive)polymorphic- whether to include subtypes in the response (default: false)- Returns:
- JSON containing type schema definition(s) with authorization-appropriate detail level
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException- if the specified type is not found in the systemorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- for retrieval errors or other system failures
-