* Clients perform both CRUD and Query operations against the service both via using the client library or by directly interacting with the service REST interface.
* They interact with the service producing the custom metadata document (stored in a Document Store DB) and registering related Filesets (stored in gCube StorageHub).
* Clients sends steps (pre configured in the collection UCD) requests to the service, which in turn delegate Lifecycle operations to configured implementations.
* Clients may also directly consume materialized projects in ad hoc engines (e.g. SDI or DBMS). For this purpose, the service exposes information needed by the client in order to properly consume the project collection.
gCube CMS Service is a gCube REST-like Application developped on top of gCube SmartGears.
It implements the core business logic of gCube CMS Suite, exposing methods for the management of Projects, Use Case Descriptors and available server plugins.
It is built on top of Jersey Framework, it uses a MongoDB Document Store for JSON archiving and Querying.
It exploits the infrastructure StorageHub for archiving FileSets and the Information System in order to discover available resources.
Clients can register Filesets with JSON requests with the following fields :
***fieldName** : target field name
***parentPath** : the target field's parent
***fieldDefinitionPath** : JSONPath of the target field definition in UCD schema
***streams** : list of JSON objects representing the fileset's payload and filenames. Payload can be specified either as **gCube Storage Hub volatile area ID** or as **URL**
***clashOptions** : one of **REPLACE_EXISTING**, **MERGE_EXISTING**, **APPEND**
***toSetAccess** [optional]: to set access policy for the fileset. Default is taken from the UCD.
***attributes** [optional] : additional attributes to set to the FileSet.
Following example is taken from *Concessioni* use case submission :
Following are examples of queries towards collections (in some of the following example we consider structure and lifecycle from *"Concessioni"* UCD) :
Some resources are generated by the service in the normal execution of Projects lifecycle (e.g. indexes).
The service exposes the following informations in order to allow clients (e.g. GUIs) to properly consume these resources.
.. alert :: Format of the resource representation vary according to their nature in order to adapt to the needs of the collection's lifecycle.
***indexes** : A set of generated indexes (e.g. SDI centroid layers)
***archives** : A set of generated archive (e.g. Document archive) along with related information.
***errorMessages** : A set of error messages reporting errors in generating the current response
***warningMessages** : A set of warning messages reporting unexpected behaviour in generating the current response
***status** : the global status.
.. note :: In the current implementation all collection uses the same **DOCUMENT-STORE-COLLECTION** (based on MongoDB) and **W-STORAGE** (based on gCube StorageHub).
.. note :: **DOCUMENT-STORE-COLLECTION** archive also reports aggregated Projects count by PHASE and STATUS.
Following is an example of the returned information
Projects metadata are stored as JSON document in a Document Store DB (powered by MongoDB) called Project archive. The core logic of Project management lies in the class *org.gcube.application.geoportal.service.engine.mongo.ProfiledMongoManager*, which is the only component in charge of accessing the Project archive, in order to grant robustness via isolation.
.. note :: In order to execute both lifecyle **EVENTs** and **STEPs**, the service locates the configured LifecycleManager handler and passes to them requests with all the required information (check **Plugin Framework** below).
*ProfiledMongoManager* class implements the following lock mechanism for all writing executions (here represented for the STEP execution scenario for completeness).
In order to isolate logic, Plugins are discovered via reflection.
Plugins are thus expected to implement the proper interface, choosing between the ones defined in the framework and listed below.
.. alert :: Plugins **SHOULD** depend **only** by the Plugin Framework and their specific dependencies.
The framework provides also :
* Definition of all involved **Requests**, **Response** and **Faults** beans
* Basic plugin implementations for common use cases, that can be extended for custom solutions (e.g. AbstractLifeCycleManager, SingleLifecycleManager, Default3PhaseManager)
* Common utilities for plugin discovery (e.g. for Lifecycle Manager to invoke Materializers and Indexers)
***Engine Provider** in order to allow plugins to access implementations provided by the service
*org.gcube.application.cms.implementations.ImplementationProvider* class represents a common point of implementations reference for both the service and plugins.
It exposes registered implementations by asking for an Engine (generic interface *org.gcube.application.cms.caches.Engine*<T>) responsible to provide a specific object class.
The service (or a startup environment, e.g. for testing purposes) is expected to register the implemented Engines at startup.
.. note ::Some of the provided engines also implements **Cache** (generic cache) and **AbstractScopedMap** (per context cache).
In the following list there are all **Engine<T>** implementations provided by the service and available to Plugins :
* MongoClientProvider provided class T : org.gcube.application.geoportal.service.model.internal.db.Mongo
* ProjectAccessProvider provided class T : org.gcube.application.cms.implementations.ProjectAccess
* StorageClientProvider provided class T : org.gcube.application.geoportal.common.utils.StorageUtils
* SingleISResourceUCDProviderp rovided class T : org.gcube.application.geoportal.service.engine.providers.ucd.ProfileMap
* PluginManager provided class T : org.gcube.application.geoportal.service.engine.providers.PluginManager.PluginMap
* UCDManager provided class T : org.gcube.application.geoportal.service.engine.mongo.UCDManagerI
* ConfigurationCacheprovided class T : org.gcube.application.geoportal.service.engine.providers.ConfigurationCache.ConfigurationMap
The following is a list of defined plugin interfaces, which implementations are expected to implement in order to make themself available.
Following diagram shows the interfaces defined in the framework (package *org.gcube.application.cms.plugins*)
.. figure :: _static/imgs/plugin_interfaces.png
:alt:Plugin interfaces
.. note :: **Plugin** interface as root of the above hierarchy grants common behaviour to all plugins, i.e. the exposition of PluginDescriptor object, which information are returned by the service Plugin REST interface.
In order to facilitate the development of plugins, the following solutions may be of use to the developer :
* extension of an already provided LifecycleManager in order to override default behaviour (e.g. as per *Concessioni* UCD, see suite module concessioni-lifecycle)
* extension of *org.gcube.application.cms.plugins.AbstractPlugin* class in order to leverage on common behaiovur (e.g. configuration management, error handling)
* extension of *org.gcube.application.cms.caches.AbstractScopedMap* or *org.gcube.application.cms.caches.TimedMap* for easy implementation of caches (respectively by context and global)
* leverage on module *cms-test-commons* for exploitation of context management, basic plugin testing (both static and in a gCube context)