Difference between revisions of "GeoPortal Service"

From Gcube Wiki
Jump to: navigation, search
(ConcessioniManagerI)
(Utility Classes =)
Line 64: Line 64:
 
</source>
 
</source>
  
==== Utility Classes =====
+
==== Utility Classes ====
 
===== StorageUtils =====
 
===== StorageUtils =====
 
In order to transfer FileSets to the REST service, an utility class is provided, allowing for the management of infrastructure's TempFiles.
 
In order to transfer FileSets to the REST service, an utility class is provided, allowing for the management of infrastructure's TempFiles.
Line 70: Line 70:
  
 
<source lang="xml">
 
<source lang="xml">
 +
StorageUtils storage=new StorageUtils();
  
 +
InputStream myPayload=...
 +
String payloadName=...
 +
 +
TempFile toUpload=storage.putOntoStorage(myPayload, payloadName);
 
</source>
 
</source>
  
 
== Handler Framework ==
 
== Handler Framework ==

Revision as of 17:31, 13 January 2021

Overview

Architecture

Components

API

REST Interface

Client Library

Java client library to interact with the service is distributed as maven artifact

<groupId>org.gcube.application</groupId>
<artifactId>geoportal-client</artifactId>


The library offers various wrappings of the REST interface, allowing for :

  • Both Custom & Generic management of Profiled Documents ;
  • Both Custom & Generic automatic parsing of JSON communications over REST interface;
  • Transparent authentication and service discovery, thanks to gCube Framework;

Generic Profiled Documents Managers

  • ProfiledDocumentsManagerI : JAVA interface for the management of Profiled Documents.

Custom Concessioni Managers

The library provides the following customized versions of the generic clients in order to manage Concessioni Documents :

MongoConcessioni

Interface for the stateless management of Concessioni Documents. It reflects the contract of the generic REST API. Following snippet shows typical usage :

 
ConcessioniManagerI

Interface for the statefull creation of Concessioni Documents. Stateful logic helps client to manage the management of the last loaded/registered Concessione, offering dedicated methods for adding FileSets (e.g. RelazioneScavo) to the current Document.

Following snippet shows typical usage :

import org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
....
 
//Obtain the client
ConcessioniManagerI manager=statefulMongoConcessioni().build();
...
 
//Create a new Document from scratch
Concessione c = ...
...
manager.createNew(c);
 
//Adds an UploadedImage to the current document
 
UploadedImage toRegisterImg= ...
TempFile toUpload=....
 
manager.addImmagineRappresentativa(toRegisterImg, toUpload);
 
 
//Publishes current object
manager.publish();

Utility Classes

StorageUtils

In order to transfer FileSets to the REST service, an utility class is provided, allowing for the management of infrastructure's TempFiles. Following snippet is a typical usage :

StorageUtils storage=new StorageUtils();
 
InputStream myPayload=...
String payloadName=...
 
TempFile toUpload=storage.putOntoStorage(myPayload, payloadName);

Handler Framework