@ -0,0 +1,6 @@
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
# Changelog for org.gcube.application.cms-plugin-framework
|
||||
|
||||
## [v1.0.0] 2021-09-20
|
||||
- First release
|
@ -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);
|
@ -0,0 +1,53 @@
|
||||
CMS - Plugin Framework
|
||||
--------------------------------------------------
|
||||
|
||||
CMS Plugin Framework is a library containing the definition of Java interfaces that plugins should implement
|
||||
|
||||
## Built with
|
||||
* [gCube SDI] (https://gcube.wiki.gcube-system.org/gcube/) - The gCube SDI
|
||||
* [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).
|
||||
|
||||
## 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);
|
||||
|
@ -0,0 +1,43 @@
|
||||
<?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>cms-plugin-framework</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.gcube.application.cms</groupId>
|
||||
<artifactId>gcube-cms-suite</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</parent>
|
||||
|
||||
|
||||
<properties>
|
||||
<gitBaseUrl>https://code-repo.d4science.org/gCubeSystem</gitBaseUrl>
|
||||
<sis.version>1.0</sis.version>
|
||||
|
||||
</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>geoportal-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,28 @@
|
||||
package 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;
|
||||
|
||||
public interface InitializablePlugin extends Plugin{
|
||||
/**
|
||||
* To be called once per context
|
||||
* @return
|
||||
* @throws InitializationException
|
||||
*/
|
||||
|
||||
public InitializationReport initInContext()throws InitializationException;
|
||||
|
||||
/**
|
||||
* To be called for static initialization
|
||||
* @return
|
||||
* @throws InitializationException
|
||||
*/
|
||||
public InitializationReport init()throws InitializationException;
|
||||
|
||||
/**
|
||||
* To be called at application shutdown
|
||||
* @throws ShutDownException
|
||||
*/
|
||||
public void shutdown() throws ShutDownException;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package org.gcube.application.cms.plugins;
|
||||
|
||||
import org.gcube.application.cms.plugins.faults.StepException;
|
||||
import org.gcube.application.cms.plugins.reports.ExecutionReport;
|
||||
import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
|
||||
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
|
||||
|
||||
public interface LifecycleManager extends InitializablePlugin{
|
||||
|
||||
// Lifecycle operations
|
||||
|
||||
public ExecutionReport performStep(StepExecutionRequest request)throws StepException;
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package org.gcube.application.cms.plugins;
|
||||
|
||||
import org.gcube.application.cms.plugins.model.PluginDescriptor;
|
||||
|
||||
public interface Plugin {
|
||||
|
||||
public PluginDescriptor getDescriptor();
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package org.gcube.application.cms.plugins.faults;
|
||||
|
||||
public class InitializationException extends Exception{
|
||||
|
||||
public InitializationException() {
|
||||
}
|
||||
|
||||
public InitializationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public InitializationException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public InitializationException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public InitializationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package org.gcube.application.cms.plugins.faults;
|
||||
|
||||
public class ShutDownException extends Exception {
|
||||
|
||||
public ShutDownException() {
|
||||
}
|
||||
|
||||
public ShutDownException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ShutDownException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public ShutDownException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public ShutDownException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package org.gcube.application.cms.plugins.faults;
|
||||
|
||||
public class StepException extends Exception {
|
||||
|
||||
public StepException() {
|
||||
}
|
||||
|
||||
public StepException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public StepException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public StepException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public StepException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package org.gcube.application.cms.plugins.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.gcube.application.geoportal.common.model.document.ComparableVersion;
|
||||
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PluginDescriptor {
|
||||
|
||||
public static class BaseTypes{
|
||||
public static final String LIFECYCLE_MANAGER="LifecycleManagement";
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private String id;
|
||||
@NonNull
|
||||
private String type;
|
||||
private String label;
|
||||
private String description;
|
||||
private ComparableVersion version;
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package org.gcube.application.cms.plugins.reports;
|
||||
|
||||
import lombok.Data;
|
||||
import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
|
||||
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
|
||||
|
||||
@Data
|
||||
public class ExecutionReport extends Report{
|
||||
|
||||
StepExecutionRequest request;
|
||||
|
||||
ProfiledDocument result;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package org.gcube.application.cms.plugins.reports;
|
||||
|
||||
public class InitializationReport {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package org.gcube.application.cms.plugins.reports;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class Report {
|
||||
|
||||
public static enum Status {
|
||||
ERROR,WARNING,OK
|
||||
}
|
||||
|
||||
private Status status;
|
||||
private List<String> messages;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package org.gcube.application.cms.plugins.requests;
|
||||
|
||||
import lombok.Data;
|
||||
import org.bson.Document;
|
||||
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
|
||||
import org.gcube.application.geoportal.common.model.profile.Profile;
|
||||
|
||||
@Data
|
||||
public class StepExecutionRequest {
|
||||
|
||||
public static class Steps{
|
||||
public static final String ON_INIT_DOCUMENT="@@@INIT_DOCUMENT@@";
|
||||
public static final String ON_UPDATE_DOCUMENT="@@@UPDATE_DOCUMENT@@";
|
||||
public static final String ON_DELETE_DOCUMENT="@@@DELETE_DOCUMENT@@";
|
||||
|
||||
public static final String ON_MATERIALIZE_DOCUMENT="@@@MATERIALIZE_DOCUMENT@@";
|
||||
public static final String ON_DEMATERIALIZE_DOCUMENT="@@@DEMATERIALIZE_DOCUMENT@@";
|
||||
|
||||
public static final String ON_INDEX_DOCUMENT="@@@INDEX_DOCUMENT@@";
|
||||
public static final String ON_DEINDEX_DOCUMENT="@@@DEINDEX_DOCUMENT@@";
|
||||
}
|
||||
|
||||
|
||||
Profile profile;
|
||||
ProfiledDocument document;
|
||||
String step;
|
||||
Document callParameters;
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
# Changelog for org.gcube.application.cms.cms-test-commons
|
||||
## [v1.0.1] - 2021-09-11
|
||||
- Introduced profiled documents
|
||||
|
||||
## [v1.0.0] - 2021-09-11
|
||||
First release
|
||||
- First release
|
@ -0,0 +1,71 @@
|
||||
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.Plugin;
|
||||
import org.gcube.application.cms.plugins.faults.InitializationException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.reflections.Reflections;
|
||||
import org.reflections.util.ConfigurationBuilder;
|
||||
import org.reflections.util.FilterBuilder;
|
||||
|
||||
import java.rmi.ServerError;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
public class BasicPluginTest {
|
||||
|
||||
static List<Plugin> plugins;
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
Assert.assertFalse(plugins.isEmpty());
|
||||
System.out.println("Plugin Loading OK");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void basicChecks(){
|
||||
plugins.forEach(p->{
|
||||
System.out.println("INIT Plugin "+p.getClass());
|
||||
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.init();
|
||||
} catch (InitializationException e) {
|
||||
e.printStackTrace(System.err);
|
||||
Assert.fail("Unable to Init "+p.getDescriptor().getId());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,33 +1,20 @@
|
||||
package org.gcube.application.cms.tests.model;
|
||||
package org.gcube.application.cms.tests.model.concessioni;
|
||||
|
||||
import org.gcube.application.geoportal.common.utils.Files;
|
||||
import sun.misc.IOUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class TestFilters {
|
||||
public class TestConcessioniFilters {
|
||||
|
||||
public static final HashMap<String,String> filters=new HashMap<>();
|
||||
|
||||
static{
|
||||
|
||||
for(File f:new File(TestModel.getBaseFolder(),"filters").listFiles()){
|
||||
for(File f:new File(TestConcessioniModel.getBaseFolder(),"filters").listFiles()){
|
||||
try {
|
||||
filters.put(f.getName(), Files.readFileAsString(f.getAbsolutePath(), Charset.defaultCharset()));
|
||||
} catch (IOException e) {
|
@ -1,21 +1,19 @@
|
||||
package org.gcube.application.cms.tests.model;
|
||||
package org.gcube.application.cms.tests.model.concessioni;
|
||||
|
||||
import org.gcube.application.geoportal.common.utils.Files;
|
||||
import sun.misc.IOUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class TestQueries {
|
||||
public class TestConcessioniQueries {
|
||||
|
||||
public static final HashMap<String,String> queries =new HashMap<>();
|
||||
|
||||
static{
|
||||
|
||||
for(File f:new File(TestModel.getBaseFolder(),"queries").listFiles()){
|
||||
for(File f:new File(TestConcessioniModel.getBaseFolder(),"queries").listFiles()){
|
||||
try {
|
||||
queries.put(f.getName(), Files.readFileAsString(f.getAbsolutePath(), Charset.defaultCharset()));
|
||||
} catch (IOException e) {
|
@ -0,0 +1,6 @@
|
||||
package org.gcube.application.cms.commons.model;
|
||||
|
||||
public class Serialization {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
# Changelog for org.gcube.application.cms.concessioni-lifecycle
|
||||
|
||||
This library contains custom extensions for the support of GNA "concessioni" use case
|
||||
|
||||
## [v1.0.0] - 2021-12-15
|
||||
- First release
|
@ -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);
|
@ -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);
|
||||
|
@ -0,0 +1,50 @@
|
||||
<?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>concessioni-lifecycle</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<name>GNA Concessioni Lifecycle</name>
|
||||
|
||||
|
||||
<parent>
|
||||
<groupId>org.gcube.application.cms</groupId>
|
||||
<artifactId>gcube-cms-suite</artifactId>
|
||||
<version>1.0.1</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>
|
||||
<dependency>
|
||||
<groupId>org.gcube.application.cms</groupId>
|
||||
<artifactId>concessioni-model</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
@ -0,0 +1,102 @@
|
||||
package org.gcube.application.cms.concessioni.plugins;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.bson.Document;
|
||||
import org.gcube.application.cms.custom.gna.concessioni.model.ProfiledConcessione;
|
||||
import org.gcube.application.cms.plugins.LifecycleManager;
|
||||
import org.gcube.application.cms.plugins.faults.InitializationException;
|
||||
import org.gcube.application.cms.plugins.faults.ShutDownException;
|
||||
import org.gcube.application.cms.plugins.faults.StepException;
|
||||
import org.gcube.application.cms.plugins.model.PluginDescriptor;
|
||||
import org.gcube.application.cms.plugins.reports.ExecutionReport;
|
||||
import org.gcube.application.cms.plugins.reports.InitializationReport;
|
||||
import org.gcube.application.cms.plugins.reports.Report;
|
||||
import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
|
||||
import org.gcube.application.geoportal.common.model.document.ComparableVersion;
|
||||
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
|
||||
import org.gcube.application.geoportal.common.utils.JSONPathWrapper;
|
||||
|
||||
@Slf4j
|
||||
public class ConcessioniLifeCycleManager implements LifecycleManager {
|
||||
|
||||
private static final PluginDescriptor DESCRIPTOR=new PluginDescriptor("GNA-CONCESSIONI-LC", PluginDescriptor.BaseTypes.LIFECYCLE_MANAGER);
|
||||
static {
|
||||
DESCRIPTOR.setDescription("GNA Concessioni. This plugin supports custom lifecycle management for the GNA Concessioni UseCase.");
|
||||
DESCRIPTOR.setVersion(new ComparableVersion("1.0.0"));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public InitializationReport initInContext() throws InitializationException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InitializationReport init() throws InitializationException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() throws ShutDownException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExecutionReport performStep(StepExecutionRequest request) throws StepException {
|
||||
log.info("Serving Request {}",request);
|
||||
ExecutionReport report=new ExecutionReport();
|
||||
report.setRequest(request);
|
||||
report.setStatus(Report.Status.OK);
|
||||
try {
|
||||
switch (request.getStep()) {
|
||||
case StepExecutionRequest.Steps.ON_INIT_DOCUMENT:
|
||||
// Set Defaults as for on update
|
||||
case StepExecutionRequest.Steps.ON_UPDATE_DOCUMENT: {
|
||||
ProfiledDocument doc = request.getDocument();
|
||||
|
||||
break;
|
||||
}
|
||||
case StepExecutionRequest.Steps.ON_MATERIALIZE_DOCUMENT: {
|
||||
break;
|
||||
}
|
||||
case StepExecutionRequest.Steps.ON_DEMATERIALIZE_DOCUMENT: {
|
||||
break;
|
||||
}
|
||||
case StepExecutionRequest.Steps.ON_DEINDEX_DOCUMENT: {
|
||||
break;
|
||||
}
|
||||
case StepExecutionRequest.Steps.ON_INDEX_DOCUMENT: {
|
||||
break;
|
||||
}
|
||||
case StepExecutionRequest.Steps.ON_DELETE_DOCUMENT: {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new StepException("Invalid Step " + request.getStep());
|
||||
}
|
||||
}catch (StepException e){
|
||||
throw e;
|
||||
}catch (Throwable t){
|
||||
log.error("Unable to perform step "+request.getStep(),t);
|
||||
report.setStatus(Report.Status.ERROR);
|
||||
report.getMessages().add("Unable to execute Step "+request.getStep()+". Error was "+t.getMessage());
|
||||
}
|
||||
return report;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginDescriptor getDescriptor() {
|
||||
return DESCRIPTOR;
|
||||
}
|
||||
|
||||
|
||||
// STATIC ROUTINES
|
||||
|
||||
private static final ProfiledDocument setDefaults(ProfiledDocument document){
|
||||
ProfiledConcessione c =(ProfiledConcessione) document;
|
||||
c.setDefaults();
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package org.gcube.application.cms.concessioni.plugins;
|
||||
|
||||
import org.gcube.application.cms.tests.BasicPluginTest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class Tests extends BasicPluginTest {
|
||||
|
||||
@Test
|
||||
public void testLoad(){
|
||||
Assert.assertTrue(true);
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
# Changelog for org.gcube.application.cms.concessioni-model
|
||||
|
||||
This library contains custom BEANS for the support of GNA "concessioni" use case
|
||||
|
||||
## [v1.0.0-SNAPSHOT] - 2021-12-15
|
||||
- First release
|
@ -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);
|
@ -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);
|
||||
|
@ -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>
|
||||
|
||||
<groupId>org.gcube.application.cms</groupId>
|
||||
<artifactId>concessioni-model</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<name>GNA Concessioni Model</name>
|
||||
|
||||
|
||||
<parent>
|
||||
<groupId>org.gcube.application.cms</groupId>
|
||||
<artifactId>gcube-cms-suite</artifactId>
|
||||
<version>1.0.1</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>geoportal-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.application.cms</groupId>
|
||||
<artifactId>cms-test-commons</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,7 @@
|
||||
package org.gcube.application.cms.custom.gna.concessioni.model;
|
||||
|
||||
public interface DefaultLogicHolder {
|
||||
|
||||
public void setDefaults();
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package org.gcube.application.cms.custom.gna.concessioni.model;
|
||||
|
||||
import org.bson.Document;
|
||||
|
||||
public class DocumentedRelazioneScavo extends Document implements DefaultLogicHolder{
|
||||
|
||||
@Override
|
||||
public void setDefaults() {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package org.gcube.application.geoportal.client;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.model.rest.AddSectionToConcessioneRequest;
|
||||
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.MongoConcessioni;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class DefaultProfiledConcessioni implements MongoConcessioni {
|
||||
|
||||
|
||||
@Override
|
||||
public Concessione createNew(Concessione c) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String id) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String id, Boolean force) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Concessione getById(String id) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Concessione> getList() throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Concessione publish(String id) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Concessione registerFileSet(String id, AddSectionToConcessioneRequest request) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Concessione cleanFileSet(String id, String path) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Concessione update(String id, String jsonUpdate) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Concessione replace(Concessione replacement) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unPublish(String id) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration getCurrentConfiguration() throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Concessione> search(String filter) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Concessione> query(QueryRequest request) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryForJSON(QueryRequest request) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Iterator<T> queryForType(QueryRequest request, Class<T> clazz) throws Exception {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package org.gcube.application.geoportal.client;
|
||||
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.bson.Document;
|
||||
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.common.clients.delegates.ProxyDelegate;
|
||||
|
||||
import javax.ws.rs.client.WebTarget;
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.Iterator;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class DefaultProfiledDocuments implements ProfiledDocumentsI<ProfiledDocument> {
|
||||
|
||||
@NonNull
|
||||
private final ProxyDelegate<WebTarget> delegate;
|
||||
|
||||
@Override
|
||||
public ProfiledDocument createNew(Document toCreate) throws RemoteException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String id) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String id, Boolean force) throws RemoteException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProfiledDocument getById(String id) throws RemoteException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration getConfiguration() throws RemoteException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<ProfiledDocument> query(QueryRequest request) throws RemoteException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String querForJSON(QueryRequest request) throws RemoteException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProfiledDocument performStep(String id, String step, Document request) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
package org.gcube.application.geoportal.client;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.ws.rs.client.WebTarget;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.project.Project;
|
||||
import org.gcube.application.geoportal.common.rest.ProjectsI;
|
||||
import org.gcube.common.clients.Call;
|
||||
import org.gcube.common.clients.delegates.ProxyDelegate;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class DefaultProjects implements ProjectsI{
|
||||
|
||||
@NonNull
|
||||
private final ProxyDelegate<WebTarget> delegate;
|
||||
|
||||
@Override
|
||||
public void deleteById(String profileId, String projectId) throws RemoteException {
|
||||
deleteById(profileId,projectId,false);
|
||||
}
|
||||
@Override
|
||||
public void deleteById(String profileId, String projectId,Boolean force) throws RemoteException {
|
||||
// Call<WebTarget,String> call= new Call<WebTarget, String>() {
|
||||
//
|
||||
// @Override
|
||||
// public String call(WebTarget endpoint) throws Exception {
|
||||
// endpoint.path(profileId).path(projectId).request(MediaType.APPLICATION_JSON).delete();
|
||||
// }
|
||||
// };
|
||||
// try{
|
||||
// delegate.make(call);
|
||||
// }catch(Exception e) {
|
||||
//// throw new RemoteException(e);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Project> getAll() throws RemoteException {
|
||||
Call<WebTarget,Iterator<Project>> call=new Call<WebTarget,Iterator<Project>>(){
|
||||
@Override
|
||||
public Iterator<Project> call(WebTarget endpoint) throws Exception {
|
||||
throw new Exception("Client method not ready");
|
||||
}
|
||||
};
|
||||
try{
|
||||
return delegate.make(call);
|
||||
}catch(Exception e) {
|
||||
throw new RemoteException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Project> getByFilter(String filter) throws RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Project> getByFilter(String filter, String profileId) throws RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project getById(String profileId, String id) throws RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Project> getByProfile(String profileId) throws RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project registrNew(String profileId, String jsonDocument) throws RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Project update(String profileId, String projectId, String jsonDocument) throws RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package org.gcube.application.geoportal.common.model.document;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class Access {
|
||||
|
||||
public static final String POLICY="policy";
|
||||
public static final String LICENSE="license";
|
||||
|
||||
private AccessPolicy policy;
|
||||
private String license;
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package org.gcube.application.geoportal.common.model.document;
|
||||
|
||||
public enum AccessPolicy {
|
||||
|
||||
OPEN,RESTRICTED,EMBARGOED;
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package org.gcube.application.geoportal.common.model.document;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class AccountingInfo {
|
||||
|
||||
public static final String USER="user";
|
||||
public static final String CONTEXT="context";
|
||||
public static final String INSTANT="instant";
|
||||
|
||||
private User user;
|
||||
private Context context;
|
||||
private LocalDateTime instant;
|
||||
}
|
@ -0,0 +1,840 @@
|
||||
package org.gcube.application.geoportal.common.model.document;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Deque;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Generic implementation of version comparison.
|
||||
* </p>
|
||||
*
|
||||
* Features:
|
||||
* <ul>
|
||||
* <li>mixing of '<code>-</code>' (hyphen) and '<code>.</code>' (dot) separators,</li>
|
||||
* <li>transition between characters and digits also constitutes a separator:
|
||||
* <code>1.0alpha1 => [1, 0, alpha, 1]</code></li>
|
||||
* <li>unlimited number of version components,</li>
|
||||
* <li>version components in the text can be digits or strings,</li>
|
||||
* <li>strings are checked for well-known qualifiers and the qualifier ordering is used for version ordering.
|
||||
* Well-known qualifiers (case insensitive) are:<ul>
|
||||
* <li><code>alpha</code> or <code>a</code></li>
|
||||
* <li><code>beta</code> or <code>b</code></li>
|
||||
* <li><code>milestone</code> or <code>m</code></li>
|
||||
* <li><code>rc</code> or <code>cr</code></li>
|
||||
* <li><code>snapshot</code></li>
|
||||
* <li><code>(the empty string)</code> or <code>ga</code> or <code>final</code></li>
|
||||
* <li><code>sp</code></li>
|
||||
* </ul>
|
||||
* Unknown qualifiers are considered after known qualifiers, with lexical order (always case insensitive),
|
||||
* </li>
|
||||
* <li>a hyphen usually precedes a qualifier, and is always less important than something preceded with a dot.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @see <a href="https://cwiki.apache.org/confluence/display/MAVENOLD/Versioning">"Versioning" on Maven Wiki</a>
|
||||
* @author <a href="mailto:kenney@apache.org">Kenney Westerhof</a>
|
||||
* @author <a href="mailto:hboutemy@apache.org">Hervé Boutemy</a>
|
||||
*/
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class ComparableVersion
|
||||
implements Comparable<ComparableVersion>
|
||||
{
|
||||
private static final int MAX_INTITEM_LENGTH = 9;
|
||||
|
||||
private static final int MAX_LONGITEM_LENGTH = 18;
|
||||
|
||||
private String value;
|
||||
|
||||
private String canonical;
|
||||
|
||||
private ListItem items;
|
||||
|
||||
private interface Item
|
||||
{
|
||||
int INT_ITEM = 3;
|
||||
int LONG_ITEM = 4;
|
||||
int BIGINTEGER_ITEM = 0;
|
||||
int STRING_ITEM = 1;
|
||||
int LIST_ITEM = 2;
|
||||
|
||||
int compareTo( Item item );
|
||||
|
||||
int getType();
|
||||
|
||||
boolean isNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a numeric item in the version item list that can be represented with an int.
|
||||
*/
|
||||
private static class IntItem
|
||||
implements Item
|
||||
{
|
||||
private final int value;
|
||||
|
||||
public static final IntItem ZERO = new IntItem();
|
||||
|
||||
private IntItem()
|
||||
{
|
||||
this.value = 0;
|
||||
}
|
||||
|
||||
IntItem( String str )
|
||||
{
|
||||
this.value = Integer.parseInt( str );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
return INT_ITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNull()
|
||||
{
|
||||
return value == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo( Item item )
|
||||
{
|
||||
if ( item == null )
|
||||
{
|
||||
return ( value == 0 ) ? 0 : 1; // 1.0 == 1, 1.1 > 1
|
||||
}
|
||||
|
||||
switch ( item.getType() )
|
||||
{
|
||||
case INT_ITEM:
|
||||
int itemValue = ( (IntItem) item ).value;
|
||||
return Integer.compare( value, itemValue );
|
||||
case LONG_ITEM:
|
||||
case BIGINTEGER_ITEM:
|
||||
return -1;
|
||||
|
||||
case STRING_ITEM:
|
||||
return 1; // 1.1 > 1-sp
|
||||
|
||||
case LIST_ITEM:
|
||||
return 1; // 1.1 > 1-1
|
||||
|
||||
default:
|
||||
throw new IllegalStateException( "invalid item: " + item.getClass() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o )
|
||||
{
|
||||
if ( this == o )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ( o == null || getClass() != o.getClass() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
IntItem intItem = (IntItem) o;
|
||||
|
||||
return value == intItem.value;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return Integer.toString( value );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a numeric item in the version item list that can be represented with a long.
|
||||
*/
|
||||
private static class LongItem
|
||||
implements Item
|
||||
{
|
||||
private final long value;
|
||||
|
||||
LongItem( String str )
|
||||
{
|
||||
this.value = Long.parseLong( str );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
return LONG_ITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNull()
|
||||
{
|
||||
return value == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo( Item item )
|
||||
{
|
||||
if ( item == null )
|
||||
{
|
||||
return ( value == 0 ) ? 0 : 1; // 1.0 == 1, 1.1 > 1
|
||||
}
|
||||
|
||||
switch ( item.getType() )
|
||||
{
|
||||
case INT_ITEM:
|
||||
return 1;
|
||||
case LONG_ITEM:
|
||||
long itemValue = ( (LongItem) item ).value;
|
||||
return Long.compare( value, itemValue );
|
||||
case BIGINTEGER_ITEM:
|
||||
return -1;
|
||||
|
||||
case STRING_ITEM:
|
||||
return 1; // 1.1 > 1-sp
|
||||
|
||||
case LIST_ITEM:
|
||||
return 1; // 1.1 > 1-1
|
||||
|
||||
default:
|
||||
throw new IllegalStateException( "invalid item: " + item.getClass() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o )
|
||||
{
|
||||
if ( this == o )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ( o == null || getClass() != o.getClass() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
LongItem longItem = (LongItem) o;
|
||||
|
||||
return value == longItem.value;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return (int) ( value ^ ( value >>> 32 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return Long.toString( value );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a numeric item in the version item list.
|
||||
*/
|
||||
private static class BigIntegerItem
|
||||
implements Item
|
||||
{
|
||||
private final BigInteger value;
|
||||
|
||||
BigIntegerItem( String str )
|
||||
{
|
||||
this.value = new BigInteger( str );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
return BIGINTEGER_ITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNull()
|
||||
{
|
||||
return BigInteger.ZERO.equals( value );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo( Item item )
|
||||
{
|
||||
if ( item == null )
|
||||
{
|
||||
return BigInteger.ZERO.equals( value ) ? 0 : 1; // 1.0 == 1, 1.1 > 1
|
||||
}
|
||||
|
||||
switch ( item.getType() )
|
||||
{
|
||||
case INT_ITEM:
|
||||
case LONG_ITEM:
|
||||
return 1;
|
||||
|
||||
case BIGINTEGER_ITEM:
|
||||
return value.compareTo( ( (BigIntegerItem) item ).value );
|
||||
|
||||
case STRING_ITEM:
|
||||
return 1; // 1.1 > 1-sp
|
||||
|
||||
case LIST_ITEM:
|
||||
return 1; // 1.1 > 1-1
|
||||
|
||||
default:
|
||||
throw new IllegalStateException( "invalid item: " + item.getClass() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o )
|
||||
{
|
||||
if ( this == o )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ( o == null || getClass() != o.getClass() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BigIntegerItem that = (BigIntegerItem) o;
|
||||
|
||||
return value.equals( that.value );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return value.hashCode();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a string in the version item list, usually a qualifier.
|
||||
*/
|
||||
private static class StringItem
|
||||
implements Item
|
||||
{
|
||||
private static final List<String> QUALIFIERS =
|
||||
Arrays.asList( "alpha", "beta", "milestone", "rc", "snapshot", "", "sp" );
|
||||
|
||||
private static final Properties ALIASES = new Properties();
|
||||
static
|
||||
{
|
||||
ALIASES.put( "ga", "" );
|
||||
ALIASES.put( "final", "" );
|
||||
ALIASES.put( "release", "" );
|
||||
ALIASES.put( "cr", "rc" );
|
||||
}
|
||||
|
||||
/**
|
||||
* A comparable value for the empty-string qualifier. This one is used to determine if a given qualifier makes
|
||||
* the version older than one without a qualifier, or more recent.
|
||||
*/
|
||||
private static final String RELEASE_VERSION_INDEX = String.valueOf( QUALIFIERS.indexOf( "" ) );
|
||||
|
||||
private final String value;
|
||||
|
||||
StringItem( String value, boolean followedByDigit )
|
||||
{
|
||||
if ( followedByDigit && value.length() == 1 )
|
||||
{
|
||||
// a1 = alpha-1, b1 = beta-1, m1 = milestone-1
|
||||
switch ( value.charAt( 0 ) )
|
||||
{
|
||||
case 'a':
|
||||
value = "alpha";
|
||||
break;
|
||||
case 'b':
|
||||
value = "beta";
|
||||
break;
|
||||
case 'm':
|
||||
value = "milestone";
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
this.value = ALIASES.getProperty( value , value );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
return STRING_ITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNull()
|
||||
{
|
||||
return ( comparableQualifier( value ).compareTo( RELEASE_VERSION_INDEX ) == 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a comparable value for a qualifier.
|
||||
*
|
||||
* This method takes into account the ordering of known qualifiers then unknown qualifiers with lexical
|
||||
* ordering.
|
||||
*
|
||||
* just returning an Integer with the index here is faster, but requires a lot of if/then/else to check for -1
|
||||
* or QUALIFIERS.size and then resort to lexical ordering. Most comparisons are decided by the first character,
|
||||
* so this is still fast. If more characters are needed then it requires a lexical sort anyway.
|
||||
*
|
||||
* @param qualifier
|
||||
* @return an equivalent value that can be used with lexical comparison
|
||||
*/
|
||||
public static String comparableQualifier( String qualifier )
|
||||
{
|
||||
int i = QUALIFIERS.indexOf( qualifier );
|
||||
|
||||
return i == -1 ? ( QUALIFIERS.size() + "-" + qualifier ) : String.valueOf( i );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo( Item item )
|
||||
{
|
||||
if ( item == null )
|
||||
{
|
||||
// 1-rc < 1, 1-ga > 1
|
||||
return comparableQualifier( value ).compareTo( RELEASE_VERSION_INDEX );
|
||||
}
|
||||
switch ( item.getType() )
|
||||
{
|
||||
case INT_ITEM:
|
||||
case LONG_ITEM:
|
||||
case BIGINTEGER_ITEM:
|
||||
return -1; // 1.any < 1.1 ?
|
||||
|
||||
case STRING_ITEM:
|
||||
return comparableQualifier( value ).compareTo( comparableQualifier( ( (StringItem) item ).value ) );
|
||||
|
||||
case LIST_ITEM:
|
||||
return -1; // 1.any < 1-1
|
||||
|
||||
default:
|
||||
throw new IllegalStateException( "invalid item: " + item.getClass() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o )
|
||||
{
|
||||
if ( this == o )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ( o == null || getClass() != o.getClass() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
StringItem that = (StringItem) o;
|
||||
|
||||
return value.equals( that.value );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return value.hashCode();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a version list item. This class is used both for the global item list and for sub-lists (which start
|
||||
* with '-(number)' in the version specification).
|
||||
*/
|
||||
private static class ListItem
|
||||
extends ArrayList<Item>
|
||||
implements Item
|
||||
{
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
return LIST_ITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNull()
|
||||
{
|
||||
return ( size() == 0 );
|
||||
}
|
||||
|
||||
void normalize()
|
||||
{
|
||||
for ( int i = size() - 1; i >= 0; i-- )
|
||||
{
|
||||
Item lastItem = get( i );
|
||||
|
||||
if ( lastItem.isNull() )
|
||||
{
|
||||
// remove null trailing items: 0, "", empty list
|
||||
remove( i );
|
||||
}
|
||||
else if ( !( lastItem instanceof ListItem ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo( Item item )
|
||||
{
|
||||
if ( item == null )
|
||||
{
|
||||
if ( size() == 0 )
|
||||
{
|
||||
return 0; // 1-0 = 1- (normalize) = 1
|
||||
}
|
||||
// Compare the entire list of items with null - not just the first one, MNG-6964
|
||||
for ( Item i : this )
|
||||
{
|
||||
int result = i.compareTo( null );
|
||||
if ( result != 0 )
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
switch ( item.getType() )
|
||||
{
|
||||
case INT_ITEM:
|
||||
case LONG_ITEM:
|
||||
case BIGINTEGER_ITEM:
|
||||
return -1; // 1-1 < 1.0.x
|
||||
|
||||
case STRING_ITEM:
|
||||
return 1; // 1-1 > 1-sp
|
||||
|
||||
case LIST_ITEM:
|
||||
Iterator<Item> left = iterator();
|
||||
Iterator<Item> right = ( (ListItem) item ).iterator();
|
||||
|
||||
while ( left.hasNext() || right.hasNext() )
|
||||
{
|
||||
Item l = left.hasNext() ? left.next() : null;
|
||||
Item r = right.hasNext() ? right.next() : null;
|
||||
|
||||
// if this is shorter, then invert the compare and mul with -1
|
||||
int result = l == null ? ( r == null ? 0 : -1 * r.compareTo( l ) ) : l.compareTo( r );
|
||||
|
||||
if ( result != 0 )
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
default:
|
||||
throw new IllegalStateException( "invalid item: " + item.getClass() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
for ( Item item : this )
|
||||
{
|
||||
if ( buffer.length() > 0 )
|
||||
{
|
||||
buffer.append( ( item instanceof ListItem ) ? '-' : '.' );
|
||||
}
|
||||
buffer.append( item );
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the contents in the same format that is used when you call toString() on a List.
|
||||
*/
|
||||
private String toListString()
|
||||
{
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append( "[" );
|
||||
for ( Item item : this )
|
||||
{
|
||||
if ( buffer.length() > 1 )
|
||||
{
|
||||
buffer.append( ", " );
|
||||
}
|
||||
if ( item instanceof ListItem )
|
||||
{
|
||||
buffer.append( ( (ListItem ) item ).toListString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer.append( item );
|
||||
}
|
||||
}
|
||||
buffer.append( "]" );
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public ComparableVersion( String version )
|
||||
{
|
||||
parseVersion( version );
|
||||
}
|
||||
|
||||
@SuppressWarnings( "checkstyle:innerassignment" )
|
||||
public final void parseVersion( String version )
|
||||
{
|
||||
this.value = version;
|
||||
|
||||
items = new ListItem();
|
||||
|
||||
version = version.toLowerCase( Locale.ENGLISH );
|
||||
|
||||
ListItem list = items;
|
||||
|
||||
Deque<Item> stack = new ArrayDeque<>();
|
||||
stack.push( list );
|
||||
|
||||
boolean isDigit = false;
|
||||
|
||||
int startIndex = 0;
|
||||
|
||||
for ( int i = 0; i < version.length(); i++ )
|
||||
{
|
||||
char c = version.charAt( i );
|
||||
|
||||
if ( c == '.' )
|
||||
{
|
||||
if ( i == startIndex )
|
||||
{
|
||||
list.add( IntItem.ZERO );
|
||||
}
|
||||
else
|
||||
{
|
||||
list.add( parseItem( isDigit, version.substring( startIndex, i ) ) );
|
||||
}
|
||||
startIndex = i + 1;
|
||||
}
|
||||
else if ( c == '-' )
|
||||
{
|
||||
if ( i == startIndex )
|
||||
{
|
||||
list.add( IntItem.ZERO );
|
||||
}
|
||||
else
|
||||
{
|
||||
list.add( parseItem( isDigit, version.substring( startIndex, i ) ) );
|
||||
}
|
||||
startIndex = i + 1;
|
||||
|
||||
list.add( list = new ListItem() );
|
||||
stack.push( list );
|
||||
}
|
||||
else if ( Character.isDigit( c ) )
|
||||
{
|
||||
if ( !isDigit && i > startIndex )
|
||||
{
|
||||
list.add( new StringItem( version.substring( startIndex, i ), true ) );
|
||||
startIndex = i;
|
||||
|
||||
list.add( list = new ListItem() );
|
||||
stack.push( list );
|
||||
}
|
||||
|
||||
isDigit = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isDigit && i > startIndex )
|
||||
{
|
||||
list.add( parseItem( true, version.substring( startIndex, i ) ) );
|
||||
startIndex = i;
|
||||
|
||||
list.add( list = new ListItem() );
|
||||
stack.push( list );
|
||||
}
|
||||
|
||||
isDigit = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( version.length() > startIndex )
|
||||
{
|
||||
list.add( parseItem( isDigit, version.substring( startIndex ) ) );
|
||||
}
|
||||
|
||||
while ( !stack.isEmpty() )
|
||||
{
|
||||
list = (ListItem) stack.pop();
|
||||
list.normalize();
|
||||
}
|
||||
}
|
||||
|
||||
private static Item parseItem( boolean isDigit, String buf )
|
||||
{
|
||||
if ( isDigit )
|
||||
{
|
||||
buf = stripLeadingZeroes( buf );
|
||||
if ( buf.length() <= MAX_INTITEM_LENGTH )
|
||||
{
|
||||
// lower than 2^31
|
||||
return new IntItem( buf );
|
||||
}
|
||||
else if ( buf.length() <= MAX_LONGITEM_LENGTH )
|
||||
{
|
||||
// lower than 2^63
|
||||
return new LongItem( buf );
|
||||
}
|
||||
return new BigIntegerItem( buf );
|
||||
}
|
||||
return new StringItem( buf, false );
|
||||
}
|
||||
|
||||
private static String stripLeadingZeroes( String buf )
|
||||
{
|
||||
if ( buf == null || buf.isEmpty() )
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
for ( int i = 0; i < buf.length(); ++i )
|
||||
{
|
||||
char c = buf.charAt( i );
|
||||
if ( c != '0' )
|
||||
{
|
||||
return buf.substring( i );
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo( ComparableVersion o )
|
||||
{
|
||||
return items.compareTo( o.items );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getCanonical()
|
||||
{
|
||||
if ( canonical == null )
|
||||
{
|
||||
canonical = items.toString();
|
||||
}
|
||||
return canonical;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object o )
|
||||
{
|
||||
return ( o instanceof ComparableVersion ) && items.equals( ( (ComparableVersion) o ).items );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return items.hashCode();
|
||||
}
|
||||
|
||||
// CHECKSTYLE_OFF: LineLength
|
||||
/**
|
||||
* Main to test version parsing and comparison.
|
||||
* <p>
|
||||
* To check how "1.2.7" compares to "1.2-SNAPSHOT", for example, you can issue
|
||||
* <pre>java -jar ${maven.repo.local}/org/apache/maven/maven-artifact/${maven.version}/maven-artifact-${maven.version}.jar "1.2.7" "1.2-SNAPSHOT"</pre>
|
||||
* command to command line. Result of given command will be something like this:
|
||||
* <pre>
|
||||
* Display parameters as parsed by Maven (in canonical form) and comparison result:
|
||||
* 1. 1.2.7 == 1.2.7
|
||||
* 1.2.7 > 1.2-SNAPSHOT
|
||||
* 2. 1.2-SNAPSHOT == 1.2-snapshot
|
||||
* </pre>
|
||||
*
|
||||
* @param args the version strings to parse and compare. You can pass arbitrary number of version strings and always
|
||||
* two adjacent will be compared
|
||||
*/
|
||||
// CHECKSTYLE_ON: LineLength
|
||||
public static void main( String... args )
|
||||
{
|
||||
System.out.println( "Display parameters as parsed by Maven (in canonical form and as a list of tokens) and"
|
||||
+ " comparison result:" );
|
||||
if ( args.length == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ComparableVersion prev = null;
|
||||
int i = 1;
|
||||
for ( String version : args )
|
||||
{
|
||||
ComparableVersion c = new ComparableVersion( version );
|
||||
|
||||
if ( prev != null )
|
||||
{
|
||||
int compare = prev.compareTo( c );
|
||||
System.out.println( " " + prev.toString() + ' '
|
||||
+ ( ( compare == 0 ) ? "==" : ( ( compare < 0 ) ? "<" : ">" ) ) + ' ' + version );
|
||||
}
|
||||
|
||||
System.out.println( ( i++ ) + ". " + version + " -> " + c.getCanonical()
|
||||
+ "; tokens: " + c.items.toListString() );
|
||||
|
||||
prev = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
package org.gcube.application.geoportal.common.model.document;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class Context {
|
||||
public static final String ID="id";
|
||||
public static final String NAME = "name";
|
||||
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package org.gcube.application.geoportal.common.model.document;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class LifecycleInformation {
|
||||
|
||||
public static final String PHASE="phase";
|
||||
public static final String LAST_OPERATION_STATUS="lastOperationStatus";
|
||||
public static final String ERROR_MESSAGES="errorMessages";
|
||||
public static final String WARNING_MESSAGES="warningMEssages";
|
||||
public static final String CHILDREN="children";
|
||||
|
||||
public static enum Status{
|
||||
PASSED,ERROR,WARNING
|
||||
}
|
||||
|
||||
|
||||
private String phase;
|
||||
private Status lastOperationStatus;
|
||||
private List<String> errorMessages;
|
||||
private List<String> warningMessages;
|
||||
private List<LifecycleInformation> children;
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package org.gcube.application.geoportal.common.model.document;
|
||||
|
||||
import com.mongodb.client.model.geojson.GeoJsonObjectType;
|
||||
import lombok.*;
|
||||
import org.bson.Document;
|
||||
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class ProfiledDocument {
|
||||
|
||||
public static final String _ID="_id";
|
||||
public static final String VERSION="version";
|
||||
public static final String INFO="info";
|
||||
public static final String PROFILE_ID="profileID";
|
||||
public static final String PROFILE_VERSION="profileVersion";
|
||||
public static final String LIFECYCLE_INFORMATION="lifecycleInformation";
|
||||
public static final String RELATIONSHIPS="relationships";
|
||||
public static final String SPATIAL_REFERENCE="spatialReference";
|
||||
public static final String TEMPORAL_REFERENCE="temporalReference";
|
||||
public static final String THE_DOCUMENT="theDocument";
|
||||
|
||||
// CORE METADATA
|
||||
|
||||
private String _id;
|
||||
private ComparableVersion version;
|
||||
|
||||
// Publication Info
|
||||
private PublicationInfo info;
|
||||
|
||||
// Profile reference
|
||||
private String profileID;
|
||||
private ComparableVersion profileVersion;
|
||||
|
||||
private LifecycleInformation lifecycleInformation;
|
||||
|
||||
private Relationship[] relationships;
|
||||
|
||||
private GeoJsonObjectType spatialReference;
|
||||
|
||||
private TemporalReference temporalReference;
|
||||
|
||||
private Document theDocument;
|
||||
|
||||
public void setDefaults(){
|
||||
// TODO APPLY DEFAULTS ??
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package org.gcube.application.geoportal.common.model.document;
|
||||
|
||||
import lombok.*;
|
||||
import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class PublicationInfo {
|
||||
|
||||
public static final String CREATION_INFO="creationInfo";
|
||||
public static final String LAST_EDIT_INFO="lastEditInfo";
|
||||
public static final String ACCESS = "access";
|
||||
|
||||
|
||||
private AccountingInfo creationInfo;
|
||||
private AccountingInfo lastEditInfo;
|
||||
private Access access;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package org.gcube.application.geoportal.common.model.document;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class RegisteredFile {
|
||||
|
||||
public static String MIMETYPE="mimetype";
|
||||
public static String STORAGE_ID="storageID";
|
||||
public static String LINK="link";
|
||||
public static String NAME="NAME";
|
||||
|
||||
private String mimetype;
|
||||
private String storageID;
|
||||
private String link;
|
||||
private String name;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package org.gcube.application.geoportal.common.model.document;
|
||||
|
||||
import lombok.*;
|
||||
import org.bson.Document;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class RegisteredFileSet {
|
||||
|
||||
public static final String CREATION_INFO="creationInfo";
|
||||
public static final String ACCESS="access";
|
||||
public static final String FOLDER_ID="folderID";
|
||||
public static final String PAYLOADS="payloads";
|
||||
|
||||
private AccountingInfo creationInfo;
|
||||
private Access access;
|
||||
private String folderID;
|
||||
|
||||
private List<RegisteredFile> payloads;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package org.gcube.application.geoportal.common.model.document;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class Relationship {
|
||||
|
||||
public static final String RELATIONSHIP_NAME="relationshipName";
|
||||
public static final String TARGET_ID="targetID";
|
||||
|
||||
private String relationshipName;
|
||||
private String targetID;
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package org.gcube.application.geoportal.common.model.document;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class TemporalReference {
|
||||
|
||||
private String field;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package org.gcube.application.geoportal.common.model.document;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class User {
|
||||
|
||||
public static final String USERNAME="username";
|
||||
|
||||
|
||||
private String username;
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package org.gcube.application.geoportal.common.model.profile;
|
||||
|
||||
public class DefaultCompiler {
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package org.gcube.application.geoportal.common.model.profile;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class Field {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package org.gcube.application.geoportal.common.model.profile;
|
||||
|
||||
public class FieldMapping {
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package org.gcube.application.geoportal.common.model.profile;
|
||||
|
||||
import lombok.Data;
|
||||
import org.bson.Document;
|
||||
|
||||
@Data
|
||||
public class HandlerDeclaration {
|
||||
|
||||
private String id;
|
||||
private String type;
|
||||
private Document configuration;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package org.gcube.application.geoportal.common.model.profile;
|
||||
|
||||
public class IndexDefinition {
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package org.gcube.application.geoportal.common.model.profile;
|
||||
|
||||
public class IsoMapper {
|
||||
|
||||
private String className;
|
||||
|
||||
}
|
@ -1,24 +1,46 @@
|
||||
package org.gcube.application.geoportal.common.model.profile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.bson.Document;
|
||||
import org.gcube.application.geoportal.common.model.document.AccountingInfo;
|
||||
import org.gcube.application.geoportal.common.model.document.ComparableVersion;
|
||||
|
||||
@Getter
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@XmlRootElement
|
||||
public class Profile{
|
||||
|
||||
private String name;
|
||||
private String id;
|
||||
private List<Field> fields;
|
||||
private ComparableVersion version;
|
||||
|
||||
private String name;
|
||||
private String description;
|
||||
private AccountingInfo creationInfo;
|
||||
|
||||
private Document schema;
|
||||
|
||||
private List<HandlerDeclaration> handlers;
|
||||
|
||||
private List<DefaultCompiler> defaultCompilers;
|
||||
private List<Validator> validators;
|
||||
private IsoMapper isoMapper;
|
||||
private List<FieldMapping> centroidsMapping;
|
||||
private List<IndexDefinition> indexes;
|
||||
/**
|
||||
* Returns map Type -> Handler Declaration
|
||||
* @return
|
||||
*/
|
||||
public Map<String,List<HandlerDeclaration>> getHandlersMap(){
|
||||
HashMap<String,List<HandlerDeclaration>> toReturn=new HashMap<>();
|
||||
handlers.forEach(h->{
|
||||
if(!toReturn.containsKey(h.getType()))
|
||||
toReturn.put(h.getType(),new ArrayList<>());
|
||||
toReturn.get(h.getType()).add(h);
|
||||
});
|
||||
return toReturn;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
package org.gcube.application.geoportal.common.model.profile;
|
||||
|
||||
public class Validator {
|
||||
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package org.gcube.application.geoportal.common.model.project;
|
||||
|
||||
public class Centroid {
|
||||
|
||||
private Double x;
|
||||
private Double y;
|
||||
private Double z;
|
||||
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package org.gcube.application.geoportal.common.model.project;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.BasicJSONObject;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
public class Project {
|
||||
|
||||
|
||||
/**
|
||||
* Project{
|
||||
_id:
|
||||
profile_id:
|
||||
publication :{
|
||||
creation_time:
|
||||
creation_user:
|
||||
last_update_time:
|
||||
last_update_user:
|
||||
version :
|
||||
license :
|
||||
policy :
|
||||
status : VALID,
|
||||
PUBLISHED,INVALID
|
||||
document : {.....}
|
||||
centroid : {
|
||||
x:
|
||||
y:
|
||||
z:}
|
||||
}
|
||||
|
||||
*
|
||||
*/
|
||||
|
||||
private String _id;
|
||||
private String profile_id;
|
||||
private Status status;
|
||||
private Object document;
|
||||
private Centroid centroid;
|
||||
private PublicationDetails publication;
|
||||
|
||||
private String json;
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package org.gcube.application.geoportal.common.model.project;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PublicationDetails {
|
||||
|
||||
public static enum Policy{
|
||||
OPEN,RESTRICTED,EMBARGOED;
|
||||
}
|
||||
|
||||
private LocalDateTime creation_time;
|
||||
private String creation_user;
|
||||
private LocalDateTime last_update_time;
|
||||
private String last_update_user;
|
||||
private String version;
|
||||
private String license;
|
||||
private String policy;
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package org.gcube.application.geoportal.common.model.project;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Status {
|
||||
|
||||
|
||||
private StatusPhase phase;
|
||||
private List<String> messages;
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package org.gcube.application.geoportal.common.model.project;
|
||||
|
||||
public enum StatusPhase {
|
||||
|
||||
DRAFT,
|
||||
UNDER_VALIDATION,
|
||||
INVALID,
|
||||
VALID,
|
||||
UNDER_PUBLICATION,
|
||||
PUBLICATION_ERROR,
|
||||
PUBLISHED
|
||||
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package org.gcube.application.geoportal.common.model.project;
|
||||
|
||||
|
||||
|
@ -0,0 +1,28 @@
|
||||
package org.gcube.application.geoportal.common.rest;
|
||||
|
||||
import org.bson.Document;
|
||||
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 java.rmi.RemoteException;
|
||||
import java.util.Iterator;
|
||||
|
||||
public interface ProfiledDocumentsI<P extends ProfiledDocument> {
|
||||
|
||||
// CRUD
|
||||
public P createNew(Document toCreate)throws RemoteException;
|
||||
public void deleteById(String id) throws RemoteException;
|
||||
public void deleteById(String id,Boolean force) throws RemoteException;
|
||||
public P getById(String id) throws RemoteException;
|
||||
|
||||
// CONFIG
|
||||
public Configuration getConfiguration() throws RemoteException;
|
||||
|
||||
// QUERY
|
||||
public Iterator<P> query (QueryRequest request) throws RemoteException;
|
||||
public String querForJSON(QueryRequest request)throws RemoteException;
|
||||
|
||||
//Execution
|
||||
public P performStep(String id, String step, Document request);
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package org.gcube.application.geoportal.common.rest;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.project.Project;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public interface ProjectsI {
|
||||
|
||||
|
||||
public Iterator<Project> getAll() throws Exception;
|
||||
public Iterator<Project> getByProfile(String profileId) throws Exception;
|
||||
public Project getById(String profileId,String id) throws Exception;
|
||||
public Iterator<Project> getByFilter(String filter)throws Exception;
|
||||
public Iterator<Project> getByFilter(String filter, String profileId)throws Exception;
|
||||
public Project registrNew(String profileId, String jsonDocument)throws Exception;
|
||||
public Project update(String profileId, String projectId,String jsonDocument) throws Exception;
|
||||
public void deleteById(String profileId, String projectId)throws Exception;
|
||||
public void deleteById(String profileId, String projectId, Boolean force)throws Exception;
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package org.gcube.application.geoportal.common.utils;
|
||||
|
||||
import com.jayway.jsonpath.Configuration;
|
||||
import com.jayway.jsonpath.DocumentContext;
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import com.jayway.jsonpath.Option;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JSONPathWrapper {
|
||||
|
||||
public static Configuration JSON_PATH_ALWAYS_LIST_CONFIG=null;
|
||||
public static Configuration JSON_PATH_PATHS_CONFIGURATION=null;
|
||||
|
||||
static {
|
||||
JSON_PATH_ALWAYS_LIST_CONFIG= Configuration.builder().options(Option.ALWAYS_RETURN_LIST,Option.SUPPRESS_EXCEPTIONS,Option.DEFAULT_PATH_LEAF_TO_NULL).build();
|
||||
JSON_PATH_PATHS_CONFIGURATION = Configuration.builder().options(Option.AS_PATH_LIST,Option.SUPPRESS_EXCEPTIONS,Option.DEFAULT_PATH_LEAF_TO_NULL).build();
|
||||
}
|
||||
|
||||
|
||||
@Getter
|
||||
DocumentContext ctx=null;
|
||||
|
||||
public JSONPathWrapper(String json) {
|
||||
ctx=JsonPath.using(JSON_PATH_ALWAYS_LIST_CONFIG).parse(json);
|
||||
}
|
||||
|
||||
public List<Object> getByPath(String path){
|
||||
throw new RuntimeException("TO IMPLEMENT");
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package org.gcube.application.geoportal.common.legacy;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
|
||||
import org.gcube.application.geoportal.common.model.legacy.report.ConstraintCheck;
|
||||
import org.gcube.application.geoportal.common.model.legacy.report.ValidationReport;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class DefaultsTests {
|
||||
|
||||
@Test
|
||||
public void checkConstraints(){
|
||||
assertEquals(AccessPolicy.OPEN,ConstraintCheck.defaultFor(null,AccessPolicy.OPEN).evaluate());
|
||||
assertEquals(AccessPolicy.EMBARGOED,ConstraintCheck.defaultFor(AccessPolicy.EMBARGOED,AccessPolicy.OPEN).evaluate());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void checkDefaults(){
|
||||
|
||||
Concessione c= new Concessione();
|
||||
|
||||
c.setDefaults();
|
||||
c.validate();
|
||||
System.out.println(c.getReport());
|
||||
// Mandatory fields without defaults
|
||||
assertEquals(ValidationReport.ValidationStatus.ERROR,c.getReport().getStatus());
|
||||
|
||||
c=new Concessione();
|
||||
c.setRelazioneScavo(new RelazioneScavo());
|
||||
c.getRelazioneScavo().setPolicy(AccessPolicy.EMBARGOED);
|
||||
c.setPolicy(AccessPolicy.OPEN);
|
||||
assertEquals(AccessPolicy.EMBARGOED,c.getRelazioneScavo().getPolicy());
|
||||
c.setDefaults();
|
||||
assertEquals(AccessPolicy.EMBARGOED,c.getRelazioneScavo().getPolicy());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package org.gcube.application.geoportal.service.engine.handlers;
|
||||
|
||||
import com.google.protobuf.DescriptorProtos;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.gcube.application.cms.plugins.LifecycleManager;
|
||||
import org.gcube.application.cms.plugins.faults.InitializationException;
|
||||
import org.gcube.application.cms.plugins.faults.ShutDownException;
|
||||
import org.gcube.application.cms.plugins.faults.StepException;
|
||||
import org.gcube.application.cms.plugins.model.PluginDescriptor;
|
||||
import org.gcube.application.cms.plugins.reports.ExecutionReport;
|
||||
import org.gcube.application.cms.plugins.reports.InitializationReport;
|
||||
import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
|
||||
import org.gcube.application.geoportal.common.model.document.ComparableVersion;
|
||||
|
||||
@Slf4j
|
||||
public class SimpleLifeCycleManager implements LifecycleManager {
|
||||
|
||||
|
||||
private static final PluginDescriptor DESCRIPTOR=new PluginDescriptor("SIMPLE-LIFECYCLE", "Simple Lifecycle manager");
|
||||
static {
|
||||
DESCRIPTOR.setDescription("Simple Lifecycle Management. This plugin supports a simple publication lifecycle.");
|
||||
DESCRIPTOR.setVersion(new ComparableVersion("1.0.0"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public InitializationReport initInContext() throws InitializationException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InitializationReport init() throws InitializationException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() throws ShutDownException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExecutionReport performStep(StepExecutionRequest request) throws StepException {
|
||||
log.info("Received Request ");
|
||||
|
||||
switch(request.getStep()){
|
||||
case StepExecutionRequest.Steps.ON_INIT_DOCUMENT:{
|
||||
break;
|
||||
}
|
||||
case StepExecutionRequest.Steps.ON_MATERIALIZE_DOCUMENT:{
|
||||
break;
|
||||
}
|
||||
case StepExecutionRequest.Steps.ON_DEMATERIALIZE_DOCUMENT:{
|
||||
break;
|
||||
}
|
||||
case StepExecutionRequest.Steps.ON_DEINDEX_DOCUMENT:{
|
||||
break;
|
||||
}
|
||||
case StepExecutionRequest.Steps.ON_INDEX_DOCUMENT:{
|
||||
break;
|
||||
}
|
||||
case StepExecutionRequest.Steps.ON_DELETE_DOCUMENT:{
|
||||
break;
|
||||
}
|
||||
default : throw new StepException("Invalid Step "+request.getStep());
|
||||
}
|
||||
|
||||
|
||||
throw new StepException("Still to implement");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public PluginDescriptor getDescriptor() {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package org.gcube.application.geoportal.service.engine.mongo;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import org.bson.Document;
|
||||
import org.gcube.application.cms.plugins.faults.StepException;
|
||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||
import org.gcube.application.geoportal.service.model.internal.faults.DeletionException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface MongoManagerI<T> {
|
||||
|
||||
|
||||
// create
|
||||
|
||||
public T registerNew(Document toRegister) throws IOException, StepException;
|
||||
|
||||
// update
|
||||
public T update(String id,T toSet) throws IOException, StepException;
|
||||
|
||||
// delete
|
||||
|
||||
public void delete(String id,boolean force) throws DeletionException;
|
||||
|
||||
// get By ID
|
||||
|
||||
public T getByID(String id) throws IOException;
|
||||
|
||||
// query
|
||||
|
||||
public Iterable<Document> query(QueryRequest request);
|
||||
public Iterable<T> filter(QueryRequest request);
|
||||
|
||||
// materialize
|
||||
|
||||
public T materialize(String id);
|
||||
|
||||
// dematerialize
|
||||
|
||||
public T dematerialize(String id);
|
||||
// index
|
||||
|
||||
public T index(String id);
|
||||
|
||||
// deIndex
|
||||
public T deIndex(String id);
|
||||
|
||||
public T performStep(String id, String step, Document options);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue