Pom 1.0.2-SNAPSHOT

This commit is contained in:
Fabio Sinibaldi 2022-02-24 18:09:30 +01:00
parent 221fb36c78
commit 7c0e615429
83 changed files with 2792 additions and 191 deletions

View File

@ -2,6 +2,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for org.gcube.spatial.data.gcube-sdi-suite
## [v1.0.2-SNAPSHOT] - 2021-02-24
-Introduced module sdi-plugins
-Introduced module notifications-plugins
-Introduced module dataminer-plugins
-Introduced module images-plugins
-Introduced module ckan-plugin
## [v1.0.1] - 2021-12-07
- Introduced cms-plugin-framework
- Introduced concessioni use case

8
ckan-plugin/CHANGELOG.md Normal file
View File

@ -0,0 +1,8 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms.ckan-plugin
This library contains gcube-cms plugins for ckan materializations
## [v1.0.0-SNAPSHOT] - 2022-02-24
- First release

26
ckan-plugin/FUNDING.md Normal file
View File

@ -0,0 +1,26 @@
# Acknowledgments
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
- the H2020 research and innovation programme
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);

312
ckan-plugin/LICENSE.md Normal file
View File

@ -0,0 +1,312 @@
# European Union Public Licence V. 1.1
EUPL © the European Community 2007
This European Union Public Licence (the “EUPL”) applies to the Work or Software
(as defined below) which is provided under the terms of this Licence. Any use of
the Work, other than as authorised under this Licence is prohibited (to the
extent such use is covered by a right of the copyright holder of the Work).
The Original Work is provided under the terms of this Licence when the Licensor
(as defined below) has placed the following notice immediately following the
copyright notice for the Original Work:
Licensed under the EUPL V.1.1
or has expressed by any other mean his willingness to license under the EUPL.
## 1. Definitions
In this Licence, the following terms have the following meaning:
- The Licence: this Licence.
- The Original Work or the Software: the software distributed and/or
communicated by the Licensor under this Licence, available as Source Code and
also as Executable Code as the case may be.
- Derivative Works: the works or software that could be created by the Licensee,
based upon the Original Work or modifications thereof. This Licence does not
define the extent of modification or dependence on the Original Work required
in order to classify a work as a Derivative Work; this extent is determined by
copyright law applicable in the country mentioned in Article 15.
- The Work: the Original Work and/or its Derivative Works.
- The Source Code: the human-readable form of the Work which is the most
convenient for people to study and modify.
- The Executable Code: any code which has generally been compiled and which is
meant to be interpreted by a computer as a program.
- The Licensor: the natural or legal person that distributes and/or communicates
the Work under the Licence.
- Contributor(s): any natural or legal person who modifies the Work under the
Licence, or otherwise contributes to the creation of a Derivative Work.
- The Licensee or “You”: any natural or legal person who makes any usage of the
Software under the terms of the Licence.
- Distribution and/or Communication: any act of selling, giving, lending,
renting, distributing, communicating, transmitting, or otherwise making
available, on-line or off-line, copies of the Work or providing access to its
essential functionalities at the disposal of any other natural or legal
person.
## 2. Scope of the rights granted by the Licence
The Licensor hereby grants You a world-wide, royalty-free, non-exclusive,
sub-licensable licence to do the following, for the duration of copyright vested
in the Original Work:
- use the Work in any circumstance and for all usage, reproduce the Work, modify
- the Original Work, and make Derivative Works based upon the Work, communicate
- to the public, including the right to make available or display the Work or
- copies thereof to the public and perform publicly, as the case may be, the
- Work, distribute the Work or copies thereof, lend and rent the Work or copies
- thereof, sub-license rights in the Work or copies thereof.
Those rights can be exercised on any media, supports and formats, whether now
known or later invented, as far as the applicable law permits so.
In the countries where moral rights apply, the Licensor waives his right to
exercise his moral right to the extent allowed by law in order to make effective
the licence of the economic rights here above listed.
The Licensor grants to the Licensee royalty-free, non exclusive usage rights to
any patents held by the Licensor, to the extent necessary to make use of the
rights granted on the Work under this Licence.
## 3. Communication of the Source Code
The Licensor may provide the Work either in its Source Code form, or as
Executable Code. If the Work is provided as Executable Code, the Licensor
provides in addition a machine-readable copy of the Source Code of the Work
along with each copy of the Work that the Licensor distributes or indicates, in
a notice following the copyright notice attached to the Work, a repository where
the Source Code is easily and freely accessible for as long as the Licensor
continues to distribute and/or communicate the Work.
## 4. Limitations on copyright
Nothing in this Licence is intended to deprive the Licensee of the benefits from
any exception or limitation to the exclusive rights of the rights owners in the
Original Work or Software, of the exhaustion of those rights or of other
applicable limitations thereto.
## 5. Obligations of the Licensee
The grant of the rights mentioned above is subject to some restrictions and
obligations imposed on the Licensee. Those obligations are the following:
Attribution right: the Licensee shall keep intact all copyright, patent or
trademarks notices and all notices that refer to the Licence and to the
disclaimer of warranties. The Licensee must include a copy of such notices and a
copy of the Licence with every copy of the Work he/she distributes and/or
communicates. The Licensee must cause any Derivative Work to carry prominent
notices stating that the Work has been modified and the date of modification.
Copyleft clause: If the Licensee distributes and/or communicates copies of the
Original Works or Derivative Works based upon the Original Work, this
Distribution and/or Communication will be done under the terms of this Licence
or of a later version of this Licence unless the Original Work is expressly
distributed only under this version of the Licence. The Licensee (becoming
Licensor) cannot offer or impose any additional terms or conditions on the Work
or Derivative Work that alter or restrict the terms of the Licence.
Compatibility clause: If the Licensee Distributes and/or Communicates Derivative
Works or copies thereof based upon both the Original Work and another work
licensed under a Compatible Licence, this Distribution and/or Communication can
be done under the terms of this Compatible Licence. For the sake of this clause,
“Compatible Licence” refers to the licences listed in the appendix attached to
this Licence. Should the Licensees obligations under the Compatible Licence
conflict with his/her obligations under this Licence, the obligations of the
Compatible Licence shall prevail.
Provision of Source Code: When distributing and/or communicating copies of the
Work, the Licensee will provide a machine-readable copy of the Source Code or
indicate a repository where this Source will be easily and freely available for
as long as the Licensee continues to distribute and/or communicate the Work.
Legal Protection: This Licence does not grant permission to use the trade names,
trademarks, service marks, or names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the copyright notice.
## 6. Chain of Authorship
The original Licensor warrants that the copyright in the Original Work granted
hereunder is owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each Contributor warrants that the copyright in the modifications he/she brings
to the Work are owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each time You accept the Licence, the original Licensor and subsequent
Contributors grant You a licence to their contributions to the Work, under the
terms of this Licence.
## 7. Disclaimer of Warranty
The Work is a work in progress, which is continuously improved by numerous
contributors. It is not a finished work and may therefore contain defects or
“bugs” inherent to this type of software development.
For the above reason, the Work is provided under the Licence on an “as is” basis
and without warranties of any kind concerning the Work, including without
limitation merchantability, fitness for a particular purpose, absence of defects
or errors, accuracy, non-infringement of intellectual property rights other than
copyright as stated in Article 6 of this Licence.
This disclaimer of warranty is an essential part of the Licence and a condition
for the grant of any rights to the Work.
## 8. Disclaimer of Liability
Except in the cases of wilful misconduct or damages directly caused to natural
persons, the Licensor will in no event be liable for any direct or indirect,
material or moral, damages of any kind, arising out of the Licence or of the use
of the Work, including without limitation, damages for loss of goodwill, work
stoppage, computer failure or malfunction, loss of data or any commercial
damage, even if the Licensor has been advised of the possibility of such
damage. However, the Licensor will be liable under statutory product liability
laws as far such laws apply to the Work.
## 9. Additional agreements
While distributing the Original Work or Derivative Works, You may choose to
conclude an additional agreement to offer, and charge a fee for, acceptance of
support, warranty, indemnity, or other liability obligations and/or services
consistent with this Licence. However, in accepting such obligations, You may
act only on your own behalf and on your sole responsibility, not on behalf of
the original Licensor or any other Contributor, and only if You agree to
indemnify, defend, and hold each Contributor harmless for any liability incurred
by, or claims asserted against such Contributor by the fact You have accepted
any such warranty or additional liability.
## 10. Acceptance of the Licence
The provisions of this Licence can be accepted by clicking on an icon “I agree”
placed under the bottom of a window displaying the text of this Licence or by
affirming consent in any other similar way, in accordance with the rules of
applicable law. Clicking on that icon indicates your clear and irrevocable
acceptance of this Licence and all of its terms and conditions.
Similarly, you irrevocably accept this Licence and all of its terms and
conditions by exercising any rights granted to You by Article 2 of this Licence,
such as the use of the Work, the creation by You of a Derivative Work or the
Distribution and/or Communication by You of the Work or copies thereof.
## 11. Information to the public
In case of any Distribution and/or Communication of the Work by means of
electronic communication by You (for example, by offering to download the Work
from a remote location) the distribution channel or media (for example, a
website) must at least provide to the public the information requested by the
applicable law regarding the Licensor, the Licence and the way it may be
accessible, concluded, stored and reproduced by the Licensee.
## 12. Termination of the Licence
The Licence and the rights granted hereunder will terminate automatically upon
any breach by the Licensee of the terms of the Licence.
Such a termination will not terminate the licences of any person who has
received the Work from the Licensee under the Licence, provided such persons
remain in full compliance with the Licence.
## 13. Miscellaneous
Without prejudice of Article 9 above, the Licence represents the complete
agreement between the Parties as to the Work licensed hereunder.
If any provision of the Licence is invalid or unenforceable under applicable
law, this will not affect the validity or enforceability of the Licence as a
whole. Such provision will be construed and/or reformed so as necessary to make
it valid and enforceable.
The European Commission may publish other linguistic versions and/or new
versions of this Licence, so far this is required and reasonable, without
reducing the scope of the rights granted by the Licence. New versions of the
Licence will be published with a unique version number.
All linguistic versions of this Licence, approved by the European Commission,
have identical value. Parties can take advantage of the linguistic version of
their choice.
## 14. Jurisdiction
Any litigation resulting from the interpretation of this License, arising
between the European Commission, as a Licensor, and any Licensee, will be
subject to the jurisdiction of the Court of Justice of the European Communities,
as laid down in article 238 of the Treaty establishing the European Community.
Any litigation arising between Parties, other than the European Commission, and
resulting from the interpretation of this License, will be subject to the
exclusive jurisdiction of the competent court where the Licensor resides or
conducts its primary business.
## 15. Applicable Law
This Licence shall be governed by the law of the European Union country where
the Licensor resides or has his registered office.
This licence shall be governed by the Belgian law if:
- a litigation arises between the European Commission, as a Licensor, and any
- Licensee; the Licensor, other than the European Commission, has no residence
- or registered office inside a European Union country.
## Appendix
“Compatible Licences” according to article 5 EUPL are:
- GNU General Public License (GNU GPL) v. 2
- Open Software License (OSL) v. 2.1, v. 3.0
- Common Public License v. 1.0
- Eclipse Public License v. 1.0
- Cecill v. 2.0

52
ckan-plugin/README.md Normal file
View File

@ -0,0 +1,52 @@
gCube CMS Suite
--------------------------------------------------
gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles.
## Built with
* [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework
* [OpenJDK](https://openjdk.java.net/) - The JDK used
* [JAX-RS](https://github.com/eclipse-ee4j/jaxrs-api) - Java™ API for RESTful Web Services
* [Jersey](https://jersey.github.io/) - JAX-RS runtime
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service).
## Change log
See [CHANGELOG.md](CHANGELOG.md).
## License
This project is licensed under the EUPL V.1.1 License - see the [LICENSE.md](LICENSE.md) file for details.
## About the gCube Framework
This software is part of the [gCubeFramework](https://www.gcube-system.org/ "gCubeFramework"): an
open-source software toolkit used for building and operating Hybrid Data
Infrastructures enabling the dynamic deployment of Virtual Research Environments
by favouring the realisation of reuse oriented policies.
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- DILIGENT (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- D4Science (grant no. 212488);
- D4Science-II (grant no.239019);
- ENVRI (grant no. 283465);
- iMarine(grant no. 283644);
- EUBrazilOpenBio (grant no. 288754).
- the H2020 research and innovation programme
- SoBigData (grant no. 654024);
- PARTHENOS (grant no. 654119);
- EGIEngage (grant no. 654142);
- ENVRIplus (grant no. 654182);
- BlueBRIDGE (grant no. 675680);
- PerformFish (grant no. 727610);
- AGINFRAplus (grant no. 731001);
- DESIRA (grant no. 818194);
- ARIADNEplus (grant no. 823914);
- RISIS2 (grant no. 824091);

48
ckan-plugin/pom.xml Normal file
View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>ckan-plugins</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>gCube CMS - CKAN Plugins</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.2-SNAPSHOT</version>
</parent>
<properties>
<gitBaseUrl>https://code-repo.d4science.org/gCubeSystem</gitBaseUrl>
</properties>
<scm>
<connection>scm:git:${gitBaseUrl}/gcube-cms-suite</connection>
<developerConnection>scm:git:${gitBaseUrl}/gcube-cms-suite</developerConnection>
<url>${gitBaseUrl}/gcube-cms-suite</url>
</scm>
<dependencies>
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>cms-plugin-framework</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>cms-test-commons</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -9,7 +9,7 @@
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
</parent>

View File

@ -1,5 +1,6 @@
package org.gcube.application.cms.plugins;
import org.gcube.application.cms.plugins.faults.InvalidProfileException;
import org.gcube.application.cms.plugins.model.PluginDescriptor;
import org.gcube.application.cms.plugins.reports.DocumentHandlingReport;
import org.gcube.application.cms.plugins.requests.BaseExecutionRequest;
@ -7,6 +8,7 @@ import org.gcube.application.geoportal.common.model.profile.HandlerDeclaration;
import org.gcube.application.geoportal.common.model.profile.Profile;
import java.util.List;
import java.util.Map;
public abstract class AbstractPlugin implements Plugin{
@ -14,10 +16,13 @@ public abstract class AbstractPlugin implements Plugin{
protected HandlerDeclaration getConfigurationFromProfile(Profile profile){
return getMultipleDeclarationsFromProfile(profile).get(0);
protected HandlerDeclaration getConfigurationFromProfile(Profile profile) throws InvalidProfileException{
return getMultipleDeclarationsFromProfile(profile).get(0);
}
protected List<HandlerDeclaration> getMultipleDeclarationsFromProfile(Profile p){
return p.getHandlersMap().get(getDescriptor().getId());
protected List<HandlerDeclaration> getMultipleDeclarationsFromProfile(Profile p)throws InvalidProfileException {
Map<String,List<HandlerDeclaration>> map = p.getHandlersMapByID();
if(map.containsKey(getDescriptor().getId()))
return map.get(getDescriptor().getId());
else throw new InvalidProfileException("No Configuration found for "+getDescriptor().getId()+" in "+p.getId());
}
}

View File

@ -0,0 +1,45 @@
package org.gcube.application.cms.plugins;
import lombok.extern.slf4j.Slf4j;
import org.reflections.Reflections;
import org.reflections.util.ConfigurationBuilder;
import org.reflections.util.FilterBuilder;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@Slf4j
public class PluginsReflections {
/** Loads Plugin implementation classes. It should only be accessed once by Plugin Manager
* Plugins shouldn't access this unless this class for testing purposes.
* @return
*/
public static Map<String,Plugin> load(){
Map<String,Plugin> toReturn=new HashMap<>();
log.warn("WARNING!! LOADING PLUGIN SET : THIS SHOULD HAPPEN ONLY ONCE");
Reflections reflections = new Reflections(
new ConfigurationBuilder()
.forPackage("org.gcube.application.cms")
.filterInputsBy(new FilterBuilder().includePackage("org.gcube.application.cms")));
reflections.getSubTypesOf(Plugin.class).iterator().forEachRemaining(pluginClass->{
if(!pluginClass.isInterface() && !Modifier.isAbstract(pluginClass.getModifiers())){
try {
Plugin plugin = pluginClass.newInstance();
log.debug("Loading {} description : {}", plugin, plugin.getDescriptor());
toReturn.put(plugin.getDescriptor().getId(), plugin);
}catch (Throwable t){
log.warn("Unable to instantiate Plugin "+pluginClass,t);
}
}
});
return toReturn;
}
}

View File

@ -0,0 +1,22 @@
package org.gcube.application.cms.plugins.faults;
public class InvalidProfileException extends Exception {
public InvalidProfileException() {
}
public InvalidProfileException(String message) {
super(message);
}
public InvalidProfileException(String message, Throwable cause) {
super(message, cause);
}
public InvalidProfileException(Throwable cause) {
super(cause);
}
public InvalidProfileException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}

View File

@ -26,7 +26,7 @@ public class DocumentHandlingReport<T extends BaseExecutionRequest> extends Repo
public DocumentHandlingReport(@NonNull T theRequest) {
this.theRequest = theRequest;
toSetLifecycleInformation=theRequest.getDocument().getLifecycleInformation().cleanState();
toSetLifecycleInformation=theRequest.getDocument().getLifecycleInformation();
resultingDocument = theRequest.getDocument().getTheDocument();
}

View File

@ -14,7 +14,10 @@ import java.util.List;
public class StepExecutionReport extends DocumentHandlingReport<StepExecutionRequest>{
public StepExecutionReport(@NonNull StepExecutionRequest theRequest) {
super(theRequest);
this.getToSetLifecycleInformation().cleanState();
this.getToSetLifecycleInformation().setLastInvokedStep(theRequest.getStep());
}
List<EventExecutionRequest> toTriggerEvents;

View File

@ -1,12 +1,14 @@
package org.gcube.application.cms.plugins.requests;
import lombok.Data;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
import org.gcube.application.geoportal.common.model.profile.Profile;
@Data
@ToString(callSuper = true)
public class EventExecutionRequest extends BaseExecutionRequest{
public static class Events{

View File

@ -1,5 +1,8 @@
package org.gcube.application.cms.plugins.requests;
import lombok.ToString;
@ToString(callSuper = true)
public class IndexDocumentRequest extends BaseExecutionRequest{
}

View File

@ -1,12 +1,12 @@
package org.gcube.application.cms.plugins.requests;
import lombok.Data;
import lombok.ToString;
import org.bson.Document;
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
import org.gcube.application.geoportal.common.model.profile.Profile;
@Data
@ToString(callSuper = true)
public class MaterializationRequest extends BaseExecutionRequest{
}

View File

@ -1,6 +1,7 @@
package org.gcube.application.cms.plugins.requests;
import lombok.Data;
import lombok.ToString;
import org.bson.Document;
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
import org.gcube.application.geoportal.common.model.document.accounting.Context;
@ -8,6 +9,7 @@ import org.gcube.application.geoportal.common.model.document.accounting.User;
import org.gcube.application.geoportal.common.model.profile.Profile;
@Data
@ToString(callSuper = true)
public class StepExecutionRequest extends BaseExecutionRequest{
public static class Steps{

View File

@ -12,7 +12,7 @@
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
</parent>

View File

@ -2,8 +2,12 @@ package org.gcube.application.cms.tests;
import ch.qos.logback.core.net.SyslogOutputStream;
import org.gcube.application.cms.plugins.InitializablePlugin;
import org.gcube.application.cms.plugins.MaterializationPlugin;
import org.gcube.application.cms.plugins.Plugin;
import org.gcube.application.cms.plugins.PluginsReflections;
import org.gcube.application.cms.plugins.faults.InitializationException;
import org.gcube.application.cms.plugins.requests.MaterializationRequest;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
@ -13,36 +17,24 @@ import org.reflections.util.ConfigurationBuilder;
import org.reflections.util.FilterBuilder;
import java.rmi.ServerError;
import java.util.ArrayList;
import java.util.List;
import java.util.ServiceLoader;
import java.util.concurrent.atomic.AtomicLong;
import static org.junit.Assume.assumeTrue;
public class BasicPluginTest {
static List<Plugin> plugins;
protected String context;
static List<Plugin> plugins=new ArrayList<>();
@BeforeClass
public static void checkPluginRegistration() {
Reflections reflections = new Reflections(
new ConfigurationBuilder()
.forPackage("org.gcube.application.cms")
.filterInputsBy(new FilterBuilder().includePackage("org.gcube.application.cms")));
reflections.getSubTypesOf(Plugin.class).iterator().forEachRemaining(pluginClass->{
if(!pluginClass.isInterface()){
try {
Plugin plugin = pluginClass.newInstance();
plugins.add(plugin);
}catch (Throwable t){
t.printStackTrace(System.err);
Assert.fail("Unable to Load "+pluginClass);
}
}
});
plugins.addAll(PluginsReflections.load().values());
plugins.forEach(plugin -> System.out.println());
Assert.assertFalse(plugins.isEmpty());
System.out.println("Plugin Loading OK");
@ -50,7 +42,7 @@ public class BasicPluginTest {
@Test
public void basicChecks(){
public void init(){
plugins.forEach(p->{
System.out.println("INIT Plugin "+p.getClass());
Assert.assertNotNull(p.getDescriptor());
@ -68,4 +60,28 @@ public class BasicPluginTest {
}
});
}
@Test
public void initInContext(){
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
plugins.forEach(p->{
TokenSetter.set(context);
System.out.println("INIT Plugin "+p.getClass()+" in "+context);
Assert.assertNotNull(p.getDescriptor());
Assert.assertNotNull(p.getDescriptor().getId());
Assert.assertNotNull(p.getDescriptor().getType());
Assert.assertNotNull(p.getDescriptor().getVersion());
if(p instanceof InitializablePlugin){
InitializablePlugin ip=(InitializablePlugin)p;
try {
ip.initInContext();
} catch (InitializationException e) {
e.printStackTrace(System.err);
Assert.fail("Unable to Init "+p.getDescriptor().getId());
}
}
});
}
}

View File

@ -0,0 +1,70 @@
package org.gcube.application.cms.tests.model;
import org.gcube.application.cms.plugins.IndexerPluginInterface;
import org.gcube.application.cms.plugins.LifecycleManager;
import org.gcube.application.cms.plugins.MaterializationPlugin;
import org.gcube.application.cms.plugins.PluginManagerInterface;
import org.gcube.application.cms.plugins.faults.*;
import org.gcube.application.cms.plugins.model.ComparableVersion;
import org.gcube.application.cms.plugins.model.PluginDescriptor;
import org.gcube.application.cms.plugins.reports.*;
import org.gcube.application.cms.plugins.requests.EventExecutionRequest;
import org.gcube.application.cms.plugins.requests.IndexDocumentRequest;
import org.gcube.application.cms.plugins.requests.MaterializationRequest;
import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
import org.gcube.application.geoportal.common.model.rest.Configuration;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
public class DummyPlugin implements LifecycleManager, IndexerPluginInterface, MaterializationPlugin {
@Override
public IndexDocumentReport index(IndexDocumentRequest request) {
return new IndexDocumentReport(request);
}
@Override
public InitializationReport initInContext() throws InitializationException {
return new InitializationReport();
}
@Override
public InitializationReport init() throws InitializationException {
return new InitializationReport();
}
@Override
public void shutdown() throws ShutDownException {
}
@Override
public StepExecutionReport performStep(StepExecutionRequest request) throws StepException {
return new StepExecutionReport(request);
}
@Override
public Configuration getCurrentConfiguration() throws ConfigurationException {
return new Configuration();
}
@Override
public EventExecutionReport onEvent(EventExecutionRequest request) throws EventException {
return new EventExecutionReport(request);
}
@Override
public void setPluginManager(PluginManagerInterface manager) {
}
@Override
public MaterializationReport materialize(MaterializationRequest request) throws MaterializationException {
return new MaterializationReport(request);
}
@Override
public PluginDescriptor getDescriptor() {
return new PluginDescriptor("DUMMY-PLUGIN","DUMMY-TYPE","Dummy","No op plugin", new ComparableVersion("1.0.0"));
}
}

View File

@ -34,16 +34,16 @@ public class SerializationTest {
}
@Test
public void readProfile() throws JsonProcessingException, IOException {
Profile concessione=mapper.readerFor(Profile.class).readValue(new File(TestConcessioniModel.getBaseFolder(),"ProfileConcessioni.json"));
System.out.println("Profile is "+mapper.writeValueAsString(concessione));
//Assert.assertTrue(concessione .getFields().size()>0);
}
// @Test
// public void readProfile() throws JsonProcessingException, IOException {
//
// Profile concessione=mapper.readerFor(Profile.class).readValue(new File(TestConcessioniModel.getBaseFolder(),"ProfileConcessioni.json"));
//
// System.out.println("Profile is "+mapper.writeValueAsString(concessione));
//
// //Assert.assertTrue(concessione .getFields().size()>0);
//
// }
@Test
public void readConcessione() throws JsonProcessingException, IOException {

View File

@ -12,7 +12,7 @@
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
</parent>
<properties>

View File

@ -166,8 +166,8 @@ public class ConcessioniLifeCycleManager implements LifecycleManager {
indexRequest.setDocument(request.getDocument());
indexRequest.setProfile(request.getProfile());
Document callParameters = new Document();
callParameters.put("workspace","gna_concessioni_"+request.getContext());
callParameters.put("indexName","gna_concessioni_centroids_"+request.getContext());
callParameters.put("workspace",Files.fixFilename("gna_concessioni_"+request.getContext().getId()));
callParameters.put("indexName",Files.fixFilename("gna_concessioni_centroids_"+request.getContext().getId()));
indexRequest.setCallParameters(callParameters);
IndexDocumentReport indexReport = indexerPlugin.index(indexRequest);

View File

@ -67,7 +67,7 @@ public class SDIManagerWrapper extends SDIManager{
// Evaluate Layer Name
String baseName = getToUseBaseLayerName(fileSet);
log.debug("Base layer name is {}, checking conflicts.. ");
log.debug("Base layer name is {}, checking conflicts.. ",baseName);
String toSetLayerName = baseName;
//Check if layer already exists
int count = 0;

View File

@ -5,6 +5,7 @@ import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.gcube.application.cms.plugins.IndexerPluginInterface;
import org.gcube.application.cms.plugins.faults.InitializationException;
import org.gcube.application.cms.plugins.faults.InvalidProfileException;
import org.gcube.application.cms.plugins.model.PluginDescriptor;
import org.gcube.application.cms.plugins.reports.IndexDocumentReport;
import org.gcube.application.cms.plugins.reports.InitializationReport;
@ -20,16 +21,23 @@ import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
import org.gcube.application.geoportal.common.model.document.filesets.GCubeSDILayer;
import org.gcube.application.geoportal.common.model.profile.Profile;
import java.util.ArrayList;
import java.util.List;
@Slf4j
public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPluginInterface {
@Data
private class MappingObject{
private static class MappingObject{
private String name;
private String type;
private String path;
public void validate () throws RuntimeException {
if(name==null) throw new RuntimeException("Invalid mapping "+this+" : name is null");
if(type==null) throw new RuntimeException("Invalid mapping "+this+" : type is null");
if(path==null) throw new RuntimeException("Invalid mapping "+this+" : path is null");
}
}
@ -68,26 +76,27 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
@Override
public IndexDocumentReport index(IndexDocumentRequest request) {
log.info("Indxer {} : Performing {} ",this.getDescriptor().getId(),request);
log.info("Indexer {} : Performing {} ",this.getDescriptor().getId(),request);
ProfiledDocument profiledDocument=request.getDocument();
Profile profile = request.getProfile();
Document requestArguments=request.getCallParameters();
Document profileConfiguration =getConfigurationFromProfile(profile).getConfiguration();
IndexDocumentReport report= new IndexDocumentReport(request);
log.debug("Profile Configuration is {} ",profileConfiguration);
try{
// ********* INIT INDEX
// TODO CACHE
PostgisIndexer indexer = new PostgisIndexer(sdiCache.getObject(),profile,postgisCache.getObject());
Document profileConfiguration =getConfigurationFromProfile(profile).getConfiguration();
log.debug("Profile Configuration is {} ",profileConfiguration);
// SCHEMA
log.debug("Profile {} : Evaluating Index schema.. ",profile.getId());
List<PostgisTable.Field> fields = null; // TODO From Profile
List<PostgisTable.Field> fields = new ArrayList<>(); // TODO From Profile
fields.add(new PostgisTable.Field("geom", PostgisTable.FieldType.GEOMETRY));
fields.add(new PostgisTable.Field("projectid", PostgisTable.FieldType.TEXT));
List mappingObjs= profileConfiguration.get("explicitFieldMapping",List.class);
@ -95,6 +104,7 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
mappingObjs.forEach(o -> {
log.trace("Mapping is {} ",o);
MappingObject m = Serialization.convert(o,MappingObject.class);
m.validate();
fields.add(new PostgisTable.Field(m.getName(), PostgisTable.FieldType.valueOf(m.getType())));
});
}
@ -133,7 +143,7 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
for(Object pathObj : bboxEvaluationPaths){
log.debug("Profile {} : Evaluating path {} ",profile.getId(),pathObj);
for(String path : documentNavigator.getMatchingPaths(pathObj.toString())) {
Object bboxObject = documentNavigator.getByPath(path);
Object bboxObject = documentNavigator.getByPath(path).get(0);
log.info("Matched path {}, value is {} ",path,bboxObject);
GCubeSDILayer.BBOX box = Serialization.convert(bboxObject, GCubeSDILayer.BBOX.class);

View File

@ -92,12 +92,12 @@ public class SDIMaterializerPlugin extends AbstractPlugin implements Materializa
ProfiledDocument profiledDocument=request.getDocument();
Profile profile = request.getProfile();
Document requestArguments=request.getCallParameters();
Document profileConfiguration =getConfigurationFromProfile(profile).getConfiguration();
MaterializationReport report= new MaterializationReport(request);
log.debug("Profile Configuration is {} ",profileConfiguration);
try{
Document profileConfiguration =getConfigurationFromProfile(profile).getConfiguration();
log.debug("Profile Configuration is {} ",profileConfiguration);
JSONPathWrapper documentNavigator=new JSONPathWrapper(profiledDocument.getTheDocument().toJson());
JSONPathWrapper schemaNavigator=new JSONPathWrapper(profile.getSchema().toJson());
@ -131,7 +131,7 @@ public class SDIMaterializerPlugin extends AbstractPlugin implements Materializa
// Actually materializing
RegisteredFileSet obtained = getSDIManager().materializeLayer(fs,requestArguments);
log.debug("Obtained {} ",obtained);
documentNavigator.setElement("$..[?(@.uuid == '"+fs.getUUID()+"')]",obtained);
documentNavigator.setElement("$..[?(@."+ RegisteredFileSet.UUID+" == '"+fs.getUUID()+"')]",obtained);
}
}

View File

@ -13,7 +13,7 @@
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
</parent>
<properties>

View File

@ -0,0 +1,8 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms.dataminer-plugins
This library contains gcube-cms plugins for processing via gCube Dataminer
## [v1.0.0-SNAPSHOT] - 2022-02-24
- First release

View File

@ -0,0 +1,26 @@
# Acknowledgments
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
- the H2020 research and innovation programme
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);

View File

@ -0,0 +1,312 @@
# European Union Public Licence V. 1.1
EUPL © the European Community 2007
This European Union Public Licence (the “EUPL”) applies to the Work or Software
(as defined below) which is provided under the terms of this Licence. Any use of
the Work, other than as authorised under this Licence is prohibited (to the
extent such use is covered by a right of the copyright holder of the Work).
The Original Work is provided under the terms of this Licence when the Licensor
(as defined below) has placed the following notice immediately following the
copyright notice for the Original Work:
Licensed under the EUPL V.1.1
or has expressed by any other mean his willingness to license under the EUPL.
## 1. Definitions
In this Licence, the following terms have the following meaning:
- The Licence: this Licence.
- The Original Work or the Software: the software distributed and/or
communicated by the Licensor under this Licence, available as Source Code and
also as Executable Code as the case may be.
- Derivative Works: the works or software that could be created by the Licensee,
based upon the Original Work or modifications thereof. This Licence does not
define the extent of modification or dependence on the Original Work required
in order to classify a work as a Derivative Work; this extent is determined by
copyright law applicable in the country mentioned in Article 15.
- The Work: the Original Work and/or its Derivative Works.
- The Source Code: the human-readable form of the Work which is the most
convenient for people to study and modify.
- The Executable Code: any code which has generally been compiled and which is
meant to be interpreted by a computer as a program.
- The Licensor: the natural or legal person that distributes and/or communicates
the Work under the Licence.
- Contributor(s): any natural or legal person who modifies the Work under the
Licence, or otherwise contributes to the creation of a Derivative Work.
- The Licensee or “You”: any natural or legal person who makes any usage of the
Software under the terms of the Licence.
- Distribution and/or Communication: any act of selling, giving, lending,
renting, distributing, communicating, transmitting, or otherwise making
available, on-line or off-line, copies of the Work or providing access to its
essential functionalities at the disposal of any other natural or legal
person.
## 2. Scope of the rights granted by the Licence
The Licensor hereby grants You a world-wide, royalty-free, non-exclusive,
sub-licensable licence to do the following, for the duration of copyright vested
in the Original Work:
- use the Work in any circumstance and for all usage, reproduce the Work, modify
- the Original Work, and make Derivative Works based upon the Work, communicate
- to the public, including the right to make available or display the Work or
- copies thereof to the public and perform publicly, as the case may be, the
- Work, distribute the Work or copies thereof, lend and rent the Work or copies
- thereof, sub-license rights in the Work or copies thereof.
Those rights can be exercised on any media, supports and formats, whether now
known or later invented, as far as the applicable law permits so.
In the countries where moral rights apply, the Licensor waives his right to
exercise his moral right to the extent allowed by law in order to make effective
the licence of the economic rights here above listed.
The Licensor grants to the Licensee royalty-free, non exclusive usage rights to
any patents held by the Licensor, to the extent necessary to make use of the
rights granted on the Work under this Licence.
## 3. Communication of the Source Code
The Licensor may provide the Work either in its Source Code form, or as
Executable Code. If the Work is provided as Executable Code, the Licensor
provides in addition a machine-readable copy of the Source Code of the Work
along with each copy of the Work that the Licensor distributes or indicates, in
a notice following the copyright notice attached to the Work, a repository where
the Source Code is easily and freely accessible for as long as the Licensor
continues to distribute and/or communicate the Work.
## 4. Limitations on copyright
Nothing in this Licence is intended to deprive the Licensee of the benefits from
any exception or limitation to the exclusive rights of the rights owners in the
Original Work or Software, of the exhaustion of those rights or of other
applicable limitations thereto.
## 5. Obligations of the Licensee
The grant of the rights mentioned above is subject to some restrictions and
obligations imposed on the Licensee. Those obligations are the following:
Attribution right: the Licensee shall keep intact all copyright, patent or
trademarks notices and all notices that refer to the Licence and to the
disclaimer of warranties. The Licensee must include a copy of such notices and a
copy of the Licence with every copy of the Work he/she distributes and/or
communicates. The Licensee must cause any Derivative Work to carry prominent
notices stating that the Work has been modified and the date of modification.
Copyleft clause: If the Licensee distributes and/or communicates copies of the
Original Works or Derivative Works based upon the Original Work, this
Distribution and/or Communication will be done under the terms of this Licence
or of a later version of this Licence unless the Original Work is expressly
distributed only under this version of the Licence. The Licensee (becoming
Licensor) cannot offer or impose any additional terms or conditions on the Work
or Derivative Work that alter or restrict the terms of the Licence.
Compatibility clause: If the Licensee Distributes and/or Communicates Derivative
Works or copies thereof based upon both the Original Work and another work
licensed under a Compatible Licence, this Distribution and/or Communication can
be done under the terms of this Compatible Licence. For the sake of this clause,
“Compatible Licence” refers to the licences listed in the appendix attached to
this Licence. Should the Licensees obligations under the Compatible Licence
conflict with his/her obligations under this Licence, the obligations of the
Compatible Licence shall prevail.
Provision of Source Code: When distributing and/or communicating copies of the
Work, the Licensee will provide a machine-readable copy of the Source Code or
indicate a repository where this Source will be easily and freely available for
as long as the Licensee continues to distribute and/or communicate the Work.
Legal Protection: This Licence does not grant permission to use the trade names,
trademarks, service marks, or names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the copyright notice.
## 6. Chain of Authorship
The original Licensor warrants that the copyright in the Original Work granted
hereunder is owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each Contributor warrants that the copyright in the modifications he/she brings
to the Work are owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each time You accept the Licence, the original Licensor and subsequent
Contributors grant You a licence to their contributions to the Work, under the
terms of this Licence.
## 7. Disclaimer of Warranty
The Work is a work in progress, which is continuously improved by numerous
contributors. It is not a finished work and may therefore contain defects or
“bugs” inherent to this type of software development.
For the above reason, the Work is provided under the Licence on an “as is” basis
and without warranties of any kind concerning the Work, including without
limitation merchantability, fitness for a particular purpose, absence of defects
or errors, accuracy, non-infringement of intellectual property rights other than
copyright as stated in Article 6 of this Licence.
This disclaimer of warranty is an essential part of the Licence and a condition
for the grant of any rights to the Work.
## 8. Disclaimer of Liability
Except in the cases of wilful misconduct or damages directly caused to natural
persons, the Licensor will in no event be liable for any direct or indirect,
material or moral, damages of any kind, arising out of the Licence or of the use
of the Work, including without limitation, damages for loss of goodwill, work
stoppage, computer failure or malfunction, loss of data or any commercial
damage, even if the Licensor has been advised of the possibility of such
damage. However, the Licensor will be liable under statutory product liability
laws as far such laws apply to the Work.
## 9. Additional agreements
While distributing the Original Work or Derivative Works, You may choose to
conclude an additional agreement to offer, and charge a fee for, acceptance of
support, warranty, indemnity, or other liability obligations and/or services
consistent with this Licence. However, in accepting such obligations, You may
act only on your own behalf and on your sole responsibility, not on behalf of
the original Licensor or any other Contributor, and only if You agree to
indemnify, defend, and hold each Contributor harmless for any liability incurred
by, or claims asserted against such Contributor by the fact You have accepted
any such warranty or additional liability.
## 10. Acceptance of the Licence
The provisions of this Licence can be accepted by clicking on an icon “I agree”
placed under the bottom of a window displaying the text of this Licence or by
affirming consent in any other similar way, in accordance with the rules of
applicable law. Clicking on that icon indicates your clear and irrevocable
acceptance of this Licence and all of its terms and conditions.
Similarly, you irrevocably accept this Licence and all of its terms and
conditions by exercising any rights granted to You by Article 2 of this Licence,
such as the use of the Work, the creation by You of a Derivative Work or the
Distribution and/or Communication by You of the Work or copies thereof.
## 11. Information to the public
In case of any Distribution and/or Communication of the Work by means of
electronic communication by You (for example, by offering to download the Work
from a remote location) the distribution channel or media (for example, a
website) must at least provide to the public the information requested by the
applicable law regarding the Licensor, the Licence and the way it may be
accessible, concluded, stored and reproduced by the Licensee.
## 12. Termination of the Licence
The Licence and the rights granted hereunder will terminate automatically upon
any breach by the Licensee of the terms of the Licence.
Such a termination will not terminate the licences of any person who has
received the Work from the Licensee under the Licence, provided such persons
remain in full compliance with the Licence.
## 13. Miscellaneous
Without prejudice of Article 9 above, the Licence represents the complete
agreement between the Parties as to the Work licensed hereunder.
If any provision of the Licence is invalid or unenforceable under applicable
law, this will not affect the validity or enforceability of the Licence as a
whole. Such provision will be construed and/or reformed so as necessary to make
it valid and enforceable.
The European Commission may publish other linguistic versions and/or new
versions of this Licence, so far this is required and reasonable, without
reducing the scope of the rights granted by the Licence. New versions of the
Licence will be published with a unique version number.
All linguistic versions of this Licence, approved by the European Commission,
have identical value. Parties can take advantage of the linguistic version of
their choice.
## 14. Jurisdiction
Any litigation resulting from the interpretation of this License, arising
between the European Commission, as a Licensor, and any Licensee, will be
subject to the jurisdiction of the Court of Justice of the European Communities,
as laid down in article 238 of the Treaty establishing the European Community.
Any litigation arising between Parties, other than the European Commission, and
resulting from the interpretation of this License, will be subject to the
exclusive jurisdiction of the competent court where the Licensor resides or
conducts its primary business.
## 15. Applicable Law
This Licence shall be governed by the law of the European Union country where
the Licensor resides or has his registered office.
This licence shall be governed by the Belgian law if:
- a litigation arises between the European Commission, as a Licensor, and any
- Licensee; the Licensor, other than the European Commission, has no residence
- or registered office inside a European Union country.
## Appendix
“Compatible Licences” according to article 5 EUPL are:
- GNU General Public License (GNU GPL) v. 2
- Open Software License (OSL) v. 2.1, v. 3.0
- Common Public License v. 1.0
- Eclipse Public License v. 1.0
- Cecill v. 2.0

View File

@ -0,0 +1,52 @@
gCube CMS Suite
--------------------------------------------------
gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles.
## Built with
* [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework
* [OpenJDK](https://openjdk.java.net/) - The JDK used
* [JAX-RS](https://github.com/eclipse-ee4j/jaxrs-api) - Java™ API for RESTful Web Services
* [Jersey](https://jersey.github.io/) - JAX-RS runtime
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service).
## Change log
See [CHANGELOG.md](CHANGELOG.md).
## License
This project is licensed under the EUPL V.1.1 License - see the [LICENSE.md](LICENSE.md) file for details.
## About the gCube Framework
This software is part of the [gCubeFramework](https://www.gcube-system.org/ "gCubeFramework"): an
open-source software toolkit used for building and operating Hybrid Data
Infrastructures enabling the dynamic deployment of Virtual Research Environments
by favouring the realisation of reuse oriented policies.
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- DILIGENT (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- D4Science (grant no. 212488);
- D4Science-II (grant no.239019);
- ENVRI (grant no. 283465);
- iMarine(grant no. 283644);
- EUBrazilOpenBio (grant no. 288754).
- the H2020 research and innovation programme
- SoBigData (grant no. 654024);
- PARTHENOS (grant no. 654119);
- EGIEngage (grant no. 654142);
- ENVRIplus (grant no. 654182);
- BlueBRIDGE (grant no. 675680);
- PerformFish (grant no. 727610);
- AGINFRAplus (grant no. 731001);
- DESIRA (grant no. 818194);
- ARIADNEplus (grant no. 823914);
- RISIS2 (grant no. 824091);

48
dataminer-plugins/pom.xml Normal file
View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>dataminer-plugins</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>gCube CMS - Dataminer Plugins</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.2-SNAPSHOT</version>
</parent>
<properties>
<gitBaseUrl>https://code-repo.d4science.org/gCubeSystem</gitBaseUrl>
</properties>
<scm>
<connection>scm:git:${gitBaseUrl}/gcube-cms-suite</connection>
<developerConnection>scm:git:${gitBaseUrl}/gcube-cms-suite</developerConnection>
<url>${gitBaseUrl}/gcube-cms-suite</url>
</scm>
<dependencies>
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>cms-plugin-framework</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>cms-test-commons</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -11,7 +11,7 @@
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
</parent>

View File

@ -1,15 +1,19 @@
package org.gcube.application.geoportal.clients;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.junit.BeforeClass;
public class BasicVreTests {
import static org.junit.Assume.assumeTrue;
public class BasicVreTests extends GCubeTest {
@BeforeClass
public static void setScope(){
assumeTrue(isTestInfrastructureEnabled());
// TokenSetter.set("/pred4s/preprod/preVRE");
// TokenSetter.set("/d4science.research-infrastructures.eu/D4OS/GeoNA-Prototype");
TokenSetter.set("/gcube/devsec/devVRE");
TokenSetter.set(GCubeTest.getContext());
}

View File

@ -6,6 +6,7 @@ import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
import org.gcube.application.geoportal.common.model.rest.Configuration;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.rest.ProfiledDocumentsI;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.junit.Test;
import java.rmi.RemoteException;
@ -13,6 +14,7 @@ import java.util.concurrent.atomic.AtomicLong;
import static junit.framework.TestCase.assertTrue;
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.*;
import static org.junit.Assume.assumeTrue;
public class ProfiledDocumentsTest<M extends ProfiledDocument,C extends ProfiledDocumentsI<M>> extends BasicVreTests{
@ -25,6 +27,7 @@ public class ProfiledDocumentsTest<M extends ProfiledDocument,C extends Profiled
@Test
public void getConfiguration() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
ProfiledDocumentsI<M> client = (ProfiledDocumentsI<M>) getClient();
Configuration config=client.getConfiguration();
System.out.println("Configuration is "+ config);
@ -33,6 +36,7 @@ public class ProfiledDocumentsTest<M extends ProfiledDocument,C extends Profiled
@Test
public void list() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
ProfiledDocumentsI<M> client = (ProfiledDocumentsI<M>) getClient();
AtomicLong counter=new AtomicLong(0);
client.query(new QueryRequest()).forEachRemaining( M -> counter.incrementAndGet());
@ -43,6 +47,7 @@ public class ProfiledDocumentsTest<M extends ProfiledDocument,C extends Profiled
@Test
public void scanStatusByID() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
ProfiledDocumentsI<M> client = (ProfiledDocumentsI<M>) getClient();
AtomicLong counter=new AtomicLong(0);
client.query(new QueryRequest()).forEachRemaining( m -> {

View File

@ -2,6 +2,7 @@ package org.gcube.application.geoportal.clients.legacy;
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
import java.io.File;
import java.io.FileInputStream;
@ -16,6 +17,7 @@ import org.gcube.application.geoportal.common.model.legacy.*;
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport.ValidationStatus;
import org.gcube.application.geoportal.common.model.rest.TempFile;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
import org.junit.Test;
@ -95,6 +97,7 @@ public class StatefulClientTests extends BasicVreTests {
@Test
public void testRegisterNew() throws RemoteBackendException, FileNotFoundException, Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
Concessione published=publishNew();
@ -116,6 +119,7 @@ public class StatefulClientTests extends BasicVreTests {
@Test
public void delete() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
ConcessioniManagerI manager=statefulMongoConcessioni().build();
StorageUtils storage=new StorageUtils();

View File

@ -1,18 +1,5 @@
package org.gcube.application.geoportal.clients.legacy;
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.mongoConcessioni;
import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
import java.io.File;
import java.io.FileInputStream;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.Iterator;
import java.util.concurrent.atomic.AtomicLong;
import com.sun.xml.internal.ws.api.addressing.AddressingPropertySet;
import org.bson.Document;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniFilters;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniQueries;
@ -23,25 +10,34 @@ import org.gcube.application.geoportal.common.model.legacy.*;
import org.gcube.application.geoportal.common.model.legacy.Concessione.Paths;
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport.ValidationStatus;
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.junit.Test;
import java.io.File;
import java.util.Iterator;
import java.util.concurrent.atomic.AtomicLong;
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.mongoConcessioni;
import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
public class StatelessClientTests extends BasicVreTests {
private MongoConcessioni client=mongoConcessioni().build();
private final MongoConcessioni client=mongoConcessioni().build();
@Test
public void getConfiguration() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
System.out.println(client.getCurrentConfiguration());
}
@Test
public void searches() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
TestConcessioniFilters.filters.forEach((k, v)->{
try {
System.out.println("Count for " + k + "\t" + count(client.search(v)));
@ -56,7 +52,7 @@ public class StatelessClientTests extends BasicVreTests {
@Test
public void query() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
System.out.println("FRA "+ count(client.query(
Queries.parse(TestConcessioniQueries.queries.get("emptyresult.json")))));
@ -94,6 +90,7 @@ public class StatelessClientTests extends BasicVreTests {
@Test
public void testList() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
final AtomicLong counter=new AtomicLong();
long before=System.currentTimeMillis();
client.getList().forEachRemaining((Concessione c)-> {counter.addAndGet(1);});
@ -102,6 +99,7 @@ public class StatelessClientTests extends BasicVreTests {
@Test
public void testCreateNew() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
Concessione c= client.createNew(TestConcessioniModel.prepareEmptyConcessione());
assertNotNull(c);
assertNotNull(c.getMongo_id());
@ -109,6 +107,7 @@ public class StatelessClientTests extends BasicVreTests {
@Test
public void testReplace() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
Concessione testObject= client.createNew(TestConcessioniModel.prepareEmptyConcessione());
String title="My new shiny Title";
testObject.setNome(title);
@ -118,6 +117,7 @@ public class StatelessClientTests extends BasicVreTests {
@Test
public void testUploadFileSet() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
Concessione testObject= client.createNew(TestConcessioniModel.prepareConcessione());
AddSectionToConcessioneRequest request=
Serialization.convert(
@ -136,6 +136,7 @@ public class StatelessClientTests extends BasicVreTests {
@Test
public void testDeleteById() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
Concessione c= client.createNew(TestConcessioniModel.prepareEmptyConcessione());
client.deleteById(c.getMongo_id());
}
@ -143,6 +144,7 @@ public class StatelessClientTests extends BasicVreTests {
@Test
public void testPublish() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
Concessione c=prepare();
assertTrue(c.getReport().getStatus().equals(ValidationStatus.PASSED));
@ -152,7 +154,7 @@ public class StatelessClientTests extends BasicVreTests {
@Test
public void testCleanFileSet() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
Concessione testObject=prepare();
System.out.println("Object is "+testObject.getPosizionamentoScavo());
//Precheck to be sure

View File

@ -10,7 +10,7 @@
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
</parent>
<properties>

View File

@ -86,6 +86,7 @@ public class JSONPathWrapper {
} else{
log.debug("Path is not definte, evaluating matching paths..");
for(String p : getMatchingPaths(path)){
log.debug("Actually setting {} as {} ",p,toSet);
setElement(p,toSet);
}
}

View File

@ -62,7 +62,7 @@ public class GCubeSDILayer extends Materialization{
}
public List getOGCLinks(){return this.get(OGC_LINKS, List.class);}
public BBOX getBBox(){return this.get(B_BOX,BBOX.class);}
public Object getBBox(){return this.get(B_BOX);}
public List getPlatformInfo(){return this.get(PLATFORM_INFO,List.class);}
}

View File

@ -30,6 +30,11 @@ public class Field extends Document {
return this.getString(TYPE);
};
public Boolean isLeaf(){
List children = getChildren();
return children == null || children.isEmpty() || children.get(0)==null;
}
public List getChildren(){
return this.get(CHILDREN,List.class);
}

View File

@ -7,10 +7,14 @@ import org.bson.Document;
@Data
public class HandlerDeclaration {
@JsonProperty("_id")
public static final String ID="_id";
public static final String TYPE="_TYPE";
public static final String CONFIGURATION="_configuration";
@JsonProperty(ID)
private String id;
@JsonProperty("_type")
@JsonProperty(TYPE)
private String type;
@JsonProperty("_configuration")
@JsonProperty(CONFIGURATION)
private Document configuration;
}

View File

@ -11,11 +11,14 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.vdurmont.semver4j.Semver;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.extern.slf4j.XSlf4j;
import org.gcube.application.geoportal.common.model.document.accounting.AccountingInfo;
@Data
@NoArgsConstructor
@XmlRootElement
@Slf4j
public class Profile{
public static final String ID="_id";
@ -55,15 +58,33 @@ public class Profile{
* Returns map Type -> Handler Declaration
* @return
*/
public Map<String,List<HandlerDeclaration>> getHandlersMap(){
public Map<String,List<HandlerDeclaration>> getHandlersMapByType(){
HashMap<String,List<HandlerDeclaration>> toReturn=new HashMap<>();
handlers.forEach(h->{
try {
if(!toReturn.containsKey(h.getType()))
toReturn.put(h.getType(),new ArrayList<>());
toReturn.get(h.getType()).add(h);
}catch (Throwable t){log.error("Invalid profile : unable to get Handler Map by Type with {} in profile [ID {}]",h,this.getId(),t);}
});
return toReturn;
}
/**
* Returns map Type -> Handler Declaration
* @return
*/
public Map<String,List<HandlerDeclaration>> getHandlersMapByID(){
HashMap<String,List<HandlerDeclaration>> toReturn=new HashMap<>();
handlers.forEach(h->{
try {
if (!toReturn.containsKey(h.getId()))
toReturn.put(h.getId(), new ArrayList<>());
toReturn.get(h.getId()).add(h);
}catch (Throwable t){
log.error("Invalid profile : unable to get Handler Map by ID with {} in profile [ID {}]",h,this.getId(),t);}
});
return toReturn;
}
}

View File

@ -96,6 +96,6 @@ public class Files {
toFix=toFix.substring(0,toFix.indexOf("."));
}
return toFix.toLowerCase().
replaceAll("[\\*\\+\\/\\\\ \\[\\]\\(\\)\\.\\\"\\:\\;\\|]","_")+extension;
replaceAll("[\\*\\+\\/\\\\ \\[\\]\\(\\)\\.\\\"\\:\\;\\|\\=]","_")+extension;
}
}

View File

@ -0,0 +1,30 @@
package org.gcube.application.geoportal.common.utils.tests;
public class GCubeTest {
public static String getContext() {
String testContext=null;
testContext = System.getProperty("testContext");
if(testContext==null) {
// trying with env
testContext=System.getenv("testContext");
}
testContext = "/pred4s/preprod/preVRE";
System.out.println("TEST CONTEXT = "+testContext);
return testContext;
}
public static boolean isTestInfrastructureEnabled() {
return getContext()!=null;
}
}

View File

@ -1,10 +1,12 @@
package org.gcube.application.geoportal.common;
import com.mongodb.MongoWaitQueueFullException;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
import org.gcube.application.geoportal.common.utils.ContextUtils;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.contentmanagement.blobstorage.service.IClient;
import org.gcube.contentmanager.storageclient.wrapper.AccessType;
import org.gcube.contentmanager.storageclient.wrapper.MemoryType;
@ -22,6 +24,8 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import static org.junit.Assume.assumeTrue;
@Slf4j
public class StorageUtilsTest {
@ -29,7 +33,8 @@ public class StorageUtilsTest {
@Before
public void init(){
TokenSetter.set("/gcube/devsec/devVRE");
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
TokenSetter.set(GCubeTest.getContext());
client=new StorageClient(InterfaceConstants.SERVICE_CLASS, InterfaceConstants.SERVICE_NAME,
ContextUtils.getCurrentCaller(), AccessType.SHARED, MemoryType.VOLATILE).getClient();
}
@ -46,7 +51,7 @@ public class StorageUtilsTest {
@Test
public void testParallelStorage() throws FileNotFoundException, InterruptedException {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
ExecutorService service = Executors.newFixedThreadPool(10);
LocalDateTime start=LocalDateTime.now();
AtomicLong executed = new AtomicLong(0);
@ -80,7 +85,7 @@ public class StorageUtilsTest {
@Test
public void testSerialStorage() throws FileNotFoundException {
TokenSetter.set("/gcube/devsec/devVRE");
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
//get client
client=new StorageClient(InterfaceConstants.SERVICE_CLASS, InterfaceConstants.SERVICE_NAME,
ContextUtils.getCurrentCaller(), AccessType.SHARED, MemoryType.VOLATILE).getClient();

View File

@ -14,6 +14,7 @@ import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
import org.gcube.application.geoportal.common.model.document.filesets.Materialization;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet;
import org.gcube.application.geoportal.common.model.document.lifecycle.TriggeredEvents;
import org.gcube.application.geoportal.common.model.profile.HandlerDeclaration;
import org.gcube.application.geoportal.common.utils.Files;
import org.junit.Test;
@ -30,7 +31,7 @@ public class JSONPathTests {
static File baseFolder=new File("../test-data/profiledDocuments");
private JSONPathWrapper profileNavigator() throws IOException {
return getNavigator("basicProfile.json");
return getNavigator("profiles/basicProfile.json");
}
private JSONPathWrapper getNavigator(String filename) throws IOException {
@ -73,8 +74,8 @@ public class JSONPathTests {
checkAddElement(wrapper,"$..triggeredEvents",event);
wrapper=getNavigator("basicProfile.json");
checkPutElement(wrapper,"$..[?(@.id == 'SDI-Default-Materializer')].configuration","additional",
wrapper=getNavigator("profiles/basicProfile.json");
checkPutElement(wrapper,"$..[?(@."+HandlerDeclaration.ID+" == 'SDI-Default-Materializer')]."+ HandlerDeclaration.CONFIGURATION,"additional",
Collections.singletonMap("myKey","myField"));
}

View File

@ -11,7 +11,7 @@
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
</parent>
<properties>

View File

@ -96,7 +96,7 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
try{
LifecycleManager toReturn=null;
//Getting Lifecycle Manager declaration from Profile
List<HandlerDeclaration> handlerDeclarations= profile.getHandlersMap().get(PluginDescriptor.BaseTypes.LIFECYCLE_MANAGER);
List<HandlerDeclaration> handlerDeclarations= profile.getHandlersMapByType().get(PluginDescriptor.BaseTypes.LIFECYCLE_MANAGER);
if(handlerDeclarations==null || handlerDeclarations.isEmpty()) throw new ConfigurationException("No Lifecycle Handler defined for profile ID "+profile.getId());
if(handlerDeclarations.size()>1) throw new ConfigurationException("Too many Lifecycle Handlers defined ("+handlerDeclarations+") in profile ID "+profile.getId());

View File

@ -4,10 +4,7 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.caches.AbstractScopedMap;
import org.gcube.application.cms.plugins.InitializablePlugin;
import org.gcube.application.cms.plugins.LifecycleManager;
import org.gcube.application.cms.plugins.Plugin;
import org.gcube.application.cms.plugins.PluginManagerInterface;
import org.gcube.application.cms.plugins.*;
import org.gcube.application.cms.plugins.faults.InitializationException;
import org.gcube.application.cms.plugins.faults.ShutDownException;
import org.gcube.application.cms.plugins.reports.InitializationReport;
@ -37,31 +34,20 @@ public class PluginManager extends AbstractScopedMap<PluginManager.PluginMap> im
super("Plugin Cache");
// reflections
Reflections reflections = new Reflections(
new ConfigurationBuilder()
.forPackage("org.gcube.application.cms")
.filterInputsBy(new FilterBuilder().includePackage("org.gcube.application.cms")));
reflections.getSubTypesOf(Plugin.class).iterator().forEachRemaining(pluginClass->{
if(!pluginClass.isInterface() && !Modifier.isAbstract(pluginClass.getModifiers())){
try {
Plugin plugin = pluginClass.newInstance();
log.debug("Loading {} description : {}", plugin, plugin.getDescriptor());
implementations.put(plugin.getDescriptor().getId(), plugin);
if(plugin instanceof LifecycleManager)
((LifecycleManager)plugin).setPluginManager(this);
}catch (Throwable t){
log.warn("Unable to instantiate Plugin "+pluginClass,t);
}
}
});
implementations.putAll(PluginsReflections.load());
log.info("Loaded {} plugins",implementations.keySet().size());
// Init plugins
implementations.forEach((id,p)->{
log.info("Registering plugin Manager ");
if(p instanceof LifecycleManager) {
log.debug("Registering plugin Manager to {} ",id);
((LifecycleManager) p).setPluginManager(this);
}
if(p instanceof InitializablePlugin){
log.info("INIT Plugin {}",id);
try {
@ -79,10 +65,12 @@ public class PluginManager extends AbstractScopedMap<PluginManager.PluginMap> im
@Override
protected PluginMap retrieveObject() throws ConfigurationException {
String context=ContextUtils.getCurrentScope();
log.warn("PLUGIN INITIALIZTIONS IN CONTEXT {} ",context);
// Init plugins
implementations.forEach((id,p)->{
if(p instanceof InitializablePlugin){
log.info("INIT Plugin {} in context {} ",id, ContextUtils.getCurrentScope());
log.info("INIT Plugin {} in context {} ",id, context);
try {
InitializablePlugin ip=(InitializablePlugin) p;
logReport(ip,ip.initInContext());

View File

@ -70,6 +70,21 @@
{
"_id" : "SDI-Indexer-Plugin",
"_type" : "Indexer",
"_configuration" : {
"bboxEvaluation" : ["$..posizionamentoScavo.._bbox"],
"explicitFieldMapping" : [
{"name" : "titolo", "path" : "$._theDocument.title", "type" : "TEXT"}
],
"jslt" : {},
"additionalLayers" : [
{"source" : {"url" : "..."},"toSetTitle":""}
]
}
},
{
"_id" : "org.gcube....geoportal-data-entry-portlet",
"_type" : "DATA_ENTRY_GUI",

View File

@ -2,6 +2,7 @@ package org.gcube.application.geoportal.service;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.rest.GuardedMethod;
import org.gcube.application.cms.serialization.Serialization;
import org.glassfish.jersey.test.JerseyTest;
@ -9,6 +10,9 @@ import org.junit.BeforeClass;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.Response;
import static org.junit.Assume.assumeTrue;
@Slf4j
public class BasicServiceTestUnit extends JerseyTest {
@ -19,30 +23,17 @@ public class BasicServiceTestUnit extends JerseyTest {
return new GeoPortalService();
}
// protected static String scope="/gcube/devsec/devVRE";
protected static String scope="/pred4s/preprod/preVRE";
// protected static String scope="/d4science.research-infrastructures.eu/D4OS/GeoNA-Prototype";
@BeforeClass
public static void init() {
GuardedMethod.addPreoperation(new Runnable() {
@Override
public void run() {
log.debug("TEST IMPL : Setting context "+scope+" in received call");
TokenSetter.set(scope);
String context = GCubeTest.getContext();
log.debug("TEST IMPL : Setting context "+context+" in received call");
TokenSetter.set(context);
}
});
// ImplementationProvider.get().setStorageProvider(
// new StorageClientProvider(){
// @Override
// public StorageUtils retrieveObject(){
// new StorageUtils(){
// @Override
// getP
// }
// };
// }
// );
}

View File

@ -1,6 +1,7 @@
package org.gcube.application.geoportal.service;
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
import org.gcube.application.geoportal.service.profiledDocuments.AbstractProfiledDocumentsTests;
import org.junit.Test;
import javax.ws.rs.client.WebTarget;

View File

@ -8,6 +8,7 @@ import com.mongodb.client.model.Projections;
import org.bson.Document;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.engine.mongo.MongoManager;
import org.gcube.application.geoportal.service.engine.providers.MongoClientProvider;
import org.gcube.application.geoportal.service.model.internal.db.Mongo;
@ -17,6 +18,8 @@ import org.junit.Test;
import java.io.IOException;
import static org.junit.Assume.assumeTrue;
public class MongoTests {
public static class MongoTester extends MongoManager {
@ -35,6 +38,8 @@ public class MongoTests {
@BeforeClass
public static final void init() {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
ImplementationProvider.get().setEngine(new MongoClientProvider() {
@Override
public Mongo getObject() throws ConfigurationException {
@ -68,6 +73,7 @@ public class MongoTests {
@Test
public void queries() throws ConfigurationException {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
MongoTester tester=new MongoTester();
System.out.println("Using builders..");
tester.getCollection().find(Document.parse("{\"report.status\" : \"WARNING\"}")).

View File

@ -1,19 +0,0 @@
package org.gcube.application.geoportal.service;
import org.gcube.application.cms.tests.TestProfiles;
import org.junit.Test;
public class Profiles {
@Test
public void getFields(){
TestProfiles.profiles.forEach((k,v)->{
System.out.println(k+"\t"+v);
v.getSchema().getChildren().forEach(
i-> System.out.println(i.getClass()+"\t"+i)
);
});
}
}

View File

@ -6,6 +6,7 @@ import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.BasicServiceTestUnit;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.service.engine.mongo.ConcessioniMongoManager;
@ -24,14 +25,15 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
@Slf4j
public class Caches extends BasicServiceTestUnit {
@Test
public void testCache() throws ConfigurationException {
TokenSetter.set("/gcube/devsec/devVRE");
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
TokenSetter.set(GCubeTest.getContext());
Duration ttl=Duration.of(10, ChronoUnit.SECONDS);
@ -66,9 +68,10 @@ public class Caches extends BasicServiceTestUnit {
}
@Test
// @Test
public void mongoconnections() throws ConfigurationException, InterruptedException {
TokenSetter.set(scope);
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
TokenSetter.set(GCubeTest.getContext());
ExecutorService service = Executors.newFixedThreadPool(1000);
LocalDateTime start=LocalDateTime.now();
AtomicLong executed = new AtomicLong(0);
@ -101,9 +104,10 @@ public class Caches extends BasicServiceTestUnit {
}
@Test
//@Test
public void testStorageCache() throws ConfigurationException, FileNotFoundException, InterruptedException {
TokenSetter.set(scope);
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
TokenSetter.set(GCubeTest.getContext());
ExecutorService service = Executors.newFixedThreadPool(10);
LocalDateTime start=LocalDateTime.now();
AtomicLong executed = new AtomicLong(0);

View File

@ -9,6 +9,7 @@ import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.legacy.GeoServerContent;
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.engine.postgis.PostgisIndex;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.service.model.internal.faults.SDIInteractionException;
@ -25,17 +26,17 @@ import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import static org.junit.Assume.assumeTrue;
@Slf4j
public class SDITests {
public class SDITests extends GCubeTest {
@Before
public void init(){
TokenSetter.set("/gcube/devsec/devVRE");
}
@Test
public void registerCentroidsLayer() throws SDIInteractionException, SQLException, ConfigurationException {
assumeTrue(isTestInfrastructureEnabled());
PostgisIndex index=new PostgisIndex();
}

View File

@ -1,4 +1,4 @@
package org.gcube.application.geoportal.service;
package org.gcube.application.geoportal.service.legacy;
import org.bson.Document;
import org.gcube.application.cms.tests.TokenSetter;
@ -18,6 +18,8 @@ import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.BasicServiceTestUnit;
import org.geotoolkit.referencing.operation.provider.PolarStereographic;
import org.json.JSONObject;
import org.junit.Assert;
@ -36,8 +38,9 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
public class ConcessioniOverMongoTest extends BasicServiceTestUnit {
private static final String PATH=InterfaceConstants.Methods.MONGO_CONCESSIONI;
@ -47,7 +50,8 @@ public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
@Before
public void setContext(){
TokenSetter.set(scope);
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
TokenSetter.set(GCubeTest.getContext());
}
//Used for local test data
@ -138,12 +142,14 @@ public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
@Test
public void list() {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
System.out.println(target.request(MediaType.APPLICATION_JSON).get(List.class));
}
@Test
public void search() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
AtomicLong validatedCount= new AtomicLong(0);
Iterator<Concessione> it=search(TestConcessioniFilters.filters.get("validated.json"),target);
@ -153,6 +159,7 @@ public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
@Test
public void query() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Iterator<Concessione> it;
@ -173,6 +180,7 @@ public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
@Test
public void getConfiguration() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
System.out.println(check(target.path(InterfaceConstants.Methods.CONFIGURATION_PATH).request(MediaType.APPLICATION_JSON).get(),String.class));
}
@ -180,6 +188,7 @@ public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
@Test
public void createNew() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Concessione c=register(target,TestConcessioniModel.prepareConcessione());
Assert.assertTrue(c.getMongo_id()!=null&&!c.getMongo_id().isEmpty());
@ -188,6 +197,7 @@ public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
@Test
public void delete() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Concessione c = get(target);
@ -203,6 +213,7 @@ public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
@Test
public void republish() throws Exception{
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Concessione published=getFullPublished(target);
//Concessione published=getById(target,"6155ba6002ad3d2c23b72b5a");
@ -215,6 +226,7 @@ public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
@Test
public void handlePrecise() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
//Republishing
WebTarget target=target(PATH);
//String id="61e6d5212f7b172ac9874879";
@ -248,6 +260,7 @@ public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
@Test
public void getById() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Concessione c = get(target);
Response resp=target.path(c.getMongo_id()).request(MediaType.APPLICATION_JSON).get();
@ -259,6 +272,7 @@ public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
@Test
public void update() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Concessione c = get(target);
String newTitle="Questo titolo l'ho modificato mo nel test quello proprio apposta pewr questa cosa'";
@ -269,6 +283,7 @@ public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
@Test
public void uploadFile() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Response resp=target.request(MediaType.APPLICATION_JSON).post(Entity.entity(Serialization.write(TestConcessioniModel.prepareEmptyConcessione()), MediaType.APPLICATION_JSON));
Concessione c=check(resp,Concessione.class);
@ -293,6 +308,7 @@ public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
@Test
public void testClearFileSet() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Concessione published=getFullPublished(target);
@ -326,6 +342,7 @@ public class ConcessioniOverMongoTest extends BasicServiceTestUnit{
@Test
public void publish() throws Exception {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
WebTarget target=target(PATH);
Concessione published=getFullPublished(target);

View File

@ -1,4 +1,4 @@
package org.gcube.application.geoportal.service;
package org.gcube.application.geoportal.service.profiledDocuments;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.jayway.jsonpath.JsonPath;
@ -17,6 +17,8 @@ import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest;
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
import org.gcube.application.geoportal.service.BasicServiceTestUnit;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -31,13 +33,15 @@ import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
public abstract class AbstractProfiledDocumentsTests extends BasicServiceTestUnit{
public abstract class AbstractProfiledDocumentsTests extends BasicServiceTestUnit {
@Before
public void setContext(){
TokenSetter.set(scope);
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
TokenSetter.set(GCubeTest.getContext());
}
@ -47,11 +51,13 @@ public abstract class AbstractProfiledDocumentsTests extends BasicServiceTestUni
@Test
public void getAll() {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
System.out.println(baseTarget().request(MediaType.APPLICATION_JSON).get(List.class));
}
@Test
public void getByID(){
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
baseTarget().request(MediaType.APPLICATION_JSON).get(List.class).forEach(d ->{
try {
@ -66,12 +72,14 @@ public abstract class AbstractProfiledDocumentsTests extends BasicServiceTestUni
@Test
public void getConfiguration() {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
System.out.println(baseTarget().path(InterfaceConstants.Methods.CONFIGURATION_PATH).request(MediaType.APPLICATION_JSON).get(Configuration.class));
}
// Queries
@Test
public void query() throws JsonProcessingException {
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
System.out.println(baseTarget().path(InterfaceConstants.Methods.QUERY_PATH).
request(MediaType.APPLICATION_JSON).
post(Entity.entity(Serialization.write(new QueryRequest()),MediaType.APPLICATION_JSON)));

View File

@ -1,4 +1,4 @@
package org.gcube.application.geoportal.service;
package org.gcube.application.geoportal.service.profiledDocuments;
import org.bson.Document;
import org.gcube.application.cms.serialization.Serialization;
@ -13,13 +13,13 @@ import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest;
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.service.BasicServiceTestUnit;
import org.junit.Assert;
import org.junit.Test;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import java.util.Collections;
import java.util.List;
import static org.junit.Assert.assertTrue;
@ -50,7 +50,7 @@ public class DummyProfiledDocumentTest extends AbstractProfiledDocumentsTests{
doc.getTheDocument().put("someStrangeField","someOtherRandomValue");
String edited=doc.getTheDocument().toJson();
Assert.assertNotEquals(beforeJson,doc.getTheDocument().toJson());
doc=check(baseTarget().path(doc.getId()).request(MediaType.APPLICATION_JSON).
doc= BasicServiceTestUnit.check(baseTarget().path(doc.getId()).request(MediaType.APPLICATION_JSON).
put(Entity.entity(doc.getTheDocument(), MediaType.APPLICATION_JSON)),ProfiledDocument.class);
Assert.assertEquals(edited,doc.getTheDocument().toJson());
}

View File

@ -1,8 +1,7 @@
package org.gcube.application.geoportal.service;
package org.gcube.application.geoportal.service.profiledDocuments;
import org.bson.Document;
import org.gcube.application.cms.serialization.Serialization;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
@ -12,7 +11,6 @@ import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.junit.Test;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

View File

@ -0,0 +1,21 @@
package org.gcube.application.geoportal.service.profiledDocuments;
import org.gcube.application.cms.tests.TestProfiles;
import org.junit.Test;
public class Profiles {
@Test
public void getFields(){
TestProfiles.profiles.forEach((k,v)->{
System.out.println(k+"\t"+v);
if(v.getSchema()!=null&&!v.getSchema().isLeaf()) {
v.getSchema().getChildren().forEach(
i -> System.out.println(i.getClass() + "\t" + i)
);
}
});
}
}

View File

@ -0,0 +1,8 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms.images-plugin
This library contains gcube-cms plugins for images materializations
## [v1.0.0-SNAPSHOT] - 2022-02-24
- First release

26
images-plugin/FUNDING.md Normal file
View File

@ -0,0 +1,26 @@
# Acknowledgments
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
- the H2020 research and innovation programme
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);

312
images-plugin/LICENSE.md Normal file
View File

@ -0,0 +1,312 @@
# European Union Public Licence V. 1.1
EUPL © the European Community 2007
This European Union Public Licence (the “EUPL”) applies to the Work or Software
(as defined below) which is provided under the terms of this Licence. Any use of
the Work, other than as authorised under this Licence is prohibited (to the
extent such use is covered by a right of the copyright holder of the Work).
The Original Work is provided under the terms of this Licence when the Licensor
(as defined below) has placed the following notice immediately following the
copyright notice for the Original Work:
Licensed under the EUPL V.1.1
or has expressed by any other mean his willingness to license under the EUPL.
## 1. Definitions
In this Licence, the following terms have the following meaning:
- The Licence: this Licence.
- The Original Work or the Software: the software distributed and/or
communicated by the Licensor under this Licence, available as Source Code and
also as Executable Code as the case may be.
- Derivative Works: the works or software that could be created by the Licensee,
based upon the Original Work or modifications thereof. This Licence does not
define the extent of modification or dependence on the Original Work required
in order to classify a work as a Derivative Work; this extent is determined by
copyright law applicable in the country mentioned in Article 15.
- The Work: the Original Work and/or its Derivative Works.
- The Source Code: the human-readable form of the Work which is the most
convenient for people to study and modify.
- The Executable Code: any code which has generally been compiled and which is
meant to be interpreted by a computer as a program.
- The Licensor: the natural or legal person that distributes and/or communicates
the Work under the Licence.
- Contributor(s): any natural or legal person who modifies the Work under the
Licence, or otherwise contributes to the creation of a Derivative Work.
- The Licensee or “You”: any natural or legal person who makes any usage of the
Software under the terms of the Licence.
- Distribution and/or Communication: any act of selling, giving, lending,
renting, distributing, communicating, transmitting, or otherwise making
available, on-line or off-line, copies of the Work or providing access to its
essential functionalities at the disposal of any other natural or legal
person.
## 2. Scope of the rights granted by the Licence
The Licensor hereby grants You a world-wide, royalty-free, non-exclusive,
sub-licensable licence to do the following, for the duration of copyright vested
in the Original Work:
- use the Work in any circumstance and for all usage, reproduce the Work, modify
- the Original Work, and make Derivative Works based upon the Work, communicate
- to the public, including the right to make available or display the Work or
- copies thereof to the public and perform publicly, as the case may be, the
- Work, distribute the Work or copies thereof, lend and rent the Work or copies
- thereof, sub-license rights in the Work or copies thereof.
Those rights can be exercised on any media, supports and formats, whether now
known or later invented, as far as the applicable law permits so.
In the countries where moral rights apply, the Licensor waives his right to
exercise his moral right to the extent allowed by law in order to make effective
the licence of the economic rights here above listed.
The Licensor grants to the Licensee royalty-free, non exclusive usage rights to
any patents held by the Licensor, to the extent necessary to make use of the
rights granted on the Work under this Licence.
## 3. Communication of the Source Code
The Licensor may provide the Work either in its Source Code form, or as
Executable Code. If the Work is provided as Executable Code, the Licensor
provides in addition a machine-readable copy of the Source Code of the Work
along with each copy of the Work that the Licensor distributes or indicates, in
a notice following the copyright notice attached to the Work, a repository where
the Source Code is easily and freely accessible for as long as the Licensor
continues to distribute and/or communicate the Work.
## 4. Limitations on copyright
Nothing in this Licence is intended to deprive the Licensee of the benefits from
any exception or limitation to the exclusive rights of the rights owners in the
Original Work or Software, of the exhaustion of those rights or of other
applicable limitations thereto.
## 5. Obligations of the Licensee
The grant of the rights mentioned above is subject to some restrictions and
obligations imposed on the Licensee. Those obligations are the following:
Attribution right: the Licensee shall keep intact all copyright, patent or
trademarks notices and all notices that refer to the Licence and to the
disclaimer of warranties. The Licensee must include a copy of such notices and a
copy of the Licence with every copy of the Work he/she distributes and/or
communicates. The Licensee must cause any Derivative Work to carry prominent
notices stating that the Work has been modified and the date of modification.
Copyleft clause: If the Licensee distributes and/or communicates copies of the
Original Works or Derivative Works based upon the Original Work, this
Distribution and/or Communication will be done under the terms of this Licence
or of a later version of this Licence unless the Original Work is expressly
distributed only under this version of the Licence. The Licensee (becoming
Licensor) cannot offer or impose any additional terms or conditions on the Work
or Derivative Work that alter or restrict the terms of the Licence.
Compatibility clause: If the Licensee Distributes and/or Communicates Derivative
Works or copies thereof based upon both the Original Work and another work
licensed under a Compatible Licence, this Distribution and/or Communication can
be done under the terms of this Compatible Licence. For the sake of this clause,
“Compatible Licence” refers to the licences listed in the appendix attached to
this Licence. Should the Licensees obligations under the Compatible Licence
conflict with his/her obligations under this Licence, the obligations of the
Compatible Licence shall prevail.
Provision of Source Code: When distributing and/or communicating copies of the
Work, the Licensee will provide a machine-readable copy of the Source Code or
indicate a repository where this Source will be easily and freely available for
as long as the Licensee continues to distribute and/or communicate the Work.
Legal Protection: This Licence does not grant permission to use the trade names,
trademarks, service marks, or names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the copyright notice.
## 6. Chain of Authorship
The original Licensor warrants that the copyright in the Original Work granted
hereunder is owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each Contributor warrants that the copyright in the modifications he/she brings
to the Work are owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each time You accept the Licence, the original Licensor and subsequent
Contributors grant You a licence to their contributions to the Work, under the
terms of this Licence.
## 7. Disclaimer of Warranty
The Work is a work in progress, which is continuously improved by numerous
contributors. It is not a finished work and may therefore contain defects or
“bugs” inherent to this type of software development.
For the above reason, the Work is provided under the Licence on an “as is” basis
and without warranties of any kind concerning the Work, including without
limitation merchantability, fitness for a particular purpose, absence of defects
or errors, accuracy, non-infringement of intellectual property rights other than
copyright as stated in Article 6 of this Licence.
This disclaimer of warranty is an essential part of the Licence and a condition
for the grant of any rights to the Work.
## 8. Disclaimer of Liability
Except in the cases of wilful misconduct or damages directly caused to natural
persons, the Licensor will in no event be liable for any direct or indirect,
material or moral, damages of any kind, arising out of the Licence or of the use
of the Work, including without limitation, damages for loss of goodwill, work
stoppage, computer failure or malfunction, loss of data or any commercial
damage, even if the Licensor has been advised of the possibility of such
damage. However, the Licensor will be liable under statutory product liability
laws as far such laws apply to the Work.
## 9. Additional agreements
While distributing the Original Work or Derivative Works, You may choose to
conclude an additional agreement to offer, and charge a fee for, acceptance of
support, warranty, indemnity, or other liability obligations and/or services
consistent with this Licence. However, in accepting such obligations, You may
act only on your own behalf and on your sole responsibility, not on behalf of
the original Licensor or any other Contributor, and only if You agree to
indemnify, defend, and hold each Contributor harmless for any liability incurred
by, or claims asserted against such Contributor by the fact You have accepted
any such warranty or additional liability.
## 10. Acceptance of the Licence
The provisions of this Licence can be accepted by clicking on an icon “I agree”
placed under the bottom of a window displaying the text of this Licence or by
affirming consent in any other similar way, in accordance with the rules of
applicable law. Clicking on that icon indicates your clear and irrevocable
acceptance of this Licence and all of its terms and conditions.
Similarly, you irrevocably accept this Licence and all of its terms and
conditions by exercising any rights granted to You by Article 2 of this Licence,
such as the use of the Work, the creation by You of a Derivative Work or the
Distribution and/or Communication by You of the Work or copies thereof.
## 11. Information to the public
In case of any Distribution and/or Communication of the Work by means of
electronic communication by You (for example, by offering to download the Work
from a remote location) the distribution channel or media (for example, a
website) must at least provide to the public the information requested by the
applicable law regarding the Licensor, the Licence and the way it may be
accessible, concluded, stored and reproduced by the Licensee.
## 12. Termination of the Licence
The Licence and the rights granted hereunder will terminate automatically upon
any breach by the Licensee of the terms of the Licence.
Such a termination will not terminate the licences of any person who has
received the Work from the Licensee under the Licence, provided such persons
remain in full compliance with the Licence.
## 13. Miscellaneous
Without prejudice of Article 9 above, the Licence represents the complete
agreement between the Parties as to the Work licensed hereunder.
If any provision of the Licence is invalid or unenforceable under applicable
law, this will not affect the validity or enforceability of the Licence as a
whole. Such provision will be construed and/or reformed so as necessary to make
it valid and enforceable.
The European Commission may publish other linguistic versions and/or new
versions of this Licence, so far this is required and reasonable, without
reducing the scope of the rights granted by the Licence. New versions of the
Licence will be published with a unique version number.
All linguistic versions of this Licence, approved by the European Commission,
have identical value. Parties can take advantage of the linguistic version of
their choice.
## 14. Jurisdiction
Any litigation resulting from the interpretation of this License, arising
between the European Commission, as a Licensor, and any Licensee, will be
subject to the jurisdiction of the Court of Justice of the European Communities,
as laid down in article 238 of the Treaty establishing the European Community.
Any litigation arising between Parties, other than the European Commission, and
resulting from the interpretation of this License, will be subject to the
exclusive jurisdiction of the competent court where the Licensor resides or
conducts its primary business.
## 15. Applicable Law
This Licence shall be governed by the law of the European Union country where
the Licensor resides or has his registered office.
This licence shall be governed by the Belgian law if:
- a litigation arises between the European Commission, as a Licensor, and any
- Licensee; the Licensor, other than the European Commission, has no residence
- or registered office inside a European Union country.
## Appendix
“Compatible Licences” according to article 5 EUPL are:
- GNU General Public License (GNU GPL) v. 2
- Open Software License (OSL) v. 2.1, v. 3.0
- Common Public License v. 1.0
- Eclipse Public License v. 1.0
- Cecill v. 2.0

52
images-plugin/README.md Normal file
View File

@ -0,0 +1,52 @@
gCube CMS Suite
--------------------------------------------------
gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles.
## Built with
* [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework
* [OpenJDK](https://openjdk.java.net/) - The JDK used
* [JAX-RS](https://github.com/eclipse-ee4j/jaxrs-api) - Java™ API for RESTful Web Services
* [Jersey](https://jersey.github.io/) - JAX-RS runtime
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service).
## Change log
See [CHANGELOG.md](CHANGELOG.md).
## License
This project is licensed under the EUPL V.1.1 License - see the [LICENSE.md](LICENSE.md) file for details.
## About the gCube Framework
This software is part of the [gCubeFramework](https://www.gcube-system.org/ "gCubeFramework"): an
open-source software toolkit used for building and operating Hybrid Data
Infrastructures enabling the dynamic deployment of Virtual Research Environments
by favouring the realisation of reuse oriented policies.
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- DILIGENT (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- D4Science (grant no. 212488);
- D4Science-II (grant no.239019);
- ENVRI (grant no. 283465);
- iMarine(grant no. 283644);
- EUBrazilOpenBio (grant no. 288754).
- the H2020 research and innovation programme
- SoBigData (grant no. 654024);
- PARTHENOS (grant no. 654119);
- EGIEngage (grant no. 654142);
- ENVRIplus (grant no. 654182);
- BlueBRIDGE (grant no. 675680);
- PerformFish (grant no. 727610);
- AGINFRAplus (grant no. 731001);
- DESIRA (grant no. 818194);
- ARIADNEplus (grant no. 823914);
- RISIS2 (grant no. 824091);

48
images-plugin/pom.xml Normal file
View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>images-plugins</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>gCube CMS - Images Plugins</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.2-SNAPSHOT</version>
</parent>
<properties>
<gitBaseUrl>https://code-repo.d4science.org/gCubeSystem</gitBaseUrl>
</properties>
<scm>
<connection>scm:git:${gitBaseUrl}/gcube-cms-suite</connection>
<developerConnection>scm:git:${gitBaseUrl}/gcube-cms-suite</developerConnection>
<url>${gitBaseUrl}/gcube-cms-suite</url>
</scm>
<dependencies>
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>cms-plugin-framework</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>cms-test-commons</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,8 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms.notifications-plugins
This library contains gcube-cms plugins for notitfications events
## [v1.0.0-SNAPSHOT] - 2022-02-24
- First release

View File

@ -0,0 +1,26 @@
# Acknowledgments
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
- the H2020 research and innovation programme
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);

View File

@ -0,0 +1,312 @@
# European Union Public Licence V. 1.1
EUPL © the European Community 2007
This European Union Public Licence (the “EUPL”) applies to the Work or Software
(as defined below) which is provided under the terms of this Licence. Any use of
the Work, other than as authorised under this Licence is prohibited (to the
extent such use is covered by a right of the copyright holder of the Work).
The Original Work is provided under the terms of this Licence when the Licensor
(as defined below) has placed the following notice immediately following the
copyright notice for the Original Work:
Licensed under the EUPL V.1.1
or has expressed by any other mean his willingness to license under the EUPL.
## 1. Definitions
In this Licence, the following terms have the following meaning:
- The Licence: this Licence.
- The Original Work or the Software: the software distributed and/or
communicated by the Licensor under this Licence, available as Source Code and
also as Executable Code as the case may be.
- Derivative Works: the works or software that could be created by the Licensee,
based upon the Original Work or modifications thereof. This Licence does not
define the extent of modification or dependence on the Original Work required
in order to classify a work as a Derivative Work; this extent is determined by
copyright law applicable in the country mentioned in Article 15.
- The Work: the Original Work and/or its Derivative Works.
- The Source Code: the human-readable form of the Work which is the most
convenient for people to study and modify.
- The Executable Code: any code which has generally been compiled and which is
meant to be interpreted by a computer as a program.
- The Licensor: the natural or legal person that distributes and/or communicates
the Work under the Licence.
- Contributor(s): any natural or legal person who modifies the Work under the
Licence, or otherwise contributes to the creation of a Derivative Work.
- The Licensee or “You”: any natural or legal person who makes any usage of the
Software under the terms of the Licence.
- Distribution and/or Communication: any act of selling, giving, lending,
renting, distributing, communicating, transmitting, or otherwise making
available, on-line or off-line, copies of the Work or providing access to its
essential functionalities at the disposal of any other natural or legal
person.
## 2. Scope of the rights granted by the Licence
The Licensor hereby grants You a world-wide, royalty-free, non-exclusive,
sub-licensable licence to do the following, for the duration of copyright vested
in the Original Work:
- use the Work in any circumstance and for all usage, reproduce the Work, modify
- the Original Work, and make Derivative Works based upon the Work, communicate
- to the public, including the right to make available or display the Work or
- copies thereof to the public and perform publicly, as the case may be, the
- Work, distribute the Work or copies thereof, lend and rent the Work or copies
- thereof, sub-license rights in the Work or copies thereof.
Those rights can be exercised on any media, supports and formats, whether now
known or later invented, as far as the applicable law permits so.
In the countries where moral rights apply, the Licensor waives his right to
exercise his moral right to the extent allowed by law in order to make effective
the licence of the economic rights here above listed.
The Licensor grants to the Licensee royalty-free, non exclusive usage rights to
any patents held by the Licensor, to the extent necessary to make use of the
rights granted on the Work under this Licence.
## 3. Communication of the Source Code
The Licensor may provide the Work either in its Source Code form, or as
Executable Code. If the Work is provided as Executable Code, the Licensor
provides in addition a machine-readable copy of the Source Code of the Work
along with each copy of the Work that the Licensor distributes or indicates, in
a notice following the copyright notice attached to the Work, a repository where
the Source Code is easily and freely accessible for as long as the Licensor
continues to distribute and/or communicate the Work.
## 4. Limitations on copyright
Nothing in this Licence is intended to deprive the Licensee of the benefits from
any exception or limitation to the exclusive rights of the rights owners in the
Original Work or Software, of the exhaustion of those rights or of other
applicable limitations thereto.
## 5. Obligations of the Licensee
The grant of the rights mentioned above is subject to some restrictions and
obligations imposed on the Licensee. Those obligations are the following:
Attribution right: the Licensee shall keep intact all copyright, patent or
trademarks notices and all notices that refer to the Licence and to the
disclaimer of warranties. The Licensee must include a copy of such notices and a
copy of the Licence with every copy of the Work he/she distributes and/or
communicates. The Licensee must cause any Derivative Work to carry prominent
notices stating that the Work has been modified and the date of modification.
Copyleft clause: If the Licensee distributes and/or communicates copies of the
Original Works or Derivative Works based upon the Original Work, this
Distribution and/or Communication will be done under the terms of this Licence
or of a later version of this Licence unless the Original Work is expressly
distributed only under this version of the Licence. The Licensee (becoming
Licensor) cannot offer or impose any additional terms or conditions on the Work
or Derivative Work that alter or restrict the terms of the Licence.
Compatibility clause: If the Licensee Distributes and/or Communicates Derivative
Works or copies thereof based upon both the Original Work and another work
licensed under a Compatible Licence, this Distribution and/or Communication can
be done under the terms of this Compatible Licence. For the sake of this clause,
“Compatible Licence” refers to the licences listed in the appendix attached to
this Licence. Should the Licensees obligations under the Compatible Licence
conflict with his/her obligations under this Licence, the obligations of the
Compatible Licence shall prevail.
Provision of Source Code: When distributing and/or communicating copies of the
Work, the Licensee will provide a machine-readable copy of the Source Code or
indicate a repository where this Source will be easily and freely available for
as long as the Licensee continues to distribute and/or communicate the Work.
Legal Protection: This Licence does not grant permission to use the trade names,
trademarks, service marks, or names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the copyright notice.
## 6. Chain of Authorship
The original Licensor warrants that the copyright in the Original Work granted
hereunder is owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each Contributor warrants that the copyright in the modifications he/she brings
to the Work are owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each time You accept the Licence, the original Licensor and subsequent
Contributors grant You a licence to their contributions to the Work, under the
terms of this Licence.
## 7. Disclaimer of Warranty
The Work is a work in progress, which is continuously improved by numerous
contributors. It is not a finished work and may therefore contain defects or
“bugs” inherent to this type of software development.
For the above reason, the Work is provided under the Licence on an “as is” basis
and without warranties of any kind concerning the Work, including without
limitation merchantability, fitness for a particular purpose, absence of defects
or errors, accuracy, non-infringement of intellectual property rights other than
copyright as stated in Article 6 of this Licence.
This disclaimer of warranty is an essential part of the Licence and a condition
for the grant of any rights to the Work.
## 8. Disclaimer of Liability
Except in the cases of wilful misconduct or damages directly caused to natural
persons, the Licensor will in no event be liable for any direct or indirect,
material or moral, damages of any kind, arising out of the Licence or of the use
of the Work, including without limitation, damages for loss of goodwill, work
stoppage, computer failure or malfunction, loss of data or any commercial
damage, even if the Licensor has been advised of the possibility of such
damage. However, the Licensor will be liable under statutory product liability
laws as far such laws apply to the Work.
## 9. Additional agreements
While distributing the Original Work or Derivative Works, You may choose to
conclude an additional agreement to offer, and charge a fee for, acceptance of
support, warranty, indemnity, or other liability obligations and/or services
consistent with this Licence. However, in accepting such obligations, You may
act only on your own behalf and on your sole responsibility, not on behalf of
the original Licensor or any other Contributor, and only if You agree to
indemnify, defend, and hold each Contributor harmless for any liability incurred
by, or claims asserted against such Contributor by the fact You have accepted
any such warranty or additional liability.
## 10. Acceptance of the Licence
The provisions of this Licence can be accepted by clicking on an icon “I agree”
placed under the bottom of a window displaying the text of this Licence or by
affirming consent in any other similar way, in accordance with the rules of
applicable law. Clicking on that icon indicates your clear and irrevocable
acceptance of this Licence and all of its terms and conditions.
Similarly, you irrevocably accept this Licence and all of its terms and
conditions by exercising any rights granted to You by Article 2 of this Licence,
such as the use of the Work, the creation by You of a Derivative Work or the
Distribution and/or Communication by You of the Work or copies thereof.
## 11. Information to the public
In case of any Distribution and/or Communication of the Work by means of
electronic communication by You (for example, by offering to download the Work
from a remote location) the distribution channel or media (for example, a
website) must at least provide to the public the information requested by the
applicable law regarding the Licensor, the Licence and the way it may be
accessible, concluded, stored and reproduced by the Licensee.
## 12. Termination of the Licence
The Licence and the rights granted hereunder will terminate automatically upon
any breach by the Licensee of the terms of the Licence.
Such a termination will not terminate the licences of any person who has
received the Work from the Licensee under the Licence, provided such persons
remain in full compliance with the Licence.
## 13. Miscellaneous
Without prejudice of Article 9 above, the Licence represents the complete
agreement between the Parties as to the Work licensed hereunder.
If any provision of the Licence is invalid or unenforceable under applicable
law, this will not affect the validity or enforceability of the Licence as a
whole. Such provision will be construed and/or reformed so as necessary to make
it valid and enforceable.
The European Commission may publish other linguistic versions and/or new
versions of this Licence, so far this is required and reasonable, without
reducing the scope of the rights granted by the Licence. New versions of the
Licence will be published with a unique version number.
All linguistic versions of this Licence, approved by the European Commission,
have identical value. Parties can take advantage of the linguistic version of
their choice.
## 14. Jurisdiction
Any litigation resulting from the interpretation of this License, arising
between the European Commission, as a Licensor, and any Licensee, will be
subject to the jurisdiction of the Court of Justice of the European Communities,
as laid down in article 238 of the Treaty establishing the European Community.
Any litigation arising between Parties, other than the European Commission, and
resulting from the interpretation of this License, will be subject to the
exclusive jurisdiction of the competent court where the Licensor resides or
conducts its primary business.
## 15. Applicable Law
This Licence shall be governed by the law of the European Union country where
the Licensor resides or has his registered office.
This licence shall be governed by the Belgian law if:
- a litigation arises between the European Commission, as a Licensor, and any
- Licensee; the Licensor, other than the European Commission, has no residence
- or registered office inside a European Union country.
## Appendix
“Compatible Licences” according to article 5 EUPL are:
- GNU General Public License (GNU GPL) v. 2
- Open Software License (OSL) v. 2.1, v. 3.0
- Common Public License v. 1.0
- Eclipse Public License v. 1.0
- Cecill v. 2.0

View File

@ -0,0 +1,52 @@
gCube CMS Suite
--------------------------------------------------
gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles.
## Built with
* [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework
* [OpenJDK](https://openjdk.java.net/) - The JDK used
* [JAX-RS](https://github.com/eclipse-ee4j/jaxrs-api) - Java™ API for RESTful Web Services
* [Jersey](https://jersey.github.io/) - JAX-RS runtime
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service).
## Change log
See [CHANGELOG.md](CHANGELOG.md).
## License
This project is licensed under the EUPL V.1.1 License - see the [LICENSE.md](LICENSE.md) file for details.
## About the gCube Framework
This software is part of the [gCubeFramework](https://www.gcube-system.org/ "gCubeFramework"): an
open-source software toolkit used for building and operating Hybrid Data
Infrastructures enabling the dynamic deployment of Virtual Research Environments
by favouring the realisation of reuse oriented policies.
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- DILIGENT (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- D4Science (grant no. 212488);
- D4Science-II (grant no.239019);
- ENVRI (grant no. 283465);
- iMarine(grant no. 283644);
- EUBrazilOpenBio (grant no. 288754).
- the H2020 research and innovation programme
- SoBigData (grant no. 654024);
- PARTHENOS (grant no. 654119);
- EGIEngage (grant no. 654142);
- ENVRIplus (grant no. 654182);
- BlueBRIDGE (grant no. 675680);
- PerformFish (grant no. 727610);
- AGINFRAplus (grant no. 731001);
- DESIRA (grant no. 818194);
- ARIADNEplus (grant no. 823914);
- RISIS2 (grant no. 824091);

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>notifications-plugins</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>gCube CMS - Notifications Plugins</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.2-SNAPSHOT</version>
</parent>
<properties>
<gitBaseUrl>https://code-repo.d4science.org/gCubeSystem</gitBaseUrl>
</properties>
<scm>
<connection>scm:git:${gitBaseUrl}/gcube-cms-suite</connection>
<developerConnection>scm:git:${gitBaseUrl}/gcube-cms-suite</developerConnection>
<url>${gitBaseUrl}/gcube-cms-suite</url>
</scm>
<dependencies>
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>cms-plugin-framework</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>cms-test-commons</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

39
pom.xml
View File

@ -9,7 +9,7 @@
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<packaging>pom</packaging>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
<name>Gcube CMS Suite</name>
<description>gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles.</description>
@ -43,6 +43,14 @@
<module>geoportal-client</module>
<!-- Common Plugins -->
<module>sdi-plugins</module>
<module>notifications-plugins</module>
<module>dataminer-plugins</module>
<module>images-plugin</module>
<module>ckan-plugin</module>
<!-- Custom implementations -->
<module>concessioni-lifecycle</module>
<module>concessioni-model</module>
@ -90,6 +98,35 @@
<version>[1.0.0-SNAPSHOT,2.0.0)</version>
</dependency>
<!-- Common Plugins -->
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>sdi-plugins</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0)</version>
</dependency>
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>notifications-plugins</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0)</version>
</dependency>
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>dataminer-plugins</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0)</version>
</dependency>
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>images-plugin</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0)</version>
</dependency>
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>ckan-plugin</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0)</version>
</dependency>
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-client</artifactId>

8
sdi-plugins/CHANGELOG.md Normal file
View File

@ -0,0 +1,8 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
# Changelog for org.gcube.application.cms.sdi-plugins
This library contains gcube-cms plugins for indexing and materializations in gCube SDI
## [v1.0.0-SNAPSHOT] - 2022-02-24
- First release

26
sdi-plugins/FUNDING.md Normal file
View File

@ -0,0 +1,26 @@
# Acknowledgments
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
- the H2020 research and innovation programme
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);

312
sdi-plugins/LICENSE.md Normal file
View File

@ -0,0 +1,312 @@
# European Union Public Licence V. 1.1
EUPL © the European Community 2007
This European Union Public Licence (the “EUPL”) applies to the Work or Software
(as defined below) which is provided under the terms of this Licence. Any use of
the Work, other than as authorised under this Licence is prohibited (to the
extent such use is covered by a right of the copyright holder of the Work).
The Original Work is provided under the terms of this Licence when the Licensor
(as defined below) has placed the following notice immediately following the
copyright notice for the Original Work:
Licensed under the EUPL V.1.1
or has expressed by any other mean his willingness to license under the EUPL.
## 1. Definitions
In this Licence, the following terms have the following meaning:
- The Licence: this Licence.
- The Original Work or the Software: the software distributed and/or
communicated by the Licensor under this Licence, available as Source Code and
also as Executable Code as the case may be.
- Derivative Works: the works or software that could be created by the Licensee,
based upon the Original Work or modifications thereof. This Licence does not
define the extent of modification or dependence on the Original Work required
in order to classify a work as a Derivative Work; this extent is determined by
copyright law applicable in the country mentioned in Article 15.
- The Work: the Original Work and/or its Derivative Works.
- The Source Code: the human-readable form of the Work which is the most
convenient for people to study and modify.
- The Executable Code: any code which has generally been compiled and which is
meant to be interpreted by a computer as a program.
- The Licensor: the natural or legal person that distributes and/or communicates
the Work under the Licence.
- Contributor(s): any natural or legal person who modifies the Work under the
Licence, or otherwise contributes to the creation of a Derivative Work.
- The Licensee or “You”: any natural or legal person who makes any usage of the
Software under the terms of the Licence.
- Distribution and/or Communication: any act of selling, giving, lending,
renting, distributing, communicating, transmitting, or otherwise making
available, on-line or off-line, copies of the Work or providing access to its
essential functionalities at the disposal of any other natural or legal
person.
## 2. Scope of the rights granted by the Licence
The Licensor hereby grants You a world-wide, royalty-free, non-exclusive,
sub-licensable licence to do the following, for the duration of copyright vested
in the Original Work:
- use the Work in any circumstance and for all usage, reproduce the Work, modify
- the Original Work, and make Derivative Works based upon the Work, communicate
- to the public, including the right to make available or display the Work or
- copies thereof to the public and perform publicly, as the case may be, the
- Work, distribute the Work or copies thereof, lend and rent the Work or copies
- thereof, sub-license rights in the Work or copies thereof.
Those rights can be exercised on any media, supports and formats, whether now
known or later invented, as far as the applicable law permits so.
In the countries where moral rights apply, the Licensor waives his right to
exercise his moral right to the extent allowed by law in order to make effective
the licence of the economic rights here above listed.
The Licensor grants to the Licensee royalty-free, non exclusive usage rights to
any patents held by the Licensor, to the extent necessary to make use of the
rights granted on the Work under this Licence.
## 3. Communication of the Source Code
The Licensor may provide the Work either in its Source Code form, or as
Executable Code. If the Work is provided as Executable Code, the Licensor
provides in addition a machine-readable copy of the Source Code of the Work
along with each copy of the Work that the Licensor distributes or indicates, in
a notice following the copyright notice attached to the Work, a repository where
the Source Code is easily and freely accessible for as long as the Licensor
continues to distribute and/or communicate the Work.
## 4. Limitations on copyright
Nothing in this Licence is intended to deprive the Licensee of the benefits from
any exception or limitation to the exclusive rights of the rights owners in the
Original Work or Software, of the exhaustion of those rights or of other
applicable limitations thereto.
## 5. Obligations of the Licensee
The grant of the rights mentioned above is subject to some restrictions and
obligations imposed on the Licensee. Those obligations are the following:
Attribution right: the Licensee shall keep intact all copyright, patent or
trademarks notices and all notices that refer to the Licence and to the
disclaimer of warranties. The Licensee must include a copy of such notices and a
copy of the Licence with every copy of the Work he/she distributes and/or
communicates. The Licensee must cause any Derivative Work to carry prominent
notices stating that the Work has been modified and the date of modification.
Copyleft clause: If the Licensee distributes and/or communicates copies of the
Original Works or Derivative Works based upon the Original Work, this
Distribution and/or Communication will be done under the terms of this Licence
or of a later version of this Licence unless the Original Work is expressly
distributed only under this version of the Licence. The Licensee (becoming
Licensor) cannot offer or impose any additional terms or conditions on the Work
or Derivative Work that alter or restrict the terms of the Licence.
Compatibility clause: If the Licensee Distributes and/or Communicates Derivative
Works or copies thereof based upon both the Original Work and another work
licensed under a Compatible Licence, this Distribution and/or Communication can
be done under the terms of this Compatible Licence. For the sake of this clause,
“Compatible Licence” refers to the licences listed in the appendix attached to
this Licence. Should the Licensees obligations under the Compatible Licence
conflict with his/her obligations under this Licence, the obligations of the
Compatible Licence shall prevail.
Provision of Source Code: When distributing and/or communicating copies of the
Work, the Licensee will provide a machine-readable copy of the Source Code or
indicate a repository where this Source will be easily and freely available for
as long as the Licensee continues to distribute and/or communicate the Work.
Legal Protection: This Licence does not grant permission to use the trade names,
trademarks, service marks, or names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the copyright notice.
## 6. Chain of Authorship
The original Licensor warrants that the copyright in the Original Work granted
hereunder is owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each Contributor warrants that the copyright in the modifications he/she brings
to the Work are owned by him/her or licensed to him/her and that he/she has the
power and authority to grant the Licence.
Each time You accept the Licence, the original Licensor and subsequent
Contributors grant You a licence to their contributions to the Work, under the
terms of this Licence.
## 7. Disclaimer of Warranty
The Work is a work in progress, which is continuously improved by numerous
contributors. It is not a finished work and may therefore contain defects or
“bugs” inherent to this type of software development.
For the above reason, the Work is provided under the Licence on an “as is” basis
and without warranties of any kind concerning the Work, including without
limitation merchantability, fitness for a particular purpose, absence of defects
or errors, accuracy, non-infringement of intellectual property rights other than
copyright as stated in Article 6 of this Licence.
This disclaimer of warranty is an essential part of the Licence and a condition
for the grant of any rights to the Work.
## 8. Disclaimer of Liability
Except in the cases of wilful misconduct or damages directly caused to natural
persons, the Licensor will in no event be liable for any direct or indirect,
material or moral, damages of any kind, arising out of the Licence or of the use
of the Work, including without limitation, damages for loss of goodwill, work
stoppage, computer failure or malfunction, loss of data or any commercial
damage, even if the Licensor has been advised of the possibility of such
damage. However, the Licensor will be liable under statutory product liability
laws as far such laws apply to the Work.
## 9. Additional agreements
While distributing the Original Work or Derivative Works, You may choose to
conclude an additional agreement to offer, and charge a fee for, acceptance of
support, warranty, indemnity, or other liability obligations and/or services
consistent with this Licence. However, in accepting such obligations, You may
act only on your own behalf and on your sole responsibility, not on behalf of
the original Licensor or any other Contributor, and only if You agree to
indemnify, defend, and hold each Contributor harmless for any liability incurred
by, or claims asserted against such Contributor by the fact You have accepted
any such warranty or additional liability.
## 10. Acceptance of the Licence
The provisions of this Licence can be accepted by clicking on an icon “I agree”
placed under the bottom of a window displaying the text of this Licence or by
affirming consent in any other similar way, in accordance with the rules of
applicable law. Clicking on that icon indicates your clear and irrevocable
acceptance of this Licence and all of its terms and conditions.
Similarly, you irrevocably accept this Licence and all of its terms and
conditions by exercising any rights granted to You by Article 2 of this Licence,
such as the use of the Work, the creation by You of a Derivative Work or the
Distribution and/or Communication by You of the Work or copies thereof.
## 11. Information to the public
In case of any Distribution and/or Communication of the Work by means of
electronic communication by You (for example, by offering to download the Work
from a remote location) the distribution channel or media (for example, a
website) must at least provide to the public the information requested by the
applicable law regarding the Licensor, the Licence and the way it may be
accessible, concluded, stored and reproduced by the Licensee.
## 12. Termination of the Licence
The Licence and the rights granted hereunder will terminate automatically upon
any breach by the Licensee of the terms of the Licence.
Such a termination will not terminate the licences of any person who has
received the Work from the Licensee under the Licence, provided such persons
remain in full compliance with the Licence.
## 13. Miscellaneous
Without prejudice of Article 9 above, the Licence represents the complete
agreement between the Parties as to the Work licensed hereunder.
If any provision of the Licence is invalid or unenforceable under applicable
law, this will not affect the validity or enforceability of the Licence as a
whole. Such provision will be construed and/or reformed so as necessary to make
it valid and enforceable.
The European Commission may publish other linguistic versions and/or new
versions of this Licence, so far this is required and reasonable, without
reducing the scope of the rights granted by the Licence. New versions of the
Licence will be published with a unique version number.
All linguistic versions of this Licence, approved by the European Commission,
have identical value. Parties can take advantage of the linguistic version of
their choice.
## 14. Jurisdiction
Any litigation resulting from the interpretation of this License, arising
between the European Commission, as a Licensor, and any Licensee, will be
subject to the jurisdiction of the Court of Justice of the European Communities,
as laid down in article 238 of the Treaty establishing the European Community.
Any litigation arising between Parties, other than the European Commission, and
resulting from the interpretation of this License, will be subject to the
exclusive jurisdiction of the competent court where the Licensor resides or
conducts its primary business.
## 15. Applicable Law
This Licence shall be governed by the law of the European Union country where
the Licensor resides or has his registered office.
This licence shall be governed by the Belgian law if:
- a litigation arises between the European Commission, as a Licensor, and any
- Licensee; the Licensor, other than the European Commission, has no residence
- or registered office inside a European Union country.
## Appendix
“Compatible Licences” according to article 5 EUPL are:
- GNU General Public License (GNU GPL) v. 2
- Open Software License (OSL) v. 2.1, v. 3.0
- Common Public License v. 1.0
- Eclipse Public License v. 1.0
- Cecill v. 2.0

52
sdi-plugins/README.md Normal file
View File

@ -0,0 +1,52 @@
gCube CMS Suite
--------------------------------------------------
gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles.
## Built with
* [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework
* [OpenJDK](https://openjdk.java.net/) - The JDK used
* [JAX-RS](https://github.com/eclipse-ee4j/jaxrs-api) - Java™ API for RESTful Web Services
* [Jersey](https://jersey.github.io/) - JAX-RS runtime
* [Maven](https://maven.apache.org/) - Dependency Management
## Documentation
Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service).
## Change log
See [CHANGELOG.md](CHANGELOG.md).
## License
This project is licensed under the EUPL V.1.1 License - see the [LICENSE.md](LICENSE.md) file for details.
## About the gCube Framework
This software is part of the [gCubeFramework](https://www.gcube-system.org/ "gCubeFramework"): an
open-source software toolkit used for building and operating Hybrid Data
Infrastructures enabling the dynamic deployment of Virtual Research Environments
by favouring the realisation of reuse oriented policies.
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- DILIGENT (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- D4Science (grant no. 212488);
- D4Science-II (grant no.239019);
- ENVRI (grant no. 283465);
- iMarine(grant no. 283644);
- EUBrazilOpenBio (grant no. 288754).
- the H2020 research and innovation programme
- SoBigData (grant no. 654024);
- PARTHENOS (grant no. 654119);
- EGIEngage (grant no. 654142);
- ENVRIplus (grant no. 654182);
- BlueBRIDGE (grant no. 675680);
- PerformFish (grant no. 727610);
- AGINFRAplus (grant no. 731001);
- DESIRA (grant no. 818194);
- ARIADNEplus (grant no. 823914);
- RISIS2 (grant no. 824091);

62
sdi-plugins/pom.xml Normal file
View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>sdi-plugins</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>gCube CMS - SDI Plugins</name>
<parent>
<groupId>org.gcube.application.cms</groupId>
<artifactId>gcube-cms-suite</artifactId>
<version>1.0.2-SNAPSHOT</version>
</parent>
<properties>
<gitBaseUrl>https://code-repo.d4science.org/gCubeSystem</gitBaseUrl>
</properties>
<scm>
<connection>scm:git:${gitBaseUrl}/gcube-cms-suite</connection>
<developerConnection>scm:git:${gitBaseUrl}/gcube-cms-suite</developerConnection>
<url>${gitBaseUrl}/gcube-cms-suite</url>
</scm>
<dependencies>
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>cms-plugin-framework</artifactId>
</dependency>
<!-- SDI -->
<dependency>
<groupId>org.gcube.spatial.data</groupId>
<artifactId>gis-interface</artifactId>
<version>[2.4.6,3.0.0)</version>
</dependency>
<!-- DT -->
<dependency>
<groupId>org.gcube.data.transfer</groupId>
<artifactId>data-transfer-library</artifactId>
<version>[1.2.1,2.0.0]</version>
</dependency>
<dependency>
<groupId>org.gcube.application.cms</groupId>
<artifactId>cms-test-commons</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -65,7 +65,7 @@
{
"_id" : "PostgisIndex",
"_id" : "SDI-Indexer-Plugin",
"_type" : "Indexer",
"_configuration" : {
"bboxEvaluation" : ["$..posizionamentoScavo.._bbox"],

View File

@ -2,6 +2,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for org.gcube.application.geoportal-client
## [v1.0.2-SNAPSHOT] - 2022-02-24
- Updated parent
## [v1.0.1] - 2021-09-20
- Updated parent

View File

@ -4,12 +4,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>use-cases</artifactId>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
<name>CMS Use cases</name>
<parent>
<artifactId>gcube-cms-suite</artifactId>
<groupId>org.gcube.application.cms</groupId>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
</parent>

View File

@ -1,6 +1,7 @@
package org.gcube.application.cms.usecases;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.usecases.mocks.ConcessionPublisherThread;
import org.gcube.application.geoportal.common.utils.FileSets;
@ -37,7 +38,7 @@ public class EditFileSet {
//Prepare Fileset
System.out.println("Preparing request..");
StorageUtils storage=new StorageUtils();
AddSectionToConcessioneRequest request= FileSets.prepareRequestFromFolder(storage,toEditPath,sourceFolder);
AddSectionToConcessioneRequest request= ConcessionPublisherThread.prepareRequest(storage,toEditPath,sourceFolder);
MongoConcessioni client=mongoConcessioni().build();

View File

@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.cms.usecases.mocks.ConcessionPublisherThread;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
@ -29,7 +30,7 @@ public class StressTest {
TokenSetter.set("/pred4s/preprod/preVRE");
AtomicLong executed=new AtomicLong(0);
AddSectionToConcessioneRequest request= FileSets.prepareRequest(
AddSectionToConcessioneRequest request= ConcessionPublisherThread.prepareRequest(
new StorageUtils(), Concessione.Paths.RELAZIONE,new File(TestConcessioniModel.getBaseFolder(),"relazione.pdf"));
int numRequests=100000;

View File

@ -1,22 +1,29 @@
package org.gcube.application.cms.usecases.mocks;
import lombok.*;
import lombok.Data;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.geoportal.client.utils.Serialization;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport;
import org.gcube.application.geoportal.common.model.legacy.InputStreamDescriptor;
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
import org.gcube.application.geoportal.common.utils.FileSets;
import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.List;
import java.util.Map;
import java.util.NavigableSet;
import java.util.concurrent.*;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.mongoConcessioni;
@ -113,7 +120,19 @@ public class ConcessionPublisherThread implements Runnable{
}
}
public static AddSectionToConcessioneRequest prepareRequest(StorageUtils storage, String path, File... toUpload) throws FileNotFoundException {
AddSectionToConcessioneRequest toReturn=new AddSectionToConcessioneRequest();
toReturn.setDestinationPath(path);
for (File f : toUpload) {
if(!f.isDirectory())
toReturn.getStreams().add(FileSets.asTemp(storage, new InputStreamDescriptor(new FileInputStream(f), f.getName())));
else {
toReturn.getStreams().addAll(prepareRequest(storage,path,f.listFiles()).getStreams());
}
}
return toReturn;
}
private static Concessione createMock(String baseName, String packageName, Map<String,List<File>> piante, List<File> pos,
MongoConcessioni client, StorageUtils storage) throws Exception {
@ -124,15 +143,15 @@ public class ConcessionPublisherThread implements Runnable{
String mongoId=c.getMongo_id();
// TEST DATA, DO NOT CARE
client.registerFileSet(mongoId, FileSets.prepareRequest(storage,
client.registerFileSet(mongoId, prepareRequest(storage,
Concessione.Paths.RELAZIONE,new File (TestConcessioniModel.getBaseFolder(),"relazione.pdf")));
client.registerFileSet(mongoId, FileSets.prepareRequest(storage,
client.registerFileSet(mongoId, prepareRequest(storage,
Concessione.Paths.imgByIndex(0),Files.getSiblings(TestConcessioniModel.getBaseFolder(),"immagine").get(0)));
// POSIZIONAMENTO
client.registerFileSet(mongoId, FileSets.prepareRequest(storage,
client.registerFileSet(mongoId, prepareRequest(storage,
Concessione.Paths.POSIZIONAMENTO,pos.toArray(new File[pos.size()])));
// PIANTE
@ -145,7 +164,7 @@ public class ConcessionPublisherThread implements Runnable{
client.update(mongoId, Serialization.write(c));
//Set fileset
client.registerFileSet(mongoId, FileSets.prepareRequest(storage,path, entries[i].getValue().toArray(new File[0])));
client.registerFileSet(mongoId, prepareRequest(storage,path, entries[i].getValue().toArray(new File[0])));
}
c=client.publish(mongoId);