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

From Gcube Wiki
Jump to: navigation, search
(Move Context)
(Resource Registry Context Client)
 
(148 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.
 
  
== Java Client ==
+
Context Management exposes the following APIs:
  
To use the Java library to interact with Context Collection declare the following dependency in your pom.xml file.
+
* '''[[#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;
<dependency>
+
* '''[[#Exists|Exists]]''': allows to check if a Context exists;
<groupId>org.gcube.information-system</groupId>
+
* '''[[#Read Context|Read]]''': allows to read a Context;
<artifactId>resource-registry-context-client</artifactId>
+
* '''[[#Update Context|Update]]''':
<version>[4.0.0,5.0.0-SNAPSHOT)</version>
+
** '''[[#Rename Context|Rename]]''': rename a context;
<dependency>
+
** '''[[#Move Context|Move]]''': move a context as a child of another Context.
 +
* '''[[#Delete Context|Delete]]''': allows to delete a Context.
  
 
== Context Collection ==
 
== Context Collection ==
 +
 +
The following table shows the exposed APIs as REST Collection
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 52: Line 50:
 
|-
 
|-
 
| Create || PUT || <code>/contexts/{UUID}</code>
 
| Create || PUT || <code>/contexts/{UUID}</code>
 +
|-
 +
| Exists || HEAD || <code>/contexts/{UUID}</code>
 
|-
 
|-
 
| Read || GET || <code>/contexts/{UUID}</code>
 
| Read || GET || <code>/contexts/{UUID}</code>
Line 60: Line 60:
 
|}
 
|}
  
 +
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]].
  
 +
== Resource Registry Context Client ==
  
=== List ===
+
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>GET /resource-registry/contexts</pre>
+
To use the Java library to interact with Context Collection declare the following dependency in your pom.xml file.
 +
 
 +
<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>
 +
 
 +
 
 +
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;
 +
 
 +
....
 +
 
 +
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 +
</source>
 +
 
 +
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 https://code-repo.d4science.org/gCubeSystem/resource-registry-context-client]
 +
 
 +
== APIs ==
 +
 
 +
The provided examples are based on the following Context tree
 +
 
 +
<pre>
 +
-  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)
 +
</pre>
  
==== Description ====
+
=== List Contexts ===
  
 
List all available contexts.
 
List all available contexts.
  
  
=== Create ===
+
==== List via Java client ====
 +
 
 +
<source lang="java">
 +
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 +
List<Context> contexts = resourceRegistryContextClient.all();
 +
</source>
 +
 
 +
 
 +
==== List via REST API ====
 +
 
 +
<pre>GET /resource-registry/contexts</pre>
 +
 
 +
 
 +
{|class="wikitable"
 +
! Code
 +
! Type
 +
! Description
 +
|-
 +
| 200
 +
| String
 +
| A JSON array containing as an element the representation of each Context
 +
|}
 +
 
 +
'''Request URL'''
 +
 
 +
<pre>GET /resource-registry/contexts</pre>
 +
 
 +
'''Response Body'''
 +
 
 +
<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>
 +
 
 +
=== 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.
 +
 
 +
<source lang="java">
 +
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);
 +
</source>
 +
 
 +
===== 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).
 +
 
 +
<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>
 
<pre>PUT /resource-registry/contexts/{{UUID}}</pre>
  
==== Description ====
+
{|class="wikitable"
 +
! Code
 +
! Type
 +
! Description
 +
|-
 +
| 200
 +
| String
 +
| The JSON representation of the newly created Context
 +
|}
  
Create new Context as child of another Context (if any).
 
  
==== Example 1 ====
+
===== Create via REST API Example 1 =====
  
Create a new Context with name '''testROOT''' with no parent. It is a ROOT Context.
+
Create a new Context with name '''gcube''' with no parent. It is a ROOT Context.
  
 
'''Request URL'''
 
'''Request URL'''
  
<pre>PUT /resource-registry/context/007f9154-25fa-4f52-9cd4-ec1f8c3c3baf</pre>
+
<pre>PUT /resource-registry/context/ca50eb95-b76c-44fd-9182-229d39c3c9e2</pre>
  
'''Body'''
+
'''Request Body'''
  
 
<source lang="javascript">
 
<source lang="javascript">
 
{
 
{
 
"@class": "Context",
 
"@class": "Context",
"name": "testRoot",
+
"name": "gcube",
 
"header": {
 
"header": {
 
"@class": "Header",
 
"@class": "Header",
"uuid": "007f9154-25fa-4f52-9cd4-ec1f8c3c3baf"
+
"uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2"
 
}
 
}
 
}
 
}
Line 105: Line 480:
 
<source lang="javascript">
 
<source lang="javascript">
 
{
 
{
     "name": "testRoot",
+
     "@class": "Context",
 
     "header": {
 
     "header": {
 
         "@class": "Header",
 
         "@class": "Header",
         "creator": "luca.frosini",
+
         "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
         "creationTime": "2020-10-30 13:49:21.457 +0100",
+
        "createdBy": "luca.frosini",
         "modifiedBy": "luca.frosini",
+
         "creationTime": "2021-06-30 09:38:26.464 +0000",
        "uuid": "007f9154-25fa-4f52-9cd4-ec1f8c3c3baf",
+
         "lastUpdateBy": "luca.frosini",
         "lastUpdateTime": "2020-10-30 13:49:21.457 +0100"
+
         "lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
 
     },
 
     },
     "@class": "Context",
+
     "name": "gcube",
     "@superClasses": [
+
     "parent": null,
        "EntityElement"
+
    "children": []
    ]
+
 
}
 
}
 
</source>
 
</source>
  
==== Example 2 ====
+
===== Create via REST API Example 2 =====
Create a new Context with name '''testVO''' as child of Context with UUID '''007f9154-25fa-4f52-9cd4-ec1f8c3c3baf''' (testROOT).
+
  
'''Request URL'''
+
Create a new Context with name '''devNext''' as child of Context with UUID '''c470a070-83e8-45e8-8630-440225702acc''' (gcube).
  
<pre>PUT /resource-registry/contexts/30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb</pre>
+
'''Request URL'''
  
 +
<pre>PUT /resource-registry/contexts/aa860961-6eb0-4c1c-89fb-c406fe2a2771</pre>
  
'''Body'''
+
'''Request Body'''
  
 
<source lang="javascript">
 
<source lang="javascript">
Line 136: Line 510:
 
     "header": {
 
     "header": {
 
         "@class": "Header",
 
         "@class": "Header",
         "uuid": "30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb"
+
         "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771"
 
     },
 
     },
     "name": "testVO",
+
     "name": "devNext",
 
     "parent": {
 
     "parent": {
 
         "@class": "IsParentOf",
 
         "@class": "IsParentOf",
 +
        "header": null,
 
         "source": {
 
         "source": {
 
             "@class": "Context",
 
             "@class": "Context",
 
             "header": {
 
             "header": {
 
                 "@class": "Header",
 
                 "@class": "Header",
                 "uuid": "007f9154-25fa-4f52-9cd4-ec1f8c3c3baf"
+
                 "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2"
 
             }
 
             }
 
         }
 
         }
Line 151: Line 526:
 
}
 
}
 
</source>
 
</source>
 
 
  
 
'''Response Body'''
 
'''Response Body'''
Line 158: Line 531:
 
<source lang="javascript">
 
<source lang="javascript">
 
{
 
{
     "name": "testVO",
+
     "@class": "Context",
 
     "header": {
 
     "header": {
 
         "@class": "Header",
 
         "@class": "Header",
         "creator": "luca.frosini",
+
         "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
         "creationTime": "2020-10-30 13:49:25.499 +0100",
+
        "createdBy": "luca.frosini",
         "modifiedBy": "luca.frosini",
+
         "creationTime": "2021-06-30 09:38:26.978 +0000",
        "uuid": "30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb",
+
         "lastUpdateBy": "luca.frosini",
         "lastUpdateTime": "2020-10-30 13:49:25.499 +0100"
+
         "lastUpdateTime": "2021-06-30 09:38:26.978 +0000"
 
     },
 
     },
     "@class": "Context",
+
     "name": "devNext",
    "@superClasses": [
+
        "EntityElement"
+
    ],
+
 
     "parent": {
 
     "parent": {
 +
        "@class": "IsParentOf",
 
         "header": {
 
         "header": {
 
             "@class": "Header",
 
             "@class": "Header",
             "creator": "luca.frosini",
+
             "uuid": "c470a070-83e8-45e8-8630-440225702acc",
             "creationTime": "2020-10-30 13:49:25.492 +0100",
+
            "createdBy": "luca.frosini",
             "modifiedBy": "luca.frosini",
+
             "creationTime": "2021-06-30 09:38:26.967 +0000",
            "uuid": "4e27d18e-1567-44bf-8dc2-c441230d5458",
+
             "lastUpdateBy": "luca.frosini",
             "lastUpdateTime": "2020-10-30 13:49:25.492 +0100"
+
             "lastUpdateTime": "2021-06-30 09:38:26.967 +0000"
 
         },
 
         },
        "@class": "IsParentOf",
 
        "@superClasses": [
 
            "RelationElement"
 
        ],
 
 
         "source": {
 
         "source": {
             "name": "testRoot",
+
             "@class": "Context",
 
             "header": {
 
             "header": {
 
                 "@class": "Header",
 
                 "@class": "Header",
                 "creator": "luca.frosini",
+
                 "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
                 "creationTime": "2020-10-30 13:49:21.457 +0100",
+
                "createdBy": "luca.frosini",
                 "modifiedBy": "luca.frosini",
+
                 "creationTime": "2021-06-30 09:38:26.464 +0000",
                "uuid": "007f9154-25fa-4f52-9cd4-ec1f8c3c3baf",
+
                 "lastUpdateBy": "luca.frosini",
                 "lastUpdateTime": "2020-10-30 13:49:21.457 +0100"
+
                 "lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
 
             },
 
             },
             "@class": "Context",
+
             "name": "gcube"
            "@superClasses": [
+
                "EntityElement"
+
            ]
+
 
         }
 
         }
     }
+
     },
 +
    "children": []
 
}
 
}
 
</source>
 
</source>
  
==== Create With Java Client ====
+
=== Read Context ===
  
This Java code snippet shows how to create contexts used in examples 1 and 2.
+
Return the definition of the Context identified by the UUID provided as the path parameter.
  
 +
==== Read via Java Client ====
  
<source lang="java">
 
  
 +
===== Read via Java Client Example 1 =====
 +
 +
 +
Read the Context having UUID '''ca50eb95-b76c-44fd-9182-229d39c3c9e2''' (gcube)
 +
 +
Read using a string representing the UUID.
 +
 +
<source lang="java">
 
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 +
Context gcubeContext = resourceRegistryContextClient.read("ca50eb95-b76c-44fd-9182-229d39c3c9e2");
 +
</source>
  
Context testROOTContext = new ContextImpl("testROOT");
+
===== Read via Java Client Example 2 =====
// Java class generate a random UUID and use to interact with Resource Regsitry Service
+
// To specify the UUID
+
// UUID testROOTUUID = UUID.fromString("007f9154-25fa-4f52-9cd4-ec1f8c3c3baf");
+
// Context testROOTContext = new ContextImpl("testROOT", testROOTUUID);
+
testROOTContext = resourceRegistryContextClient.create(testROOTContext);
+
  
 +
Read the Context having UUID '''aa860961-6eb0-4c1c-89fb-c406fe2a2771''' (devNext)
  
Context testVOContext = new ContextImpl("testVO");
+
Read using UUID. This normally used when we already have the UUID instance.
// To specify the UUID  
+
// UUID testVOUUID = UUID.fromString("30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb");
+
// Context testVOContext = new ContextImpl("testVO", testVOTUUID);
+
testVOContext.setParent(testROOTContext);
+
testVOContext = resourceRegistryContextClient.create(testVOContext);
+
  
 +
<source lang="java">
 +
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 +
UUID devNextUUID = UUID.fromString("aa860961-6eb0-4c1c-89fb-c406fe2a2771");
 +
Context devNextContext = resourceRegistryContextClient.read(devNextUUID);
 
</source>
 
</source>
  
=== Read ===
+
 
 +
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>
 
<pre>GET /resource-registry/context/{UUID}</pre>
  
==== Description ====
+
{|class="wikitable"
 +
! Code
 +
! Type
 +
! Description
 +
|-
 +
| 200
 +
| String
 +
| The JSON representation of the requested Context
 +
|}
  
Return the definition of the Context identified by the UUID provided as the path parameter.
 
  
==== Example 1====
+
===== Read via REST API Example 1 =====
  
Read the Context having UUID '''007f9154-25fa-4f52-9cd4-ec1f8c3c3baf'''
+
Read the Context having UUID '''ca50eb95-b76c-44fd-9182-229d39c3c9e2''' (gcube)
  
 
'''Request URL'''
 
'''Request URL'''
  
<pre>GET /resource-registry/contexts/007f9154-25fa-4f52-9cd4-ec1f8c3c3baf</pre>
+
<pre>GET /resource-registry/contexts/ca50eb95-b76c-44fd-9182-229d39c3c9e2</pre>
  
 
'''Response Body'''
 
'''Response Body'''
Line 249: Line 637:
 
<source lang="javascript">
 
<source lang="javascript">
 
{
 
{
     "name": "testRoot",
+
     "@class": "Context",
 
     "header": {
 
     "header": {
 
         "@class": "Header",
 
         "@class": "Header",
         "creator": "luca.frosini",
+
         "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
         "creationTime": "2020-10-30 13:49:21.457 +0100",
+
        "createdBy": "luca.frosini",
         "modifiedBy": "luca.frosini",
+
         "creationTime": "2021-06-30 09:38:26.464 +0000",
        "uuid": "007f9154-25fa-4f52-9cd4-ec1f8c3c3baf",
+
         "lastUpdateBy": "luca.frosini",
         "lastUpdateTime": "2020-10-30 13:49:21.457 +0100"
+
         "lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
 
     },
 
     },
     "@class": "Context",
+
     "name": "gcube",
     "@superClasses": [
+
     "parent": null,
        "EntityElement"
+
    ],
+
 
     "children": [
 
     "children": [
 
         {
 
         {
 +
            "@class": "IsParentOf",
 
             "header": {
 
             "header": {
 
                 "@class": "Header",
 
                 "@class": "Header",
                 "creator": "luca.frosini",
+
                 "uuid": "c470a070-83e8-45e8-8630-440225702acc",
                 "creationTime": "2020-10-30 13:49:25.492 +0100",
+
                "createdBy": "luca.frosini",
                 "modifiedBy": "luca.frosini",
+
                 "creationTime": "2021-06-30 09:38:26.967 +0000",
                "uuid": "4e27d18e-1567-44bf-8dc2-c441230d5458",
+
                 "lastUpdateBy": "luca.frosini",
                 "lastUpdateTime": "2020-10-30 13:49:25.492 +0100"
+
                 "lastUpdateTime": "2021-06-30 09:38:26.967 +0000"
 
             },
 
             },
            "@class": "IsParentOf",
 
            "@superClasses": [
 
                "RelationElement"
 
            ],
 
 
             "target": {
 
             "target": {
                 "name": "testVO",
+
                 "@class": "Context",
 
                 "header": {
 
                 "header": {
 
                     "@class": "Header",
 
                     "@class": "Header",
                     "creator": "luca.frosini",
+
                     "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
                     "creationTime": "2020-10-30 13:49:25.499 +0100",
+
                    "createdBy": "luca.frosini",
                     "modifiedBy": "luca.frosini",
+
                     "creationTime": "2021-06-30 09:38:26.978 +0000",
                    "uuid": "30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb",
+
                     "lastUpdateBy": "luca.frosini",
                     "lastUpdateTime": "2020-10-30 13:49:25.499 +0100"
+
                     "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",
 
                 "@class": "Context",
                 "@superClasses": [
+
                 "header": {
                     "EntityElement"
+
                    "@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"
 
             }
 
             }
 
         }
 
         }
Line 296: Line 699:
 
</source>
 
</source>
  
==== Example 2 ====
+
===== Read via REST API Example 2 =====
  
Read the Context having UUID '''30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb'''
+
Read the Context having UUID '''aa860961-6eb0-4c1c-89fb-c406fe2a2771''' (devNext)
  
 
'''Request URL'''
 
'''Request URL'''
  
<pre>GET /resource-registry/contexts/30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb</pre>
+
<pre>GET /resource-registry/contexts/aa860961-6eb0-4c1c-89fb-c406fe2a2771</pre>
  
 
'''Response Body'''
 
'''Response Body'''
Line 308: Line 711:
 
<source lang="javascript">
 
<source lang="javascript">
 
{
 
{
     "name": "testVO",
+
     "@class": "Context",
 
     "header": {
 
     "header": {
 
         "@class": "Header",
 
         "@class": "Header",
         "creator": "luca.frosini",
+
         "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
         "creationTime": "2020-10-30 13:49:25.499 +0100",
+
        "createdBy": "luca.frosini",
         "modifiedBy": "luca.frosini",
+
         "creationTime": "2021-06-30 09:38:26.978 +0000",
        "uuid": "30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb",
+
         "lastUpdateBy": "luca.frosini",
         "lastUpdateTime": "2020-10-30 13:49:25.499 +0100"
+
         "lastUpdateTime": "2021-06-30 09:38:26.978 +0000"
 
     },
 
     },
     "@class": "Context",
+
     "name": "devNext",
    "@superClasses": [
+
        "EntityElement"
+
    ],
+
 
     "parent": {
 
     "parent": {
 +
        "@class": "IsParentOf",
 
         "header": {
 
         "header": {
 
             "@class": "Header",
 
             "@class": "Header",
             "creator": "luca.frosini",
+
             "uuid": "c470a070-83e8-45e8-8630-440225702acc",
             "creationTime": "2020-10-30 13:49:25.492 +0100",
+
            "createdBy": "luca.frosini",
             "modifiedBy": "luca.frosini",
+
             "creationTime": "2021-06-30 09:38:26.967 +0000",
            "uuid": "4e27d18e-1567-44bf-8dc2-c441230d5458",
+
             "lastUpdateBy": "luca.frosini",
             "lastUpdateTime": "2020-10-30 13:49:25.492 +0100"
+
             "lastUpdateTime": "2021-06-30 09:38:26.967 +0000"
 
         },
 
         },
        "@class": "IsParentOf",
 
        "@superClasses": [
 
            "RelationElement"
 
        ],
 
 
         "source": {
 
         "source": {
             "name": "testRoot",
+
             "@class": "Context",
 
             "header": {
 
             "header": {
 
                 "@class": "Header",
 
                 "@class": "Header",
                 "creator": "luca.frosini",
+
                 "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
                 "creationTime": "2020-10-30 13:49:21.457 +0100",
+
                "createdBy": "luca.frosini",
                 "modifiedBy": "luca.frosini",
+
                 "creationTime": "2021-06-30 09:38:26.464 +0000",
                "uuid": "007f9154-25fa-4f52-9cd4-ec1f8c3c3baf",
+
                 "lastUpdateBy": "luca.frosini",
                 "lastUpdateTime": "2020-10-30 13:49:21.457 +0100"
+
                 "lastUpdateTime": "2021-06-30 09:38:26.464 +0000"
 
             },
 
             },
             "@class": "Context",
+
             "name": "gcube"
            "@superClasses": [
+
                "EntityElement"
+
            ]
+
 
         }
 
         }
     }
+
     },
 +
    "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>
 
</source>
  
 +
=== Update Context ===
  
 +
Update a Context identified by the UUID provided as the path parameter.
  
==== Read With Java Client ====
+
The possible updates are on:
 +
* name;
 +
* parent Context.
  
Read using a string representing the UUID.
 
  
<source lang="java">
+
==== Update via Java Client ====
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
+
Context testVOContext = resourceRegistryContextClient.read("30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb");
+
</source>
+
 
+
 
+
Read using UUID. This normally used when we already have the UUID instance.
+
  
 
<source lang="java">
 
<source lang="java">
 
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
UUID testVOUUID = UUID.fromString("30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb");
 
Context testVOContext = resourceRegistryContextClient.read(testVOUUID);
 
</source>
 
  
 +
Context contextToBeUpdated = ....;
  
Read using context instace. This normally used when we already have the context instance.
+
Context updatedContext = resourceRegistryContextClient.update(contextToBeUpdated);
 
+
<source lang="java">
+
UUID testVOUUID = UUID.fromString("30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb");
+
Context testVOContext = new ContextImpl("testVO", testVOTUUID);
+
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
+
Context testVOContext = resourceRegistryContextClient.read(testVOContext);
+
 
</source>
 
</source>
  
=== Update ===
+
==== Update via REST API ====
  
 
<pre>PUT /resource-registry/contexts/{UUID}</pre>
 
<pre>PUT /resource-registry/contexts/{UUID}</pre>
  
==== Description ====
+
{|class="wikitable"
 +
! Code
 +
! Type
 +
! Description
 +
|-
 +
| 200
 +
| String
 +
| The JSON representation of the updated Context
 +
|}
  
Update a Context identified by the UUID provided as the path parameter.
+
==== Rename Context ====
  
The possible updates are on:
+
===== Rename via Java Client =====
* name;
+
* parent Context.
+
  
==== Rename Context ====
+
Rename a Context '''aa860961-6eb0-4c1c-89fb-c406fe2a2771''' (was '''devNext''') to the new name '''newDevNext'''.
  
Rename a Context '''007f9154-25fa-4f52-9cd4-ec1f8c3c3baf''' (was '''testVO''') to the new name '''devVO'''.
+
<source lang="java">
 +
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 +
Context devNextContext = resourceRegistryContextClient.read("aa860961-6eb0-4c1c-89fb-c406fe2a2771");
 +
devNextContext.setName("newDevNext");
 +
Context newDevNext = resourceRegistryContextClient.update(devNextContext);
 +
</source>
  
''Request URL''
+
===== Rename via REST API =====
  
<pre>PUT /resource-registry/contexts/007f9154-25fa-4f52-9cd4-ec1f8c3c3baf</pre>
+
Rename a Context '''aa860961-6eb0-4c1c-89fb-c406fe2a2771''' (was '''devNext''') to the new name '''newDevNext'''.
  
''Body''
+
'''Request URL'''
 +
 
 +
<pre>PUT /resource-registry/contexts/aa860961-6eb0-4c1c-89fb-c406fe2a2771</pre>
 +
 
 +
'''Request Body'''
  
 
<source lang="javascript">
 
<source lang="javascript">
Line 410: Line 833:
 
     "header": {
 
     "header": {
 
         "@class": "Header",
 
         "@class": "Header",
         "uuid": "30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb"
+
         "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771"
 
     },
 
     },
     "name": "devVO",
+
     "name": "newDevNext",
 
     "parent": {
 
     "parent": {
 
         "@class": "IsParentOf",
 
         "@class": "IsParentOf",
 +
        "header": {
 +
            "@class": "Header",
 +
            "uuid": "c470a070-83e8-45e8-8630-440225702acc"
 +
        },
 
         "source": {
 
         "source": {
 
             "@class": "Context",
 
             "@class": "Context",
 
             "header": {
 
             "header": {
 
                 "@class": "Header",
 
                 "@class": "Header",
                 "uuid": "007f9154-25fa-4f52-9cd4-ec1f8c3c3baf"
+
                 "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2"
 
             },
 
             },
             "name": "test"
+
             "name": "gcube"
 
         }
 
         }
 
     }
 
     }
Line 427: Line 854:
 
</source>
 
</source>
  
''Response Body''
+
'''Response Body'''
  
 
<source lang="javascript">
 
<source lang="javascript">
 
{
 
{
     "name": "devVO",
+
     "name": "newDevNext",
 
     "header": {
 
     "header": {
 
         "@class": "Header",
 
         "@class": "Header",
        "creator": "luca.frosini",
+
         "creationTime": "2021-06-30 11:38:26.978 +0200",
         "creationTime": "2020-10-30 13:49:25.499 +0100",
+
         "createdBy": "luca.frosini",
         "modifiedBy": "luca.frosini",
+
         "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
         "uuid": "30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb",
+
        "lastUpdateBy": "luca.frosini",
         "lastUpdateTime": "2020-10-30 14:07:04.120 +0100"
+
         "lastUpdateTime": "2021-07-01 16:44:46.592 +0200"
 
     },
 
     },
 
     "@class": "Context",
 
     "@class": "Context",
    "@superClasses": [
 
        "EntityElement"
 
    ],
 
 
     "parent": {
 
     "parent": {
 
         "header": {
 
         "header": {
 
             "@class": "Header",
 
             "@class": "Header",
            "creator": "luca.frosini",
+
             "creationTime": "2021-07-01 16:43:57.358 +0200",
             "creationTime": "2020-10-30 13:49:25.492 +0100",
+
             "createdBy": "luca.frosini",
             "modifiedBy": "luca.frosini",
+
             "uuid": "c470a070-83e8-45e8-8630-440225702acc",
             "uuid": "4e27d18e-1567-44bf-8dc2-c441230d5458",
+
            "lastUpdateBy": "luca.frosini",
             "lastUpdateTime": "2020-10-30 13:49:25.492 +0100"
+
             "lastUpdateTime": "2021-07-01 16:43:57.358 +0200"
 
         },
 
         },
 
         "@class": "IsParentOf",
 
         "@class": "IsParentOf",
        "@superClasses": [
 
            "RelationElement"
 
        ],
 
 
         "source": {
 
         "source": {
             "name": "testRoot",
+
             "name": "gcube",
 
             "header": {
 
             "header": {
 
                 "@class": "Header",
 
                 "@class": "Header",
                "creator": "luca.frosini",
+
                 "creationTime": "2021-06-30 11:38:26.464 +0200",
                 "creationTime": "2020-10-30 13:49:21.457 +0100",
+
                 "createdBy": "luca.frosini",
                 "modifiedBy": "luca.frosini",
+
                 "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
                 "uuid": "007f9154-25fa-4f52-9cd4-ec1f8c3c3baf",
+
                "lastUpdateBy": "luca.frosini",
                 "lastUpdateTime": "2020-10-30 13:49:21.457 +0100"
+
                 "lastUpdateTime": "2021-06-30 11:38:26.464 +0200"
 
             },
 
             },
             "@class": "Context",
+
             "@class": "Context"
            "@superClasses": [
+
                "EntityElement"
+
            ]
+
 
         }
 
         }
     }
+
     },
 +
    "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"
 +
            }
 +
        }
 +
    ]
 
}
 
}
 
</source>
 
</source>
Line 478: Line 921:
 
==== Move Context ====
 
==== Move Context ====
  
Imagine we have 5 Contexts organized in the following Context Tree:
+
We have 5 Contexts organized in the following Context Tree:
  
 
<pre>
 
<pre>
- 007f9154-25fa-4f52-9cd4-ec1f8c3c3ba (testROOT)
+
- ca50eb95-b76c-44fd-9182-229d39c3c9e2 (gcube)
 
|
 
|
|---- 30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb (testVO)
+
|---- d0544ff9-8f61-416f-b685-589a2262e2c4 (devsec)
 
|  |
 
|  |
|  |---- 55e3f48e-2aaf-4a2d-89c4-05cb43822c4a (testVRE)
+
|  |---- 4c0c3500-32d6-11ea-867c-af3c989f8e41 (devVRE)
 
|
 
|
|--- cbe1855b-97c5-495e-a24d-b04428bb4ef6 (anotherVO)
+
|---- aa860961-6eb0-4c1c-89fb-c406fe2a2771 (devNext)
 +
    |
 +
    |---- bad5f350-345c-11e9-9f49-cef9b1608c3f (NextNext)
 
</pre>
 
</pre>
  
We want to move Context '''55e3f48e-2aaf-4a2d-89c4-05cb43822c4a''' (testVRE) as child of the Context '''cbe1855b-97c5-495e-a24d-b04428bb4ef6''' (anotherVO) in palce of 30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb (testVO)
+
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
 
We will obtain the following Context tree
  
 
<pre>
 
<pre>
- 007f9154-25fa-4f52-9cd4-ec1f8c3c3ba (testROOT)
+
- ca50eb95-b76c-44fd-9182-229d39c3c9e2 (gcube)
 
|
 
|
|---- 30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb (testVO)
+
|---- d0544ff9-8f61-416f-b685-589a2262e2c4 (devsec)
|
+
|--- cbe1855b-97c5-495e-a24d-b04428bb4ef6 (anotherVO)
+
 
|  |
 
|  |
|  |---- 55e3f48e-2aaf-4a2d-89c4-05cb43822c4a (testVRE)
+
|  |---- 4c0c3500-32d6-11ea-867c-af3c989f8e41 (devVRE)
 +
|
 +
|---- aa860961-6eb0-4c1c-89fb-c406fe2a2771 (devNext)
 +
|
 +
|---- bad5f350-345c-11e9-9f49-cef9b1608c3f (NextNext)
 
</pre>
 
</pre>
  
  
If we read the Context ''55e3f48e-2aaf-4a2d-89c4-05cb43822c4a''' (testVRE) before moving it we have:
+
===== Move with Java client =====
 +
 
 +
<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>
 +
 
 +
 
 +
===== Move via REST API =====
 +
 
 +
If we read the Context ''bad5f350-345c-11e9-9f49-cef9b1608c3f''' (NextNext) before moving it we have:
  
 
<source lang="javascript">
 
<source lang="javascript">
 
{
 
{
     "name": "testVRE",
+
     "@class": "Context",
 
     "header": {
 
     "header": {
 
         "@class": "Header",
 
         "@class": "Header",
         "creator": "luca.frosini",
+
         "uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
         "creationTime": "2020-10-30 14:31:13.027 +0100",
+
        "createdBy": "luca.frosini",
         "modifiedBy": "luca.frosini",
+
         "creationTime": "2021-06-30 09:38:27.846 +0000",
        "uuid": "55e3f48e-2aaf-4a2d-89c4-05cb43822c4a",
+
         "lastUpdateBy": "luca.frosini",
         "lastUpdateTime": "2020-10-30 14:31:31.358 +0100"
+
         "lastUpdateTime": "2021-06-30 09:38:27.846 +0000"
 
     },
 
     },
     "@class": "Context",
+
     "name": "NextNext",
    "@superClasses": [
+
        "EntityElement"
+
    ],
+
 
     "parent": {
 
     "parent": {
 +
        "@class": "IsParentOf",
 
         "header": {
 
         "header": {
 
             "@class": "Header",
 
             "@class": "Header",
             "creator": "luca.frosini",
+
             "uuid": "74d435c1-29ce-49f4-b3b9-cbca42c2b046",
             "creationTime": "2020-10-30 14:31:13.016 +0100",
+
            "createdBy": "luca.frosini",
             "modifiedBy": "luca.frosini",
+
             "creationTime": "2021-06-30 09:38:27.835 +0000",
            "uuid": "a1c4ef6d-e443-4dc4-bf56-f657c7b8941a",
+
             "lastUpdateBy": "luca.frosini",
             "lastUpdateTime": "2020-10-30 14:31:13.016 +0100"
+
             "lastUpdateTime": "2021-06-30 09:38:27.835 +0000"
 
         },
 
         },
        "@class": "IsParentOf",
 
        "@superClasses": [
 
            "RelationElement"
 
        ],
 
 
         "source": {
 
         "source": {
             "name": "testVO",
+
             "@class": "Context",
 
             "header": {
 
             "header": {
 
                 "@class": "Header",
 
                 "@class": "Header",
                 "creator": "luca.frosini",
+
                 "uuid": "aa860961-6eb0-4c1c-89fb-c406fe2a2771",
                 "creationTime": "2020-10-30 13:49:25.499 +0100",
+
                "createdBy": "luca.frosini",
                 "modifiedBy": "luca.frosini",
+
                 "creationTime": "2021-06-30 09:38:26.978 +0000",
                "uuid": "30bdb3cc-cf18-4d26-bdb7-0bb8ffb481eb",
+
                 "lastUpdateBy": "luca.frosini",
                 "lastUpdateTime": "2020-10-30 14:26:34.458 +0100"
+
                 "lastUpdateTime": "2021-07-01 14:44:46.592 +0000"
 
             },
 
             },
             "@class": "Context",
+
             "name": "devNext"
            "@superClasses": [
+
                "EntityElement"
+
            ]
+
 
         }
 
         }
     }
+
     },
 +
    "children": []
 
}
 
}
 
</source>
 
</source>
  
''Request URL''
+
'''Request URL'''
  
<pre>PUT /resource-registry/contexts/55e3f48e-2aaf-4a2d-89c4-05cb43822c4a</pre>
+
<pre>PUT /resource-registry/contexts/bad5f350-345c-11e9-9f49-cef9b1608c3f</pre>
  
''Body''
+
'''Request Body'''
  
 
<source lang="javascript">
 
<source lang="javascript">
Line 565: Line 1,018:
 
     "header": {
 
     "header": {
 
         "@class": "Header",
 
         "@class": "Header",
         "uuid": "55e3f48e-2aaf-4a2d-89c4-05cb43822c4a"
+
         "uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
 
     },
 
     },
     "name": "testVRE",
+
     "name": "NextNext",
 
     "parent": {
 
     "parent": {
         "@class": "IsParentOf",
+
         "header": {
 +
            "@class": "Header",
 +
            "uuid": "c470a070-83e8-45e8-8630-440225702acc"
 +
        },
 +
        "@class": "IsParentOf"
 
         "source": {
 
         "source": {
             "@class": "Context",
+
             "name": "gcube",
 
             "header": {
 
             "header": {
 
                 "@class": "Header",
 
                 "@class": "Header",
                 "uuid": "cbe1855b-97c5-495e-a24d-b04428bb4ef6"
+
                 "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2"
             }
+
             },
 +
            "@class": "Context"
 
         }
 
         }
     }
+
     },
 +
    "children": []
 
}
 
}
 
</source>
 
</source>
  
''Response Body''
+
'''Response Body'''
  
 
<source lang="javascript">
 
<source lang="javascript">
 
{
 
{
     "name": "testVRE",
+
     "name": "NextNext",
 
     "header": {
 
     "header": {
 
         "@class": "Header",
 
         "@class": "Header",
        "creator": "luca.frosini",
+
         "creationTime": "2021-06-30 11:38:27.846 +0200",
         "creationTime": "2020-10-30 14:31:13.027 +0100",
+
         "createdBy": "luca.frosini",
         "modifiedBy": "luca.frosini",
+
         "uuid": "bad5f350-345c-11e9-9f49-cef9b1608c3f",
         "uuid": "55e3f48e-2aaf-4a2d-89c4-05cb43822c4a",
+
        "lastUpdateBy": "luca.frosini",
         "lastUpdateTime": "2020-10-30 14:37:50.669 +0100"
+
         "lastUpdateTime": "2021-07-01 16:51:34.143 +0200"
 
     },
 
     },
     "@class": "Context",
+
     "@class": "Context"
    "@superClasses": [
+
        "EntityElement"
+
    ],
+
 
     "parent": {
 
     "parent": {
 
         "header": {
 
         "header": {
 
             "@class": "Header",
 
             "@class": "Header",
            "creator": "luca.frosini",
+
             "creationTime": "2021-07-01 16:51:34.131 +0200",
             "creationTime": "2020-10-30 14:37:50.662 +0100",
+
             "createdBy": "luca.frosini",
             "modifiedBy": "luca.frosini",
+
             "uuid": "c470a070-83e8-45e8-8630-440225702acc",
             "uuid": "ac685ea9-8112-4418-a5a0-5fc9d7126f97",
+
            "lastUpdateBy": "luca.frosini",
             "lastUpdateTime": "2020-10-30 14:37:50.662 +0100"
+
             "lastUpdateTime": "2021-07-01 16:51:34.131 +0200"
 
         },
 
         },
         "@class": "IsParentOf",
+
         "@class": "IsParentOf"
        "@superClasses": [
+
            "RelationElement"
+
        ],
+
 
         "source": {
 
         "source": {
             "name": "anotherVO",
+
             "name": "gcube",
 
             "header": {
 
             "header": {
 
                 "@class": "Header",
 
                 "@class": "Header",
                "creator": "luca.frosini",
+
                 "creationTime": "2021-06-30 11:38:26.464 +0200",
                 "creationTime": "2020-10-30 14:32:22.654 +0100",
+
                 "createdBy": "luca.frosini",
                 "modifiedBy": "luca.frosini",
+
                 "uuid": "ca50eb95-b76c-44fd-9182-229d39c3c9e2",
                 "uuid": "cbe1855b-97c5-495e-a24d-b04428bb4ef6",
+
                "lastUpdateBy": "luca.frosini",
                 "lastUpdateTime": "2020-10-30 14:32:22.654 +0100"
+
                 "lastUpdateTime": "2021-06-30 11:38:26.464 +0200"
 
             },
 
             },
             "@class": "Context",
+
             "@class": "Context"
            "@superClasses": [
+
                "EntityElement"
+
            ]
+
 
         }
 
         }
 
     }
 
     }
Line 630: Line 1,080:
 
</source>
 
</source>
  
=== Delete ===
+
=== Delete Context ===
  
<pre>DELETE /resource-registry/context/{{UUID}}</pre>
 
  
==== Description ====
+
Delete the Context identified by the UUID provided as the path parameter.
  
Delete the Context identified by the UUID provided as 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.'''
  
==== Parameters ====
+
==== Delete via Java Client ====
  
{|class="wikitable"
+
Delete using UUID. This normally used when we already have the UUID instance.
! Name
+
! Type
+
! Required
+
! Description
+
|-
+
| '''{''Path Parameter''}'''
+
| String (UUID)
+
| true
+
| The UUID of the target Context
+
|}
+
  
==== Responses ====
+
<source lang="java">
 +
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
 +
resourceRegistryContextClient.delete("bad5f350-345c-11e9-9f49-cef9b1608c3f");
 +
</source>
  
{|class="wikitable"
+
Delete using context instance. This normally used when we already have the context instance.
! Code
+
! Type
+
! Description
+
|-
+
| 200
+
| String
+
| NO CONTENT
+
|}
+
  
==== Example ====
+
<source lang="java">
 
+
ResourceRegistryContextClient resourceRegistryContextClient = ResourceRegistryContextClientFactory.create();
Delete the Context having UUID '''9d73d3bd-1873-490c-b0a7-e3c0da11ad52'''
+
Context nextNextContext = resourceRegistryContextClient.read("bad5f350-345c-11e9-9f49-cef9b1608c3f");
 
+
resourceRegistryContextClient.delete(nextNextContext);
''Request URL''
+
</source>
 
+
<pre>DELETE /resource-registry/context/9d73d3bd-1873-490c-b0a7-e3c0da11ad52</pre>
+
 
+
== Schema Management ==
+
 
+
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.
+
 
+
=== Type Definition ===
+
 
+
Any Type is described by the following attributes:
+
 
+
* '''name''' (String): Type Name
+
* '''description''' (String): The description of the Type. <code>default=null</code>.
+
* '''abstractType''' (Boolean): Indicate if the type is abstract so that it cannot be instantiated. In other words, only subtypes of this type can be instantiated. <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 ====
+
 
+
Any [[Facet_Based_Resource_Model#Property | Property]] is described by the following attributes:
+
 
+
* '''name''' : Property Name
+
* '''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 available at [https://regex101.com/ https://regex101.com/]
+
 
+
===== Property Type Mapping =====
+
  
[[Facet_Based_Resource_Model#Basic_Property_Type | Property Type]] are mapped to and integer to be used in property definition:
+
==== Delete via REST API ====
  
Type binder is defined here:
+
<pre>DELETE /resource-registry/contexts/{{UUID}}</pre>
[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"
+
! Type
+
! Integer Mapping
+
! 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 Name } </pre>
+
 
+
==== Description ====
+
 
+
Allow to create new Entity or Relation or Embedded Type.
+
 
+
==== Parameters ====
+
 
+
{|class="wikitable"
+
! Name
+
! Type
+
! Required
+
! Description
+
|-
+
| '''Type Name'''
+
| String
+
| true
+
| The name of the new type to create
+
|}
+
 
+
==== Responses ====
+
  
 
{|class="wikitable"
 
{|class="wikitable"
Line 813: Line 1,115:
 
! Description
 
! Description
 
|-
 
|-
| 200
+
| 204 - No Content
| String
+
| N/A
| The json representation of the newly created type (which is the same of the request)
+
| N/A
 
|}
 
|}
  
==== Examples ====
 
  
===== Resource Type Creation =====
+
'''Request URL'''
  
<pre>PUT /resource-registry/schema/Actor</pre>
+
For example to delete the Context having UUID '''bad5f350-345c-11e9-9f49-cef9b1608c3f''' (NextNext) we just need to perform the following HTTP request
  
'''''Request Body'''''
+
<pre>DELETE /resource-registry/contexts/bad5f350-345c-11e9-9f49-cef9b1608c3f</pre>
<pre>
+
{
+
"name":"Actor",
+
"description":"Any entity (human or machine) playing an active role.",
+
"abstractType":true, /* If the Resource cannot be instantiated */
+
"superclasses":["Resource"], /* Resource or any registered specialization. */
+
"properties":null /* MUST be null. The Resource cannot have any property. */
+
}
+
</pre>
+
 
+
===== Facet Type Creation =====
+
 
+
<pre>PUT /resource-registry/schema/ContactFacet</pre>
+
 
+
'''''Request Body'''''
+
<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 Creation =====
+
<pre>PUT /resource-registry/schema/Hosts</pre>
+
 
+
'''''Request Body'''''
+
<pre>
+
{
+
"name":"Hosts",
+
"description": "…”,
+
"abstractType":false,
+
"superclasses":["IsRelatedTo"],
+
"properties":[]
+
}
+
</pre>
+
 
+
===== ConsistsOf Type Creation =====
+
 
+
<pre>PUT /resource-registry/schema/HasContact</pre>
+
 
+
'''''Request Body'''''
+
<pre>
+
{
+
"name":"HasContact",
+
"description":"",
+
"abstractType":true,
+
"superclasses":["ConsistsOf"],
+
"properties":[]
+
}
+
</pre>
+
 
+
===== Embedded Type Creation =====
+
 
+
<pre>PUT /resource-registry/schema/AccessPolicy</pre>
+
 
+
'''''Request Body'''''
+
<pre>
+
{
+
"name":"AccessPolicy",
+
"description":"",
+
"abstractType":false,
+
"superclasses":["Embedded"],
+
"properties":[{
+
"name":"policy",
+
"description":"",
+
"mandatory":false,
+
"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>
+
 
+
=== Read Type Definition ===
+
 
+
<pre>GET /resource-registry/schema/{ Type Name } </pre>
+
 
+
==== Description ====
+
 
+
Allow to read Type Definition
+
 
+
==== Parameters ====
+
 
+
{|class="wikitable"
+
! Name
+
! Type
+
! Required
+
! Description
+
|-
+
| '''Type Name'''
+
| String
+
| true
+
| The name of the type you want to retrieve the definition
+
|}
+
 
+
==== Responses ====
+
 
+
{|class="wikitable"
+
! Code
+
! Type
+
! Description
+
|-
+
| 200
+
| String
+
| The json representation of the newly created type
+
|}
+
 
+
==== Examples ====
+
 
+
===== Resource Type =====
+
 
+
<pre>GET /resource-registry/schema/Actor</pre>
+
 
+
'''''Response'''''
+
<pre>
+
{
+
"name":"Actor",
+
"description":"Any entity (human or machine) playing an active role.",
+
"abstractType":true,
+
"superclasses":["Resource"],
+
"properties":null
+
}
+
</pre>
+
 
+
===== Facet Type =====
+
 
+
<pre>GET /resource-registry/schema/ContactFacet</pre>
+
 
+
'''''Response'''''
+
<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 =====
+
 
+
<pre>GET /resource-registry/schema/Hosts</pre>
+
 
+
'''''Response'''''
+
<pre>
+
{
+
"name":"Hosts",
+
"description": "…”,
+
"abstractType":false,
+
"superclasses":["IsRelatedTo"],
+
"properties":[]
+
}
+
</pre>
+
 
+
===== ConsistsOf Type =====
+
 
+
<pre>GET /resource-registry/schema/HasContact</pre>
+
 
+
'''''Response'''''
+
<pre>
+
{
+
"name":"HasContact",
+
"description":"",
+
"abstractType":true,
+
"superclasses":["ConsistsOf"],
+
"properties":[]
+
}
+
</pre>
+
 
+
===== Embedded Type =====
+
 
+
<pre>GET /resource-registry/schema/AccessPolicy</pre>
+
 
+
'''''Response'''''
+
<pre>
+
{
+
"name":"AccessPolicy",
+
"description":"",
+
"abstractType":false,
+
"superclasses":["Embedded"],
+
"properties":[{
+
"name":"policy",
+
"description":"",
+
"mandatory":false,
+
"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>
+

Latest revision as of 10: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