Difference between revisions of "Resource Registry Service - Context Management"

From Gcube Wiki
Jump to: navigation, search
(Resource Registry Context Client)
 
(202 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
|}
 
|}
  
This sections provide information regarding how to interact with [[Information System Resource Registry#Resource_Registry Service | Resource Registry Service]] for Context and Schema Port Type.  
+
These sections provide information regarding how to interact with [[Information System Resource Registry#Resource Registry Service | Resource Registry Service]] for Context Management.  
 
REST API are presented for each functionality.
 
REST API are presented for each functionality.
Java libraries for these port types are currently under development and will be document as soon as available.
 
  
 
Please note that the provided examples can intentionally hide some details in the response to avoid unneeded complexity.
 
Please note that the provided examples can intentionally hide some details in the response to avoid unneeded complexity.
Line 13: Line 12:
 
== Context Management ==
 
== Context Management ==
  
It is responsible for managing [[Facet_Based_Resource_Model#Context| Context]] belonging to the same Application Domain.
+
Context Management is responsible for managing hierarchical [[Facet_Based_Resource_Model#Context| Context]] as defined by the [[Facet_Based_Resource_Model|IS Model]].
 
+
Security configuration based on [[Authorization Framework]] make this port type accessible only from [[Information System Resource Manager|Resource Manager]]. In other words no others client is allowed to manage [[Facet_Based_Resource_Model#Context| Context]] rather than [[Information System Resource Manager|Resource Manager]].
+
  
 
[[Facet_Based_Resource_Model#Context|Context]] requirements:
 
[[Facet_Based_Resource_Model#Context|Context]] requirements:
* No predefined number of levels.
+
* No predefined number of levels;
* Possibility to change the name of the Context with no impact for any component.
+
* Possibility to change the name of the Context with no impact for any component;
 
* Possibility to move a [[Facet_Based_Resource_Model#Context| Context]] from a parent [[Facet_Based_Resource_Model#Context| Context]] to another.
 
* Possibility to move a [[Facet_Based_Resource_Model#Context| Context]] from a parent [[Facet_Based_Resource_Model#Context| Context]] to another.
  
Available Methods:
+
Any request to this port type has success if the following guarantees are satisfied:
  
* [[#Create|Create]]
+
* the hierarchy of contexts is a tree with an arbitrary number of levels;
* [[#Read|Read]]
+
* two contexts with the same name can only exist if they have different parents;
* [[#Rename|Rename]]
+
* any update to a context does not have any side effect on the instances belonging to the context;
* [[#Move|Move]]
+
* it is not possible to delete a context if
* [[#Delete|Delete]]
+
** it contains instances. It is the responsibility of the clients to remove the instances from the context (or delete them) before trying to delete the context;
 +
** it has children context. It is the responsibility of the clients to remove or move the children context before trying to delete the context.
  
Any action made to Contexts succeed if the following requirements are guaranteed:
 
* Two Context with same name can exist but only if they have different parents. The operation which will try to obtain a Context with the same name to the same parent will fails with no effect.
 
* Any operation made in any Context has effect only to the Context. In other words, there will be no effect on the associated Entity and Relations.
 
  
At time of writing this port type is only accessible by using REST API. [[Information System Resource Registry#Resource_Registry_Context_Client | Resource Registry Context Client]] (java client) is under development.
+
Context Management exposes the following APIs:
  
=== Create ===
+
* '''[[#List Contexts|List]]''': allows to enumerate the contexts;
 +
* '''[[#Create Context|Create]]''': allows to create a new context as a child of another context (if any). The context has a name;
 +
* '''[[#Exists|Exists]]''': allows to check if a Context exists;
 +
* '''[[#Read Context|Read]]''': allows to read a Context;
 +
* '''[[#Update Context|Update]]''':
 +
** '''[[#Rename Context|Rename]]''': rename a context;
 +
** '''[[#Move Context|Move]]''': move a context as a child of another Context.
 +
* '''[[#Delete Context|Delete]]''': allows to delete a Context.
  
<pre>PUT /resource-registry/context</pre>
+
== Context Collection ==
  
==== Description ====
+
The following table shows the exposed APIs as REST Collection
  
Create new Context as child of another Context (if any).
+
{| class="wikitable"
 
+
! Operation || HTTP Method || URL
==== Parameters ====
+
 
+
{|class="wikitable"
+
! Name
+
! Type
+
! Required
+
! Description
+
 
|-
 
|-
| '''name'''
+
| List || GET || <code>/contexts</code>
| String
+
| true
+
| The name of the context.
+
 
|-
 
|-
| '''parentContextId'''
+
| Create || PUT || <code>/contexts/{UUID}</code>
| String (UUID)
+
|-
| false
+
| Exists || HEAD || <code>/contexts/{UUID}</code>
| The UUID of the parent Context if any
+
|-
|}
+
| Read || GET || <code>/contexts/{UUID}</code>
 
+
==== Responses ====
+
 
+
{|class="wikitable"
+
! Code
+
! Type
+
! Description
+
 
|-
 
|-
| 200
+
| Update || PUT || <code>/contexts/{UUID}</code>
| String
+
|-
| The json representation of the Context.
+
| Delete || DELETE || <code>/contexts/{UUID}</code>
 
|}
 
|}
  
==== Examples ====
+
Security configuration based on [[Authorization Framework]] make this port type accessible only from [[Information System Resource Manager|Resource Manager]]. In other words, no others client is allowed to manage [[Facet_Based_Resource_Model#Context| Context]] rather than [[Information System Resource Manager|Resource Manager]].
  
Create a new Context with name '''gcube''' with no parent. It is a ROOT Context.
+
== Resource Registry Context Client ==
  
''Request URL''
+
Resource Registry Context Client is a java library providing RPC facilities to interact with [[#Context Collection|Context Collection]].
 +
The library hides all the complexity of marshalling and unmarshalling of requests and results.
 +
By using this library any client is able to manage java classes instead of JSON objects.
  
<pre>PUT /resource-registry/context?name=gcube</pre>
+
To use the Java library to interact with Context Collection declare the following dependency in your pom.xml file.
  
''Response Body''
+
<source lang="xml">
 +
<dependency>
 +
<groupId>org.gcube.information-system</groupId>
 +
<artifactId>resource-registry-context-client</artifactId>
 +
<version>[4.0.0,5.0.0-SNAPSHOT)</version>
 +
<dependency>
 +
</source>
  
<pre>
 
{
 
"@class":"Context",
 
"name":"gcube",
 
"header": {
 
"@class":"Header",
 
"uuid":"2705dd32-c857-444b-818a-3ec69e339e5d",
 
"creator":"luca.frosini",
 
"lastUpdater":"luca.frosini",
 
"creationTime":"2017-03-17 11:47:55",
 
"lastUpdateTime":"2017-03-17 11:47:55"
 
}
 
}
 
</pre>
 
  
 +
To use the client you just need to instantiate the client via the provided factory.
  
 +
<source lang="java">
 +
import org.gcube.informationsystem.resourceregistry.context.ResourceRegistryContextClient;
 +
import org.gcube.informationsystem.resourceregistry.context.ResourceRegistryContextClientFactory;
  
Create a new Context with name '''devsec''' as child of Context with UUID '''2705dd32-c857-444b-818a-3ec69e339e5d (gcube)'''
+
....
  
''Request URL''
+
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 +
</source>
  
<pre>/resource-registry/context?name=devsec&parentContextId=2705dd32-c857-444b-818a-3ec69e339e5d</pre>
+
The provided client exposes the available methods and options as explained below.
  
''Response Body''
+
The source code of the resource-registry-context-client is available at [https://code-repo.d4science.org/gCubeSystem/resource-registry-context-client https://code-repo.d4science.org/gCubeSystem/resource-registry-context-client]
  
<pre>
+
== APIs ==
{
+
"@class":"Context",
+
"name":"devsec",
+
"header": {
+
"@class":"Header",
+
"uuid":"30f6254c-c87a-451e-bc0f-7cfcbd94a84a",
+
"creator":"luca.frosini",
+
"lastUpdater":"luca.frosini",
+
"creationTime":"2017-03-17 11:47:56",
+
"lastUpdateTime":"2017-03-17 11:47:56"
+
}
+
}
+
</pre>
+
  
 
+
The provided examples are based on the following Context tree
Create a new Context with name '''devVRE''' as child of Context with UUID '''30f6254c-c87a-451e-bc0f-7cfcbd94a84a (devsec)'''
+
 
+
''Request URL''
+
 
+
<pre>/resource-registry/context?name=devVRE&parentContextId=30f6254c-c87a-451e-bc0f-7cfcbd94a84a</pre>
+
 
+
''Response Body''
+
  
 
<pre>
 
<pre>
{
+
-  ca50eb95-b76c-44fd-9182-229d39c3c9e2 (gcube)
"@class":"Context",
+
|
"name":"devVRE",
+
|---- d0544ff9-8f61-416f-b685-589a2262e2c4 (devsec)
"header": {
+
|  |
"@class":"Header",
+
|  |---- 4c0c3500-32d6-11ea-867c-af3c989f8e41 (devVRE)
"uuid":"9d73d3bd-1873-490c-b0a7-e3c0da11ad52",
+
|
"lastUpdater":"luca.frosini",
+
|---- aa860961-6eb0-4c1c-89fb-c406fe2a2771 (devNext)
"creator":"luca.frosini",
+
    |
"creationTime":"2017-03-17 11:47:57",
+
    |---- bad5f350-345c-11e9-9f49-cef9b1608c3f (NextNext)
"lastUpdateTime":"2017-03-17 11:47:57"
+
}
+
}
+
 
</pre>
 
</pre>
  
If you try to create again a Context with name '''gcube''' with no parent. You will obtain a '''400 Bad Request''' HTTP error
+
=== List Contexts ===
  
''Request URL''
+
List all available contexts.
  
<pre>PUT /resource-registry/context?name=gcube</pre>
 
  
''Response Body''
+
==== List via Java client ====
<pre>
+
{
+
    "@class": "ContextCreationException",
+
    "message": "A root context with the same name (gcube) already exist"
+
}
+
</pre>
+
  
This will happen anytime you try to create a context with the same name, having the same parent, of an existing Context.
+
<source lang="java">
 +
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 +
List<Context> contexts = resourceRegistryContextClient.all();
 +
</source>
  
=== Read ===
 
  
<pre>GET /resource-registry/context/{UUID}</pre>
+
==== List via REST API ====
 
+
==== Description ====
+
  
Return the definition of the Context identified by the UUID provided as path parameter.
+
<pre>GET /resource-registry/contexts</pre>
  
==== Parameters ====
 
 
{|class="wikitable"
 
! Name
 
! Type
 
! Required
 
! Description
 
|-
 
| '''{''Path Parameter''}'''
 
| String (UUID)
 
| true
 
| The UUID of the target context.
 
|}
 
 
==== Responses ====
 
  
 
{|class="wikitable"
 
{|class="wikitable"
Line 196: Line 135:
 
| 200
 
| 200
 
| String
 
| String
| The json representation of the context.
+
| A JSON array containing as an element the representation of each Context
 
|}
 
|}
  
==== Examples ====
+
'''Request URL'''
  
Read the Context having UUID '''9d73d3bd-1873-490c-b0a7-e3c0da11ad52'''
+
<pre>GET /resource-registry/contexts</pre>
  
''Request URL''
+
'''Response Body'''
  
<pre>GET /resource-registry/context/9d73d3bd-1873-490c-b0a7-e3c0da11ad52</pre>
+
<source lang="JavaScript">
 +
[
 +
{
 +
"@class": "Context",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:26.464 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
 +
},
 +
"name": "gcube",
 +
"parent": null,
 +
"children": [
 +
{
 +
"@class": "IsParentOf",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "c470a070-83e8-45e8-8630-440225702acc",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:26.967 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:26.967 +0000"
 +
},
 +
"target": {
 +
"@class": "Context",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:26.978 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:26.978 +0000"
 +
},
 +
"name": "devNext"
 +
}
 +
},
 +
{
 +
"@class": "IsParentOf",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "9966f136-25c9-4e73-aa54-5357ac5e09d1",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:27.410 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:27.410 +0000"
 +
},
 +
"target": {
 +
"@class": "Context",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "d0544ff9-8f61-416f-b685-589a2262e2c4",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:27.418 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:27.418 +0000"
 +
},
 +
"name": "devsec"
 +
}
 +
}
 +
]
 +
},
 +
{
 +
"@class": "Context",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "4c0c3500-32d6-11ea-867c-af3c989f8e41",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:30.098 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:30.098 +0000"
 +
},
 +
"name": "devVRE",
 +
"parent": {
 +
"@class": "IsParentOf",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "347f0e81-7407-485d-9698-946cf3b10c0b",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:30.090 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:30.090 +0000"
 +
},
 +
"source": {
 +
"@class": "Context",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "d0544ff9-8f61-416f-b685-589a2262e2c4",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:27.418 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:27.418 +0000"
 +
},
 +
"name": "devsec"
 +
}
 +
},
 +
"children": []
 +
},
 +
{
 +
"@class": "Context",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:26.978 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:26.978 +0000"
 +
},
 +
"name": "devNext",
 +
"parent": {
 +
"@class": "IsParentOf",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "c470a070-83e8-45e8-8630-440225702acc",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:26.967 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:26.967 +0000"
 +
},
 +
"source": {
 +
"@class": "Context",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:26.464 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
 +
},
 +
"name": "gcube"
 +
}
 +
},
 +
"children": [
 +
{
 +
"@class": "IsParentOf",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "74d435c1-29ce-49f4-b3b9-cbca42c2b046",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:27.835 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:27.835 +0000"
 +
},
 +
"target": {
 +
"@class": "Context",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:27.846 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:27.846 +0000"
 +
},
 +
"name": "NextNext"
 +
}
 +
}
 +
]
 +
},
 +
{
 +
"@class": "Context",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "d0544ff9-8f61-416f-b685-589a2262e2c4",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:27.418 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:27.418 +0000"
 +
},
 +
"name": "devsec",
 +
"parent": {
 +
"@class": "IsParentOf",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "9966f136-25c9-4e73-aa54-5357ac5e09d1",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:27.410 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:27.410 +0000"
 +
},
 +
"source": {
 +
"@class": "Context",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:26.464 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
 +
},
 +
"name": "gcube"
 +
}
 +
},
 +
"children": [
 +
{
 +
"@class": "IsParentOf",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "347f0e81-7407-485d-9698-946cf3b10c0b",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:30.090 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:30.090 +0000"
 +
},
 +
"target": {
 +
"@class": "Context",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "4c0c3500-32d6-11ea-867c-af3c989f8e41",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:30.098 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:30.098 +0000"
 +
},
 +
"name": "devVRE"
 +
}
 +
}
 +
]
 +
},
 +
{
 +
"@class": "Context",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:27.846 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:27.846 +0000"
 +
},
 +
"name": "NextNext",
 +
"parent": {
 +
"@class": "IsParentOf",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "74d435c1-29ce-49f4-b3b9-cbca42c2b046",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:27.835 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:27.835 +0000"
 +
},
 +
"source": {
 +
"@class": "Context",
 +
"header": {
 +
"@class": "Header",
 +
"uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
 +
"createdBy": "luca.frosini",
 +
"creationTime": "2021-06-30 09:38:26.978 +0000",
 +
"lastUpdateBy": "luca.frosini",
 +
"lastUpdateTime": "2021-06-30 09:38:26.978 +0000"
 +
},
 +
"name": "devNext"
 +
}
 +
},
 +
"children": []
 +
}
 +
]
 +
</source>
  
''Response Body''
+
=== Create Context ===
  
<pre>
+
Create new Context as a child of another Context (if any).
{
+
"@class":"Context",
+
"name":"devVRE",
+
"header": {
+
"@class":"Header",
+
"uuid":"9d73d3bd-1873-490c-b0a7-e3c0da11ad52",
+
"creator":"luca.frosini",
+
"lastUpdater":"luca.frosini",
+
"creationTime":"2017-03-17 11:47:56",
+
"lastUpdateTime":"2017-03-17 11:52:56"
+
}
+
}
+
</pre>
+
  
=== Rename ===
+
==== Create via Java Client ====
  
<pre>POST /resource-registry/context/rename/{UUID}</pre>
+
===== Create via Java Client Example 1 =====
  
==== Description ====
+
This Java code snippet shows how to create a new Context with name '''gcube''' with no parent. It is a ROOT Context.
  
Rename a Context identified by the UUID provided as path parameter to the new name provided as query parameter.
+
<source lang="java">
 +
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
  
==== Parameters ====
+
Context gcubeContext = new ContextImpl("gcube");
 +
// Java class generate a random UUID and use to interact with Resource Regsitry Service
 +
// To specify the UUID
 +
// UUID gcubeUUID = UUID.fromString("ca50eb95-b76c-44fd-9182-229d39c3c9e2");
 +
// Context gcubeContext = new ContextImpl("gcube", gcubeUUID);
 +
gcubeContext = resourceRegistryContextClient.create(gcubeContext);
 +
</source>
  
{|class="wikitable"
+
===== Create via Java Client Example 2 =====
! Name
+
 
! Type
+
This Java code snippet shows how to create a new Context with name '''devNext''' as child of Context with UUID '''c470a070-83e8-45e8-8630-440225702acc''' (gcube).
! Required
+
! Description
+
|-
+
| '''{''Path Parameter''}'''
+
| String (UUID)
+
| true
+
| The UUID of the target context.
+
|-
+
| '''name'''
+
| String
+
| true
+
| The new name of the target context.
+
|}
+
  
==== Responses ====
+
<source lang="java">
 +
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 +
Context gcubeContext = resourceRegistryContextClient.read("ca50eb95-b76c-44fd-9182-229d39c3c9e2");
 +
 
 +
Context devNextContext = new ContextImpl("devNext");
 +
// To specify the UUID
 +
// UUID devNextUUID = UUID.fromString("aa860961-6eb0-4c1c-89fb-c406fe2a2771");
 +
// Context testVOContext = new ContextImpl("devNext", devNextUUID);
 +
devNextContext.setParent(gcubeContext);
 +
devNextContext = resourceRegistryContextClient.create(devNextContext);
 +
</source>
 +
 
 +
==== Create via REST API ====
 +
 
 +
<pre>PUT /resource-registry/contexts/{{UUID}}</pre>
  
 
{|class="wikitable"
 
{|class="wikitable"
Line 260: Line 450:
 
| 200
 
| 200
 
| String
 
| String
| The json representation of the context.
+
| The JSON representation of the newly created Context
 
|}
 
|}
  
==== Examples ====
 
  
Rename a Context '''9d73d3bd-1873-490c-b0a7-e3c0da11ad52''' (was '''devVRE''') to the new name '''devNext'''.
+
===== Create via REST API Example 1 =====
  
''Request URL''
+
Create a new Context with name '''gcube''' with no parent. It is a ROOT Context.
  
<pre>POST /resource-registry/context/rename/9d73d3bd-1873-490c-b0a7-e3c0da11ad52?name=devNext</pre>
+
'''Request URL'''
  
''Response Body''
+
<pre>PUT /resource-registry/context/ca50eb95-b76c-44fd-9182-229d39c3c9e2</pre>
  
<pre>
+
'''Request Body'''
 +
 
 +
<source lang="javascript">
 
{
 
{
"@class":"Context",
+
"@class": "Context",
"name":"devNext",
+
"name": "gcube",
 
"header": {
 
"header": {
"@class":"Header",
+
"@class": "Header",
"uuid":"9d73d3bd-1873-490c-b0a7-e3c0da11ad52",
+
"uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2"
"creator":"luca.frosini",
+
"lastUpdater":"luca.frosini",
+
"creationTime":"2017-03-17 11:47:56",
+
"lastUpdateTime":"2017-03-17 11:52:56"
+
 
}
 
}
 
}
 
}
</pre>
+
</source>
  
=== Move ===
 
  
<pre>POST /resource-registry/context/move/{{UUID}}</pre>
+
'''Response Body'''
  
==== Description ====
+
<source lang="javascript">
 +
{
 +
    "@class": "Context",
 +
    "header": {
 +
        "@class": "Header",
 +
        "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
 +
        "createdBy": "luca.frosini",
 +
        "creationTime": "2021-06-30 09:38:26.464 +0000",
 +
        "lastUpdateBy": "luca.frosini",
 +
        "lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
 +
    },
 +
    "name": "gcube",
 +
    "parent": null,
 +
    "children": []
 +
}
 +
</source>
  
Move a Context identified by the UUID provided as path parameter as child of the Context provided as query parameter.
+
===== Create via REST API Example 2 =====
  
==== Parameters ====
+
Create a new Context with name '''devNext''' as child of Context with UUID '''c470a070-83e8-45e8-8630-440225702acc''' (gcube).
  
{|class="wikitable"
+
'''Request URL'''
! Name
+
! Type
+
! Required
+
! Description
+
|-
+
| '''{''Path Parameter''}'''
+
| String (UUID)
+
| true
+
| The UUID of the target Context
+
|-
+
| '''parentContextId'''
+
| String (UUID)
+
| true
+
| The parent Context UUID
+
|}
+
  
==== Responses ====
+
<pre>PUT /resource-registry/contexts/aa860961-6eb0-4c1c-89fb-c406fe2a2771</pre>
  
{|class="wikitable"
+
'''Request Body'''
! Code
+
! Type
+
! Description
+
|-
+
| 200
+
| String
+
| The json representation of the context.
+
|}
+
  
==== Examples ====
+
<source lang="javascript">
 +
{
 +
    "@class": "Context",
 +
    "header": {
 +
        "@class": "Header",
 +
        "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771"
 +
    },
 +
    "name": "devNext",
 +
    "parent": {
 +
        "@class": "IsParentOf",
 +
        "header": null,
 +
        "source": {
 +
            "@class": "Context",
 +
            "header": {
 +
                "@class": "Header",
 +
                "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2"
 +
            }
 +
        }
 +
    }
 +
}
 +
</source>
  
Rename a Context '''9d73d3bd-1873-490c-b0a7-e3c0da11ad52''' as child of the Context '''761d9e99-a4dc-4838-9b16-4bf73813b625'''
+
'''Response Body'''
  
''Request URL''
+
<source lang="javascript">
 +
{
 +
    "@class": "Context",
 +
    "header": {
 +
        "@class": "Header",
 +
        "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
 +
        "createdBy": "luca.frosini",
 +
        "creationTime": "2021-06-30 09:38:26.978 +0000",
 +
        "lastUpdateBy": "luca.frosini",
 +
        "lastUpdateTime": "2021-06-30 09:38:26.978 +0000"
 +
    },
 +
    "name": "devNext",
 +
    "parent": {
 +
        "@class": "IsParentOf",
 +
        "header": {
 +
            "@class": "Header",
 +
            "uuid": "c470a070-83e8-45e8-8630-440225702acc",
 +
            "createdBy": "luca.frosini",
 +
            "creationTime": "2021-06-30 09:38:26.967 +0000",
 +
            "lastUpdateBy": "luca.frosini",
 +
            "lastUpdateTime": "2021-06-30 09:38:26.967 +0000"
 +
        },
 +
        "source": {
 +
            "@class": "Context",
 +
            "header": {
 +
                "@class": "Header",
 +
                "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
 +
                "createdBy": "luca.frosini",
 +
                "creationTime": "2021-06-30 09:38:26.464 +0000",
 +
                "lastUpdateBy": "luca.frosini",
 +
                "lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
 +
            },
 +
            "name": "gcube"
 +
        }
 +
    },
 +
    "children": []
 +
}
 +
</source>
  
<pre>POST /resource-registry/context/move/9d73d3bd-1873-490c-b0a7-e3c0da11ad52?parentContextId=761d9e99-a4dc-4838-9b16-4bf73813b625</pre>
+
=== Read Context ===
  
''Response Body''
+
Return the definition of the Context identified by the UUID provided as the path parameter.
  
<pre>
+
==== Read via Java Client ====
{
+
"@class":"Context",
+
"name":"devNext"
+
"header": {
+
"@class":"Header",
+
"uuid":"9d73d3bd-1873-490c-b0a7-e3c0da11ad52",
+
"creator":"luca.frosini",
+
"lastUpdater":"luca.frosini",
+
"creationTime":"2017-03-17 11:47:56",
+
"lastUpdateTime":"2017-03-17 11:52:56"
+
}
+
}
+
</pre>
+
  
=== Delete ===
 
  
<pre>DELETE /resource-registry/context/{{UUID}}</pre>
+
===== Read via Java Client Example 1 =====
  
==== Description ====
 
  
Delete the Context identified by the UUID provided as path parameter.
+
Read the Context having UUID '''ca50eb95-b76c-44fd-9182-229d39c3c9e2''' (gcube)
  
==== Parameters ====
+
Read using a string representing the UUID.
  
{|class="wikitable"
+
<source lang="java">
! Name
+
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
! Type
+
Context gcubeContext = resourceRegistryContextClient.read("ca50eb95-b76c-44fd-9182-229d39c3c9e2");
! Required
+
</source>
! Description
+
 
|-
+
===== Read via Java Client Example 2 =====
| '''{''Path Parameter''}'''
+
| String (UUID)
+
| true
+
| The UUID of the target Context
+
|}
+
  
==== Responses ====
+
Read the Context having UUID '''aa860961-6eb0-4c1c-89fb-c406fe2a2771''' (devNext)
 +
 
 +
Read using UUID. This normally used when we already have the UUID instance.
 +
 
 +
<source lang="java">
 +
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 +
UUID devNextUUID = UUID.fromString("aa860961-6eb0-4c1c-89fb-c406fe2a2771");
 +
Context devNextContext = resourceRegistryContextClient.read(devNextUUID);
 +
</source>
 +
 
 +
 
 +
Read using context instance. This normally used when we already have the context instance.
 +
 
 +
<source lang="java">
 +
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 +
UUID devNextUUID = UUID.fromString("aa860961-6eb0-4c1c-89fb-c406fe2a2771");
 +
Context devNextContext = new ContextImpl("devNext", devNextUUID);
 +
devNextContext = resourceRegistryContextClient.read(devNextContext);
 +
</source>
 +
 
 +
 
 +
==== Read via REST API  ====
 +
 
 +
<pre>GET /resource-registry/context/{UUID}</pre>
  
 
{|class="wikitable"
 
{|class="wikitable"
Line 383: Line 621:
 
| 200
 
| 200
 
| String
 
| String
| NO CONTENT
+
| The JSON representation of the requested Context
 
|}
 
|}
  
==== Examples ====
 
  
Delete the Context having UUID '''9d73d3bd-1873-490c-b0a7-e3c0da11ad52'''
+
===== Read via REST API Example 1 =====
  
''Request URL''
+
Read the Context having UUID '''ca50eb95-b76c-44fd-9182-229d39c3c9e2''' (gcube)
  
<pre>DELETE /resource-registry/context/9d73d3bd-1873-490c-b0a7-e3c0da11ad52</pre>
+
'''Request URL'''
  
== Schema Management ==
+
<pre>GET /resource-registry/contexts/ca50eb95-b76c-44fd-9182-229d39c3c9e2</pre>
  
At time of writing this port type is only accessible by using REST API. [[Information System Resource Registry#Resource_Registry_Schema_Client | Resource Registry Schema Client]] (java client) is under development.
+
'''Response Body'''
  
=== Type Definition ===
+
<source lang="javascript">
 +
{
 +
    "@class": "Context",
 +
    "header": {
 +
        "@class": "Header",
 +
        "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
 +
        "createdBy": "luca.frosini",
 +
        "creationTime": "2021-06-30 09:38:26.464 +0000",
 +
        "lastUpdateBy": "luca.frosini",
 +
        "lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
 +
    },
 +
    "name": "gcube",
 +
    "parent": null,
 +
    "children": [
 +
        {
 +
            "@class": "IsParentOf",
 +
            "header": {
 +
                "@class": "Header",
 +
                "uuid": "c470a070-83e8-45e8-8630-440225702acc",
 +
                "createdBy": "luca.frosini",
 +
                "creationTime": "2021-06-30 09:38:26.967 +0000",
 +
                "lastUpdateBy": "luca.frosini",
 +
                "lastUpdateTime": "2021-06-30 09:38:26.967 +0000"
 +
            },
 +
            "target": {
 +
                "@class": "Context",
 +
                "header": {
 +
                    "@class": "Header",
 +
                    "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
 +
                    "createdBy": "luca.frosini",
 +
                    "creationTime": "2021-06-30 09:38:26.978 +0000",
 +
                    "lastUpdateBy": "luca.frosini",
 +
                    "lastUpdateTime": "2021-06-30 09:38:26.978 +0000"
 +
                },
 +
                "name": "devNext"
 +
            }
 +
        },
 +
        {
 +
            "@class": "IsParentOf",
 +
            "header": {
 +
                "@class": "Header",
 +
                "uuid": "9966f136-25c9-4e73-aa54-5357ac5e09d1",
 +
                "createdBy": "luca.frosini",
 +
                "creationTime": "2021-06-30 09:38:27.410 +0000",
 +
                "lastUpdateBy": "luca.frosini",
 +
                "lastUpdateTime": "2021-06-30 09:38:27.410 +0000"
 +
            },
 +
            "target": {
 +
                "@class": "Context",
 +
                "header": {
 +
                    "@class": "Header",
 +
                    "uuid": "d0544ff9-8f61-416f-b685-589a2262e2c4",
 +
                    "createdBy": "luca.frosini",
 +
                    "creationTime": "2021-06-30 09:38:27.418 +0000",
 +
                    "lastUpdateBy": "luca.frosini",
 +
                    "lastUpdateTime": "2021-06-30 09:38:27.418 +0000"
 +
                },
 +
                "name": "devsec"
 +
            }
 +
        }
 +
    ]
 +
}
 +
</source>
  
Any Type is described by the following attributes:
+
===== Read via REST API Example 2 =====
  
* '''name''' (String): Type Name
+
Read the Context having UUID '''aa860961-6eb0-4c1c-89fb-c406fe2a2771''' (devNext)
* '''description''' (String): The description of the Type. <code>default=null</code>.
+
* '''abstractType''' (Boolean): Indicate if the type is abstract so that it cannot be instatiated. In other words only subtypes of this type can be isntantiated. <code>default=false</code>.
+
* '''superclasses''' (List<String>): The list of all supertypes of this type. Multiple Inheritance is supported.
+
* Zero o more [[Facet_Based_Resource_Model#Property | Properties]]
+
  
==== Property ====
+
'''Request URL'''
  
Any [[Facet_Based_Resource_Model#Property | Property]] is described by the following attributes:
+
<pre>GET /resource-registry/contexts/aa860961-6eb0-4c1c-89fb-c406fe2a2771</pre>
  
* '''name''' : Property Name
+
'''Response Body'''
* '''type''' : The Type of the Property (e.g. String, Integer, ...). See [[#Property_Type|Property Type]]
+
* '''description''' : The description of the Property. <code>default=null</code>.
+
* '''mandatory''' : Indicate if the Property is mandatory. <code>default=false</code>.
+
* '''readOnly''' : The Property cannot change its value. <code>default=false</code>.
+
* '''notNull''' : Whether the property must assume a value diverse from 'null' or not. <code>default=false</code>
+
* '''max''' : <code>default=null</code>
+
* '''min''' : <code>default=null</code>
+
* '''regexpr''' : A [https://en.wikipedia.org/wiki/Regular_expression Regular Expression] to validate the property value, <code>default=null</code>. A good online tool for regex is avalable at [https://regex101.com/ https://regex101.com/]
+
  
===== Property Type Mapping =====
+
<source lang="javascript">
 +
{
 +
    "@class": "Context",
 +
    "header": {
 +
        "@class": "Header",
 +
        "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
 +
        "createdBy": "luca.frosini",
 +
        "creationTime": "2021-06-30 09:38:26.978 +0000",
 +
        "lastUpdateBy": "luca.frosini",
 +
        "lastUpdateTime": "2021-06-30 09:38:26.978 +0000"
 +
    },
 +
    "name": "devNext",
 +
    "parent": {
 +
        "@class": "IsParentOf",
 +
        "header": {
 +
            "@class": "Header",
 +
            "uuid": "c470a070-83e8-45e8-8630-440225702acc",
 +
            "createdBy": "luca.frosini",
 +
            "creationTime": "2021-06-30 09:38:26.967 +0000",
 +
            "lastUpdateBy": "luca.frosini",
 +
            "lastUpdateTime": "2021-06-30 09:38:26.967 +0000"
 +
        },
 +
        "source": {
 +
            "@class": "Context",
 +
            "header": {
 +
                "@class": "Header",
 +
                "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
 +
                "createdBy": "luca.frosini",
 +
                "creationTime": "2021-06-30 09:38:26.464 +0000",
 +
                "lastUpdateBy": "luca.frosini",
 +
                "lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
 +
            },
 +
            "name": "gcube"
 +
        }
 +
    },
 +
    "children": [
 +
        {
 +
            "@class": "IsParentOf",
 +
            "header": {
 +
                "@class": "Header",
 +
                "uuid": "74d435c1-29ce-49f4-b3b9-cbca42c2b046",
 +
                "createdBy": "luca.frosini",
 +
                "creationTime": "2021-06-30 09:38:27.835 +0000",
 +
                "lastUpdateBy": "luca.frosini",
 +
                "lastUpdateTime": "2021-06-30 09:38:27.835 +0000"
 +
            },
 +
            "target": {
 +
                "@class": "Context",
 +
                "header": {
 +
                    "@class": "Header",
 +
                    "uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
 +
                    "createdBy": "luca.frosini",
 +
                    "creationTime": "2021-06-30 09:38:27.846 +0000",
 +
                    "lastUpdateBy": "luca.frosini",
 +
                    "lastUpdateTime": "2021-06-30 09:38:27.846 +0000"
 +
                },
 +
                "name": "NextNext"
 +
            }
 +
        }
 +
    ]
 +
}
 +
</source>
  
[[Facet_Based_Resource_Model#Basic_Property_Type | Property Type]] are mapped to and integer to be used in property definition:
+
=== Update Context ===
  
Type binder is defined here:
+
Update a Context identified by the UUID provided as the path parameter.
[http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/information-system/information-system-model/src/main/java/org/gcube/informationsystem/types/Type.java]
+
  
{|class="wikitable"
+
The possible updates are on:
! Type
+
* name;
! Integer Mapping
+
* parent Context.
! Java type
+
! Description
+
|-
+
| Boolean
+
| 0
+
| <code>java.lang.Boolean</code> or <code>boolean</code>
+
| Handles only the values <em>True</em> or <em>False</em>.
+
|-
+
| Integer
+
| 1
+
| <code>java.lang.Integer</code> or <code>int</code> or  <code>java.math.BigInteger</code>
+
| 32-bit signed Integers.
+
|-
+
| Short
+
| 2
+
| <code>java.lang.Short</code> or <code>short</code>
+
| Small 16-bit signed integers.
+
|-
+
| Long
+
| 3
+
| <code>java.lang.Long</code> or <code>long</code>
+
| Big 64-bit signed integers.
+
|-
+
| Float
+
| 4
+
| <code>java.lang.Float</code> or <code>float</code>
+
| Decimal numbers
+
|-
+
| Double
+
| 5
+
| <code>java.lang.Double</code> or <code>double</code>
+
| Decimal numbers with high precision.
+
|-
+
| Date
+
| 6
+
| <code>java.util.Date</code>
+
| Any date with the precision up to milliseconds.
+
|-
+
| String
+
| 7
+
| <code>java.lang.String</code>
+
| Any string as alphanumeric sequence of chars.
+
|-
+
| Binary
+
| 8
+
| <code>java.lang.Byte[]</code> or <code>byte[]</code>
+
| Can contain any value as byte array.
+
|-
+
| Embedded
+
| 9
+
| <code>?  extends org.gcube.informationsystem.model.embedded.Embedded</code>
+
| This is an Object contained inside the owner Entity and has no [[#Header|Header]]. It is reachable only by navigating the owner Entity.
+
|-
+
| Embedded list
+
| 10
+
| <code>List&lt;?  extends org.gcube.informationsystem.model.embedded.Embedded&gt;</code>
+
| List of Objects contained inside the owner Entity and have no [[#Header|Header]]. They are reachable only by navigating the owner Entity.
+
|-
+
| Embedded set
+
| 11
+
| <code>Set&lt;? extends org.gcube.informationsystem.model.embedded.Embedded&gt;</code>
+
| Set (no duplicates) of Objects contained inside the owner Entity and have no [[#Header|Header]]. They are reachable only by navigating the owner Entity.
+
|-
+
| Embedded map
+
| 12
+
| <code>Map&lt;String, ? extends org.gcube.informationsystem.model.embedded.Embedded&gt;</code>
+
| Map of Objects contained inside the owner Entity and have no [[#Header|Header]]. They are reachable only by navigating the owner Entity.
+
|-
+
| Byte
+
| 17
+
| <code>java.lang.Byte</code> or <code>byte</code>
+
| Single byte. usesful to store small 8-bit signed integers.
+
|}
+
  
=== Type Creation ===
 
  
<pre>PUT /resource-registry/schema/{{type}} </pre>
+
==== Update via Java Client ====
  
==== Description ====
+
<source lang="java">
 +
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
  
Allow to create new Entity or Relation or Embedded Type.
+
Context contextToBeUpdated = ....;
  
==== Parameters ====
+
Context updatedContext = resourceRegistryContextClient.update(contextToBeUpdated);
 +
</source>
  
{|class="wikitable"
+
==== Update via REST API ====
! Name
+
! Type
+
! Required
+
! Description
+
|-
+
| '''type'''
+
| String
+
| true
+
| The name of the new type to create
+
|}
+
  
==== Responses ====
+
<pre>PUT /resource-registry/contexts/{UUID}</pre>
  
 
{|class="wikitable"
 
{|class="wikitable"
Line 537: Line 802:
 
| 200
 
| 200
 
| String
 
| String
| The json representation of the newly created type (which is the same of the request)
+
| The JSON representation of the updated Context
 
|}
 
|}
  
==== Examples ====
+
==== Rename Context ====
  
===== Resource Type Creation =====
+
===== Rename via Java Client =====
  
<pre>PUT /resource-registry/schema/Actor</pre>
+
Rename a Context '''aa860961-6eb0-4c1c-89fb-c406fe2a2771''' (was '''devNext''') to the new name '''newDevNext'''.
  
'''''Request Body'''''
+
<source lang="java">
<pre>
+
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
{
+
Context devNextContext = resourceRegistryContextClient.read("aa860961-6eb0-4c1c-89fb-c406fe2a2771");
"name":"Actor",
+
devNextContext.setName("newDevNext");
"description":"Any entity (human or machine) playing an active role.",
+
Context newDevNext = resourceRegistryContextClient.update(devNextContext);
"abstractType":true, /* If the Resource cannot be instantiated */
+
</source>
"superclasses":["Resource"], /* Resource or any registered specialization. */
+
"properties":null /* MUST be null. The Resource cannot have any property. */
+
}
+
</pre>
+
  
===== Facet Type Creation =====
+
===== Rename via REST API =====
  
<pre>PUT /resource-registry/schema/ContactFacet</pre>
+
Rename a Context '''aa860961-6eb0-4c1c-89fb-c406fe2a2771''' (was '''devNext''') to the new name '''newDevNext'''.
  
'''''Request Body'''''
+
'''Request URL'''
<pre>
+
 
 +
<pre>PUT /resource-registry/contexts/aa860961-6eb0-4c1c-89fb-c406fe2a2771</pre>
 +
 
 +
'''Request Body'''
 +
 
 +
<source lang="javascript">
 
{
 
{
"name":"ContactFacet",
+
    "@class": "Context",
"description":"This facet is expected to capture contact information",
+
    "header": {
"abstractType": false,
+
        "@class": "Header",
"superclasses":["Facet"],
+
        "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771"
"properties":[
+
    },
{
+
    "name": "newDevNext",
"name":"name",
+
    "parent": {
"description":"First Name",
+
        "@class": "IsParentOf",
"mandatory":true,
+
        "header": {
"readonly":false,
+
            "@class": "Header",
"notnull":true,
+
            "uuid": "c470a070-83e8-45e8-8630-440225702acc"
"max":null,
+
        },
"min":null,
+
        "source": {
"regexpr":null,
+
            "@class": "Context",
"linkedType":null,
+
            "header": {
"linkedClass":null,
+
                "@class": "Header",
"type":7 /* String*/
+
                "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2"
},{
+
            },
"name":"eMail",
+
            "name": "gcube"
"description": "A restricted range of RFC‑822 compliant email address. ... ",
+
        }
"mandatory":true,
+
    }
"readonly":false,
+
"notnull":true,
+
"max":null,
+
"min":null,
+
"regexpr":"^[a-z0-9._%+-]{1,128}@[a-z0-9.-]{1,128}$",
+
"linkedType":null,
+
"linkedClass":null,
+
"type":7 /* String */
+
}
+
]
+
 
}
 
}
</pre>
+
</source>
  
===== IsRelatedTo Type Creation =====
+
'''Response Body'''
<pre>
+
PUT /resource-registry/schema/Hosts
+
</pre>
+
  
'''''Request Body'''''
+
<source lang="javascript">
<pre>
+
 
{
 
{
"name":"Hosts",
+
    "name": "newDevNext",
"description": "…”,
+
    "header": {
"abstractType":false,
+
        "@class": "Header",
"superclasses":["IsRelatedTo"],
+
        "creationTime": "2021-06-30 11:38:26.978 +0200",
"properties":[]
+
        "createdBy": "luca.frosini",
 +
        "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
 +
        "lastUpdateBy": "luca.frosini",
 +
        "lastUpdateTime": "2021-07-01 16:44:46.592 +0200"
 +
    },
 +
    "@class": "Context",
 +
    "parent": {
 +
        "header": {
 +
            "@class": "Header",
 +
            "creationTime": "2021-07-01 16:43:57.358 +0200",
 +
            "createdBy": "luca.frosini",
 +
            "uuid": "c470a070-83e8-45e8-8630-440225702acc",
 +
            "lastUpdateBy": "luca.frosini",
 +
            "lastUpdateTime": "2021-07-01 16:43:57.358 +0200"
 +
        },
 +
        "@class": "IsParentOf",
 +
        "source": {
 +
            "name": "gcube",
 +
            "header": {
 +
                "@class": "Header",
 +
                "creationTime": "2021-06-30 11:38:26.464 +0200",
 +
                "createdBy": "luca.frosini",
 +
                "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
 +
                "lastUpdateBy": "luca.frosini",
 +
                "lastUpdateTime": "2021-06-30 11:38:26.464 +0200"
 +
            },
 +
            "@class": "Context"
 +
        }
 +
    },
 +
    "children": [
 +
        {
 +
            "header": {
 +
                "@class": "Header",
 +
                "creationTime": "2021-06-30 11:38:27.835 +0200",
 +
                "createdBy": "luca.frosini",
 +
                "uuid": "74d435c1-29ce-49f4-b3b9-cbca42c2b046",
 +
                "lastUpdateBy": "luca.frosini",
 +
                "lastUpdateTime": "2021-06-30 11:38:27.835 +0200"
 +
            },
 +
            "@class": "IsParentOf",
 +
            "target": {
 +
                "name": "NextNext",
 +
                "header": {
 +
                    "@class": "Header",
 +
                    "creationTime": "2021-06-30 11:38:27.846 +0200",
 +
                    "createdBy": "luca.frosini",
 +
                    "uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
 +
                    "lastUpdateBy": "luca.frosini",
 +
                    "lastUpdateTime": "2021-06-30 11:38:27.846 +0200"
 +
                },
 +
                "@class": "Context"
 +
            }
 +
        }
 +
    ]
 
}
 
}
</pre>
+
</source>
  
===== ConsistsOf Type Creation =====
+
==== Move Context ====
  
<pre>
+
We have 5 Contexts organized in the following Context Tree:
PUT /resource-registry/schema/HasContact
+
</pre>
+
  
'''''Request Body'''''
 
 
<pre>
 
<pre>
{
+
-  ca50eb95-b76c-44fd-9182-229d39c3c9e2 (gcube)
"name":"HasContact",
+
|
"description":"",
+
|---- d0544ff9-8f61-416f-b685-589a2262e2c4 (devsec)
"abstractType":true,
+
|  |
"superclasses":["ConsistsOf"],
+
|  |---- 4c0c3500-32d6-11ea-867c-af3c989f8e41 (devVRE)
"properties":[]
+
|
}
+
|---- aa860961-6eb0-4c1c-89fb-c406fe2a2771 (devNext)
 +
    |
 +
    |---- bad5f350-345c-11e9-9f49-cef9b1608c3f (NextNext)
 
</pre>
 
</pre>
  
===== Embedded Type Creation =====
+
We want to move Context '''bad5f350-345c-11e9-9f49-cef9b1608c3f''' (NextNext) as child of the Context '''ca50eb95-b76c-44fd-9182-229d39c3c9e2''' (gcube) in palce of aa860961-6eb0-4c1c-89fb-c406fe2a2771  (devNext)
<pre>
+
In other words, NextNext will be a VO in place of a VRE.
PUT /resource-registry/schema/AccessPolicy
+
 
</pre>
+
We will obtain the following Context tree
  
'''''Request Body'''''
 
 
<pre>
 
<pre>
{
+
- ca50eb95-b76c-44fd-9182-229d39c3c9e2 (gcube)
"name":"AccessPolicy",
+
|
"description":"",
+
|---- d0544ff9-8f61-416f-b685-589a2262e2c4 (devsec)
"abstractType":false,
+
|  |
"superclasses":["Embedded"],
+
|  |---- 4c0c3500-32d6-11ea-867c-af3c989f8e41 (devVRE)
"properties":[{
+
|
"name":"policy",
+
|---- aa860961-6eb0-4c1c-89fb-c406fe2a2771 (devNext)
"description":"",
+
|
"mandatory":false,
+
|---- bad5f350-345c-11e9-9f49-cef9b1608c3f (NextNext)
"readonly":false,
+
"notnull":false,
+
"max":null,
+
"min":null,
+
"regexpr":null,
+
"linkedType":null,
+
"linkedClass":”ValueSchema”,
+
"type": 9 /* Embedded */
+
},{
+
"name":"note",
+
"description":"",
+
"mandatory": false,
+
"readonly":false,
+
"notnull":false,
+
"max":null,
+
"min":null,
+
"regexpr":null,
+
"linkedType":null,
+
"linkedClass":null,
+
"type":7 /* String */
+
}]
+
}
+
 
</pre>
 
</pre>
  
  
=== Read Type Definition ===
+
===== Move with Java client =====
  
<pre>GET /resource-registry/schema/{{type}} </pre>
+
<source lang="java">
 +
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 +
Context gcubeContext = resourceRegistryContextClient.read("ca50eb95-b76c-44fd-9182-229d39c3c9e2");
 +
Context nextNextContext = resourceRegistryContextClient.read("bad5f350-345c-11e9-9f49-cef9b1608c3f");
 +
nextNextContext.setParent(gcubeContext);
 +
nextNextContext = resourceRegistryContextClient.update(nextNextContext);
 +
</source>
  
==== Description ====
 
  
Allow to read Type Definition
+
===== Move via REST API =====
  
==== Parameters ====
+
If we read the Context ''bad5f350-345c-11e9-9f49-cef9b1608c3f''' (NextNext) before moving it we have:
  
{|class="wikitable"
+
<source lang="javascript">
! Name
+
{
! Type
+
    "@class": "Context",
! Required
+
    "header": {
! Description
+
        "@class": "Header",
|-
+
        "uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
| '''type'''
+
        "createdBy": "luca.frosini",
| String
+
        "creationTime": "2021-06-30 09:38:27.846 +0000",
| true
+
        "lastUpdateBy": "luca.frosini",
| The name of the type you want to retrieve the definition
+
        "lastUpdateTime": "2021-06-30 09:38:27.846 +0000"
|}
+
    },
 +
    "name": "NextNext",
 +
    "parent": {
 +
        "@class": "IsParentOf",
 +
        "header": {
 +
            "@class": "Header",
 +
            "uuid": "74d435c1-29ce-49f4-b3b9-cbca42c2b046",
 +
            "createdBy": "luca.frosini",
 +
            "creationTime": "2021-06-30 09:38:27.835 +0000",
 +
            "lastUpdateBy": "luca.frosini",
 +
            "lastUpdateTime": "2021-06-30 09:38:27.835 +0000"
 +
        },
 +
        "source": {
 +
            "@class": "Context",
 +
            "header": {
 +
                "@class": "Header",
 +
                "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
 +
                "createdBy": "luca.frosini",
 +
                "creationTime": "2021-06-30 09:38:26.978 +0000",
 +
                "lastUpdateBy": "luca.frosini",
 +
                "lastUpdateTime": "2021-07-01 14:44:46.592 +0000"
 +
            },
 +
            "name": "devNext"
 +
        }
 +
    },
 +
    "children": []
 +
}
 +
</source>
  
==== Responses ====
+
'''Request URL'''
  
{|class="wikitable"
+
<pre>PUT /resource-registry/contexts/bad5f350-345c-11e9-9f49-cef9b1608c3f</pre>
! Code
+
! Type
+
! Description
+
|-
+
| 200
+
| String
+
| The json representation of the newly created type
+
|}
+
  
==== Examples ====
+
'''Request Body'''
  
===== Resource Type =====
+
<source lang="javascript">
 +
{
 +
    "@class": "Context",
 +
    "header": {
 +
        "@class": "Header",
 +
        "uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
 +
    },
 +
    "name": "NextNext",
 +
    "parent": {
 +
        "header": {
 +
            "@class": "Header",
 +
            "uuid": "c470a070-83e8-45e8-8630-440225702acc"
 +
        },
 +
        "@class": "IsParentOf"
 +
        "source": {
 +
            "name": "gcube",
 +
            "header": {
 +
                "@class": "Header",
 +
                "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2"
 +
            },
 +
            "@class": "Context"
 +
        }
 +
    },
 +
    "children": []
 +
}
 +
</source>
  
<pre>GET /resource-registry/schema/Actor</pre>
+
'''Response Body'''
  
'''''Response'''''
+
<source lang="javascript">
<pre>
+
 
{
 
{
"name":"Actor",
+
    "name": "NextNext",
"description":"Any entity (human or machine) playing an active role.",
+
    "header": {
"abstractType":true,
+
        "@class": "Header",
"superclasses":["Resource"],
+
        "creationTime": "2021-06-30 11:38:27.846 +0200",
"properties":null
+
        "createdBy": "luca.frosini",
 +
        "uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
 +
        "lastUpdateBy": "luca.frosini",
 +
        "lastUpdateTime": "2021-07-01 16:51:34.143 +0200"
 +
    },
 +
    "@class": "Context"
 +
    "parent": {
 +
        "header": {
 +
            "@class": "Header",
 +
            "creationTime": "2021-07-01 16:51:34.131 +0200",
 +
            "createdBy": "luca.frosini",
 +
            "uuid": "c470a070-83e8-45e8-8630-440225702acc",
 +
            "lastUpdateBy": "luca.frosini",
 +
            "lastUpdateTime": "2021-07-01 16:51:34.131 +0200"
 +
        },
 +
        "@class": "IsParentOf"
 +
        "source": {
 +
            "name": "gcube",
 +
            "header": {
 +
                "@class": "Header",
 +
                "creationTime": "2021-06-30 11:38:26.464 +0200",
 +
                "createdBy": "luca.frosini",
 +
                "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
 +
                "lastUpdateBy": "luca.frosini",
 +
                "lastUpdateTime": "2021-06-30 11:38:26.464 +0200"
 +
            },
 +
            "@class": "Context"
 +
        }
 +
    }
 
}
 
}
</pre>
+
</source>
  
===== Facet Type =====
+
=== Delete Context ===
  
<pre>GET /resource-registry/schema/ContactFacet</pre>
 
  
'''''Response'''''
+
Delete the Context identified by the UUID provided as the path parameter.
<pre>
+
{
+
"name":"ContactFacet",
+
"description":"This facet is expected to capture contact information",
+
"abstractType": false,
+
"superclasses":["Facet"],
+
"properties":[
+
{
+
"name":"name",
+
"description":"First Name",
+
"mandatory":true,
+
"readonly":false,
+
"notnull":true,
+
"max":null,
+
"min":null,
+
"regexpr":null,
+
"linkedType":null,
+
"linkedClass":null,
+
"type":7 /* String*/
+
},{
+
"name":"eMail",
+
"description": "A restricted range of RFC‑822 compliant email address. ... ",
+
"mandatory":true,
+
"readonly":false,
+
"notnull":true,
+
"max":null,
+
"min":null,
+
"regexpr":"^[a-z0-9._%+-]{1,128}@[a-z0-9.-]{1,128}$",
+
"linkedType":null,
+
"linkedClass":null,
+
"type":7 /* String */
+
}
+
]
+
}
+
</pre>
+
  
===== IsRelatedTo Type =====
+
'''The resource registry performs the following checks before deleting a context:'''
<pre>GET /resource-registry/schema/Hosts</pre>
+
* '''the context MUST have no children: this implies that you can't delete the ''testVO'' context if you don't have deleted (or moved to another parent) the context ''testVRE'';'''
 +
* '''the context MUST NOT have associated entities and relation instances: this implies that the client must remove in advance the available instances from the context.'''
  
'''''Response'''''
+
==== Delete via Java Client ====
<pre>
+
{
+
"name":"Hosts",
+
"description": "…”,
+
"abstractType":false,
+
"superclasses":["IsRelatedTo"],
+
"properties":[]
+
}
+
</pre>
+
  
===== ConsistsOf Type =====
+
Delete using UUID. This normally used when we already have the UUID instance.
  
<pre>GET /resource-registry/schema/HasContact</pre>
+
<source lang="java">
 +
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 +
resourceRegistryContextClient.delete("bad5f350-345c-11e9-9f49-cef9b1608c3f");
 +
</source>
  
'''''Response'''''
+
Delete using context instance. This normally used when we already have the context instance.
<pre>
+
 
{
+
<source lang="java">
"name":"HasContact",
+
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
"description":"",
+
Context nextNextContext = resourceRegistryContextClient.read("bad5f350-345c-11e9-9f49-cef9b1608c3f");
"abstractType":true,
+
resourceRegistryContextClient.delete(nextNextContext);
"superclasses":["ConsistsOf"],
+
</source>
"properties":[]
+
}
+
</pre>
+
  
===== Embedded Type =====
+
==== Delete via REST API ====
<pre>GET /resource-registry/schema/AccessPolicy</pre>
+
  
'''''Response'''''
+
<pre>DELETE /resource-registry/contexts/{{UUID}}</pre>
<pre>
+
 
{
+
{|class="wikitable"
"name":"AccessPolicy",
+
! Code
"description":"",
+
! Type
"abstractType":false,
+
! Description
"superclasses":["Embedded"],
+
|-
"properties":[{
+
| 204 - No Content
"name":"policy",
+
| N/A
"description":"",
+
| N/A
"mandatory":false,
+
|}
"readonly":false,
+
 
"notnull":false,
+
 
"max":null,
+
'''Request URL'''
"min":null,
+
 
"regexpr":null,
+
For example to delete the Context having UUID '''bad5f350-345c-11e9-9f49-cef9b1608c3f''' (NextNext) we just need to perform the following HTTP request
"linkedType":null,
+
 
"linkedClass":”ValueSchema”,
+
<pre>DELETE /resource-registry/contexts/bad5f350-345c-11e9-9f49-cef9b1608c3f</pre>
"type": 9  /* Embedded */
+
},{
+
"name":"note",
+
"description":"",
+
"mandatory": false,
+
"readonly":false,
+
"notnull":false,
+
"max":null,
+
"min":null,
+
"regexpr":null,
+
"linkedType":null,
+
"linkedClass":null,
+
"type":7 /* String */
+
}]
+
}
+
</pre>
+

Latest revision as of 09:38, 9 September 2021

These sections provide information regarding how to interact with Resource Registry Service for Context Management. REST API are presented for each functionality.

Please note that the provided examples can intentionally hide some details in the response to avoid unneeded complexity.

Context Management

Context Management is responsible for managing hierarchical Context as defined by the IS Model.

Context requirements:

  • No predefined number of levels;
  • Possibility to change the name of the Context with no impact for any component;
  • Possibility to move a Context from a parent Context to another.

Any request to this port type has success if the following guarantees are satisfied:

  • the hierarchy of contexts is a tree with an arbitrary number of levels;
  • two contexts with the same name can only exist if they have different parents;
  • any update to a context does not have any side effect on the instances belonging to the context;
  • it is not possible to delete a context if
    • it contains instances. It is the responsibility of the clients to remove the instances from the context (or delete them) before trying to delete the context;
    • it has children context. It is the responsibility of the clients to remove or move the children context before trying to delete the context.


Context Management exposes the following APIs:

  • List: allows to enumerate the contexts;
  • Create: allows to create a new context as a child of another context (if any). The context has a name;
  • Exists: allows to check if a Context exists;
  • Read: allows to read a Context;
  • Update:
    • Rename: rename a context;
    • Move: move a context as a child of another Context.
  • Delete: allows to delete a Context.

Context Collection

The following table shows the exposed APIs as REST Collection

Operation HTTP Method URL
List GET /contexts
Create PUT /contexts/{UUID}
Exists HEAD /contexts/{UUID}
Read GET /contexts/{UUID}
Update PUT /contexts/{UUID}
Delete DELETE /contexts/{UUID}

Security configuration based on Authorization Framework make this port type accessible only from Resource Manager. In other words, no others client is allowed to manage Context rather than Resource Manager.

Resource Registry Context Client

Resource Registry Context Client is a java library providing RPC facilities to interact with Context Collection. The library hides all the complexity of marshalling and unmarshalling of requests and results. By using this library any client is able to manage java classes instead of JSON objects.

To use the Java library to interact with Context Collection declare the following dependency in your pom.xml file.

<dependency>
	<groupId>org.gcube.information-system</groupId>
	<artifactId>resource-registry-context-client</artifactId>
	<version>[4.0.0,5.0.0-SNAPSHOT)</version>
<dependency>


To use the client you just need to instantiate the client via the provided factory.

import org.gcube.informationsystem.resourceregistry.context.ResourceRegistryContextClient;
import org.gcube.informationsystem.resourceregistry.context.ResourceRegistryContextClientFactory;
 
....
 
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();

The provided client exposes the available methods and options as explained below.

The source code of the resource-registry-context-client is available at https://code-repo.d4science.org/gCubeSystem/resource-registry-context-client

APIs

The provided examples are based on the following Context tree

-  ca50eb95-b76c-44fd-9182-229d39c3c9e2 (gcube)
|
|---- d0544ff9-8f61-416f-b685-589a2262e2c4 (devsec)
|   |
|   |---- 4c0c3500-32d6-11ea-867c-af3c989f8e41 (devVRE)
|
|---- aa860961-6eb0-4c1c-89fb-c406fe2a2771 (devNext)
    |
    |---- bad5f350-345c-11e9-9f49-cef9b1608c3f (NextNext)

List Contexts

List all available contexts.


List via Java client

ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
List<Context> contexts = resourceRegistryContextClient.all();


List via REST API

GET /resource-registry/contexts


Code Type Description
200 String A JSON array containing as an element the representation of each Context

Request URL

GET /resource-registry/contexts

Response Body

[
	{
		"@class": "Context",
		"header": {
			"@class": "Header",
			"uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
			"createdBy": "luca.frosini",
			"creationTime": "2021-06-30 09:38:26.464 +0000",
			"lastUpdateBy": "luca.frosini",
			"lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
		},
		"name": "gcube",
		"parent": null,
		"children": [
			{
				"@class": "IsParentOf",
				"header": {
					"@class": "Header",
					"uuid": "c470a070-83e8-45e8-8630-440225702acc",
					"createdBy": "luca.frosini",
					"creationTime": "2021-06-30 09:38:26.967 +0000",
					"lastUpdateBy": "luca.frosini",
					"lastUpdateTime": "2021-06-30 09:38:26.967 +0000"
				},
				"target": {
					"@class": "Context",
					"header": {
						"@class": "Header",
						"uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
						"createdBy": "luca.frosini",
						"creationTime": "2021-06-30 09:38:26.978 +0000",
						"lastUpdateBy": "luca.frosini",
						"lastUpdateTime": "2021-06-30 09:38:26.978 +0000"
					},
					"name": "devNext"
				}
			},
			{
				"@class": "IsParentOf",
				"header": {
					"@class": "Header",
					"uuid": "9966f136-25c9-4e73-aa54-5357ac5e09d1",
					"createdBy": "luca.frosini",
					"creationTime": "2021-06-30 09:38:27.410 +0000",
					"lastUpdateBy": "luca.frosini",
					"lastUpdateTime": "2021-06-30 09:38:27.410 +0000"
				},
				"target": {
					"@class": "Context",
					"header": {
						"@class": "Header",
						"uuid": "d0544ff9-8f61-416f-b685-589a2262e2c4",
						"createdBy": "luca.frosini",
						"creationTime": "2021-06-30 09:38:27.418 +0000",
						"lastUpdateBy": "luca.frosini",
						"lastUpdateTime": "2021-06-30 09:38:27.418 +0000"
					},
					"name": "devsec"
				}
			}
		]
	},
	{
		"@class": "Context",
		"header": {
			"@class": "Header",
			"uuid": "4c0c3500-32d6-11ea-867c-af3c989f8e41",
			"createdBy": "luca.frosini",
			"creationTime": "2021-06-30 09:38:30.098 +0000",
			"lastUpdateBy": "luca.frosini",
			"lastUpdateTime": "2021-06-30 09:38:30.098 +0000"
		},
		"name": "devVRE",
		"parent": {
			"@class": "IsParentOf",
			"header": {
				"@class": "Header",
				"uuid": "347f0e81-7407-485d-9698-946cf3b10c0b",
				"createdBy": "luca.frosini",
				"creationTime": "2021-06-30 09:38:30.090 +0000",
				"lastUpdateBy": "luca.frosini",
				"lastUpdateTime": "2021-06-30 09:38:30.090 +0000"
			},
			"source": {
				"@class": "Context",
				"header": {
					"@class": "Header",
					"uuid": "d0544ff9-8f61-416f-b685-589a2262e2c4",
					"createdBy": "luca.frosini",
					"creationTime": "2021-06-30 09:38:27.418 +0000",
					"lastUpdateBy": "luca.frosini",
					"lastUpdateTime": "2021-06-30 09:38:27.418 +0000"
				},
				"name": "devsec"
			}
		},
		"children": []
	},
	{
		"@class": "Context",
		"header": {
			"@class": "Header",
			"uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
			"createdBy": "luca.frosini",
			"creationTime": "2021-06-30 09:38:26.978 +0000",
			"lastUpdateBy": "luca.frosini",
			"lastUpdateTime": "2021-06-30 09:38:26.978 +0000"
		},
		"name": "devNext",
		"parent": {
			"@class": "IsParentOf",
			"header": {
				"@class": "Header",
				"uuid": "c470a070-83e8-45e8-8630-440225702acc",
				"createdBy": "luca.frosini",
				"creationTime": "2021-06-30 09:38:26.967 +0000",
				"lastUpdateBy": "luca.frosini",
				"lastUpdateTime": "2021-06-30 09:38:26.967 +0000"
			},
			"source": {
				"@class": "Context",
				"header": {
					"@class": "Header",
					"uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
					"createdBy": "luca.frosini",
					"creationTime": "2021-06-30 09:38:26.464 +0000",
					"lastUpdateBy": "luca.frosini",
					"lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
				},
				"name": "gcube"
			}
		},
		"children": [
			{
				"@class": "IsParentOf",
				"header": {
					"@class": "Header",
					"uuid": "74d435c1-29ce-49f4-b3b9-cbca42c2b046",
					"createdBy": "luca.frosini",
					"creationTime": "2021-06-30 09:38:27.835 +0000",
					"lastUpdateBy": "luca.frosini",
					"lastUpdateTime": "2021-06-30 09:38:27.835 +0000"
				},
				"target": {
					"@class": "Context",
					"header": {
						"@class": "Header",
						"uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
						"createdBy": "luca.frosini",
						"creationTime": "2021-06-30 09:38:27.846 +0000",
						"lastUpdateBy": "luca.frosini",
						"lastUpdateTime": "2021-06-30 09:38:27.846 +0000"
					},
					"name": "NextNext"
				}
			}
		]
	},
	{
		"@class": "Context",
		"header": {
			"@class": "Header",
			"uuid": "d0544ff9-8f61-416f-b685-589a2262e2c4",
			"createdBy": "luca.frosini",
			"creationTime": "2021-06-30 09:38:27.418 +0000",
			"lastUpdateBy": "luca.frosini",
			"lastUpdateTime": "2021-06-30 09:38:27.418 +0000"
		},
		"name": "devsec",
		"parent": {
			"@class": "IsParentOf",
			"header": {
				"@class": "Header",
				"uuid": "9966f136-25c9-4e73-aa54-5357ac5e09d1",
				"createdBy": "luca.frosini",
				"creationTime": "2021-06-30 09:38:27.410 +0000",
				"lastUpdateBy": "luca.frosini",
				"lastUpdateTime": "2021-06-30 09:38:27.410 +0000"
			},
			"source": {
				"@class": "Context",
				"header": {
					"@class": "Header",
					"uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
					"createdBy": "luca.frosini",
					"creationTime": "2021-06-30 09:38:26.464 +0000",
					"lastUpdateBy": "luca.frosini",
					"lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
				},
				"name": "gcube"
			}
		},
		"children": [
			{
				"@class": "IsParentOf",
				"header": {
					"@class": "Header",
					"uuid": "347f0e81-7407-485d-9698-946cf3b10c0b",
					"createdBy": "luca.frosini",
					"creationTime": "2021-06-30 09:38:30.090 +0000",
					"lastUpdateBy": "luca.frosini",
					"lastUpdateTime": "2021-06-30 09:38:30.090 +0000"
				},
				"target": {
					"@class": "Context",
					"header": {
						"@class": "Header",
						"uuid": "4c0c3500-32d6-11ea-867c-af3c989f8e41",
						"createdBy": "luca.frosini",
						"creationTime": "2021-06-30 09:38:30.098 +0000",
						"lastUpdateBy": "luca.frosini",
						"lastUpdateTime": "2021-06-30 09:38:30.098 +0000"
					},
					"name": "devVRE"
				}
			}
		]
	},
	{
		"@class": "Context",
		"header": {
			"@class": "Header",
			"uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
			"createdBy": "luca.frosini",
			"creationTime": "2021-06-30 09:38:27.846 +0000",
			"lastUpdateBy": "luca.frosini",
			"lastUpdateTime": "2021-06-30 09:38:27.846 +0000"
		},
		"name": "NextNext",
		"parent": {
			"@class": "IsParentOf",
			"header": {
				"@class": "Header",
				"uuid": "74d435c1-29ce-49f4-b3b9-cbca42c2b046",
				"createdBy": "luca.frosini",
				"creationTime": "2021-06-30 09:38:27.835 +0000",
				"lastUpdateBy": "luca.frosini",
				"lastUpdateTime": "2021-06-30 09:38:27.835 +0000"
			},
			"source": {
				"@class": "Context",
				"header": {
					"@class": "Header",
					"uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
					"createdBy": "luca.frosini",
					"creationTime": "2021-06-30 09:38:26.978 +0000",
					"lastUpdateBy": "luca.frosini",
					"lastUpdateTime": "2021-06-30 09:38:26.978 +0000"
				},
				"name": "devNext"
			}
		},
		"children": []
	}
]

Create Context

Create new Context as a child of another Context (if any).

Create via Java Client

Create via Java Client Example 1

This Java code snippet shows how to create a new Context with name gcube with no parent. It is a ROOT Context.

ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 
Context gcubeContext = new ContextImpl("gcube");
// Java class generate a random UUID and use to interact with Resource Regsitry Service
// To specify the UUID 
// UUID gcubeUUID = UUID.fromString("ca50eb95-b76c-44fd-9182-229d39c3c9e2");
// Context gcubeContext = new ContextImpl("gcube", gcubeUUID);
gcubeContext = resourceRegistryContextClient.create(gcubeContext);
Create via Java Client Example 2

This Java code snippet shows how to create a new Context with name devNext as child of Context with UUID c470a070-83e8-45e8-8630-440225702acc (gcube).

ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
Context gcubeContext = resourceRegistryContextClient.read("ca50eb95-b76c-44fd-9182-229d39c3c9e2");
 
Context devNextContext = new ContextImpl("devNext");
// To specify the UUID 
// UUID devNextUUID = UUID.fromString("aa860961-6eb0-4c1c-89fb-c406fe2a2771");
// Context testVOContext = new ContextImpl("devNext", devNextUUID);
devNextContext.setParent(gcubeContext);
devNextContext = resourceRegistryContextClient.create(devNextContext);

Create via REST API

PUT /resource-registry/contexts/{{UUID}}
Code Type Description
200 String The JSON representation of the newly created Context


Create via REST API Example 1

Create a new Context with name gcube with no parent. It is a ROOT Context.

Request URL

PUT /resource-registry/context/ca50eb95-b76c-44fd-9182-229d39c3c9e2

Request Body

{
	"@class": "Context",
	"name": "gcube",
	"header": {
		"@class": "Header",
		"uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2"
	}
}


Response Body

{
    "@class": "Context",
    "header": {
        "@class": "Header",
        "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
        "createdBy": "luca.frosini",
        "creationTime": "2021-06-30 09:38:26.464 +0000",
        "lastUpdateBy": "luca.frosini",
        "lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
    },
    "name": "gcube",
    "parent": null,
    "children": []
}
Create via REST API Example 2

Create a new Context with name devNext as child of Context with UUID c470a070-83e8-45e8-8630-440225702acc (gcube).

Request URL

PUT /resource-registry/contexts/aa860961-6eb0-4c1c-89fb-c406fe2a2771

Request Body

{
    "@class": "Context",
    "header": {
        "@class": "Header",
        "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771"
    },
    "name": "devNext",
    "parent": {
        "@class": "IsParentOf",
        "header": null,
        "source": {
            "@class": "Context",
            "header": {
                "@class": "Header",
                "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2"
            }
        }
    }
}

Response Body

{
    "@class": "Context",
    "header": {
        "@class": "Header",
        "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
        "createdBy": "luca.frosini",
        "creationTime": "2021-06-30 09:38:26.978 +0000",
        "lastUpdateBy": "luca.frosini",
        "lastUpdateTime": "2021-06-30 09:38:26.978 +0000"
    },
    "name": "devNext",
    "parent": {
        "@class": "IsParentOf",
        "header": {
            "@class": "Header",
            "uuid": "c470a070-83e8-45e8-8630-440225702acc",
            "createdBy": "luca.frosini",
            "creationTime": "2021-06-30 09:38:26.967 +0000",
            "lastUpdateBy": "luca.frosini",
            "lastUpdateTime": "2021-06-30 09:38:26.967 +0000"
        },
        "source": {
            "@class": "Context",
            "header": {
                "@class": "Header",
                "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
                "createdBy": "luca.frosini",
                "creationTime": "2021-06-30 09:38:26.464 +0000",
                "lastUpdateBy": "luca.frosini",
                "lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
            },
            "name": "gcube"
        }
    },
    "children": []
}

Read Context

Return the definition of the Context identified by the UUID provided as the path parameter.

Read via Java Client

Read via Java Client Example 1

Read the Context having UUID ca50eb95-b76c-44fd-9182-229d39c3c9e2 (gcube)

Read using a string representing the UUID.

ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
Context gcubeContext = resourceRegistryContextClient.read("ca50eb95-b76c-44fd-9182-229d39c3c9e2");
Read via Java Client Example 2

Read the Context having UUID aa860961-6eb0-4c1c-89fb-c406fe2a2771 (devNext)

Read using UUID. This normally used when we already have the UUID instance.

ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
UUID devNextUUID = UUID.fromString("aa860961-6eb0-4c1c-89fb-c406fe2a2771");
Context devNextContext = resourceRegistryContextClient.read(devNextUUID);


Read using context instance. This normally used when we already have the context instance.

ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
UUID devNextUUID = UUID.fromString("aa860961-6eb0-4c1c-89fb-c406fe2a2771");
Context devNextContext = new ContextImpl("devNext", devNextUUID);
devNextContext = resourceRegistryContextClient.read(devNextContext);


Read via REST API

GET /resource-registry/context/{UUID}
Code Type Description
200 String The JSON representation of the requested Context


Read via REST API Example 1

Read the Context having UUID ca50eb95-b76c-44fd-9182-229d39c3c9e2 (gcube)

Request URL

GET /resource-registry/contexts/ca50eb95-b76c-44fd-9182-229d39c3c9e2

Response Body

{
    "@class": "Context",
    "header": {
        "@class": "Header",
        "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
        "createdBy": "luca.frosini",
        "creationTime": "2021-06-30 09:38:26.464 +0000",
        "lastUpdateBy": "luca.frosini",
        "lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
    },
    "name": "gcube",
    "parent": null,
    "children": [
        {
            "@class": "IsParentOf",
            "header": {
                "@class": "Header",
                "uuid": "c470a070-83e8-45e8-8630-440225702acc",
                "createdBy": "luca.frosini",
                "creationTime": "2021-06-30 09:38:26.967 +0000",
                "lastUpdateBy": "luca.frosini",
                "lastUpdateTime": "2021-06-30 09:38:26.967 +0000"
            },
            "target": {
                "@class": "Context",
                "header": {
                    "@class": "Header",
                    "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
                    "createdBy": "luca.frosini",
                    "creationTime": "2021-06-30 09:38:26.978 +0000",
                    "lastUpdateBy": "luca.frosini",
                    "lastUpdateTime": "2021-06-30 09:38:26.978 +0000"
                },
                "name": "devNext"
            }
        },
        {
            "@class": "IsParentOf",
            "header": {
                "@class": "Header",
                "uuid": "9966f136-25c9-4e73-aa54-5357ac5e09d1",
                "createdBy": "luca.frosini",
                "creationTime": "2021-06-30 09:38:27.410 +0000",
                "lastUpdateBy": "luca.frosini",
                "lastUpdateTime": "2021-06-30 09:38:27.410 +0000"
            },
            "target": {
                "@class": "Context",
                "header": {
                    "@class": "Header",
                    "uuid": "d0544ff9-8f61-416f-b685-589a2262e2c4",
                    "createdBy": "luca.frosini",
                    "creationTime": "2021-06-30 09:38:27.418 +0000",
                    "lastUpdateBy": "luca.frosini",
                    "lastUpdateTime": "2021-06-30 09:38:27.418 +0000"
                },
                "name": "devsec"
            }
        }
    ]
}
Read via REST API Example 2

Read the Context having UUID aa860961-6eb0-4c1c-89fb-c406fe2a2771 (devNext)

Request URL

GET /resource-registry/contexts/aa860961-6eb0-4c1c-89fb-c406fe2a2771

Response Body

{
    "@class": "Context",
    "header": {
        "@class": "Header",
        "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
        "createdBy": "luca.frosini",
        "creationTime": "2021-06-30 09:38:26.978 +0000",
        "lastUpdateBy": "luca.frosini",
        "lastUpdateTime": "2021-06-30 09:38:26.978 +0000"
    },
    "name": "devNext",
    "parent": {
        "@class": "IsParentOf",
        "header": {
            "@class": "Header",
            "uuid": "c470a070-83e8-45e8-8630-440225702acc",
            "createdBy": "luca.frosini",
            "creationTime": "2021-06-30 09:38:26.967 +0000",
            "lastUpdateBy": "luca.frosini",
            "lastUpdateTime": "2021-06-30 09:38:26.967 +0000"
        },
        "source": {
            "@class": "Context",
            "header": {
                "@class": "Header",
                "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
                "createdBy": "luca.frosini",
                "creationTime": "2021-06-30 09:38:26.464 +0000",
                "lastUpdateBy": "luca.frosini",
                "lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
            },
            "name": "gcube"
        }
    },
    "children": [
        {
            "@class": "IsParentOf",
            "header": {
                "@class": "Header",
                "uuid": "74d435c1-29ce-49f4-b3b9-cbca42c2b046",
                "createdBy": "luca.frosini",
                "creationTime": "2021-06-30 09:38:27.835 +0000",
                "lastUpdateBy": "luca.frosini",
                "lastUpdateTime": "2021-06-30 09:38:27.835 +0000"
            },
            "target": {
                "@class": "Context",
                "header": {
                    "@class": "Header",
                    "uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
                    "createdBy": "luca.frosini",
                    "creationTime": "2021-06-30 09:38:27.846 +0000",
                    "lastUpdateBy": "luca.frosini",
                    "lastUpdateTime": "2021-06-30 09:38:27.846 +0000"
                },
                "name": "NextNext"
            }
        }
    ]
}

Update Context

Update a Context identified by the UUID provided as the path parameter.

The possible updates are on:

  • name;
  • parent Context.


Update via Java Client

ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 
Context contextToBeUpdated = ....;
 
Context updatedContext = resourceRegistryContextClient.update(contextToBeUpdated);

Update via REST API

PUT /resource-registry/contexts/{UUID}
Code Type Description
200 String The JSON representation of the updated Context

Rename Context

Rename via Java Client

Rename a Context aa860961-6eb0-4c1c-89fb-c406fe2a2771 (was devNext) to the new name newDevNext.

ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
Context devNextContext = resourceRegistryContextClient.read("aa860961-6eb0-4c1c-89fb-c406fe2a2771");
devNextContext.setName("newDevNext");
Context newDevNext = resourceRegistryContextClient.update(devNextContext);
Rename via REST API

Rename a Context aa860961-6eb0-4c1c-89fb-c406fe2a2771 (was devNext) to the new name newDevNext.

Request URL

PUT /resource-registry/contexts/aa860961-6eb0-4c1c-89fb-c406fe2a2771

Request Body

{
    "@class": "Context",
    "header": {
        "@class": "Header",
        "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771"
    },
    "name": "newDevNext",
    "parent": {
        "@class": "IsParentOf",
        "header": {
            "@class": "Header",
            "uuid": "c470a070-83e8-45e8-8630-440225702acc"
        },
        "source": {
            "@class": "Context",
            "header": {
                "@class": "Header",
                "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2"
            },
            "name": "gcube"
        }
    }
}

Response Body

{
    "name": "newDevNext",
    "header": {
        "@class": "Header",
        "creationTime": "2021-06-30 11:38:26.978 +0200",
        "createdBy": "luca.frosini",
        "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
        "lastUpdateBy": "luca.frosini",
        "lastUpdateTime": "2021-07-01 16:44:46.592 +0200"
    },
    "@class": "Context",
    "parent": {
        "header": {
            "@class": "Header",
            "creationTime": "2021-07-01 16:43:57.358 +0200",
            "createdBy": "luca.frosini",
            "uuid": "c470a070-83e8-45e8-8630-440225702acc",
            "lastUpdateBy": "luca.frosini",
            "lastUpdateTime": "2021-07-01 16:43:57.358 +0200"
        },
        "@class": "IsParentOf",
        "source": {
            "name": "gcube",
            "header": {
                "@class": "Header",
                "creationTime": "2021-06-30 11:38:26.464 +0200",
                "createdBy": "luca.frosini",
                "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
                "lastUpdateBy": "luca.frosini",
                "lastUpdateTime": "2021-06-30 11:38:26.464 +0200"
            },
            "@class": "Context"
        }
    },
    "children": [
        {
            "header": {
                "@class": "Header",
                "creationTime": "2021-06-30 11:38:27.835 +0200",
                "createdBy": "luca.frosini",
                "uuid": "74d435c1-29ce-49f4-b3b9-cbca42c2b046",
                "lastUpdateBy": "luca.frosini",
                "lastUpdateTime": "2021-06-30 11:38:27.835 +0200"
            },
            "@class": "IsParentOf",
            "target": {
                "name": "NextNext",
                "header": {
                    "@class": "Header",
                    "creationTime": "2021-06-30 11:38:27.846 +0200",
                    "createdBy": "luca.frosini",
                    "uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
                    "lastUpdateBy": "luca.frosini",
                    "lastUpdateTime": "2021-06-30 11:38:27.846 +0200"
                },
                "@class": "Context"
            }
        }
    ]
}

Move Context

We have 5 Contexts organized in the following Context Tree:

-  ca50eb95-b76c-44fd-9182-229d39c3c9e2 (gcube)
|
|---- d0544ff9-8f61-416f-b685-589a2262e2c4 (devsec)
|   |
|   |---- 4c0c3500-32d6-11ea-867c-af3c989f8e41 (devVRE)
|
|---- aa860961-6eb0-4c1c-89fb-c406fe2a2771 (devNext)
    |
    |---- bad5f350-345c-11e9-9f49-cef9b1608c3f (NextNext)

We want to move Context bad5f350-345c-11e9-9f49-cef9b1608c3f (NextNext) as child of the Context ca50eb95-b76c-44fd-9182-229d39c3c9e2 (gcube) in palce of aa860961-6eb0-4c1c-89fb-c406fe2a2771 (devNext) In other words, NextNext will be a VO in place of a VRE.

We will obtain the following Context tree

-  ca50eb95-b76c-44fd-9182-229d39c3c9e2 (gcube)
|
|---- d0544ff9-8f61-416f-b685-589a2262e2c4 (devsec)
|   |
|   |---- 4c0c3500-32d6-11ea-867c-af3c989f8e41 (devVRE)
|
|---- aa860961-6eb0-4c1c-89fb-c406fe2a2771 (devNext)
|
|---- bad5f350-345c-11e9-9f49-cef9b1608c3f (NextNext)


Move with Java client
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
Context gcubeContext = resourceRegistryContextClient.read("ca50eb95-b76c-44fd-9182-229d39c3c9e2");
Context nextNextContext = resourceRegistryContextClient.read("bad5f350-345c-11e9-9f49-cef9b1608c3f");
nextNextContext.setParent(gcubeContext);
nextNextContext = resourceRegistryContextClient.update(nextNextContext);


Move via REST API

If we read the Context bad5f350-345c-11e9-9f49-cef9b1608c3f' (NextNext) before moving it we have:

{
    "@class": "Context",
    "header": {
        "@class": "Header",
        "uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
        "createdBy": "luca.frosini",
        "creationTime": "2021-06-30 09:38:27.846 +0000",
        "lastUpdateBy": "luca.frosini",
        "lastUpdateTime": "2021-06-30 09:38:27.846 +0000"
    },
    "name": "NextNext",
    "parent": {
        "@class": "IsParentOf",
        "header": {
            "@class": "Header",
            "uuid": "74d435c1-29ce-49f4-b3b9-cbca42c2b046",
            "createdBy": "luca.frosini",
            "creationTime": "2021-06-30 09:38:27.835 +0000",
            "lastUpdateBy": "luca.frosini",
            "lastUpdateTime": "2021-06-30 09:38:27.835 +0000"
        },
        "source": {
            "@class": "Context",
            "header": {
                "@class": "Header",
                "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
                "createdBy": "luca.frosini",
                "creationTime": "2021-06-30 09:38:26.978 +0000",
                "lastUpdateBy": "luca.frosini",
                "lastUpdateTime": "2021-07-01 14:44:46.592 +0000"
            },
            "name": "devNext"
        }
    },
    "children": []
}

Request URL

PUT /resource-registry/contexts/bad5f350-345c-11e9-9f49-cef9b1608c3f

Request Body

{
    "@class": "Context",
    "header": {
        "@class": "Header",
        "uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
    },
    "name": "NextNext",
    "parent": {
        "header": {
            "@class": "Header",
            "uuid": "c470a070-83e8-45e8-8630-440225702acc"
        },
        "@class": "IsParentOf"
        "source": {
            "name": "gcube",
            "header": {
                "@class": "Header",
                "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2"
            },
            "@class": "Context"
        }
    },
    "children": []
}

Response Body

{
    "name": "NextNext",
    "header": {
        "@class": "Header",
        "creationTime": "2021-06-30 11:38:27.846 +0200",
        "createdBy": "luca.frosini",
        "uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
        "lastUpdateBy": "luca.frosini",
        "lastUpdateTime": "2021-07-01 16:51:34.143 +0200"
    },
    "@class": "Context"
    "parent": {
        "header": {
            "@class": "Header",
            "creationTime": "2021-07-01 16:51:34.131 +0200",
            "createdBy": "luca.frosini",
            "uuid": "c470a070-83e8-45e8-8630-440225702acc",
            "lastUpdateBy": "luca.frosini",
            "lastUpdateTime": "2021-07-01 16:51:34.131 +0200"
        },
        "@class": "IsParentOf"
        "source": {
            "name": "gcube",
            "header": {
                "@class": "Header",
                "creationTime": "2021-06-30 11:38:26.464 +0200",
                "createdBy": "luca.frosini",
                "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
                "lastUpdateBy": "luca.frosini",
                "lastUpdateTime": "2021-06-30 11:38:26.464 +0200"
            },
            "@class": "Context"
        }
    }
}

Delete Context

Delete the Context identified by the UUID provided as the path parameter.

The resource registry performs the following checks before deleting a context:

  • the context MUST have no children: this implies that you can't delete the testVO context if you don't have deleted (or moved to another parent) the context testVRE;
  • the context MUST NOT have associated entities and relation instances: this implies that the client must remove in advance the available instances from the context.

Delete via Java Client

Delete using UUID. This normally used when we already have the UUID instance.

ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
resourceRegistryContextClient.delete("bad5f350-345c-11e9-9f49-cef9b1608c3f");

Delete using context instance. This normally used when we already have the context instance.

ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
Context nextNextContext = resourceRegistryContextClient.read("bad5f350-345c-11e9-9f49-cef9b1608c3f");
resourceRegistryContextClient.delete(nextNextContext);

Delete via REST API

DELETE /resource-registry/contexts/{{UUID}}
Code Type Description
204 - No Content N/A N/A


Request URL

For example to delete the Context having UUID bad5f350-345c-11e9-9f49-cef9b1608c3f (NextNext) we just need to perform the following HTTP request

DELETE /resource-registry/contexts/bad5f350-345c-11e9-9f49-cef9b1608c3f