Java Client Usage

The Resource Registry provides Java client libraries for easy integration.

Maven Dependency:

<dependency>
    <groupId>org.gcube.information-system</groupId>
    <artifactId>resource-registry-client</artifactId>
</dependency>

Basic Usage Example:

import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;

// Get client instance
ResourceRegistryClient client = ResourceRegistryClientFactory.create();

// Read a resource
EService service = client.read(EService.class, uuid);

// Create a resource
EService newService = new EService();
// ... set facets ...
client.create(newService);

Methods Result:

The service exposes its methods using a standard naming approach. Moreover, they accept (in the case of HTTP POST/PUT methods) JSON objects.

Important

The result of all methods is always a JSON object as per below:

{
    ....
}

Inputs are automatically validated before the request is served.

Examples

Creating a Service Resource:

PUT /instances/EService/550e8400-e29b-41d4-a716-446655440000
Content-Type: application/json
Authorization: Bearer your-oidc-token

{
    "type": "EService",
    "consistsOf": [
        {
            "type": "IsIdentifiedBy",
            "target": {
                "type": "SoftwareFacet",
                "group": "org.example",
                "name": "my-service",
                "version": "1.0.0"
            }
        },
        ...
    ]
}

Querying Resources:

GET /access/instances/EService?polymorphic=true&includeMeta=true

Adding Resource to Context:

PUT /sharing/contexts/{context-uuid}/EService/{resource-uuid}?operation=ADD