Difference between revisions of "GeoPortal Service"
(→Handler Framework) |
(→REST Interface) |
||
Line 31: | Line 31: | ||
== API == | == API == | ||
=== REST Interface === | === REST Interface === | ||
+ | This section describes the HTTP methods and interfaces exposed by the service. | ||
+ | Base relative PATH for all interfaces ('''BASE_PATH''') is "geoportal-service/srv/". | ||
+ | |||
+ | ==== Profiles ==== | ||
+ | ==== Projects ==== | ||
+ | |||
+ | ==== Concessioni ==== | ||
+ | Custom prototype interface for '''GNA''' case study available at BASE_PATH/'''mongo-concessioni''' ('''CONCESSIONI_BASE_PATH'''). | ||
+ | |||
+ | Accepted HTTP methods and sub-paths are : | ||
+ | {|class="wikitable" | ||
+ | |+ Caption: Access and search Methods | ||
+ | |- | ||
+ | !Method Name!!HTTP Method!!Sub Path!!Parameters!!Description | ||
+ | |- | ||
+ | !List | ||
+ | |GET|| || ||List al registered records | ||
+ | |- | ||
+ | !Get By Id | ||
+ | | GET ||<ID>||Path : ID || Returns the corresponding record if any | ||
+ | |- | ||
+ | !Search | ||
+ | | POST ||search||Body : Filter || Returns all records matching the Filter | ||
+ | |- | ||
+ | !Query | ||
+ | | POST ||query||Body : QueryRequest || Returns all records matching the QueryRequest | ||
+ | |} | ||
+ | |||
+ | {|class="wikitable" | ||
+ | |+ Caption: Concessioni lifecycle | ||
+ | !Method Name!!HTTP Method!!Sub Path!!Parameters!!Description | ||
+ | |- | ||
+ | !Create New | ||
+ | |POST|| ||Body ''Concessioni record||Creates a new record | ||
+ | |- | ||
+ | !Delete By ID | ||
+ | | DELETE ||<ID>||Path : ID || Deletes the corresponding record if any | ||
+ | |- | ||
+ | !Update By ID | ||
+ | | PUT ||<ID>||Path : ID || Updates the corresponding record if any | ||
+ | |- | ||
+ | !Publish By ID | ||
+ | | PUT ||publish/<ID>||Path : ID || Publishes the corresponding record if any | ||
+ | |- | ||
+ | !Unpublish By ID | ||
+ | | DELETE ||publish/<ID>||Path : ID || Unpublishes the corresponding record if any | ||
+ | |- | ||
+ | !Register FileSet By ID | ||
+ | | POST ||registerFiles/<ID>||Path : ID,</br>Body : FileSet || Registers the FileSet into the corresponding record if any | ||
+ | |} | ||
+ | |||
+ | {|class="wikitable" | ||
+ | |+ Caption: Management | ||
+ | !Method Name!!HTTP Method!!Sub Path!!Parameters!!Description | ||
+ | |- | ||
+ | !Get Configuration | ||
+ | |HEAD|| || ||Returns the current environment configuration | ||
+ | |- | ||
+ | !Replace | ||
+ | |PUT|| ||Body : ''Concessioni'' record||Replaces any existing record with the same ID (if any) as passed parameter's | ||
+ | |} | ||
+ | |||
=== Client Library === | === Client Library === | ||
Java client library to interact with the service is distributed as maven artifact | Java client library to interact with the service is distributed as maven artifact |
Revision as of 16:09, 31 August 2021
GeoPortal Service is a new REST service designed to manage complex space-temporal Documents defined by metadata Profiles. It has been released as a component of the gCube framework, and SmartGears powers it. It has been designed to manage publication lifecycle of complex space-temporal Documents, supporting their materialization & Indexing in different platforms (Databases, Catalogues, OGC Services..) and maximising reusability.
Contents
Overview
Users can define their model as a Profile in the VRE and then manage their Documents publication lifecycle both via gateway’s GUIs and by interacting with the service’s API (both JAVA and/or REST). The service provides a set of Handlers which can be declared and configured in the Profile (defaults apply) in order to be invoked in the different phases of the publication lifecycle. The set of Event Handlers is dynamically loaded by the service allowing support for custom implementation of Event Handlers. The provided java client library allows for dynamic model Serialization / Deserialization of custom provided Java model classes, allowing for easy integration of different systems.
Its main features are :
- Documents Publication Management
- CRUD (Create, Read, Update, Delete) operations, publication lifecycle, Profiles-based validation;
- Role-based access to resources and metadata sections;
- Cooperative workflow;
- Automatic Indexing & aggregation based on Profiles annotations
- GIS indexes (both centroids & multi-polygon), with dynamic aggregation based on zoom level;
- Text indexes;
- Time indexes and aggregation;
- Extensible Document model
- Generic meta-model Profile;
- Custom extensions of the model;
- Extensible behaviour
- Core engine based on a meta-model;
- Publication management implemented by an extendable set of Event Handlers;
- Behaviour configured in Profiles by declaring Event Handlers call in cascade;
Architecture
API
REST Interface
This section describes the HTTP methods and interfaces exposed by the service. Base relative PATH for all interfaces (BASE_PATH) is "geoportal-service/srv/".
Profiles
Projects
Concessioni
Custom prototype interface for GNA case study available at BASE_PATH/mongo-concessioni (CONCESSIONI_BASE_PATH).
Accepted HTTP methods and sub-paths are :
Method Name | HTTP Method | Sub Path | Parameters | Description |
---|---|---|---|---|
List | GET | List al registered records | ||
Get By Id | GET | <ID> | Path : ID | Returns the corresponding record if any |
Search | POST | search | Body : Filter | Returns all records matching the Filter |
Query | POST | query | Body : QueryRequest | Returns all records matching the QueryRequest |
Method Name | HTTP Method | Sub Path | Parameters | Description |
---|---|---|---|---|
Create New | POST | Body Concessioni record | Creates a new record | |
Delete By ID | DELETE | <ID> | Path : ID | Deletes the corresponding record if any |
Update By ID | PUT | <ID> | Path : ID | Updates the corresponding record if any |
Publish By ID | PUT | publish/<ID> | Path : ID | Publishes the corresponding record if any |
Unpublish By ID | DELETE | publish/<ID> | Path : ID | Unpublishes the corresponding record if any |
Register FileSet By ID | POST | registerFiles/<ID> | Path : ID,</br>Body : FileSet | Registers the FileSet into the corresponding record if any |
Method Name | HTTP Method | Sub Path | Parameters | Description |
---|---|---|---|---|
Get Configuration | HEAD | Returns the current environment configuration | ||
Replace | PUT | Body : Concessioni record | Replaces any existing record with the same ID (if any) as passed parameter's |
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 :
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.mongoConcessioni;
...
Concessione c=...
//Register New Concessione
c=client.createNew(c);
// Upload files to Concessione Section by Path (e.g. Relazione)
String mongoId=c.getMongo_id();
List<TempFile> files=...
AddSectionToConcessioneRequest request= new AddSectionToConcessioneRequest(Paths.RELAZIONE, files);
client.registerFile(mongoId, request);
// Publish
client.publish(mongoId);
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);