Difference between revisions of "URI Resolver"

From Gcube Wiki
Jump to: navigation, search
 
(457 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The URI Resolver is an HTTP URI resolver implemented as an HTTP servlet which gives the possibility to resolve and access trough HTTP different protocols URIs.
+
<!-- CATEGORIES -->
 +
[[Category:Developer's Guide]]
 +
<!-- END CATEGORIES -->
 +
The [https://data.d4science.org/ URI Resolver] is a RESTful service which gives access via HTTP(s) to different gCube Resolver services and gCube Applications (like [http://data.d4science.org/gis-viewer-app/ GisViewer-App]) used into the D4Science Infrastructure.
  
The first version of the component is able to give HTTP resolution to SM protocol URIs [https://gcube.wiki.gcube-system.org/gcube/index.php/Storage_Management_NEW].
+
The API documentation (provided by [https://github.com/stoicflame/enunciate/ Enunciate]) is available at [https://data.d4science.org/docs/index.html URI Resolver API]
  
Once deployed in a servlet container as Tomcat, the servlet can be used to resolve SMP URI as follows:
+
The code repo is available at [https://code-repo.d4science.org/gCubeSystem/uri-resolver URI Resolver code]
 +
 
 +
__TOC__
 +
 
 +
==== Instances ====
 +
 
 +
The DEVELOPMENT instance is available at https://data.dev.d4science.org/
 +
 
 +
The PREPRODUCTION instance is available at https://data-pre.d4science.org/
 +
 
 +
The PRODUCTION instance is available at https://data.d4science.org/
 +
 
 +
==== Maven ====
 +
 
 +
The artifact is available on Nexus with the following coordinates:
 +
 
 +
<source lang="xml">
 +
 
 +
  <groupId>org.gcube.data.transfer</groupId>
 +
  <artifactId>uri-resolver</artifactId>
 +
  <version>LATEST</version>
 +
  <type>war</type>
 +
 
 +
</source>
 +
 
 +
==== Runtime Resource ====
 +
 
 +
The address and the configuration information of the servlet are registered on the gCube Information System as Runtime Resource (RR).
 +
 
 +
You can see the configuration through Monitor service (https://services.d4science.org/infrastructure-monitor) searching in the root scope the RR with following:
 +
 
 +
<pre>
 +
<Type>RuntimeResource</Type>
 +
<Category>Service</Category>
 +
<Name>HTTP-URI-Resolver</Name>
 +
</pre>
 +
 
 +
You must copy such runtime resource in VRE scope if it is need to work at VRE level
 +
 
 +
==== Query ====
 +
 
 +
The following code snippet can be used to retrieve from the gCube Information System the info to configure the resolver
  
 
<source lang="java5">
 
<source lang="java5">
URL url = new URL("http://localhost:8080/uri-resolver/smp?smp-uri=smp://Wikipedia_logo_silver.png?5ezvFfBOLqaqBlwCEtAvz4ch5BUu1ag3yftpCvV+gayz9bAtSsnO1/sX6pemTKbDe0qbchLexXeWgGcJlskYE8td9QSDXSZj5VSl9kdN9SN0/LRYaWUZuP4Q1J7lEiwkU4GKPsiD6PDRVcT4QAqTEy5hSIbr6o4Y");
+
 +
  ScopeProvider.instance.set(THE_SCOPE);
 +
 
 +
  XQuery query = queryFor(ServiceEndpoint.class);
 +
 
 +
  query.addCondition("$resource/Profile/Name/text() eq 'HTTP-URI-Resolver'").setResult("$resource/Profile/AccessPoint");
 +
 
 +
  DiscoveryClient<AccessPoint> client = clientFor(AccessPoint.class);
 +
 
 +
  List<AccessPoint> endpoints = client.submit(query);
 +
 
 +
  if (endpoints.size() == 0)
 +
throw new Exception("No Resolver available");
 +
 +
  //Building map of Access Points linked for EntryName
 +
  Map<String, AccessPoint> mapEntryNameForAP = new HashMap<String, AccessPoint>(endpoints.size());
 +
 +
  //Printing all access points
 +
  for (AccessPoint accessPoint : endpoints) {
 +
// The AccessPoint
 +
System.out.println("\nEntryName: "+accessPoint.name());
 +
System.out.println("Description: "+accessPoint.description());
 +
System.out.println("Address: "+accessPoint.address());
 +
mapEntryNameForAP.put(accessPoint.name(), accessPoint);
 +
 +
//Adding couple (EntryName,AccessPoint)
 +
Map<String, Property> propertyMap = accessPoint.propertyMap();
 +
 +
if(propertyMap!=null) {
 +
 +
for (String key: propertyMap.keySet()) {
 +
System.out.println("Property value: "+propertyMap.get(key).value());
 +
//...
 +
 +
}
 +
}
 +
  }
 +
 +
  //Direct access to endpoint for Catalogue Resolver
 +
  AccessPoint accessPoint = mapEntryNameForAP.get("ctlg");
 +
  System.out.println("\nCatalogue Resolver - EntryName: "+accessPoint.name());
 +
  System.out.println("Address: "+accessPoint.address());
 +
 +
 
 
</source>
 
</source>
 +
 +
== Retrieve web service endpoint ==
 +
The service endpoint URL [URI_RESOLVER_SERVICE_ENDPOINT] of Resolver's services in the environment of:
 +
 +
* development
 +
 +
<source lang="xml">
 +
http://data.dev.d4science.org
 +
</source>
 +
 +
* prepoduction
 +
 +
<source lang="xml">
 +
http://data-pre.d4science.org
 +
</source>
 +
 +
* production
 +
 +
<source lang="xml">
 +
http://data.d4science.org
 +
</source>
 +
 +
== Resolvers ==
 +
 +
=== SMP Resolver ===
 +
 +
The first version of the component is able to give HTTP resolution to SMP protocol URIs [https://gcube.wiki.gcube-system.org/gcube/index.php/Storage_Management_NEW].
 +
 +
Once deployed in a SmartGear container as Tomcat, the service can be used to resolve SMP URIs as follows:
 +
 +
<source lang="java5">
 +
URL url = new URL("http://<hostname>:<port>/uri-resolver/smp?smp-uri=smp://.....);
 +
</source>
 +
 +
The HTTP URI can be also used to retrieve files using wget or trough a Web Browser:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/smp?smp-uri=[STORAGE_URI]&fileName=[FILENAME]&contentType=[CONTENT_TYPE]
 +
</pre>
 +
 +
Apart from the ''smp-uri'' mandatory parameter, two optional paramters can be used:
 +
 +
* ''fileName'' : to specify the output file name ( default: fromStorageManager)
 +
* ''contentType'' : to specify the output file content-type ( default: unknown/unknown)
 +
 +
=== SMP-ID Resolver ===
 +
 +
The resolver is able to give HTTP resolution to storage resource by ID [https://wiki.gcube-system.org/index.php?title=Storage_Manager].
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/id?smp-id=[STORAGE_SMP_ID]&fileName=[FILENAME]&contentType=[CONTENT_TYPE]
 +
</pre>
 +
 +
For instance, in the development environment you can download the following file with WGET command or through a Web Browser by using the link:
 +
 +
http://data-d.d4science.org/id?smp-id=553f9265e4b0567b75021fce&fileName=dog&contentType=image%2Fjpg
 +
 +
Apart from the ''smp-id'' mandatory parameter, SMP-ID Resolver uses two optional parameters (in the query string):
 +
 +
* ''fileName'' : to specify the output file name (default: fromStorageManager)
 +
* ''contentType'' : to specify the output file content-type (default: unknown/unknown)
 +
 +
The two default cases above will be used if and only if the file name and content-type (mime type) cannot be read from metadata of the file saved in the Storage.
 +
 +
Therefore, in this order:
 +
 +
- Either fileName is read from query string or is read from storage metadata otherwise is default: "fromStorageManager"
 +
 +
- Either contentype is read from query string or is read from storage metadata otherwise is default: "unknown/unknown"
 +
 +
=== STORAGE-ID Resolver ===
 +
 +
This works as [[#SMP-ID Resolver]] using links having the format:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/[STORAGE_ID]
 +
</pre>
 +
 +
==== HEAD HTTP: Payload validation ====
 +
 +
STORAGE-ID Resolver implements the HTTP doHead operation. It performs a payload validation (checking if it exists in the storage area) for the resource ID required:
 +
 +
- if the payload exists: it returns status 200 the content-type and content-disposition of the file in the HTTP response;
 +
 +
- if the payload does not exist: it returns status 404 in the HTTP response.
 +
 +
'''Support to parametric "Content-Disposition"'''
 +
 +
It is possible to set the content-disposition value returned in the HTTP request by the following:
 +
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/shub/[STORAGE_HUB_FILE_ID]?content-disposition={inline,attachment}
 +
 +
The parameter content-disposition={inline,attachment} is optional (default value is attachment). Specifies the 'Content-Disposition' value returned in the header of the HTTP Response.
 +
 +
=== STORAGE-HUB Resolver ===
 +
 +
The StorageHub Resolver is reachable at the following path:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/shub
 +
</pre>
 +
 +
It provides the methods either to download a gCube Workspace file or to get its metadata.
 +
 +
==== HTTP GET: Download a file ====
 +
 +
This method is reachable at:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/shub/[STORAGE_HUB_FILE_ID]
 +
</pre>
 +
 +
and allows the download of the gCube Workspace file with ID [STORAGE_HUB_FILE_ID] via the StorageHub facility.
 +
 +
'''Support to parametric "Content-Disposition"'''
 +
 +
It is possible to set the <code>content-disposition</code> value returned in the HTTP request by the following:
 +
 +
<code>[URI_RESOLVER_SERVICE_ENDPOINT]/shub/[STORAGE_HUB_FILE_ID]?content-disposition={inline,attachment}</code>
 +
 +
The parameter <code>content-disposition={inline,attachment}</code> is optional (default value is ''attachment''). Specifies the 'Content-Disposition' value returned in the header of the HTTP Response.
 +
 +
'''N.B.''' The parameter <code>content-disposition</code> is available only by (long) URL of type <code>[URI_RESOLVER_SERVICE_ENDPOINT]/shub/[STORAGE_HUB_FILE_ID]?content-disposition={inline,attachment}</code>. It is not managed with the short URL of type <code>https://data{-dev,-pre,}.d4science.net/[SHORT-CODE]</code>
 +
 +
==== HTTP HEAD: Get metadata of a file ====
 +
 +
This method is reachable at:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/shub/[STORAGE_HUB_FILE_ID]
 +
</pre>
 +
 +
and allows to get the metadata of the gCube Workspace file with ID [STORAGE_HUB_FILE_ID] (the metadata are retrieved from the StorageHub component).
 +
 +
The response returns an HTTP Status 204 ([https://tools.ietf.org/html/rfc7231#section-6.3.5 NO_CONTENT], so it DOES NOT return a message-body) and adds the headers related to STORAGE_HUB_FILE_ID listed below:
 +
* [https://tools.ietf.org/html/rfc6266 "Content-Disposition"];
 +
* [https://tools.ietf.org/html/rfc7231#section-3.1.4.2 "Content-Location"];
 +
* [https://tools.ietf.org/html/rfc7231#section-3.1.1.5 "Content-Type"] if not empty;
 +
* [https://tools.ietf.org/html/rfc7230#section-3.3.2 "Content-Length"].
 +
 +
=== GIS Resolver ===
 +
 +
This component is able to resolve GIS Links (as a redirect to Gis Viewer Application) in order to display and navigate on web-map the gis layers stored in iMarine Geonetwork [http://wiki.i-marine.eu/index.php/Blue_Hackathon_iMarine_Data_Challenges#iMarine_GeoNetwork #iMarine_GeoNetwork]
 +
 +
==== HTTP GET: Resolve a Gis Link ====
 +
 +
The Gis Resolver can be used to resolve Gis Layer using a Web Browser link as follows:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/gis?gis-UUID=[UUID]&scope=[SCOPE]
 +
</pre>
 +
 +
The link must include two mandatory parameters:
 +
 +
* ''gis-UUID'' : to specify the Metadata Universally Unique Identifier (UUID - used in iMarine Geonetwork). The UUID identifies the gis layer which you want to show in Gis Viewer Application
 +
* ''scope'' : to specify the "scope" for discovering the iMarine GeoNetwork service (e.g. scope=/gcube/devsec/devVRE)
 +
 +
====== Runtime Resource ======
 +
 +
In order to work, it is necessary to copy from Root scope (/d4science.research-infrastructures.eu) to the VRE where Gis-Resolver must work, the runtime resource with following coordinates:
 +
 +
<pre>
 +
<Type>RuntimeResource</Type>
 +
<Category>Service</Category>
 +
<Name>Gis-Resolver</Name>
 +
</pre>
 +
 +
====== Generic Resource for Gis Viewer Application ======
 +
 +
It is necessary to edit the generic resource "Gis Viewer Application" in the Root scope (/d4science.research-infrastructures.eu) adding the VRE scope where the GisViewerApplication must work.
 +
 +
The Generic Resource "Gis Viewer Application" coordiantes are:
 +
 +
<pre>
 +
<Type>GenericResource</Type>
 +
<SecondaryType>ApplicationProfile</SecondaryType>
 +
<Name>Gis Viewer Application</Name>
 +
</pre>
 +
 +
=== CATALOGUE Resolver ===
 +
 +
This works as an HTTP Resolver to get/resolve a link to a "Catalogue Entity" stored in one of the [https://wiki.gcube-system.org/gcube/GCube_Data_Catalogue gCube Data Catalogue]'s instances
 +
 +
A Catalogue Entity is either a "group" or an "organization" or a "product" of gCube Data Catalogue.
 +
 +
==== HTTP POST: Create an Item URL ====
 +
 +
The resolver provides HTTP POST operation to build a link to a "Catalogue Entity" stored into a specific gCube Data Catalogue.
 +
 +
In order to give a catalogue link for a catalogue entity is needed to pass in the body of the POST request a JSON with the fields:
 +
 +
* gcube_scope as mandatory field. It is the gcube scope where to search the gCube Catalogue Portlet;
 +
* entity_context as mandatory field. It can be: "dataset" or "group" or "organization";
 +
* entity_name as mandatory field. It is the entity name (that appears in the last part of CKAN URL).
 +
* query_string as optional filed. Use this parameter to pass a query string (e.g. ''param1=value1&param2=value'')
 +
 +
Where the JSON format is the following one:
 +
 +
<source lang='xml'>
 +
 +
{
 +
"gcube_scope" : "[gcube_scope value]",
 +
"entity_context" : "[entity_context value]",
 +
"entity_name" : "[entity_name value]"
 +
}
 +
 +
</source>
 +
 +
and with the optional parameter ''query_string'' the format is:
 +
 +
<source lang='xml'>
 +
 +
{
 +
"gcube_scope" : "[gcube_scope value]",
 +
"entity_context" : "[entity_context value]",
 +
"entity_name" : "[entity_name value]",
 +
"query_string" : "[the_query_string]"
 +
}
 +
 +
</source>
 +
 +
===== How to create the Catalogue Link =====
 +
 +
You need to perform a POST request to the resolver:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/ctlg
 +
</pre>
 +
 +
(to backward compatibility you can contact also):
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/catalogue
 +
</pre>
 +
 +
by using:
 +
 +
- the header parameter ''Content-Type'': ''application/json'';
 +
 +
- the body with the JSON format as above specified (the response returns an HTTP link).
 +
 +
An instance of body could be [ex. 1]:
 +
 +
<source lang='xml'>
 +
 +
{
 +
"gcube_scope" : "/gcube/devsec/devVRE",
 +
"entity_context" : "dataset",
 +
"entity_name" : "sarda-sarda"
 +
}
 +
 +
</source>
 +
 +
'''The HTTP Response returned: '''
 +
 +
The response returns in the body a "brief URL" in clear of kind:
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/[ctlg|ctlg-d|ctlg-o|ctlg-g]/[VRE_NAME]/[entity_name value]
 +
</pre>
 +
 +
Where:
 +
 +
ctlg | ctlg-d | ctlg-o | ctlg-g are codes to resolve the couple "catalogue"-"entity_context_value", in detail:
 +
 +
ctlg -> this one is default value to refer a 'dataset'
 +
 +
ctlg-d -> to refer respectively a 'dataset'
 +
 +
ctlg-o -> to refer an 'organization'
 +
 +
ctlg-g -> to refer a 'group'
 +
 +
For instance, using the request of [ex. 1] in the development environment, the HTTP response returns in the body the URL:
 +
http://data-d.d4science.org/ctlg/devVRE/sarda-sarda
 +
 +
===== Create a Moderation Link =====
 +
 +
In order to create a Moderation Link, you need to add the `query_string` property in the JSON body with the following parameter:
 +
 +
* moderation = show
 +
* item_name = [THE_ITEM_NAME]
 +
* status = [THE_ITEM_STATUS]
 +
 +
so the JSON body having the format:
 +
 +
<pre>
 +
{
 +
"gcube_scope" : "[THE_SCOPE]",
 +
"entity_context" : "organization",
 +
"entity_name" : "[ORG_NAME]",
 +
"query_string" : "moderation=show&item_name=[THE_ITEM_NAME]&status=[THE_ITEM_STATUS]"
 +
}
 +
</pre>
 +
 +
E.g. With:
 +
 +
* gcube_scope = /gcube/devsec/devVRE
 +
* entity_name = devvre
 +
* query_string = moderation=show&item_name=sarda-sarda&status=pending
 +
 +
the JSON is:
 +
 +
<pre>
 +
{
 +
"gcube_scope" : "/gcube/devsec/devVRE",
 +
"entity_context" : "organization",
 +
"entity_name" : "devvre",
 +
"query_string" : "moderation=show&item_name=sarda-sarda&status=pending"
 +
}
 +
</pre>
 +
 +
See more at: [https://gcube.wiki.gcube-system.org/gcube/URI_Resolver#Support_to_Catalogue_Moderation_.28System.29 | URI-Resolver-Manger support to Moderation Links]
 +
 +
==== HTTP GET: Resolve an Item URL ====
 +
 +
The resolver provides HTTP GET operation to give HTTP resolution (as HTTP redirect) for displaying the 'entity_name' through an instance of "gCube Data Catalogue Portlet" (this last one is resolved by the 'gcube_scope' used to generate the catalogue link)
 +
 +
=== Geonetwork Resolver ===
 +
 +
The 'Geonetwork Resolver' is a "middle tier" (like a Proxy) to perform queries on gCube Geonetwork services. It uses the 'Geonetwork Manager library' to discovery Geonetwork configurations like: Geonetwork service end-point, Geonetwork accounts and so on.
 +
Using the Geonetwork configurations discovered the resolver performs authentication on Geonetwork (if needed) and then forward the requests received to harvesting metadata on that Geonetwork.
 +
Authentication is needed to get layers stored as private on Geonetwork.
 +
 +
The resolver is reachable at the following:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/geonetwork
 +
</pre>
 +
 +
later referred like "GEONETWORK_RESOLVER_BASE_URL".
 +
 +
The 'Geonetwork Resolver' provides the HTTP GET method that supports the following protocol:
 +
<pre>
 +
http[s]://[GEONETWORK_RESOLVER_BASE_URL]/[SCOPE]/[MODE]/[VISIBILITY]/[FILTER_KEY]/[FILTER_VALUE]/$$
 +
</pre>
 +
 +
In detail, the protocol parameters are:
 +
 +
* SCOPE (mandatory): the gCube scope used via 'Geonetwork Manager library' to discovery the Geonetwork service end-point and other configurations (like Geonetwork accounts and so on). It must be separated by character pipe '|'. i.e. gcube|devNext|NextNext;
 +
* MODE (mandatory): must be 'VRE' or 'HARVEST'. To harvest at VRE level or External GEONETWORK level;
 +
* VISIBILITY (mandatory): must be 'PUB' or 'PRV'. When PUB: only public layer/s is/are returned. When PRV: only private layer/s is/are returned;
 +
* FILTER_KEY/FILTER_VALUE (mandatory): couple key/value passed in the path to filter on one of geonetwork:info field returned by ISO19139 schema. Only layer/s complying the filter criteria are returned (e.g. The filter category/interactiveResources returns only the layers belonging to GN category "Interactive resources"). The default value must be null/null if you don't want to apply any filter;
 +
 +
* REQUEST DELIMITER (mandatory). must be '$$'. It is the delimiter to specify the end of the path.
 +
 +
e.g. CKAN harvester configured to retrieve metadata by the URL: https://data.d4science.org/geonetwork/d4science.research-infrastructures.eu|gCubeApps|RPrototypingLab/VRE/PRV/null/null/$$
 +
 +
Where:
 +
* GEONETWORK_RESOLVER_BASE_URL has value: https://data.d4science.org, so the Geonetwork Resolver service endepoint is: https://data.d4science.org/geonetwork;
 +
* SCOPE has value: 'd4science.research-infrastructures.eu|gCubeApps|RPrototypingLab';
 +
* MODE has value: 'VRE';
 +
* VISIBILITY has value: 'PRV';
 +
* FILTER_KEY has value: null and FILTER_VALUE has value: null;
 +
 +
It retrieves all private layers of the VRE RPrototypingLab.
 +
 +
=== Parthenos URL Resolver ===
 +
 +
(DRAFT) This resolver is reachable at:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/parthenos_registry
 +
</pre>
 +
 +
It exposes the HTTP methods:
 +
 +
* GET - to resolve an "item" from a Parthenos URL stored in the Parthenos Catalogue at https://ckan-parthenos.d4science.org/
 +
* POST - to get a normalized item name from a Parthenos URL. It applies a normalization function to get from an input Parthenos URL an item name that is catalogue compliant.
 +
 +
===== HTTP POST: Get normalized Item Name =====
 +
 +
The resolver provides HTTP POST operation to request a normalized item name for an input Parthenos URL.
 +
 +
It reads the input Parthenos URL (from the 'entity_name' field of a JSON object) and returns its normalized name (as plaintext) to the Parthenos Catalogue URL.
 +
 +
You need to perform a POST request to the resolver ''parthenos_registry'' by adding the HTTP header ''Content-Type: application/json'' and passing in the body a JSON object with the following format:
 +
 +
<source lang='xml'>
 +
 +
{
 +
"entity_name" : "[PARTHENOS entity_name value]"
 +
}
 +
 +
</source>
 +
 +
An instance of body could be:
 +
 +
{
 +
"entity_name": "/Culturalitalia/unknown/Dataset/oai%3Aculturaitalia.it%3Aoai%3Aculturaitalia.it%3Amuseiditalia-mus_11953"
 +
}
 +
 +
and in this case the POST response returns:
 +
 +
- as plaintext in the ''body'': culturalitalia_unknown_dataset_oaiculturaitaliaitoaiculturaitaliaitmuseiditalia_mus_11953
 +
 +
- as ''Location'' parameter (in the HTTP header): https://parthenos.d4science.org/group/parthenos_registry/catalogue?path=/dataset/culturalitalia_unknown_dataset_oaiculturaitaliaitoaiculturaitaliaitmuseiditalia_mus_11953
 +
 +
===== HTTP GET: Resolve a Parthenos URL =====
 +
 +
The resolver provides HTTP GET operation to return the Parthenos Catalogue URL of an "item" stored as Parthenos URL in the [https://ckan-parthenos.d4science.org/ (Parthenos) Catalogue]
 +
 +
You simply by resolving via browser the HTTP link of a Parthenos URL (stored in the Parthenos Catalogue), you are performing a GET request to the resolver ''parthenos_registry'' to get its Parthenos Catalogue URL.
 +
 +
=== Analytics Resolver ===
 +
 +
The resolver provides a method to get the Analytics URLs (that are simply URLs) by which is possible to invoke through the DataMiner Executor the run of an algorithm stored in a certain VRE.
 +
By the DataMiner Executor then the user is able to monitoring the algorithm execution.
 +
 +
The Analytics Resolver is reachable at:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/analytics
 +
</pre>
 +
 +
It exposes the HTTP methods:
 +
 +
* GET - to resolve an Analytics URL (created by POST method) that invokes the "run" operation for an algorithm stored in a VRE;
 +
* POST - to generate an Analytics URL (then resolved by GET method) for a certain algorithm of a VRE.
 +
 +
'''Information System dependencies''': in order to work correctly this resolver needs to:
 +
 +
* '''AnalyticsExecutor''' GR as ApplicationProfile published at VRE level in the gCube Information System;
 +
* '''Analytics-Resolver''' SE published at ROOT level in the gCube Information System.
 +
 +
===== HTTP POST: Create an Analytics URL =====
 +
 +
This resolver (protected by AuthZ) is reachable at the following:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/analytics/create
 +
</pre>
 +
 +
It provides the HTTP POST method to create Analytics URLs. In order to obtain an Analytics URL, you need to know your gcube-token (in the VRE), the algorithm identifier and the parameters to call the algorithm/operator in the VRE.
 +
 +
If you know these things, you can perform a POST request to the resolver [URI_RESOLVER_SERVICE_ENDPOINT]/analytics/create by adding in the HTTP header:
 +
 +
* the parameter ''gcube-token: [YOUR_VRE_TOKEN]'';
 +
* the parameter ''Content-Type: ''text/plain'';
 +
 +
and passing in the body a JSON object with the following format:
 +
 +
<pre>
 +
# THE DATAMINER INVOCATION MODEL
 +
 +
{
 +
  "dataminer-invocation": {
 +
    "operator-id": "[THE_OPERATOR_ID]",
 +
    "action": "RUN|SHOW|EDIT",
 +
    "parameters": {
 +
      "input": {
 +
        "param": [
 +
          {
 +
            "key": "[key1]",
 +
            "value": "[value1]"
 +
          },
 +
          {
 +
            "key": "key2",
 +
            "value": "value2"
 +
          },
 +
          ...
 +
          {
 +
            "key": "[keyN]",
 +
            "value": "[valueN]"
 +
          }
 +
        ]
 +
      },
 +
      "output": {
 +
        "param": [
 +
          {
 +
            "key": "[keyA]",
 +
            "value": "[valuA]"
 +
          },
 +
          {
 +
            "key": "[keyB]",
 +
            "value": "[valueB]"
 +
          },
 +
          ...
 +
          {
 +
            "key": "[keyZ]",
 +
            "value": "[valueZ]"
 +
          }
 +
        ]
 +
      }
 +
    }
 +
  }
 +
}
 +
</pre>
 +
 +
Where:
 +
 +
- "''operator-id''" field is Mandatory. It is the ''DataMiner Operator'' Identifier;
 +
 +
- "''action''" field is Mandatory and its value must be "RUN" or "EDIT" or "SHOW". By resolving an Analytics URL with action:
 +
* RUN: the DataMiner Executor invokes directly the execution of the ''DataMiner Operator'' with the input/output parameters defined in the dataminer-invocation model. Monitoring of the operator execution is shown;
 +
* SHOW: the DataMiner Executor shows for the ''DataMiner Operator'' a form with the input/output parameters defined in the dataminer-invocation model without edit permission. It is not possible to change the values of parameters, only the RUN is allowed;
 +
* EDIT ('''''not supported yet by DataMiner Executor'''''): the DataMiner Executor shows for the ''DataMiner Operator'' a form to edit the input/output parameters defined in the dataminer-invocation model  and it allows the RUN.
 +
 +
- "''parameters''" field is Optional. It is a list of "input" and "output" parameters used to invoke/call the Operator Identifier ''operator-id'' through the DataMiner Executor.
 +
 +
Performing the POST request to the resolver ''/analytics/create'' with the JSON object "dataminer-invocation" as presented above, the resolver returns as plaintext in the body (and as value of header parameter ''Location'') an Analytics URL with the following format:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/analytics/get/[VRE_NAME]?dim=[PUBLIC_URL_TO_DATAMIER_INVOCATION_FILE_GENERATED_BY_POST_REQUEST]
 +
</pre>
 +
 +
e.g. By using a token of "/gcube/preprod/preVRE" VRE and passing the following "dataminer-invocation" JSON object in the body :
 +
 +
<pre>
 +
{
 +
  "dataminer-invocation": {
 +
    "operator-id": "org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.MPA_INTERSECT",
 +
    "action": "RUN",
 +
    "parameters": {
 +
      "input": {
 +
        "param": [
 +
          {
 +
            "key": "fileId",
 +
            "value": "http://publicLinkToFile"
 +
          }
 +
        ]
 +
      }
 +
    }
 +
  }
 +
}
 +
</pre>
 +
 +
the POST response returns as plaintext in the body (and as value of header parameter ''Location'') the following Analytics URL [ex.1]:
 +
 +
https://ADD_ANALYTICS_URL
 +
 +
===== HTTP GET: Resolve an Analytics URL =====
 +
 +
 +
This resolver is reachable at
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/analytics/get
 +
</pre>
 +
 +
It provides the HTTP GET method to resolve an Analytics URL that supports the following protocol:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/analytics/get/[VRE_NAME]?dim=[PUBLIC_URL_TO_DATAMIER_INVOCATION_FILE_GENERATED_BY_POST_REQUEST]
 +
</pre>
 +
 +
e.g. By clicking (so simply resolving it via browser) on the previous Analytics URL [see ex.1] it will be resolved as:
 +
 +
https://pre.d4science.org/group/prevre/dataminer-manager?dim=https://ADD_ANALYTICS_URL
 +
 +
=== KNIME Resolver ===
 +
 +
The resolver provides a method to get the Knime URLs (that are simply URLs) by which is possible to invoke the KNIME Model Simulation Application.
 +
 +
The KNIME Resolver is reachable at:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/knime
 +
</pre>
 +
 +
It exposes the HTTP methods:
 +
 +
* GET (at /get path) - to resolve a Knime URL (created by /create path) that invokes the KNIME Model Simulation Application for the model passed in the query string;
 +
* POST (at /create path) - to generate a Knime URL (then resolved by the /get path) for a KNIME Model Simulation passed by query string.
 +
 +
'''Information System dependencies''': in order to work correctly this resolver needs to:
 +
 +
* '''KnimeModelSimulationPortlet''' GR as ApplicationProfile published at VRE level in the gCube Information System.''
 +
 +
===== HTTP POST: Create a KNIME URL =====
 +
 +
This resolver (protected by AuthZ) is reachable at the following:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/knime/create
 +
</pre>
 +
 +
It provides the HTTP POST method to create Knime URLs. A valid  Knime URL is generable if you know your token (in the VRE) and query string to invoke a KNIME Model Simulation.
 +
 +
If you know these things, in order to create a Knime URL you can perform a POST request to the resolver ''/knime/create'' at:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/knime/create?[QUERY_STRING_TO_INVOKE_A_KNIME_MODEL]
 +
</pre>
 +
 +
by adding the HTTP header ''gcube-token: [YOUR_VRE_TOKEN]'' and passing the query string ([QUERY_STRING_TO_INVOKE_A_KNIME_MODEL]) and it creates a Knime URL with the following format:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/knime/get/[VRE_NAME]?p1=v1&p2=v2&p3=v3
 +
</pre>
 +
 +
that via GET method provided by Knime Resolver will be forwarded to the KNIME Model Simulation Application.
 +
 +
===== HTTP GET: Resolve a KNIME URL =====
 +
 +
This resolver is reachable at
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/knime/get
 +
</pre>
 +
 +
It provides the HTTP GET method to resolve an Knime URL that supports the following protocol:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/knime/get/[VRE_NAME]?p1=v1&p2=v2&p3=v3
 +
</pre>
 +
 +
=== Wekeo Resolver ===
 +
 +
The resolver provides a method to wrap the basic authentication from D4Science account to ''WekeoBroker'' service.
 +
 +
===== HTTP GET: getToken Wekeo =====
 +
 +
The ''getToken'' operation is reachable at
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/wekeo/gettoken
 +
</pre>
 +
 +
It provides the HTTP GET method to wrap with the gcube authentication (by ''gcube-token'') the WekeoBroker [https://wekeo-broker.apps.mercator.dpi.wekeo.eu/databroker/ui/#!/OPERATOR_-_authentication/get_accesstoken  get_accesstoken] call to get the access token to [https://wekeo-broker.apps.mercator.dpi.wekeo.eu/databroker/ui/ WekeoBroker-service-API]
 +
 +
You need to pass your gcube-token in the HTTP Header or in the HTTP query string as follows:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/wekeo/gettoken?gcube-token=[YOUR_GCUBE_TOKEN]
 +
</pre>
 +
 +
===== Service Endpoint =====
 +
 +
In order to work, it is necessary to publish in the VRE the runtime resource with the following coordinates:
 +
 +
<pre>
 +
<Type>RuntimeResource</Type>
 +
<Category>OnlineService</Category>
 +
<Name>WekeoDataBroker</Name>
 +
</pre>
 +
 +
=== Geoportal Resolver ===
 +
 +
'''Dependencies'''
 +
 +
In order to work, it is necessary to publish in the VRE the runtime resource with the following coordinates:
 +
 +
<pre>
 +
<Type>RuntimeResource</Type>
 +
<Category>Service</Category>
 +
<Name>Geoportal-Resolver</Name>
 +
</pre>
 +
 +
NB. The Geoportal_Resolver requires:
 +
 +
* the "URI-Resolver" (gCoreEndpoint) published at VO level with option "authorizeChild"
 +
* the Runtime Resource named "HTTP-URL-Shortener-DL" at VRE level
 +
 +
The Geoportal Resolver provides a method to create and resolve a link to ''Geoportal'' Data-Entry/Data-Viewer applications provided by D4Science
 +
 +
It is reachable at:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/geo
 +
</pre>
 +
 +
It exposes the HTTP methods:
 +
 +
* GET - to resolve a Data-Entry/Data-Viewer URL;
 +
* POST - to create a Data-Entry/Data-Viewer URL.
 +
 +
===== HTTP POST: Create a Data-Entry/Data-Viewer URL =====
 +
 +
It provides the following HTTP POST method to create a Data-Viewer (`dv` means Data-Viewer) URL:
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/geo/dv
 +
</pre>
 +
 +
It provides the following HTTP POST method to create a Data-Entry (`de` means Data-Entry) URL:
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/geo/de
 +
</pre>
 +
 +
You need to pass the JSON body with the following parameters:
 +
 +
* gcube_scope = the gcube scope;
 +
* item_id = the geoportal project id;
 +
* item_type = the geoportal UCD id.
 +
 +
so the JSON body having the format:
 +
 +
<pre>
 +
{
 +
  "gcube_scope":"[THE_GCUBE_SCOPE]",
 +
  "item_id": "[THE_PROJECT_ID]",
 +
  "item_type": "[THE_UCD_ID]"
 +
}
 +
</pre>
 +
 +
example of JSON body:
 +
 +
<pre>
 +
{
 +
  "gcube_scope":"/gcube/devsec/devVRE",
 +
  "item_id": "63d011c4dcac4551b9a6b930",
 +
  "item_type": "profiledConcessioni"
 +
}
 +
</pre>
 +
 +
The Geoportal Link created is of kind {targetAppId=dv}:
 +
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/geo/dv/{vre_name}/{usecase_id}/{project_id}
 +
</pre>
 +
 +
===== HTTP GET: Resolve a Data-Entry/Data-Viewer URL =====
 +
 +
* It provides the following HTTP GET method to resolve a Data-Viewer (`dv` means Data-Viewer) URL:
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/geo/dv
 +
</pre>
 +
 +
with the remaining URL path done from: <code>/{vre_name}/{usecase_id}/{project_id}</code>
 +
 +
* It provides the following HTTP GET method to resolve a Data-Entry (`de` means Data-Entry) URL:
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/geo/de
 +
</pre>
 +
 +
with the remaining URL path done from: <code>/{vre_name}/{usecase_id}/{project_id}</code>
 +
 +
* It provides the following HTTP GET method to resolve a Data-Viewer URL:
 +
<pre>
 +
[URI_RESOLVER_SERVICE_ENDPOINT]/geo
 +
</pre>
 +
 +
passing the query string parameters:
 +
 +
* gcube_scope = the gcube scope;
 +
* item_id = the geoportal project id;
 +
* item_type = the geoportal UCD id;
 +
* res = {'public`, 'private'} resolve as public/private link.
 +
 +
so the query string format is:
 +
<pre>
 +
gcube_scope=[THE_GCUBE_SCOPE]&item_id=[THE_PROJECT_ID]&item_type=[THE_UCD_ID]&res=public
 +
</pre>
 +
 +
example of query string:
 +
<pre>
 +
gcube_scope=/gcube/devsec/devVRE&item_id=63d011c4dcac4551b9a6b930&item_type=profiledConcessioni&res=public
 +
</pre>
 +
 +
== Uri Resolver Manager ==
 +
 +
The Uri Resolver Manager is a library to get a public link of a resource reachable from a (gCube) Http Resolver available in the D4Science Infrastructure.
 +
 +
At the moment, the resource types available are:
 +
 +
* '''GIS''' - accessible by Gis-Resolver;
 +
* '''SMP-ID e SMP'''- accessible by SMPD[-ID]-Resolver;
 +
* '''CTLG''' - accessible by Catalogue-Resolver;
 +
* '''SHUB''' - accessible by SHUB-Resolver.
 +
* '''GEO''' - accessible by Geoportal-Resolver.
 +
 +
The Uri Resolver Manager looks up the (Generic Resource) ''"Uri-Resolver-Map"'' to read the mapping: Application Type -> (Runtime Resource of its) Resolver, e.g. GIS -> Gis-Resolver, SMP -> HTTP-URI-Resolver, etc.
 +
Currently, the mapping "Resource Type" to "RR Resolver" is made by:
 +
<pre>
 +
GIS=Resolver [resourceName=Gis-Resolver, entryName=gis],
 +
CTLG=Resolver [resourceName=HTTP-URI-Resolver, entryName=ctlg],
 +
SHUB=Resolver [resourceName=HTTP-URI-Resolver, entryName=shub],
 +
SMP-ID=Resolver [resourceName=HTTP-URI-Resolver, entryName=smp-id],
 +
SMP=Resolver [resourceName=HTTP-URI-Resolver, entryName=smp],
 +
GEO=Resolver [resourceName=Geoportal-Resolver, entryName=geo]
 +
</pre>
 +
 +
The mandatory parameters to forward correctly the HTTP request to Resolver are dynamically read from Runtime Resources (i.e. ''Gis-Resolver'', ''HTTP-URI-Resolver'')
 +
 +
===== Support to Catalogue Moderation (System) =====
 +
 +
The following snippet provides a utility to generate a direct Catalogue Link (called 'Moderation Link') consumable by the Content Moderation System. If the Moderation facility is enabled in the {THE_SCOPE} and either the user is the item publisher or he/she has the role of "Catalogue_Moderator", by resolving the link generated, the Content Moderation UX will be directly shown to user.
 +
 +
<source lang="java">
 +
 +
@Test
 +
public void testCTLGGenerateLinkForModeration() {
 +
 +
  try {
 +
ScopeProvider.instance.set({THE_SCOPE});  //e.g. /gcube/devsec/devVRE
 +
UriResolverManager resolver;
 +
resolver = new UriResolverManager("CTLG");
 +
Map<String, String> params = new HashMap<String, String>();
 +
params.put("gcube_scope", {THE_SCOPE}); //e.g. /gcube/devsec/devVRE
 +
params.put("entity_context", "organization");
 +
params.put("entity_name", {ORGANIZATION_NAME}); //e.g. devvre
 +
 +
CatalogueResolverQueryStringBuilder builder = new CatalogueResolverQueryStringBuilder({ITEM_NAME}); //item name under moderation
 +
builder.
 +
itemStatus({THE_STATUS}). //OPTIONAL FIELD pending, approved, rejected - init the GUI on this status;
 +
moderation(MODERATION_OP.show); //OPTIONAL FIELD - to specify the operation
 +
 +
String queryString = builder.buildQueryParametersToQueryString();
 +
params.put(CatalogueResolverQueryStringBuilder.QUERY_STRING_PARAMETER, queryString);
 +
 +
String shortLink = resolver.getLink(params, true);
 +
System.out.println(shortLink);
 +
  } catch (UriResolverMapException e) {
 +
e.printStackTrace();
 +
  } catch (IllegalArgumentException e) {
 +
e.printStackTrace();
 +
  } catch (Exception e) {
 +
e.printStackTrace();
 +
  }
 +
}
 +
 +
</source>
 +
 +
Example of Moderation Link:
 +
 +
https://data.dev.d4science.org/ctlg-o/devVRE/devvre?moderation=show&item_name=test-moderation-1649068829317&status=approved
 +
 +
===== Maven =====
 +
The artifact is available on Nexus with the following coordinates:
 +
 +
<source lang="xml">
 +
 +
  <groupId>org.gcube.portlets.user</groupId>
 +
  <artifactId>uri-resolver-manager</artifactId>
 +
  <version>LATEST</version>
 +
 +
</source>
 +
 +
'''How-to with Java:'''
 +
 +
Discover the capabilities and application types supported:
 +
 +
<source lang="java">
 +
//@Test
 +
public void testUriResolverManger() {
 +
UriResolverManager manager;
 +
try {
 +
ScopeProvider.instance.set("/gcube/devsec/devVRE");
 +
manager = new UriResolverManager();
 +
System.out.println(manager.getCapabilities());
 +
System.out.println(manager.getApplicationTypes());
 +
} catch (UriResolverMapException e) {
 +
e.printStackTrace();
 +
} catch (IllegalArgumentException e) {
 +
e.printStackTrace();
 +
}
 +
 +
}
 +
</source>
 +
 +
Invoke a ''getLink'' per type of resolver:
 +
 +
<source lang="java">
 +
 +
        //@Test
 +
public void testGIS() {
 +
 +
try {
 +
ScopeProvider.instance.set("/pred4s/preprod/preVRE");
 +
UriResolverManager resolver = new UriResolverManager("GIS");
 +
Map<String, String> params = new HashMap<String, String>();
 +
params.put("gis-UUID", "1a657005-29c6-4528-a115-69640c4c2900");
 +
params.put("scope", "/pred4s/preprod/preVRE");
 +
String shortLink = resolver.getLink(params, false);
 +
System.out.println(shortLink);
 +
} catch (UriResolverMapException e) {
 +
e.printStackTrace();
 +
} catch (IllegalArgumentException e) {
 +
e.printStackTrace();
 +
} catch (Exception e) {
 +
e.printStackTrace();
 +
}
 +
}
 +
 +
//@Test
 +
public void testCTLG() {
 +
 +
try {
 +
ScopeProvider.instance.set("/gcube/devsec/devVRE");
 +
UriResolverManager resolver;
 +
resolver = new UriResolverManager("CTLG");
 +
Map<String, String> params = new HashMap<String, String>();
 +
params.put("gcube_scope", "/gcube/devsec/devVRE");
 +
params.put("entity_context", "dataset");
 +
params.put("entity_name", "sarda-sarda");
 +
String shortLink = resolver.getLink(params, true);
 +
System.out.println(shortLink);
 +
} catch (UriResolverMapException e) {
 +
e.printStackTrace();
 +
} catch (IllegalArgumentException e) {
 +
e.printStackTrace();
 +
} catch (Exception e) {
 +
e.printStackTrace();
 +
}
 +
}
 +
 +
//@Test
 +
public void testSHUB() {
 +
 +
try {
 +
ScopeProvider.instance.set("/gcube/devsec/devVRE");
 +
UriResolverManager resolver;
 +
resolver = new UriResolverManager("SHUB");
 +
Map<String, String> params = new HashMap<String, String>();
 +
params.put("id", "1dac6703-8eb0-4838-83a8-5006f5074e9b");
 +
//params.put("content-disposition", "inline");
 +
String shortLink = resolver.getLink(params, true);
 +
System.out.println(shortLink);
 +
} catch (UriResolverMapException e) {
 +
e.printStackTrace();
 +
} catch (IllegalArgumentException e) {
 +
e.printStackTrace();
 +
} catch (Exception e) {
 +
e.printStackTrace();
 +
}
 +
}
 +
</source>
 +
 +
===== Generic Resource =====
 +
 +
In order to work, it is necessary to copy from Root scope (/d4science.research-infrastructures.eu) to the VRE where Uri Resolver Manager must work, the generic resource with following coordinates:
 +
 +
<pre>
 +
<Type>GenericResource</Type>
 +
<SecondaryType>UriResolverMap</SecondaryType>
 +
<Name>Uri-Resolver-Map</Name>
 +
</pre>
 +
 +
'''NB.''' This component uses the Runtime Resource https://gcube.wiki.gcube-system.org/gcube/URI_Resolver#Runtime_Resource

Latest revision as of 09:54, 30 June 2023

The URI Resolver is a RESTful service which gives access via HTTP(s) to different gCube Resolver services and gCube Applications (like GisViewer-App) used into the D4Science Infrastructure.

The API documentation (provided by Enunciate) is available at URI Resolver API

The code repo is available at URI Resolver code

Instances

The DEVELOPMENT instance is available at https://data.dev.d4science.org/

The PREPRODUCTION instance is available at https://data-pre.d4science.org/

The PRODUCTION instance is available at https://data.d4science.org/

Maven

The artifact is available on Nexus with the following coordinates:

  <groupId>org.gcube.data.transfer</groupId>
  <artifactId>uri-resolver</artifactId>
  <version>LATEST</version>
  <type>war</type>

Runtime Resource

The address and the configuration information of the servlet are registered on the gCube Information System as Runtime Resource (RR).

You can see the configuration through Monitor service (https://services.d4science.org/infrastructure-monitor) searching in the root scope the RR with following:

<Type>RuntimeResource</Type>
<Category>Service</Category>
<Name>HTTP-URI-Resolver</Name>

You must copy such runtime resource in VRE scope if it is need to work at VRE level

Query

The following code snippet can be used to retrieve from the gCube Information System the info to configure the resolver

 
   ScopeProvider.instance.set(THE_SCOPE);
 
   XQuery query = queryFor(ServiceEndpoint.class);
 
   query.addCondition("$resource/Profile/Name/text() eq 'HTTP-URI-Resolver'").setResult("$resource/Profile/AccessPoint");
 
   DiscoveryClient<AccessPoint> client = clientFor(AccessPoint.class);
 
   List<AccessPoint> endpoints = client.submit(query);
 
   if (endpoints.size() == 0)
	throw new Exception("No Resolver available");
 
   //Building map of Access Points linked for EntryName
   Map<String, AccessPoint> mapEntryNameForAP = new HashMap<String, AccessPoint>(endpoints.size());
 
   //Printing all access points
   for (AccessPoint accessPoint : endpoints) {
	// The AccessPoint
	System.out.println("\nEntryName: "+accessPoint.name());
	System.out.println("Description: "+accessPoint.description());
	System.out.println("Address: "+accessPoint.address());
	mapEntryNameForAP.put(accessPoint.name(), accessPoint);
 
	//Adding couple (EntryName,AccessPoint)
	Map<String, Property> propertyMap = accessPoint.propertyMap();
 
	if(propertyMap!=null) {
 
		for (String key: propertyMap.keySet()) {
			System.out.println("Property value: "+propertyMap.get(key).value());
			//...
 
		}
	}
   }
 
   //Direct access to endpoint for Catalogue Resolver 
   AccessPoint accessPoint = mapEntryNameForAP.get("ctlg");
   System.out.println("\nCatalogue Resolver - EntryName: "+accessPoint.name());
   System.out.println("Address: "+accessPoint.address());

Retrieve web service endpoint

The service endpoint URL [URI_RESOLVER_SERVICE_ENDPOINT] of Resolver's services in the environment of:

  • development
http://data.dev.d4science.org
  • prepoduction
http://data-pre.d4science.org
  • production
http://data.d4science.org

Resolvers

SMP Resolver

The first version of the component is able to give HTTP resolution to SMP protocol URIs [1].

Once deployed in a SmartGear container as Tomcat, the service can be used to resolve SMP URIs as follows:

URL url = new URL("http://<hostname>:<port>/uri-resolver/smp?smp-uri=smp://.....);

The HTTP URI can be also used to retrieve files using wget or trough a Web Browser:

[URI_RESOLVER_SERVICE_ENDPOINT]/smp?smp-uri=[STORAGE_URI]&fileName=[FILENAME]&contentType=[CONTENT_TYPE]

Apart from the smp-uri mandatory parameter, two optional paramters can be used:

  • fileName : to specify the output file name ( default: fromStorageManager)
  • contentType : to specify the output file content-type ( default: unknown/unknown)

SMP-ID Resolver

The resolver is able to give HTTP resolution to storage resource by ID [2].

[URI_RESOLVER_SERVICE_ENDPOINT]/id?smp-id=[STORAGE_SMP_ID]&fileName=[FILENAME]&contentType=[CONTENT_TYPE]

For instance, in the development environment you can download the following file with WGET command or through a Web Browser by using the link:

http://data-d.d4science.org/id?smp-id=553f9265e4b0567b75021fce&fileName=dog&contentType=image%2Fjpg

Apart from the smp-id mandatory parameter, SMP-ID Resolver uses two optional parameters (in the query string):

  • fileName : to specify the output file name (default: fromStorageManager)
  • contentType : to specify the output file content-type (default: unknown/unknown)

The two default cases above will be used if and only if the file name and content-type (mime type) cannot be read from metadata of the file saved in the Storage.

Therefore, in this order:

- Either fileName is read from query string or is read from storage metadata otherwise is default: "fromStorageManager"

- Either contentype is read from query string or is read from storage metadata otherwise is default: "unknown/unknown"

STORAGE-ID Resolver

This works as #SMP-ID Resolver using links having the format:

[URI_RESOLVER_SERVICE_ENDPOINT]/[STORAGE_ID]

HEAD HTTP: Payload validation

STORAGE-ID Resolver implements the HTTP doHead operation. It performs a payload validation (checking if it exists in the storage area) for the resource ID required:

- if the payload exists: it returns status 200 the content-type and content-disposition of the file in the HTTP response;

- if the payload does not exist: it returns status 404 in the HTTP response.

Support to parametric "Content-Disposition"

It is possible to set the content-disposition value returned in the HTTP request by the following:

[URI_RESOLVER_SERVICE_ENDPOINT]/shub/[STORAGE_HUB_FILE_ID]?content-disposition={inline,attachment}

The parameter content-disposition={inline,attachment} is optional (default value is attachment). Specifies the 'Content-Disposition' value returned in the header of the HTTP Response.

STORAGE-HUB Resolver

The StorageHub Resolver is reachable at the following path:

[URI_RESOLVER_SERVICE_ENDPOINT]/shub

It provides the methods either to download a gCube Workspace file or to get its metadata.

HTTP GET: Download a file

This method is reachable at:

[URI_RESOLVER_SERVICE_ENDPOINT]/shub/[STORAGE_HUB_FILE_ID]

and allows the download of the gCube Workspace file with ID [STORAGE_HUB_FILE_ID] via the StorageHub facility.

Support to parametric "Content-Disposition"

It is possible to set the content-disposition value returned in the HTTP request by the following:

[URI_RESOLVER_SERVICE_ENDPOINT]/shub/[STORAGE_HUB_FILE_ID]?content-disposition={inline,attachment}

The parameter content-disposition={inline,attachment} is optional (default value is attachment). Specifies the 'Content-Disposition' value returned in the header of the HTTP Response.

N.B. The parameter content-disposition is available only by (long) URL of type [URI_RESOLVER_SERVICE_ENDPOINT]/shub/[STORAGE_HUB_FILE_ID]?content-disposition={inline,attachment}. It is not managed with the short URL of type https://data{-dev,-pre,}.d4science.net/[SHORT-CODE]

HTTP HEAD: Get metadata of a file

This method is reachable at:

[URI_RESOLVER_SERVICE_ENDPOINT]/shub/[STORAGE_HUB_FILE_ID]

and allows to get the metadata of the gCube Workspace file with ID [STORAGE_HUB_FILE_ID] (the metadata are retrieved from the StorageHub component).

The response returns an HTTP Status 204 (NO_CONTENT, so it DOES NOT return a message-body) and adds the headers related to STORAGE_HUB_FILE_ID listed below:

GIS Resolver

This component is able to resolve GIS Links (as a redirect to Gis Viewer Application) in order to display and navigate on web-map the gis layers stored in iMarine Geonetwork #iMarine_GeoNetwork

HTTP GET: Resolve a Gis Link

The Gis Resolver can be used to resolve Gis Layer using a Web Browser link as follows:

[URI_RESOLVER_SERVICE_ENDPOINT]/gis?gis-UUID=[UUID]&scope=[SCOPE]

The link must include two mandatory parameters:

  • gis-UUID : to specify the Metadata Universally Unique Identifier (UUID - used in iMarine Geonetwork). The UUID identifies the gis layer which you want to show in Gis Viewer Application
  • scope : to specify the "scope" for discovering the iMarine GeoNetwork service (e.g. scope=/gcube/devsec/devVRE)
Runtime Resource

In order to work, it is necessary to copy from Root scope (/d4science.research-infrastructures.eu) to the VRE where Gis-Resolver must work, the runtime resource with following coordinates:

<Type>RuntimeResource</Type>
<Category>Service</Category>
<Name>Gis-Resolver</Name>
Generic Resource for Gis Viewer Application

It is necessary to edit the generic resource "Gis Viewer Application" in the Root scope (/d4science.research-infrastructures.eu) adding the VRE scope where the GisViewerApplication must work.

The Generic Resource "Gis Viewer Application" coordiantes are:

<Type>GenericResource</Type>
<SecondaryType>ApplicationProfile</SecondaryType>
<Name>Gis Viewer Application</Name>

CATALOGUE Resolver

This works as an HTTP Resolver to get/resolve a link to a "Catalogue Entity" stored in one of the gCube Data Catalogue's instances

A Catalogue Entity is either a "group" or an "organization" or a "product" of gCube Data Catalogue.

HTTP POST: Create an Item URL

The resolver provides HTTP POST operation to build a link to a "Catalogue Entity" stored into a specific gCube Data Catalogue.

In order to give a catalogue link for a catalogue entity is needed to pass in the body of the POST request a JSON with the fields:

  • gcube_scope as mandatory field. It is the gcube scope where to search the gCube Catalogue Portlet;
  • entity_context as mandatory field. It can be: "dataset" or "group" or "organization";
  • entity_name as mandatory field. It is the entity name (that appears in the last part of CKAN URL).
  • query_string as optional filed. Use this parameter to pass a query string (e.g. param1=value1&param2=value)

Where the JSON format is the following one:

{
"gcube_scope" : "[gcube_scope value]",
"entity_context" : "[entity_context value]",
"entity_name" : "[entity_name value]"
}

and with the optional parameter query_string the format is:

{
"gcube_scope" : "[gcube_scope value]",
"entity_context" : "[entity_context value]",
"entity_name" : "[entity_name value]",
"query_string" : "[the_query_string]"
}
How to create the Catalogue Link

You need to perform a POST request to the resolver:

[URI_RESOLVER_SERVICE_ENDPOINT]/ctlg

(to backward compatibility you can contact also):

[URI_RESOLVER_SERVICE_ENDPOINT]/catalogue

by using:

- the header parameter Content-Type: application/json;

- the body with the JSON format as above specified (the response returns an HTTP link).

An instance of body could be [ex. 1]:

{
"gcube_scope" : "/gcube/devsec/devVRE",
"entity_context" : "dataset",
"entity_name" : "sarda-sarda"
}

The HTTP Response returned:

The response returns in the body a "brief URL" in clear of kind:

[URI_RESOLVER_SERVICE_ENDPOINT]/[ctlg|ctlg-d|ctlg-o|ctlg-g]/[VRE_NAME]/[entity_name value]

Where:

ctlg | ctlg-d | ctlg-o | ctlg-g are codes to resolve the couple "catalogue"-"entity_context_value", in detail:

ctlg -> this one is default value to refer a 'dataset'

ctlg-d -> to refer respectively a 'dataset'

ctlg-o -> to refer an 'organization'

ctlg-g -> to refer a 'group'

For instance, using the request of [ex. 1] in the development environment, the HTTP response returns in the body the URL:

http://data-d.d4science.org/ctlg/devVRE/sarda-sarda
Create a Moderation Link

In order to create a Moderation Link, you need to add the `query_string` property in the JSON body with the following parameter:

  • moderation = show
  • item_name = [THE_ITEM_NAME]
  • status = [THE_ITEM_STATUS]

so the JSON body having the format:

{
"gcube_scope" : "[THE_SCOPE]",
"entity_context" : "organization",
"entity_name" : "[ORG_NAME]",
"query_string" : "moderation=show&item_name=[THE_ITEM_NAME]&status=[THE_ITEM_STATUS]"
}

E.g. With:

  • gcube_scope = /gcube/devsec/devVRE
  • entity_name = devvre
  • query_string = moderation=show&item_name=sarda-sarda&status=pending

the JSON is:

{
"gcube_scope" : "/gcube/devsec/devVRE",
"entity_context" : "organization",
"entity_name" : "devvre",
"query_string" : "moderation=show&item_name=sarda-sarda&status=pending"
}

See more at: | URI-Resolver-Manger support to Moderation Links

HTTP GET: Resolve an Item URL

The resolver provides HTTP GET operation to give HTTP resolution (as HTTP redirect) for displaying the 'entity_name' through an instance of "gCube Data Catalogue Portlet" (this last one is resolved by the 'gcube_scope' used to generate the catalogue link)

Geonetwork Resolver

The 'Geonetwork Resolver' is a "middle tier" (like a Proxy) to perform queries on gCube Geonetwork services. It uses the 'Geonetwork Manager library' to discovery Geonetwork configurations like: Geonetwork service end-point, Geonetwork accounts and so on. Using the Geonetwork configurations discovered the resolver performs authentication on Geonetwork (if needed) and then forward the requests received to harvesting metadata on that Geonetwork. Authentication is needed to get layers stored as private on Geonetwork.

The resolver is reachable at the following:

[URI_RESOLVER_SERVICE_ENDPOINT]/geonetwork

later referred like "GEONETWORK_RESOLVER_BASE_URL".

The 'Geonetwork Resolver' provides the HTTP GET method that supports the following protocol:

http[s]://[GEONETWORK_RESOLVER_BASE_URL]/[SCOPE]/[MODE]/[VISIBILITY]/[FILTER_KEY]/[FILTER_VALUE]/$$

In detail, the protocol parameters are:

  • SCOPE (mandatory): the gCube scope used via 'Geonetwork Manager library' to discovery the Geonetwork service end-point and other configurations (like Geonetwork accounts and so on). It must be separated by character pipe '|'. i.e. gcube|devNext|NextNext;
  • MODE (mandatory): must be 'VRE' or 'HARVEST'. To harvest at VRE level or External GEONETWORK level;
  • VISIBILITY (mandatory): must be 'PUB' or 'PRV'. When PUB: only public layer/s is/are returned. When PRV: only private layer/s is/are returned;
  • FILTER_KEY/FILTER_VALUE (mandatory): couple key/value passed in the path to filter on one of geonetwork:info field returned by ISO19139 schema. Only layer/s complying the filter criteria are returned (e.g. The filter category/interactiveResources returns only the layers belonging to GN category "Interactive resources"). The default value must be null/null if you don't want to apply any filter;
  • REQUEST DELIMITER (mandatory). must be '$$'. It is the delimiter to specify the end of the path.

e.g. CKAN harvester configured to retrieve metadata by the URL: https://data.d4science.org/geonetwork/d4science.research-infrastructures.eu%7CgCubeApps%7CRPrototypingLab/VRE/PRV/null/null/$$

Where:

  • GEONETWORK_RESOLVER_BASE_URL has value: https://data.d4science.org, so the Geonetwork Resolver service endepoint is: https://data.d4science.org/geonetwork;
  • SCOPE has value: 'd4science.research-infrastructures.eu|gCubeApps|RPrototypingLab';
  • MODE has value: 'VRE';
  • VISIBILITY has value: 'PRV';
  • FILTER_KEY has value: null and FILTER_VALUE has value: null;

It retrieves all private layers of the VRE RPrototypingLab.

Parthenos URL Resolver

(DRAFT) This resolver is reachable at:

[URI_RESOLVER_SERVICE_ENDPOINT]/parthenos_registry

It exposes the HTTP methods:

  • GET - to resolve an "item" from a Parthenos URL stored in the Parthenos Catalogue at https://ckan-parthenos.d4science.org/
  • POST - to get a normalized item name from a Parthenos URL. It applies a normalization function to get from an input Parthenos URL an item name that is catalogue compliant.
HTTP POST: Get normalized Item Name

The resolver provides HTTP POST operation to request a normalized item name for an input Parthenos URL.

It reads the input Parthenos URL (from the 'entity_name' field of a JSON object) and returns its normalized name (as plaintext) to the Parthenos Catalogue URL.

You need to perform a POST request to the resolver parthenos_registry by adding the HTTP header Content-Type: application/json and passing in the body a JSON object with the following format:

{
"entity_name" : "[PARTHENOS entity_name value]"
}

An instance of body could be:

{ "entity_name": "/Culturalitalia/unknown/Dataset/oai%3Aculturaitalia.it%3Aoai%3Aculturaitalia.it%3Amuseiditalia-mus_11953" }

and in this case the POST response returns:

- as plaintext in the body: culturalitalia_unknown_dataset_oaiculturaitaliaitoaiculturaitaliaitmuseiditalia_mus_11953

- as Location parameter (in the HTTP header): https://parthenos.d4science.org/group/parthenos_registry/catalogue?path=/dataset/culturalitalia_unknown_dataset_oaiculturaitaliaitoaiculturaitaliaitmuseiditalia_mus_11953

HTTP GET: Resolve a Parthenos URL

The resolver provides HTTP GET operation to return the Parthenos Catalogue URL of an "item" stored as Parthenos URL in the (Parthenos) Catalogue

You simply by resolving via browser the HTTP link of a Parthenos URL (stored in the Parthenos Catalogue), you are performing a GET request to the resolver parthenos_registry to get its Parthenos Catalogue URL.

Analytics Resolver

The resolver provides a method to get the Analytics URLs (that are simply URLs) by which is possible to invoke through the DataMiner Executor the run of an algorithm stored in a certain VRE. By the DataMiner Executor then the user is able to monitoring the algorithm execution.

The Analytics Resolver is reachable at:

[URI_RESOLVER_SERVICE_ENDPOINT]/analytics

It exposes the HTTP methods:

  • GET - to resolve an Analytics URL (created by POST method) that invokes the "run" operation for an algorithm stored in a VRE;
  • POST - to generate an Analytics URL (then resolved by GET method) for a certain algorithm of a VRE.

Information System dependencies: in order to work correctly this resolver needs to:

  • AnalyticsExecutor GR as ApplicationProfile published at VRE level in the gCube Information System;
  • Analytics-Resolver SE published at ROOT level in the gCube Information System.
HTTP POST: Create an Analytics URL

This resolver (protected by AuthZ) is reachable at the following:

[URI_RESOLVER_SERVICE_ENDPOINT]/analytics/create

It provides the HTTP POST method to create Analytics URLs. In order to obtain an Analytics URL, you need to know your gcube-token (in the VRE), the algorithm identifier and the parameters to call the algorithm/operator in the VRE.

If you know these things, you can perform a POST request to the resolver [URI_RESOLVER_SERVICE_ENDPOINT]/analytics/create by adding in the HTTP header:

  • the parameter gcube-token: [YOUR_VRE_TOKEN];
  • the parameter Content-Type: text/plain;

and passing in the body a JSON object with the following format:

# THE DATAMINER INVOCATION MODEL

{
  "dataminer-invocation": {
    "operator-id": "[THE_OPERATOR_ID]",
    "action": "RUN|SHOW|EDIT",
    "parameters": {
      "input": {
        "param": [
          {
            "key": "[key1]",
            "value": "[value1]"
          },
          {
            "key": "key2",
            "value": "value2"
          },
          ...
          {
            "key": "[keyN]",
            "value": "[valueN]"
          }
        ]
      },
      "output": {
        "param": [
          {
            "key": "[keyA]",
            "value": "[valuA]"
          },
          {
            "key": "[keyB]",
            "value": "[valueB]"
          },
          ...
          {
            "key": "[keyZ]",
            "value": "[valueZ]"
          }
        ]
      }
    }
  }
}

Where:

- "operator-id" field is Mandatory. It is the DataMiner Operator Identifier;

- "action" field is Mandatory and its value must be "RUN" or "EDIT" or "SHOW". By resolving an Analytics URL with action:

  • RUN: the DataMiner Executor invokes directly the execution of the DataMiner Operator with the input/output parameters defined in the dataminer-invocation model. Monitoring of the operator execution is shown;
  • SHOW: the DataMiner Executor shows for the DataMiner Operator a form with the input/output parameters defined in the dataminer-invocation model without edit permission. It is not possible to change the values of parameters, only the RUN is allowed;
  • EDIT (not supported yet by DataMiner Executor): the DataMiner Executor shows for the DataMiner Operator a form to edit the input/output parameters defined in the dataminer-invocation model and it allows the RUN.

- "parameters" field is Optional. It is a list of "input" and "output" parameters used to invoke/call the Operator Identifier operator-id through the DataMiner Executor.

Performing the POST request to the resolver /analytics/create with the JSON object "dataminer-invocation" as presented above, the resolver returns as plaintext in the body (and as value of header parameter Location) an Analytics URL with the following format:

[URI_RESOLVER_SERVICE_ENDPOINT]/analytics/get/[VRE_NAME]?dim=[PUBLIC_URL_TO_DATAMIER_INVOCATION_FILE_GENERATED_BY_POST_REQUEST]

e.g. By using a token of "/gcube/preprod/preVRE" VRE and passing the following "dataminer-invocation" JSON object in the body :

{
  "dataminer-invocation": {
    "operator-id": "org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.MPA_INTERSECT",
    "action": "RUN",
    "parameters": {
      "input": {
        "param": [
          {
            "key": "fileId",
            "value": "http://publicLinkToFile"
          }
        ]
      }
    }
  }
}

the POST response returns as plaintext in the body (and as value of header parameter Location) the following Analytics URL [ex.1]:

https://ADD_ANALYTICS_URL

HTTP GET: Resolve an Analytics URL

This resolver is reachable at

[URI_RESOLVER_SERVICE_ENDPOINT]/analytics/get

It provides the HTTP GET method to resolve an Analytics URL that supports the following protocol:

[URI_RESOLVER_SERVICE_ENDPOINT]/analytics/get/[VRE_NAME]?dim=[PUBLIC_URL_TO_DATAMIER_INVOCATION_FILE_GENERATED_BY_POST_REQUEST]

e.g. By clicking (so simply resolving it via browser) on the previous Analytics URL [see ex.1] it will be resolved as:

https://pre.d4science.org/group/prevre/dataminer-manager?dim=https://ADD_ANALYTICS_URL

KNIME Resolver

The resolver provides a method to get the Knime URLs (that are simply URLs) by which is possible to invoke the KNIME Model Simulation Application.

The KNIME Resolver is reachable at:

[URI_RESOLVER_SERVICE_ENDPOINT]/knime

It exposes the HTTP methods:

  • GET (at /get path) - to resolve a Knime URL (created by /create path) that invokes the KNIME Model Simulation Application for the model passed in the query string;
  • POST (at /create path) - to generate a Knime URL (then resolved by the /get path) for a KNIME Model Simulation passed by query string.

Information System dependencies: in order to work correctly this resolver needs to:

  • KnimeModelSimulationPortlet GR as ApplicationProfile published at VRE level in the gCube Information System.
HTTP POST: Create a KNIME URL

This resolver (protected by AuthZ) is reachable at the following:

[URI_RESOLVER_SERVICE_ENDPOINT]/knime/create

It provides the HTTP POST method to create Knime URLs. A valid Knime URL is generable if you know your token (in the VRE) and query string to invoke a KNIME Model Simulation.

If you know these things, in order to create a Knime URL you can perform a POST request to the resolver /knime/create at:

[URI_RESOLVER_SERVICE_ENDPOINT]/knime/create?[QUERY_STRING_TO_INVOKE_A_KNIME_MODEL]

by adding the HTTP header gcube-token: [YOUR_VRE_TOKEN] and passing the query string ([QUERY_STRING_TO_INVOKE_A_KNIME_MODEL]) and it creates a Knime URL with the following format:

[URI_RESOLVER_SERVICE_ENDPOINT]/knime/get/[VRE_NAME]?p1=v1&p2=v2&p3=v3

that via GET method provided by Knime Resolver will be forwarded to the KNIME Model Simulation Application.

HTTP GET: Resolve a KNIME URL

This resolver is reachable at

[URI_RESOLVER_SERVICE_ENDPOINT]/knime/get

It provides the HTTP GET method to resolve an Knime URL that supports the following protocol:

[URI_RESOLVER_SERVICE_ENDPOINT]/knime/get/[VRE_NAME]?p1=v1&p2=v2&p3=v3

Wekeo Resolver

The resolver provides a method to wrap the basic authentication from D4Science account to WekeoBroker service.

HTTP GET: getToken Wekeo

The getToken operation is reachable at

[URI_RESOLVER_SERVICE_ENDPOINT]/wekeo/gettoken

It provides the HTTP GET method to wrap with the gcube authentication (by gcube-token) the WekeoBroker get_accesstoken call to get the access token to WekeoBroker-service-API

You need to pass your gcube-token in the HTTP Header or in the HTTP query string as follows:

[URI_RESOLVER_SERVICE_ENDPOINT]/wekeo/gettoken?gcube-token=[YOUR_GCUBE_TOKEN]
Service Endpoint

In order to work, it is necessary to publish in the VRE the runtime resource with the following coordinates:

<Type>RuntimeResource</Type>
<Category>OnlineService</Category>
<Name>WekeoDataBroker</Name>

Geoportal Resolver

Dependencies

In order to work, it is necessary to publish in the VRE the runtime resource with the following coordinates:

<Type>RuntimeResource</Type>
<Category>Service</Category>
<Name>Geoportal-Resolver</Name>

NB. The Geoportal_Resolver requires:

  • the "URI-Resolver" (gCoreEndpoint) published at VO level with option "authorizeChild"
  • the Runtime Resource named "HTTP-URL-Shortener-DL" at VRE level

The Geoportal Resolver provides a method to create and resolve a link to Geoportal Data-Entry/Data-Viewer applications provided by D4Science

It is reachable at:

[URI_RESOLVER_SERVICE_ENDPOINT]/geo

It exposes the HTTP methods:

  • GET - to resolve a Data-Entry/Data-Viewer URL;
  • POST - to create a Data-Entry/Data-Viewer URL.
HTTP POST: Create a Data-Entry/Data-Viewer URL

It provides the following HTTP POST method to create a Data-Viewer (`dv` means Data-Viewer) URL:

[URI_RESOLVER_SERVICE_ENDPOINT]/geo/dv

It provides the following HTTP POST method to create a Data-Entry (`de` means Data-Entry) URL:

[URI_RESOLVER_SERVICE_ENDPOINT]/geo/de

You need to pass the JSON body with the following parameters:

  • gcube_scope = the gcube scope;
  • item_id = the geoportal project id;
  • item_type = the geoportal UCD id.

so the JSON body having the format:

{
  "gcube_scope":"[THE_GCUBE_SCOPE]",
  "item_id": "[THE_PROJECT_ID]",
  "item_type": "[THE_UCD_ID]"
}

example of JSON body:

{
  "gcube_scope":"/gcube/devsec/devVRE",
  "item_id": "63d011c4dcac4551b9a6b930",
  "item_type": "profiledConcessioni"
}

The Geoportal Link created is of kind {targetAppId=dv}:

[URI_RESOLVER_SERVICE_ENDPOINT]/geo/dv/{vre_name}/{usecase_id}/{project_id}
HTTP GET: Resolve a Data-Entry/Data-Viewer URL
  • It provides the following HTTP GET method to resolve a Data-Viewer (`dv` means Data-Viewer) URL:
[URI_RESOLVER_SERVICE_ENDPOINT]/geo/dv

with the remaining URL path done from: /{vre_name}/{usecase_id}/{project_id}

  • It provides the following HTTP GET method to resolve a Data-Entry (`de` means Data-Entry) URL:
[URI_RESOLVER_SERVICE_ENDPOINT]/geo/de

with the remaining URL path done from: /{vre_name}/{usecase_id}/{project_id}

  • It provides the following HTTP GET method to resolve a Data-Viewer URL:
[URI_RESOLVER_SERVICE_ENDPOINT]/geo

passing the query string parameters:

  • gcube_scope = the gcube scope;
  • item_id = the geoportal project id;
  • item_type = the geoportal UCD id;
  • res = {'public`, 'private'} resolve as public/private link.

so the query string format is:

gcube_scope=[THE_GCUBE_SCOPE]&item_id=[THE_PROJECT_ID]&item_type=[THE_UCD_ID]&res=public

example of query string:

gcube_scope=/gcube/devsec/devVRE&item_id=63d011c4dcac4551b9a6b930&item_type=profiledConcessioni&res=public

Uri Resolver Manager

The Uri Resolver Manager is a library to get a public link of a resource reachable from a (gCube) Http Resolver available in the D4Science Infrastructure.

At the moment, the resource types available are:

  • GIS - accessible by Gis-Resolver;
  • SMP-ID e SMP- accessible by SMPD[-ID]-Resolver;
  • CTLG - accessible by Catalogue-Resolver;
  • SHUB - accessible by SHUB-Resolver.
  • GEO - accessible by Geoportal-Resolver.

The Uri Resolver Manager looks up the (Generic Resource) "Uri-Resolver-Map" to read the mapping: Application Type -> (Runtime Resource of its) Resolver, e.g. GIS -> Gis-Resolver, SMP -> HTTP-URI-Resolver, etc. Currently, the mapping "Resource Type" to "RR Resolver" is made by:

GIS=Resolver [resourceName=Gis-Resolver, entryName=gis], 
CTLG=Resolver [resourceName=HTTP-URI-Resolver, entryName=ctlg], 
SHUB=Resolver [resourceName=HTTP-URI-Resolver, entryName=shub], 
SMP-ID=Resolver [resourceName=HTTP-URI-Resolver, entryName=smp-id], 
SMP=Resolver [resourceName=HTTP-URI-Resolver, entryName=smp],
GEO=Resolver [resourceName=Geoportal-Resolver, entryName=geo]

The mandatory parameters to forward correctly the HTTP request to Resolver are dynamically read from Runtime Resources (i.e. Gis-Resolver, HTTP-URI-Resolver)

Support to Catalogue Moderation (System)

The following snippet provides a utility to generate a direct Catalogue Link (called 'Moderation Link') consumable by the Content Moderation System. If the Moderation facility is enabled in the {THE_SCOPE} and either the user is the item publisher or he/she has the role of "Catalogue_Moderator", by resolving the link generated, the Content Moderation UX will be directly shown to user.

@Test
public void testCTLGGenerateLinkForModeration() {
 
  try {
	ScopeProvider.instance.set({THE_SCOPE});  //e.g. /gcube/devsec/devVRE
	UriResolverManager resolver;
	resolver = new UriResolverManager("CTLG");
	Map<String, String> params = new HashMap<String, String>();
	params.put("gcube_scope", {THE_SCOPE}); //e.g. /gcube/devsec/devVRE
	params.put("entity_context", "organization");
	params.put("entity_name", {ORGANIZATION_NAME}); //e.g. devvre
 
	CatalogueResolverQueryStringBuilder builder = new CatalogueResolverQueryStringBuilder({ITEM_NAME}); //item name under moderation
	builder.
	itemStatus({THE_STATUS}). //OPTIONAL FIELD pending, approved, rejected - init the GUI on this status;
	moderation(MODERATION_OP.show); //OPTIONAL FIELD - to specify the operation 
 
	String queryString = builder.buildQueryParametersToQueryString();
	params.put(CatalogueResolverQueryStringBuilder.QUERY_STRING_PARAMETER, queryString);
 
	String shortLink = resolver.getLink(params, true);
	System.out.println(shortLink);
  } catch (UriResolverMapException e) {
	e.printStackTrace();
  } catch (IllegalArgumentException e) {
	e.printStackTrace();
  } catch (Exception e) {
	e.printStackTrace();
  }
}

Example of Moderation Link:

https://data.dev.d4science.org/ctlg-o/devVRE/devvre?moderation=show&item_name=test-moderation-1649068829317&status=approved

Maven

The artifact is available on Nexus with the following coordinates:

   <groupId>org.gcube.portlets.user</groupId>
   <artifactId>uri-resolver-manager</artifactId>
   <version>LATEST</version>

How-to with Java:

Discover the capabilities and application types supported:

	//@Test
	public void testUriResolverManger() {
		UriResolverManager manager;
		try {
			ScopeProvider.instance.set("/gcube/devsec/devVRE");
			manager = new UriResolverManager();
			System.out.println(manager.getCapabilities());
			System.out.println(manager.getApplicationTypes());
		} catch (UriResolverMapException e) {
			e.printStackTrace();
		} catch (IllegalArgumentException e) {
			e.printStackTrace();
		}
 
	}

Invoke a getLink per type of resolver:

        //@Test
	public void testGIS() {
 
		try {
			ScopeProvider.instance.set("/pred4s/preprod/preVRE");
			UriResolverManager resolver = new UriResolverManager("GIS");
			Map<String, String> params = new HashMap<String, String>();
			params.put("gis-UUID", "1a657005-29c6-4528-a115-69640c4c2900");
			params.put("scope", "/pred4s/preprod/preVRE");
			String shortLink = resolver.getLink(params, false);
			System.out.println(shortLink);
		} catch (UriResolverMapException e) {
			e.printStackTrace();
		} catch (IllegalArgumentException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
 
	//@Test
	public void testCTLG() {
 
		try {
			ScopeProvider.instance.set("/gcube/devsec/devVRE");
			UriResolverManager resolver;
			resolver = new UriResolverManager("CTLG");
			Map<String, String> params = new HashMap<String, String>();
			params.put("gcube_scope", "/gcube/devsec/devVRE");
			params.put("entity_context", "dataset");
			params.put("entity_name", "sarda-sarda");
			String shortLink = resolver.getLink(params, true);
			System.out.println(shortLink);
		} catch (UriResolverMapException e) {
			e.printStackTrace();
		} catch (IllegalArgumentException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
 
	//@Test
	public void testSHUB() {
 
		try {
			ScopeProvider.instance.set("/gcube/devsec/devVRE");
			UriResolverManager resolver;
			resolver = new UriResolverManager("SHUB");
			Map<String, String> params = new HashMap<String, String>();
			params.put("id", "1dac6703-8eb0-4838-83a8-5006f5074e9b");
			//params.put("content-disposition", "inline");
			String shortLink = resolver.getLink(params, true);
			System.out.println(shortLink);
		} catch (UriResolverMapException e) {
			e.printStackTrace();
		} catch (IllegalArgumentException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
Generic Resource

In order to work, it is necessary to copy from Root scope (/d4science.research-infrastructures.eu) to the VRE where Uri Resolver Manager must work, the generic resource with following coordinates:

<Type>GenericResource</Type>
<SecondaryType>UriResolverMap</SecondaryType>
<Name>Uri-Resolver-Map</Name>

NB. This component uses the Runtime Resource https://gcube.wiki.gcube-system.org/gcube/URI_Resolver#Runtime_Resource