diff --git a/CHANGELOG.md b/CHANGELOG.md index a1929c5..6fa2606 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ 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.4] - 2023-01-10 +- Updated plugin framework + ## [v1.0.3] - 2022-12-07 - Updated plugin framework - Introduced module default-lc-managers diff --git a/ckan-plugin/CHANGELOG.md b/ckan-plugin/CHANGELOG.md index dc13fd4..93ef689 100644 --- a/ckan-plugin/CHANGELOG.md +++ b/ckan-plugin/CHANGELOG.md @@ -1,11 +1,13 @@ -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.2] - 2023-01-10 +- Pom updates ## [v1.0.1] - 2022-12-07 - Pom updates ## [v1.0.0] - 2022-02-24 - First release + +- This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + diff --git a/ckan-plugin/README.md b/ckan-plugin/README.md index 85dd719..6a729d5 100644 --- a/ckan-plugin/README.md +++ b/ckan-plugin/README.md @@ -1,7 +1,7 @@ -gCube CMS Suite +gCube CMS Suite : CKAN Plugins -------------------------------------------------- - -gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles. + +This library is expected to contains gcube-cms plugins for ckan materializations. ## Built with * [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework @@ -11,15 +11,12 @@ gCube CMS Suite is a set of components designed to manage complex space-temporal * [Maven](https://maven.apache.org/) - Dependency Management ## Documentation - -Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service). +[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities. ## 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 diff --git a/ckan-plugin/pom.xml b/ckan-plugin/pom.xml index ce4336a..cbc6fd2 100644 --- a/ckan-plugin/pom.xml +++ b/ckan-plugin/pom.xml @@ -5,14 +5,14 @@ 4.0.0 ckan-plugins - 1.0.1 + 1.0.2 gCube CMS - CKAN Plugins org.gcube.application.cms gcube-cms-suite - 1.0.3 + 1.0.4 diff --git a/cms-plugin-framework/CHANGELOG.md b/cms-plugin-framework/CHANGELOG.md index d9194ca..5a1a0ca 100644 --- a/cms-plugin-framework/CHANGELOG.md +++ b/cms-plugin-framework/CHANGELOG.md @@ -1,7 +1,8 @@ -This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - # Changelog for org.gcube.application.cms-plugin-framework +## [v1.0.3] - 2023-01-10 +- UserUtils in framework + ## [v1.0.2] 2022-01-17 - Fixes #2435 - Introduced module default-lc-managers @@ -10,4 +11,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Serialization Features ## [v1.0.0] 2021-09-20 -- First release \ No newline at end of file +- First release + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/cms-plugin-framework/README.md b/cms-plugin-framework/README.md index 1fd3533..a43e113 100644 --- a/cms-plugin-framework/README.md +++ b/cms-plugin-framework/README.md @@ -1,8 +1,11 @@ CMS - Plugin Framework -------------------------------------------------- - -CMS Plugin Framework is a library containing the definition of Java interfaces that plugins should implement - + +This module contains the definition of interfaces that server plugins are expected to implement. +Basic and abstract implementations are provided in different module default-lc-manager. + +Basic providers (e.g. WSProvider, ISProvider) used both in test and by the service are implemented here for simplicity. + ## 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 @@ -12,8 +15,8 @@ CMS Plugin Framework is a library containing the definition of Java interfaces t * [Maven](https://maven.apache.org/) - Dependency Management ## Documentation +[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities. -Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal). ## Change log diff --git a/cms-plugin-framework/pom.xml b/cms-plugin-framework/pom.xml index d78566d..f37172e 100644 --- a/cms-plugin-framework/pom.xml +++ b/cms-plugin-framework/pom.xml @@ -4,12 +4,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 cms-plugin-framework - 1.0.2 + 1.0.3 org.gcube.application.cms gcube-cms-suite - 1.0.3 + 1.0.4 @@ -67,6 +67,12 @@ + + org.gcube.common + authorization-utils + [2.0.0, 3.0.0-SNAPSHOT) + + org.gcube.application.cms geoportal-common diff --git a/cms-plugin-framework/src/main/java/org/gcube/application/cms/caches/AbstractScopedMap.java b/cms-plugin-framework/src/main/java/org/gcube/application/cms/caches/AbstractScopedMap.java index 1a1a8cd..983503a 100644 --- a/cms-plugin-framework/src/main/java/org/gcube/application/cms/caches/AbstractScopedMap.java +++ b/cms-plugin-framework/src/main/java/org/gcube/application/cms/caches/AbstractScopedMap.java @@ -2,6 +2,7 @@ package org.gcube.application.cms.caches; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; +import org.gcube.application.cms.implementations.utils.UserUtils; import org.gcube.application.geoportal.common.model.rest.ConfigurationException; import org.gcube.application.geoportal.common.utils.ContextUtils; @@ -18,7 +19,10 @@ public abstract class AbstractScopedMap extends TimedMap implements @Override public T getObject() throws ConfigurationException { - return get(ContextUtils.getCurrentScope()); + UserUtils.AuthenticatedUser user = UserUtils.getCurrent(); + String context = user.getContext(); + log.debug(" {} : Accessing object under context {} ",name,context); + return get(context); } diff --git a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/utils/UserUtils.java b/cms-plugin-framework/src/main/java/org/gcube/application/cms/implementations/utils/UserUtils.java similarity index 98% rename from geoportal-service/src/main/java/org/gcube/application/geoportal/service/utils/UserUtils.java rename to cms-plugin-framework/src/main/java/org/gcube/application/cms/implementations/utils/UserUtils.java index cc525cc..d810f01 100644 --- a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/utils/UserUtils.java +++ b/cms-plugin-framework/src/main/java/org/gcube/application/cms/implementations/utils/UserUtils.java @@ -1,4 +1,4 @@ -package org.gcube.application.geoportal.service.utils; +package org.gcube.application.cms.implementations.utils; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/cms-test-commons/CHANGELOG.md b/cms-test-commons/CHANGELOG.md index 3bb048b..e9ddf04 100644 --- a/cms-test-commons/CHANGELOG.md +++ b/cms-test-commons/CHANGELOG.md @@ -1,7 +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.4] - 2023-01-10 +- Pom updates + ## [v1.0.3] - 2022-12-07 - Pom updates @@ -12,4 +13,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Introduced profiled documents ## [v1.0.0] - 2021-09-11 -- First release \ No newline at end of file +- First release + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/cms-test-commons/README.md b/cms-test-commons/README.md index 4838743..7e93b60 100644 --- a/cms-test-commons/README.md +++ b/cms-test-commons/README.md @@ -1,14 +1,19 @@ gCube CMS - test-commons -------------------------------------------------- - -Common logic used by test cases + +Common utilities for testing such as : + +- access to test-resources Maps +- Test Credentials management +- Basic plugin Test Case implementations + ## Built with * [Maven](https://maven.apache.org/) - Dependency Management ## Documentation +[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities. -Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal). ## Change log diff --git a/cms-test-commons/pom.xml b/cms-test-commons/pom.xml index c66b0d0..399397a 100644 --- a/cms-test-commons/pom.xml +++ b/cms-test-commons/pom.xml @@ -5,14 +5,14 @@ 4.0.0 cms-test-commons - 1.0.3 + 1.0.4 CMS Test Commons org.gcube.application.cms gcube-cms-suite - 1.0.3 + 1.0.4 diff --git a/cms-test-commons/src/main/java/org/gcube/application/cms/tests/TestDocuments.java b/cms-test-commons/src/main/java/org/gcube/application/cms/tests/TestDocuments.java index 009cb68..5b2dbf2 100644 --- a/cms-test-commons/src/main/java/org/gcube/application/cms/tests/TestDocuments.java +++ b/cms-test-commons/src/main/java/org/gcube/application/cms/tests/TestDocuments.java @@ -10,7 +10,7 @@ import java.nio.charset.Charset; import java.util.HashMap; public class TestDocuments { - public static File BASE_FOLDER =new File("test-data/profiledDocuments"); + public static File BASE_FOLDER =new File("../test-data/profiledDocuments"); public static final HashMap documentMap =new HashMap<>(); static{ diff --git a/cms-test-commons/src/main/java/org/gcube/application/cms/tests/TokenSetter.java b/cms-test-commons/src/main/java/org/gcube/application/cms/tests/TokenSetter.java index c025d48..c948401 100644 --- a/cms-test-commons/src/main/java/org/gcube/application/cms/tests/TokenSetter.java +++ b/cms-test-commons/src/main/java/org/gcube/application/cms/tests/TokenSetter.java @@ -16,6 +16,19 @@ import java.io.IOException; import java.nio.charset.Charset; import java.util.Properties; +/** + * This class is used in order to set gCube Credentials for tests that needs a gCube Infrastructure. + * + * The method TokenSetter.set(String context) is used in order to specify the context to test. + * + * The library expects a Properties file /tokens.properties in the classpath like the following example : + * + * /root/vo/vre1 = GCUBE-TOKEN + * ... + * /devRoot/vo = JWT-TOKEN + * ... + * + */ @Slf4j public class TokenSetter { diff --git a/concessioni-lifecycle/CHANGELOG.md b/concessioni-lifecycle/CHANGELOG.md index 8e4aad8..d31a592 100644 --- a/concessioni-lifecycle/CHANGELOG.md +++ b/concessioni-lifecycle/CHANGELOG.md @@ -1,8 +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.3] - 2023-01-10 +- Pom updates +- Fixes default access ## [v1.0.2] - 2022-12-07 - Pom updates @@ -13,3 +13,5 @@ This library contains custom extensions for the support of GNA "concessioni" use ## [v1.0.0] - 2021-12-15 - First release + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/concessioni-lifecycle/README.md b/concessioni-lifecycle/README.md index 85dd719..66eca9e 100644 --- a/concessioni-lifecycle/README.md +++ b/concessioni-lifecycle/README.md @@ -1,8 +1,14 @@ -gCube CMS Suite +gCube CMS Suite : Concessioni Lifecycle -------------------------------------------------- - -gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles. - + +This library contains custom extensions for the support of GNA "concessioni" use case custom requirements. +It contains a Lifecycle Manager built on top of default 3-PHASE, extending : + +- Default values setting / evaluation +- Indexing parameters : + - Relationship management : relationship chains on "follows" and "precedes" are evaluated in order to show only last published project in centroids map + + ## Built with * [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework * [OpenJDK](https://openjdk.java.net/) - The JDK used @@ -11,8 +17,8 @@ gCube CMS Suite is a set of components designed to manage complex space-temporal * [Maven](https://maven.apache.org/) - Dependency Management ## Documentation +[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities. -Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service). ## Change log diff --git a/concessioni-lifecycle/pom.xml b/concessioni-lifecycle/pom.xml index 6a7dcb8..f9595df 100644 --- a/concessioni-lifecycle/pom.xml +++ b/concessioni-lifecycle/pom.xml @@ -4,14 +4,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 concessioni-lifecycle - 1.0.2 + 1.0.3 GNA Concessioni Lifecycle org.gcube.application.cms gcube-cms-suite - 1.0.3 + 1.0.4 diff --git a/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/ConcessioniLifeCycleManager.java b/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/ConcessioniLifeCycleManager.java index 349e612..527438c 100644 --- a/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/ConcessioniLifeCycleManager.java +++ b/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/ConcessioniLifeCycleManager.java @@ -82,12 +82,6 @@ public class ConcessioniLifeCycleManager extends Default3PhaseManager implements log.debug("Concessione {}, managing relazione {}",document.getId(),rel); rel.putIfAbsent(ProfiledConcessione.Sections.TITOLO,doc.getString(ProfiledConcessione.NOME)+" relazione di scavo"); rel.putIfAbsent(ProfiledConcessione.SOGGETTO,doc.get(ProfiledConcessione.SOGGETTO)); - rel.putIfAbsent(RegisteredFileSet.CREATION_INFO,c.getInfo().getCreationInfo()); - rel.putIfAbsent(RegisteredFileSet.ACCESS,c.getInfo().getAccess()); - Access relAccess=Serialization.convert(rel.get(RegisteredFileSet.ACCESS),Access.class); - relAccess.setLicense(ConstraintCheck.defaultFor(relAccess.getLicense(),"CC-BY-4.0").evaluate()); - relAccess.setPolicy(ConstraintCheck.defaultFor(relAccess.getPolicy(), AccessPolicy.OPEN).evaluate()); - rel.put(RegisteredFileSet.ACCESS,relAccess); doc.put(ProfiledConcessione.RELAZIONE_SCAVO,rel); @@ -96,12 +90,6 @@ public class ConcessioniLifeCycleManager extends Default3PhaseManager implements Serialization.convert(doc.get(ProfiledConcessione.ABSTRACT_RELAZIONE), Document.class):new Document(); log.debug("Concessione {}, managing abstract relazione {}",document.getId(),abs); abs.putIfAbsent(ProfiledConcessione.Sections.TITOLO,doc.getString(ProfiledConcessione.NOME)+" abstract relazione di scavo"); - abs.putIfAbsent(RegisteredFileSet.CREATION_INFO,c.getInfo().getCreationInfo()); - abs.putIfAbsent(RegisteredFileSet.ACCESS,c.getInfo().getAccess()); - Access absAccess=Serialization.convert(abs.get(RegisteredFileSet.ACCESS),Access.class); - absAccess.setLicense(ConstraintCheck.defaultFor(absAccess.getLicense(),"CC-BY-4.0").evaluate()); - absAccess.setPolicy(ConstraintCheck.defaultFor(absAccess.getPolicy(), AccessPolicy.OPEN).evaluate()); - abs.put(RegisteredFileSet.ACCESS,absAccess); doc.put(ProfiledConcessione.ABSTRACT_RELAZIONE,abs); @@ -120,13 +108,6 @@ public class ConcessioniLifeCycleManager extends Default3PhaseManager implements // BBOX in registered filesets pos.put(ProfiledConcessione.RESPONSABILE,doc.get(ProfiledConcessione.RESPONSABILE)); - - pos.putIfAbsent(RegisteredFileSet.CREATION_INFO,c.getInfo().getCreationInfo()); - pos.putIfAbsent(RegisteredFileSet.ACCESS,c.getInfo().getAccess()); - Access posAccess=Serialization.convert(rel.get(RegisteredFileSet.ACCESS),Access.class); - posAccess.setLicense(ConstraintCheck.defaultFor(posAccess.getLicense(),"CC-BY-4.0").evaluate()); - posAccess.setPolicy(ConstraintCheck.defaultFor(posAccess.getPolicy(), AccessPolicy.OPEN).evaluate()); - pos.put(RegisteredFileSet.ACCESS,posAccess); doc.put(ProfiledConcessione.POSIZIONAMENTO_SCAVO,pos); } @@ -139,12 +120,7 @@ public class ConcessioniLifeCycleManager extends Default3PhaseManager implements for (int i = 0; i org.gcube.application.cms concessioni-model - 1.0.2 + 1.0.3 GNA Concessioni Model org.gcube.application.cms gcube-cms-suite - 1.0.3 + 1.0.4 diff --git a/dataminer-plugins/CHANGELOG.md b/dataminer-plugins/CHANGELOG.md index 6d1e27e..56be04f 100644 --- a/dataminer-plugins/CHANGELOG.md +++ b/dataminer-plugins/CHANGELOG.md @@ -1,11 +1,12 @@ -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.2] - 2023-01-10 +- Pom updates ## [v1.0.1] - 2022-12-07 - Pom updates ## [v1.0.0] - 2022-02-24 - First release + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/dataminer-plugins/README.md b/dataminer-plugins/README.md index 85dd719..1bd34e1 100644 --- a/dataminer-plugins/README.md +++ b/dataminer-plugins/README.md @@ -1,8 +1,8 @@ -gCube CMS Suite +gCube CMS Suite : DataMiner Plugins -------------------------------------------------- - -gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles. - + +This library contains gcube-cms plugins for processing via gCube Dataminer + ## Built with * [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework * [OpenJDK](https://openjdk.java.net/) - The JDK used @@ -11,8 +11,8 @@ gCube CMS Suite is a set of components designed to manage complex space-temporal * [Maven](https://maven.apache.org/) - Dependency Management ## Documentation +[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities. -Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service). ## Change log diff --git a/dataminer-plugins/pom.xml b/dataminer-plugins/pom.xml index 4c8b9e0..f7f82e8 100644 --- a/dataminer-plugins/pom.xml +++ b/dataminer-plugins/pom.xml @@ -5,14 +5,14 @@ 4.0.0 dataminer-plugins - 1.0.1 + 1.0.2 gCube CMS - Dataminer Plugins org.gcube.application.cms gcube-cms-suite - 1.0.3 + 1.0.4 diff --git a/default-lc-managers/CHANGELOG.md b/default-lc-managers/CHANGELOG.md index 6c80f00..7c9afa5 100644 --- a/default-lc-managers/CHANGELOG.md +++ b/default-lc-managers/CHANGELOG.md @@ -1,8 +1,9 @@ -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 default Lifecycle Managers handlers +## [v1.0.1] - 2023-01-10 +- Pom updates -## [v1.0.0] - 2022-02-24 +- ## [v1.0.0] - 2022-02-24 - First release + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/default-lc-managers/README.md b/default-lc-managers/README.md index 7180741..6a76d6a 100644 --- a/default-lc-managers/README.md +++ b/default-lc-managers/README.md @@ -1,9 +1,19 @@ gCube CMS Suite : default-lc-managers -------------------------------------------------- - -gCube CMS Suite is a set of components designed to manage complex space-temporal Documents called Projects defined in Use Case Descriptors. -This library contains the default Lifecycle Manager handler plugins. +This library contains default Lifecycle Managers handlers implementations : + +- AbstractPlugin +- AbstractLifecycleManager +- Default3PhaseManager +- SimpleLifeCycleManager + +It also contains utility like + +- RoleManager : caller role evaluation utilities +- GuardedEventManager, GuardedStepExecution, GuardedExecution : simplicity class for safe implementations + +Plugins SHOULD be defined extending the definitions provided in this module. ## Built with * [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework @@ -13,8 +23,8 @@ This library contains the default Lifecycle Manager handler plugins. * [Maven](https://maven.apache.org/) - Dependency Management ## Documentation +[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities. -Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service). ## Change log diff --git a/default-lc-managers/pom.xml b/default-lc-managers/pom.xml index 7351a94..3d3ac25 100644 --- a/default-lc-managers/pom.xml +++ b/default-lc-managers/pom.xml @@ -5,14 +5,14 @@ 4.0.0 default-lc-managers - 1.0.0 + 1.0.1 gCube CMS - Default LC Managers org.gcube.application.cms gcube-cms-suite - 1.0.3 + 1.0.4 diff --git a/default-lc-managers/src/main/java/org/gcube/application/cms/plugins/implementations/AbstractLifeCycleManager.java b/default-lc-managers/src/main/java/org/gcube/application/cms/plugins/implementations/AbstractLifeCycleManager.java index e718042..faddf7d 100644 --- a/default-lc-managers/src/main/java/org/gcube/application/cms/plugins/implementations/AbstractLifeCycleManager.java +++ b/default-lc-managers/src/main/java/org/gcube/application/cms/plugins/implementations/AbstractLifeCycleManager.java @@ -3,6 +3,7 @@ package org.gcube.application.cms.plugins.implementations; import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.gcube.application.cms.implementations.ProjectAccess; +import org.gcube.application.cms.implementations.utils.UserUtils; import org.gcube.application.cms.plugins.LifecycleManager; import org.gcube.application.cms.plugins.PluginManagerInterface; import org.gcube.application.cms.plugins.faults.*; @@ -164,9 +165,10 @@ public abstract class AbstractLifeCycleManager extends AbstractPlugin implements try{ report.setStatus(Report.Status.OK); } catch (Throwable e) { - log.error("Unable to initialize plugins in {} ", ContextUtils.getCurrentScope(),e); + String context = UserUtils.getCurrent().getContext(); + log.error("Unable to initialize plugins in {} ", context,e); report.setStatus(Report.Status.WARNING); - report.putMessage("Unable to initialize plugins in "+ ContextUtils.getCurrentScope()+" : "+e.getMessage()); + report.putMessage("Unable to initialize plugins in "+ context +" : "+e.getMessage()); } return report; } diff --git a/geoportal-client/CHANGELOG.md b/geoportal-client/CHANGELOG.md index e27a637..66630e5 100644 --- a/geoportal-client/CHANGELOG.md +++ b/geoportal-client/CHANGELOG.md @@ -1,7 +1,8 @@ -This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - # Changelog for org.gcube.application.geoportal-client +## [v1.1.2] - 2023-01-10 +- Pom updates + ## [v1.1.1] - 2022-12-07 - Pom updates @@ -39,4 +40,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm -Excluded common-calls 1.2.0 ## [v1.0.0] - 2020-11-11 -- First release \ No newline at end of file +- First release + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/geoportal-client/README.md b/geoportal-client/README.md index b80f923..4d23202 100644 --- a/geoportal-client/README.md +++ b/geoportal-client/README.md @@ -1,14 +1,21 @@ -GeoPortal - Client +gCube CMS Suite : GeoPortal Client -------------------------------------------------- - -GeoPortal - Client is the java library wrapping Geoportal REST Service + +This module contains the definition of the client library for interacting with geoportal-service. + +It is built on top of gCube FW stack and allows to build the following clients : +- Project entities management +- UseCaseDescriptor entites management + +It also provides a utility class Serialization for fast marshalling / unmarshalling. + ## Built with * [Maven](https://maven.apache.org/) - Dependency Management ## Documentation +[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities. -Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal). ## Change log diff --git a/geoportal-client/pom.xml b/geoportal-client/pom.xml index c515295..0e92db2 100644 --- a/geoportal-client/pom.xml +++ b/geoportal-client/pom.xml @@ -4,14 +4,14 @@ 4.0.0 org.gcube.application geoportal-client - 1.1.1 + 1.1.2 Geoportal Client org.gcube.application.cms gcube-cms-suite - 1.0.3 + 1.0.4 @@ -46,15 +46,6 @@ common-generic-clients - - - - - - - - - diff --git a/geoportal-client/src/test/java/org/gcube/application/geoportal/clients/GenericUseCases.java b/geoportal-client/src/test/java/org/gcube/application/geoportal/clients/GenericUseCases.java index 0a23f67..c24da3f 100644 --- a/geoportal-client/src/test/java/org/gcube/application/geoportal/clients/GenericUseCases.java +++ b/geoportal-client/src/test/java/org/gcube/application/geoportal/clients/GenericUseCases.java @@ -52,16 +52,19 @@ public abstract class GenericUseCases extends BasicVreTests{ } protected Project prepareWithFileSet(Project project) throws FileNotFoundException, InvalidRequestException, RemoteException { + + return getClient().registerFileSet(project.getId(), prepareRequest()); + } + + protected RegisterFileSetRequest prepareRequest() throws FileNotFoundException { String parentPath = "$.section"; String fieldName = "fileset"; String fieldDefinition = "$.section._children[?(@.fileset)]"; // Prepare request - RegisterFileSetRequest fsRequest = FileSets. + return FileSets. prepareRequest(new StorageUtils(), parentPath,fieldName,fieldDefinition, new File(Tests.FOLDER_CONCESSIONI,"pos.shp")); - - - return getClient().registerFileSet(project.getId(),fsRequest); } + } diff --git a/geoportal-client/src/test/java/org/gcube/application/geoportal/clients/ProfiledConcessioniTest.java b/geoportal-client/src/test/java/org/gcube/application/geoportal/clients/ProfiledConcessioniTest.java index 8af8aae..e2a17cf 100644 --- a/geoportal-client/src/test/java/org/gcube/application/geoportal/clients/ProfiledConcessioniTest.java +++ b/geoportal-client/src/test/java/org/gcube/application/geoportal/clients/ProfiledConcessioniTest.java @@ -2,12 +2,17 @@ package org.gcube.application.geoportal.clients; import com.fasterxml.jackson.core.JsonProcessingException; import lombok.Data; +import lombok.extern.slf4j.Slf4j; import org.bson.Document; import org.gcube.application.cms.tests.TestDocuments; import org.gcube.application.cms.tests.Tests; import org.gcube.application.geoportal.client.utils.Serialization; import org.gcube.application.geoportal.common.faults.InvalidRequestException; +import org.gcube.application.geoportal.common.model.JSONPathWrapper; import org.gcube.application.geoportal.common.model.document.Project; +import org.gcube.application.geoportal.common.model.document.access.Access; +import org.gcube.application.geoportal.common.model.document.access.AccessPolicy; +import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet; import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest; import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest; import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field; @@ -25,6 +30,9 @@ import java.io.IOException; import java.nio.charset.Charset; import java.rmi.RemoteException; +import static org.junit.Assert.assertEquals; + +@Slf4j public class ProfiledConcessioniTest extends ProfiledDocumentsTest{ @Data @@ -78,11 +86,28 @@ public class ProfiledConcessioniTest extends ProfiledDocumentsTest{ // Set relazione - client.registerFileSet(project.getId(), FileSets. + + Access toSetAccess = new Access(); + toSetAccess.setPolicy(AccessPolicy.RESTRICTED); + toSetAccess.setLicense("CC0-1.0"); + + RegisterFileSetRequest request=FileSets. prepareRequest(new StorageUtils(), "$.relazioneScavo","fileset", "$.relazioneScavo."+Field.CHILDREN+"[?(@.fileset)]", - new File(Tests.FOLDER_CONCESSIONI,"relazione.pdf"))); + new File(Tests.FOLDER_CONCESSIONI,"relazione.pdf")); + request.setToSetAccess(toSetAccess); + + project=client.registerFileSet(project.getId(), request); + + String jsonDoc=project.getTheDocument().toJson(); + log.info("Registered fileset. Result is {}", jsonDoc); + RegisteredFileSet f= Serialization.convert(new JSONPathWrapper(jsonDoc).getByPath( + request.getParentPath()).get(0),RegisteredFileSet.class); + + assertEquals(Serialization.convert(f.getAccess(),Access.class).getPolicy(),toSetAccess.getPolicy()); + assertEquals(Serialization.convert(f.getAccess(),Access.class).getLicense(),toSetAccess.getLicense()); + // Set Abstract diff --git a/geoportal-client/src/test/java/org/gcube/application/geoportal/clients/ProfiledDocumentsTest.java b/geoportal-client/src/test/java/org/gcube/application/geoportal/clients/ProfiledDocumentsTest.java index 5296118..606d7f4 100644 --- a/geoportal-client/src/test/java/org/gcube/application/geoportal/clients/ProfiledDocumentsTest.java +++ b/geoportal-client/src/test/java/org/gcube/application/geoportal/clients/ProfiledDocumentsTest.java @@ -3,22 +3,35 @@ package org.gcube.application.geoportal.clients; import com.fasterxml.jackson.core.JsonProcessingException; import lombok.extern.slf4j.Slf4j; import org.bson.Document; +import org.gcube.application.cms.tests.Tests; +import org.gcube.application.geoportal.client.utils.Serialization; +import org.gcube.application.geoportal.common.faults.InvalidRequestException; +import org.gcube.application.geoportal.common.model.JSONPathWrapper; import org.gcube.application.geoportal.common.model.configuration.Configuration; import org.gcube.application.geoportal.common.model.document.Project; +import org.gcube.application.geoportal.common.model.document.access.Access; +import org.gcube.application.geoportal.common.model.document.access.AccessPolicy; +import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet; import org.gcube.application.geoportal.common.model.document.relationships.RelationshipNavigationObject; import org.gcube.application.geoportal.common.model.rest.CreateRelationshipRequest; import org.gcube.application.geoportal.common.model.rest.DeleteRelationshipRequest; import org.gcube.application.geoportal.common.model.rest.QueryRequest; +import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest; import org.gcube.application.geoportal.common.rest.Projects; +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.junit.Test; +import java.io.File; +import java.io.FileNotFoundException; import java.rmi.RemoteException; import java.time.LocalDateTime; import java.util.Iterator; import java.util.concurrent.atomic.AtomicLong; import static org.gcube.application.geoportal.client.utils.Serialization.write; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeTrue; @@ -33,7 +46,7 @@ public class ProfiledDocumentsTest> exte @Test - public void registerNew() throws RemoteException, JsonProcessingException { + public void registerNew() throws RemoteException, JsonProcessingException, FileNotFoundException, InvalidRequestException { assumeTrue(GCubeTest.isTestInfrastructureEnabled()); Projects client = (Projects) getClient(); @@ -46,6 +59,38 @@ public class ProfiledDocumentsTest> exte Project p =client.createNew(theDoc); log.debug("Registered project (AS JSON) : {}", write(p)); + + + } + + + @Test + public void testAccess() throws FileNotFoundException, RemoteException, InvalidRequestException, JsonProcessingException { + assumeTrue(GCubeTest.isTestInfrastructureEnabled()); + Projects client = (Projects) getClient(); + + Document theDoc= Document.parse("{\n" + + "\"posizionamentoScavo\" :{\n" + + "\t\"titolo\" : \"mio titolo\"}}"); + + theDoc.put("startTime", LocalDateTime.now()); + + Project p =client.createNew(theDoc); + + RegisterFileSetRequest fsRequest = prepareRequest(); + + Access access = new Access(); + access.setLicense("CC0-1.0"); + access.setPolicy(AccessPolicy.RESTRICTED); + fsRequest.setToSetAccess(access); + + p=client.registerFileSet(p.getId(),fsRequest); + + log.info("Registered fileset. Result is {}", Serialization.write(p)); + RegisteredFileSet f= Serialization.convert(new JSONPathWrapper(p.getTheDocument().toJson()).getByPath(fsRequest.getParentPath()).get(0),RegisteredFileSet.class); + + assertEquals(Serialization.convert(f.getAccess(),Access.class).getPolicy(),AccessPolicy.RESTRICTED); + } @Test diff --git a/geoportal-common/CHANGELOG.md b/geoportal-common/CHANGELOG.md index b216451..18e4b71 100644 --- a/geoportal-common/CHANGELOG.md +++ b/geoportal-common/CHANGELOG.md @@ -1,7 +1,8 @@ -This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - # Changelog for org.gcube.application.geoportal-common +## [v1.0.11] - 2023-01-10 +- Pom updates + ## [v1.0.10] - 2022-12-07 - Pom updates @@ -50,4 +51,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Model update ## [v1.0.0] - 2020-11-11 -- First release \ No newline at end of file +- First release + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/geoportal-common/README.md b/geoportal-common/README.md index 95025f7..63edc56 100644 --- a/geoportal-common/README.md +++ b/geoportal-common/README.md @@ -1,14 +1,23 @@ -GeoPortal - Common +gCube CMS Suite : GeoPortal Common -------------------------------------------------- - -GeoPortal - Common is the java library containing basic classes (e.g. models) of gCube GeoPortal. + +This module contains the definition of the interface expose by geoportal-service. + +It contains both the methods, the constants, the model shared by service and clients (main classes are Project and UseCaseDescriptor). + +It also provides the following utility classes : + +- JSONPathWrapper : for JSON path parsing, built on top of com.jayway.jsonpath.json-path (https://github.com/json-path/JsonPath). +- FileSets : builder for FileSetRegistrationRequests +- StorageUtils : interface with gCube Storage +- ISUtils : Query to gCube IS ## Built with * [Maven](https://maven.apache.org/) - Dependency Management ## Documentation +[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities. -Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal). ## Change log diff --git a/geoportal-common/pom.xml b/geoportal-common/pom.xml index 5e0831c..0f18ed2 100644 --- a/geoportal-common/pom.xml +++ b/geoportal-common/pom.xml @@ -3,14 +3,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 geoportal-common - 1.0.10 + 1.0.11 Geoportal Common org.gcube.application.cms gcube-cms-suite - 1.0.3 + 1.0.4 diff --git a/geoportal-common/src/main/java/org/gcube/application/geoportal/common/utils/ContextUtils.java b/geoportal-common/src/main/java/org/gcube/application/geoportal/common/utils/ContextUtils.java index 6969202..c7f6d8c 100644 --- a/geoportal-common/src/main/java/org/gcube/application/geoportal/common/utils/ContextUtils.java +++ b/geoportal-common/src/main/java/org/gcube/application/geoportal/common/utils/ContextUtils.java @@ -8,33 +8,20 @@ import org.gcube.common.scope.api.ScopeProvider; import static org.gcube.common.authorization.client.Constants.authorizationService; @Slf4j +@Deprecated public class ContextUtils { - public static String getCurrentScope(){ - try{ - String token=SecurityTokenProvider.instance.get(); - log.trace("Token is : "+token.substring(0,2)+"..."+token.substring(token.length()-3)); - if(token==null) throw new Exception("Security Token is null"); - AuthorizationEntry entry = authorizationService().get(token); - return entry.getContext(); - }catch(Exception e ){ - log.trace("Unable to resolve token, checking scope provider..",e); - return ScopeProvider.instance.get(); - } - } - - public static String getCurrentCaller(){ try{ String token=SecurityTokenProvider.instance.get(); - log.trace("Token is : "+token.substring(0,2)+"..."+token.substring(token.length()-3)); if(token==null) throw new Exception("Security Token is null"); + log.trace("Token is : "+token.substring(0,2)+"..."+token.substring(token.length()-3)); AuthorizationEntry entry = authorizationService().get(token); return entry.getClientInfo().getId(); }catch(Exception e ){ - log.trace("Unable to resolve token, checking scope provider..",e); - return "Unidentified data-transfer user"; + log.warn("Unable to resolve token using legacy utils, using default ..",e); + return "CMS_default_user"; } } } diff --git a/geoportal-common/src/main/java/org/gcube/application/geoportal/common/utils/Files.java b/geoportal-common/src/main/java/org/gcube/application/geoportal/common/utils/Files.java index 94c8826..7916f4f 100644 --- a/geoportal-common/src/main/java/org/gcube/application/geoportal/common/utils/Files.java +++ b/geoportal-common/src/main/java/org/gcube/application/geoportal/common/utils/Files.java @@ -92,12 +92,12 @@ public class Files { if(toFix.startsWith("\\.")) toFix=toFix.replaceFirst("\\.","_"); String extension=""; - if(toFix.contains(".")) { + int extensionIndex=toFix.lastIndexOf("."); + if(extensionIndex>0) { //preserve extension - int index=toFix.indexOf("."); - extension=toFix.substring(index); + extension=toFix.substring(extensionIndex); //only escape before extension - toFix=toFix.substring(0,toFix.indexOf(".")); + toFix=toFix.substring(0,extensionIndex); } return toFix.toLowerCase(). replaceAll("[\\-\\*\\+\\/\\\\ \\[\\]\\(\\)\\.\\\"\\:\\;\\|\\=]","_")+extension.toLowerCase(); diff --git a/geoportal-common/src/main/java/org/gcube/application/geoportal/common/utils/tests/GCubeTest.java b/geoportal-common/src/main/java/org/gcube/application/geoportal/common/utils/tests/GCubeTest.java index e8ce6e7..72f0be0 100644 --- a/geoportal-common/src/main/java/org/gcube/application/geoportal/common/utils/tests/GCubeTest.java +++ b/geoportal-common/src/main/java/org/gcube/application/geoportal/common/utils/tests/GCubeTest.java @@ -17,7 +17,7 @@ public class GCubeTest { testContext = "/pred4s/preprod/preVRE"; // testContext = "/d4science.research-infrastructures.eu/D4OS/GNA"; - testContext= "/gcube/devsec/devVRE"; + // testContext= "/gcube/devsec/devVRE"; System.out.println("TEST CONTEXT = "+testContext); return testContext; diff --git a/geoportal-common/src/test/java/org/gcube/application/geoportal/common/FilesTests.java b/geoportal-common/src/test/java/org/gcube/application/geoportal/common/FilesTests.java index 2317dd3..0ec8885 100644 --- a/geoportal-common/src/test/java/org/gcube/application/geoportal/common/FilesTests.java +++ b/geoportal-common/src/test/java/org/gcube/application/geoportal/common/FilesTests.java @@ -6,6 +6,8 @@ import org.junit.Test; import java.io.File; import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; @@ -18,12 +20,18 @@ public class FilesTests { @Test public void testNames(){ - for(String name : baseFolder.list()){ + + ArrayList toTestStrings=new ArrayList<>(Arrays.asList(baseFolder.list())); + toTestStrings.add("e. gna_topografia_timponedellamotta.qmd"); + + for(String name : toTestStrings){ if(name.contains(".")) { - String originalExtension = name.substring(name.indexOf(".")); + int extensionIndex = name.lastIndexOf("."); + String originalExtension = extensionIndex>0?name.substring(extensionIndex):null; String obtained = Files.fixFilename(name); log.info(name + "->" + obtained + "[" + originalExtension + "]"); - assertTrue(obtained.endsWith(originalExtension)); + if(originalExtension!=null) + assertTrue(obtained.endsWith(originalExtension)); } } } diff --git a/geoportal-service/CHANGELOG.md b/geoportal-service/CHANGELOG.md index c5e8286..2be7162 100644 --- a/geoportal-service/CHANGELOG.md +++ b/geoportal-service/CHANGELOG.md @@ -1,7 +1,8 @@ -This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - # Changelog for org.gcube.application.geoportal-service +## [v1.0.12] - 2023-01-10 +- Refactored UserUtils into framework plugin + ## [v1.0.11] - 2022-12-07 - Pom updates - Introduced module default-lc-managers @@ -52,4 +53,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Project interface ## [v1.0.0] 2020-11-11 -- First release \ No newline at end of file +- First release + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/geoportal-service/README.md b/geoportal-service/README.md index d20b2c8..d9fd81b 100644 --- a/geoportal-service/README.md +++ b/geoportal-service/README.md @@ -1,7 +1,14 @@ -GeoPortal - Service +gCube CMS Suite : GeoPortal Service -------------------------------------------------- - -GeoPortal - Service is the main component operating a gCube GeoPortal. It is a SmartGears web application based on top of gCube SDI + +gCube CMS Service is a gCube REST-like Application developed on top of gCube SmartGears. + +It implements the core business logic of gCube CMS Suite, exposing methods for the management of Projects, Use Case Descriptors and available server plugins. + +It is built on top of Jersey Framework, it uses a MongoDB Document Store for JSON archiving and Querying. +It exploits the infrastructure StorageHub for archiving FileSets and the Information System in order to discover available resources. + +Its main goal is to receive client calls and orchestrate plugins implementation in order to serve them according to the UCD defined in the caller context. ## Built with * [gCube SDI] (https://gcube.wiki.gcube-system.org/gcube/) - The gCube SDI @@ -12,8 +19,8 @@ GeoPortal - Service is the main component operating a gCube GeoPortal. It is a S * [Maven](https://maven.apache.org/) - Dependency Management ## Documentation +[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities. -Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal). ## Change log diff --git a/geoportal-service/docs/_static/imgs/architecture.png b/geoportal-service/docs/_static/imgs/architecture.png new file mode 100644 index 0000000..f324582 Binary files /dev/null and b/geoportal-service/docs/_static/imgs/architecture.png differ diff --git a/geoportal-service/docs/_static/imgs/execution_schema.png b/geoportal-service/docs/_static/imgs/execution_schema.png new file mode 100644 index 0000000..39e9ff8 Binary files /dev/null and b/geoportal-service/docs/_static/imgs/execution_schema.png differ diff --git a/geoportal-service/docs/_static/imgs/plugin_interfaces.png b/geoportal-service/docs/_static/imgs/plugin_interfaces.png new file mode 100644 index 0000000..21f580a Binary files /dev/null and b/geoportal-service/docs/_static/imgs/plugin_interfaces.png differ diff --git a/geoportal-service/docs/example.rst b/geoportal-service/docs/example.rst deleted file mode 100644 index 69195b8..0000000 --- a/geoportal-service/docs/example.rst +++ /dev/null @@ -1,810 +0,0 @@ -.. _Anchor For ExampleRSTFile: - -################# -Example .rst File -################# - -NB https://sphinx-design.readthedocs.io/en/furo-theme/dropdowns.html - -If you work with edX documentation source files, you might find this file -helpful as a reference. This file contains examples of .rst formatting. - -Explanations and more context for each type of element are provided in -:ref:`Work with edX Documentation Source Files`. - -This file covers the following topics. - -.. contents:: - :local: - :depth: 1 - -*************** -Heading Levels -*************** - -:: - - ############# - Heading 1 - ############# - - ************* - Heading 2 - ************* - - =========== - Heading 3 - =========== - - Heading 4 - ************ - - Heading 5 - =========== - - Heading 6 - ~~~~~~~~~~~ - -************************************************ -Paragraph Text and Commented Text -************************************************ - -This is an example of regular text in paragraph form. There are no indents. As -a best practice, break lines at about 80 characters, so that each line has its -own line number for commenting in reviews. - -.. warning:: Throughout text and code examples, make sure double quotation - marks and apostrophes are straight (") or ('), not curly quotatation marks - and apostrophes, which might be introduced when text is cut and pasted from - other sources or editors. - -Boldface is used for labels that are visible in the user interface. The UI -text is surrounded by double asterisks. For example, **bold**. - -Italics are rarely used. Text surrounded by single asterisks is rendered in -*italics*. - -Monospace text is used for ``code examples``. Text surrounded by double grave -accent characters is rendered in monospace font. - -``.. comments can be added in a file by starting a line with 2 periods and a space.`` - -In English source files, look for comments addressed to translators from writers. - -``.. Translators: In this code example, do not translate such and such.`` - - -*************************************** -Ordered and Unordered Lists -*************************************** - -Use hash symbols for ordered lists. - -:: - -#. Select **Advanced Settings**. -#. Find the **Course Advertised Start Date** policy key. -#. Enter the value you want to display. - -.. note:: - Ordered lists usually use numerals. Nested ordered lists (ordered lists inside - other ordered lists) use letters. - -Use asterisks for unordered (bulleted) lists. - -:: - -* Who is teaching the course? -* What university or college is the course affiliated with? -* What topics and concepts are covered in your course? -* Why should a learner enroll in your course? - -======================= -Nested Lists or Content -======================= - -You can include content including additional lists and code examples inside -lists. - -Unordered List inside Ordered List -*************************************** - -To include an unordered list inside an ordered list, indent the unordered list -three spaces. The first bullet in the unordered list must be flush with the -text in the ordered list. - -:: - - #. Review your entry to verify that the key is accurate and that it is - surrounded by quotation marks. If there is a list of keys, they must be - comma separated. - - * In this example, the key for the Annotation Problem tool is the only - value in the list. - - * In this example, the key for the Annotation Problem tool is added at - the beginning of a list of other keys. - - #. Select **Save Changes**. - -.. image:: /Images/Lists_UL_inside_OL.png - :width: 500 - :alt: An unordered (bulleted) list inside an ordered (numbered) list. - -Ordered List inside Unordered List -*************************************** - -To include an ordered list inside an unordered list, indent the ordered list -two spaces. The first number or letter of the ordered list must be flush with -the text in the unordered list. - -:: - - * Review your entry to verify that the key is accurate and that it is - surrounded by quotation marks. If there is a list of keys, they must be comma - separated. - - #. In this example, the key for the Annotation Problem tool is the only - value in the list. - - #. In this example, the key for the Annotation Problem tool is added at the - beginning of a list of other keys. - - * Select **Save Changes**. - -.. There isn't a screen shot of the above example yet because these lists don't -.. render correctly locally, and searching for an example in the built docs -.. online was taking too much time. - -Unordered List inside Unordered List -*************************************** - -To include an unordered list inside another unordered list, indent the second -unordered list two spaces. The first bullet of the second unordered list must -be flush with the text in the unordered list. - -:: - - * Review your entry to verify that the key is accurate and that it is - surrounded by quotation marks. If there is a list of keys, they must be - comma separated. - - #. In this example, the key for the Annotation Problem tool is the only - value in the list. - - #. In this example, the key for the Annotation Problem tool is added at the - beginning of a list of other keys. - - * Select **Save Changes**. - -.. image:: /Images/Lists_UL_inside_UL.png - :width: 500 - :alt: An ordered (numbered) list inside an unordered (bulleted) list. - -Ordered List inside Ordered List -*************************************** - -To include another ordered list inside an ordered list, indent the second -ordered list three spaces. The second ordered list must be flush with the text -in the numbered list. The first ordered list uses numerals, and the second -uses letters. - -:: - - #. Review your entry to verify that the key is accurate and that it is - surrounded by quotation marks. If there is a list of keys, they must be - comma separated. - - #. In this example, the key for the Annotation Problem tool is the only - value in the list. - - #. In this example, the key for the Annotation Problem tool is added at - the beginning of a list of other keys. - - #. Select **Save Changes**. - -.. There isn't a screen shot of the above example yet because these lists don't -.. render correctly locally, and searching for an example in the built docs -.. online was taking too much time. - -Code, Images, and Other Content inside Lists -********************************************* - -To include content such as code or an image inside a list, position the code or -image directive flush with the text in the list. That is, indent three spaces -for ordered lists and two spaces for unordered lists. - -:: - - #. In the ``lms.yml`` and ``studio.yml`` files, set the value of - ``CERTIFICATES_HTML_VIEW`` within the ``FEATURES`` object to ``true``. - - .. code-block:: bash - - "FEATURES": { - ... - 'CERTIFICATES_HTML_VIEW': true, - ... - } - - #. Save the ``lms.yml`` and ``studio.yml`` files. - - -*************************************** -Conditional Text -*************************************** - -To conditionalize a single paragraph, use either the ``only:: Partners`` or -the ``only:: Open_edX`` directive, and indent the paragraph under the -directive. You can add the conditional text as regular text or as a note. - -Make sure to indent the paragraph under the directive. - -:: - - .. only:: Partners - - Data about course enrollment is available from edX Insights. You can access - Insights from the instructor dashboard for your live course: after you select - **Instructor**, follow the link in the banner at the top of each page. For - more information, see `Using edX Insights`_. - - .. only:: Open_edX - - .. note:: - If you want to require an entrance exam for your course, you also create - the exam in the course outline. Before you can create an exam, you must - set your course to require an entrance exam in Studio. For more - information, see :ref:`Require an Entrance Exam`. - -To conditionalize more than a paragraph, use either the ``only:: Partners`` or -the ``only:: Open_edX`` directive, and then use an ``include::`` directive -indented under the only directive. - -:: - - .. only:: Open_edX - - .. include:: ../../../shared/building_and_running_chapters/running_course/Section_course_student.rst - - - -********************************* -Notes and Warnings -********************************* - -:: - - .. note:: - This is note text. If note text runs over a line, make sure the lines wrap - and are indented to the same level as the note tag. If formatting is - incorrect, part of the note might not render in the HTML output. - - Notes can have more than one paragraph. Successive paragraphs must indent - to the same level as the rest of the note. - -.. note:: - This is note text. If note text runs over a line, make sure the lines wrap - and are indented to the same level as the note tag. If formatting is - incorrect, part of the note might not render in the HTML output. - - Notes can have more than one paragraph. Successive paragraphs must indent to - the same level as the rest of the note. - - -:: - - .. warning:: - Warnings are formatted in the same way as notes. In the same way, lines - must be broken and indented under the warning tag. - - -.. warning:: - Warnings are formatted in the same way as notes. In the same way, lines must - be broken and indented under the warning tag. - - -**************************** -Cross-References -**************************** - -In edX documents, you can include cross-references to other locations in the -same edX document, to locations in other edX documents (such as a cross- -reference from a location in the *Building and Running an edX Course* guide to -a location in the *EdX Learner's Guide*), to JIRA stories, and to external -websites. In this section, "EdX documents" refers to the resources, including -guides and tutorials, that are listed on docs.edx.org. - -For more information about creating cross-references using RST and Sphinx, see -`Cross-referencing arbitrary locations`_ in the online Sphinx documentation. - -================================================== -Cross-References to Locations in the Same Document -================================================== - -Cross-references to locations in the same document use anchors that are located -above the heading for each topic or section. Anchors can contain numbers, -letters, spaces, underscores, and hyphens, but cannot include punctuation. -Anchors use the following syntax. - -:: - - .. _Anchor Text: - -The following example shows an anchor for a section, followed by the heading -for that section. ``SFD SN Keyboard Shortcuts`` is the anchor text. - -:: - - .. _SFD SN Keyboard Shortcuts: - - ****************************** - Keyboard Shortcuts for Notes - ****************************** - -To create cross-references to locations in the same document, you can use the -anchor only, or you can use your own text. The anchor text is never visible in -output. It is replaced by the text of the heading that follows the anchor or -the text that you specify. - -Cross-References Using the Anchor Only -******************************************** - -To add a cross-reference to a specific location in a document and use the text -of the heading for that location as link text, use ``:ref:`Anchor Text``` -syntax, as in the following example. - -:: - - For more information about using keyboard shortcuts, see :ref:`SFD SN - Keyboard Shortcuts`. - -In this example, "SFD SN Keyboard Shortcuts" is the anchor text for a section -that is titled "Keyboard Shortcuts for Notes". Readers will see the following -text, and "Keyboard Shortcuts for Notes" will be an active link. - -:: - - For more information about using keyboard shortcuts, see Keyboard Shortcuts - for Notes. - -Cross-References Using Specified Link Text -******************************************* - -For internal cross-references that use text other than the heading for the -section that you're linking to, use ``:ref:`specified text``` -syntax, as in the following example. - -:: - - If you want to, you can use :ref:`keyboard shortcuts` to create, edit, and view notes. - -.. note:: - Do not include a space between the last word of the link text and the opening - angle bracket for the anchor text. - -In this example, "keyboard shortcuts" is the link text, and "SFD SN Keyboard -Shortcuts" is the anchor text for a section that is titled "Keyboard Shortcuts -for Notes". Readers will see the following text, and "keyboard shortcuts" will -be an active link. - -:: - - If you want to, you can use keyboard shortcuts to create, edit, and view your - notes. - -========================================================== -Cross-References to Locations in Different edX Documents -========================================================== - -You can create cross-references between different edX documents. For example, -you can create a link in *Building and Running an edX Course* to a topic in the -*EdX Learner's Guide*. To do this, you use the intersphinx map ID of the -document that you want to link to and the anchor text for the section you want. -The cross-reference uses the following syntax. - -:: - - :ref:`intersphinx_map_ID:Anchor Name` - -For example: - -:: - - :ref:`partnercoursestaff:Release Dates` - -To find the intersphinx map ID for the document that you want, follow these -steps. - -#. Open the conf.py file in the `edx-documentation/shared`_ folder, and then - locate the following line. - - ``intersphinx_mapping = {`` - -#. In the list that follows this line, find the ID for the document that you - want. The text between the single quotation marks (') at the beginning of - each line is the intersphinx map ID for the document. - -The following intersphinx map IDs are the most frequently used. - -.. list-table:: - :widths: 25 25 50 - - * - Map ID - - Document - * - ``partnercoursestaff`` - - *Building and Running an edX Course* - * - ``opencoursestaff`` - - *Building and Running an Open edX Course* - * - ``learners`` - - *EdX Learner's Guide* - * - ``openlearners`` - - *Open edX Learner's Guide* - * - ``data`` - - *EdX Research Guide* - * - ``insights`` - - *Using edX Insights* - * - ``installation`` - - *Installing, Configuring, and Running the Open edX Platform* - * - ``opendevelopers`` - - *Open edX Developer's Guide* - * - ``partnerreleasenotes`` - - Partner release notes - * - ``openreleasenotes`` - - Open edX release notes - -============================================ -Cross-References to JIRA -============================================ - -For cross-references to JIRA tickets, use the ``:jira:`PROJECT-ticketnumber``` -syntax, as in the following example. - -:: - - For more information, see :jira:`DOC-2316`. - -Note that ``jira`` replaces ``ref`` for these links. - -Readers will see the following text, and "DOC-2316" will be an active link. - -``For more information, see DOC-2316.`` - -============================================ -Cross-References to External Web Pages -============================================ - -A cross-reference to an external web page has several elements. - -* The URL of the external web page. -* The text to use for the cross-reference. This text becomes an anchor in the - file that contains the cross-reference. -* An ``include`` directive in the file that contains the cross-reference to the - links.rst file that is located in the ``edx-documentation/en_us/links/`` - folder. -* An entry in the links.rst file. - -To create an external cross-reference, follow these steps. - -#. In the paragraph where you want the cross-reference, add the text that you - want to use for the link, formatted as follows (where "Release Pages" is the - link text). This creates an anchor out of that text. - - :: - - The edX engineering wiki `Release Pages`_ provide access to detailed - information about every change made to the edx-platform GitHub - repository. - -#. In the file that contains the cross-reference, add an ``include`` directive - for the ``edx-documentation/en_us/links/links.rst`` file if one does not - already exist. These ``include`` directives are typically at the end of the - file. - - :: - - .. include:: ../../links/links.rst - - .. note:: - - The path to the links.rst file depends on the location of the file where - you are creating the link. For example, the path might be - ``../../../links/links.rst`` or ``../links/links.rst``. - -#. In the ``edx-documentation/en_us/links/links.rst`` file, add an entry for - the anchor text and the URL of the external website, formatted as follows. - Make sure that the anchor text in this file matches the anchor text in the - file that contains the cross-reference exactly, including capitalization. - - :: - - .. _Release Pages: https://openedx.atlassian.net/wiki/display/ENG/Release+Pages - -Readers will see the following text. "Release Pages" will be an active link. - -:: - - The edX engineering wiki Release Pages provide access to detailed - information about every change made to the edx-platform GitHub - repository. - - -**************************** -Image References -**************************** - -Image references look like this. -:: - - .. image:: /Images/Course_Outline_LMS.png - :width: 100 - :alt: A screen capture showing the elements of the course outline in the LMS. - - -Image links can include optional specifications such as height, width, or -scale. Alternative text for screen readers is required for each image. Provide -text that is useful to someone who might not be able to see the image. - - -.. _Examples of Tables: - -************************************ -Tables -************************************ - -Each example in this section shows the raw formatting for the table followed -by the table as it would render (if you are viewing this file as part of the -Style Guide). - -====================================== -Example of a table with an empty cell -====================================== - -The empty cell is the second column in the first row of this table. -:: - - .. list-table:: - :widths: 25 25 50 - - * - Annotation Problem - - - - Annotation problems ask students to respond to questions about a - specific block of text. The question appears above the text when the - student hovers the mouse over the highlighted text so that students can - think about the question as they read. - * - Example Poll - - Conditional Module - - You can create a conditional module to control versions of content that - groups of students see. For example, students who answer "Yes" to a - poll question then see a different block of text from the students who - answer "No" to that question. - * - Example JavaScript Problem - - Custom JavaScript - - Custom JavaScript display and grading problems (also called *custom - JavaScript problems* or *JS input problems*) allow you to create a - custom problem or tool that uses JavaScript and then add the problem or - tool directly into Studio. - -.. list-table:: - :widths: 25 25 50 - - * - Annotation Problem - - - - Annotation problems ask students to respond to questions about a - specific block of text. The question appears above the text when the - student hovers the mouse over the highlighted text so that students can - think about the question as they read. - * - Example Poll - - Conditional Module - - You can create a conditional module to control versions of content that - groups of students see. For example, students who answer "Yes" to a - poll question then see a different block of text from the students who - answer "No" to that question. - * - Exampel JavaScript Problem - - Custom JavaScript - - Custom JavaScript display and grading problems (also called *custom - JavaScript problems* or *JS input problems*) allow you to create a - custom problem or tool that uses JavaScript and then add the problem or - tool directly into Studio. - -==================================== -Example of a table with a header row -==================================== - -:: - - .. list-table:: - :widths: 15 15 70 - :header-rows: 1 - - * - First Name - - Last Name - - Residence - * - Elizabeth - - Bennett - - Longbourne - * - Fitzwilliam - - Darcy - - Pemberley - - -.. list-table:: - :widths: 15 15 70 - :header-rows: 1 - - * - First Name - - Last Name - - Residence - * - Elizabeth - - Bennett - - Longbourne - * - Fitzwilliam - - Darcy - - Pemberley - - -=============================================== -Example of a table with a boldface first column -=============================================== - -:: - - .. list-table:: - :widths: 15 15 70 - :stub-columns: 1 - - * - First Name - - Elizabeth - - Fitzwilliam - * - Last Name - - Bennett - - Darcy - * - Residence - - Longboure - - Pemberley - - -.. list-table:: - :widths: 15 15 70 - :stub-columns: 1 - - * - First Name - - Elizabeth - - Fitzwilliam - * - Last Name - - Bennett - - Darcy - * - Residence - - Longboure - - Pemberley - -============================================================== -Example of a table with a cell that includes an unordered list -============================================================== - -The blank lines before and after the unordered list are critical for the list -to render correctly. - -:: - - .. list-table:: - :widths: 15 15 60 - :header-rows: 1 - - * - Field - - Type - - Details - * - ``correct_map`` - - dict - - For each problem ID value listed by ``answers``, provides: - - * ``correctness``: string; 'correct', 'incorrect' - * ``hint``: string; Gives optional hint. Nulls allowed. - * ``hintmode``: string; None, 'on_request', 'always'. Nulls allowed. - * ``msg``: string; Gives extra message response. - * ``npoints``: integer; Points awarded for this ``answer_id``. Nulls allowed. - * ``queuestate``: dict; None when not queued, else ``{key:'', time:''}`` - where ``key`` is a secret string dump of a DateTime object in the form - '%Y%m%d%H%M%S'. Nulls allowed. - - * - ``grade`` - - integer - - Current grade value. - * - ``max_grade`` - - integer - - Maximum possible grade value. - - -.. list-table:: - :widths: 15 15 60 - :header-rows: 1 - - * - Field - - Type - - Details - * - ``correct_map`` - - dict - - For each problem ID value listed by ``answers``, provides: - - * ``correctness``: string; 'correct', 'incorrect' - * ``hint``: string; Gives optional hint. Nulls allowed. - * ``hintmode``: string; None, 'on_request', 'always'. Nulls allowed. - * ``msg``: string; Gives extra message response. - * ``npoints``: integer; Points awarded for this ``answer_id``. Nulls allowed. - * ``queuestate``: dict; None when not queued, else ``{key:'', time:''}`` - where ``key`` is a secret string dump of a DateTime object in the form - '%Y%m%d%H%M%S'. Nulls allowed. - - * - ``grade`` - - integer - - Current grade value. - * - ``max_grade`` - - integer - - Maximum possible grade value. - - -***************** -Code Formatting -***************** - -=========== -Inline code -=========== - -In inline text, any text can be formatted as code (monospace font) by -enclosing the selection within a pair of double "grave accent" characters (`). -For example, ````these words```` are formatted in a monospace font when the -documentation is output as PDF or HTML. - -=========== -Code blocks -=========== - - -To set text in a code block, end the previous paragaph with 2 colons, leave -one line before the intended code block, and make sure the code block is -indented beyond the first colon. -:: - - For example, this is the introductory paragraph - :: - -

and this is the code block following.

- - -Alternatively, use the code-block tag. Optionally, indicate the type of code -after the 2 colons in the tag, which results in the tags within the code block -being displayed in different colors. -:: - - .. code-block:: xml - - - - - PLACEHOLDER: Text of annotation - PLACEHOLDER: Text of question - PLACEHOLDER: Type your response below: - PLACEHOLDER: In your response to this question, which tag below - do you choose? - - - - - - - - -

PLACEHOLDER: Detailed explanation of solution

-
-
- -.. include:: ../../links/links.rst diff --git a/geoportal-service/enunciate.xml b/geoportal-service/enunciate.xml index 11c8453..3c3f8bb 100644 --- a/geoportal-service/enunciate.xml +++ b/geoportal-service/enunciate.xml @@ -19,7 +19,7 @@ - + diff --git a/geoportal-service/pom.xml b/geoportal-service/pom.xml index 6b03a01..82c7ac5 100644 --- a/geoportal-service/pom.xml +++ b/geoportal-service/pom.xml @@ -4,14 +4,14 @@ 4.0.0 org.gcube.application geoportal-service - 1.0.11 + 1.0.12 Geoportal Service war org.gcube.application.cms gcube-cms-suite - 1.0.3 + 1.0.4 @@ -68,11 +68,6 @@ default-lc-managers
- - org.gcube.common - authorization-utils - [2.0.0, 3.0.0-SNAPSHOT) - diff --git a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java index 3f52e50..c1b0e09 100644 --- a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java +++ b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/ProfiledMongoManager.java @@ -14,6 +14,7 @@ import org.bson.types.ObjectId; import org.gcube.application.cms.implementations.ImplementationProvider; import org.gcube.application.cms.implementations.WorkspaceManager; import org.gcube.application.cms.implementations.faults.*; +import org.gcube.application.cms.implementations.utils.UserUtils; import org.gcube.application.cms.plugins.LifecycleManager; import org.gcube.application.cms.plugins.faults.EventException; import org.gcube.application.cms.plugins.faults.InsufficientPrivileges; @@ -47,10 +48,9 @@ import org.gcube.application.geoportal.common.model.rest.QueryRequest; import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest; import org.gcube.application.geoportal.common.model.rest.TempFile; import org.gcube.application.geoportal.common.model.useCaseDescriptor.*; -import org.gcube.application.geoportal.common.utils.ContextUtils; import org.gcube.application.geoportal.common.utils.StorageUtils; import org.gcube.application.geoportal.service.engine.providers.PluginManager; -import org.gcube.application.geoportal.service.utils.UserUtils; + import org.gcube.common.storagehub.client.dsl.FolderContainer; import org.gcube.common.storagehub.model.exceptions.StorageHubException; @@ -81,7 +81,7 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI< return ID; } - public ProfiledMongoManager(String profileId) throws ConfigurationException, RegistrationException { + public ProfiledMongoManager(String profileId) throws ConfigurationException, RegistrationException { // Check UseCaseDescriptor ID log.info("Loading useCaseDescriptor ID {} ",profileId); if(profileId==null) throw new InvalidParameterException("UseCaseDescriptor ID cannot be null"); @@ -235,7 +235,7 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI< // TODO Set Access From UseCaseDescriptor Access access=new Access(); - access.setLicense(""); + access.setLicense("CC-BY-4.0"); access.setPolicy(AccessPolicy.OPEN); pubInfo.setAccess(access); @@ -624,6 +624,8 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI< } if(!policy.canWrite(doc,u)) throw new UnauthorizedAccess("No edit rights on project "+id); + + doc.getLifecycleInformation().cleanState(); doc.getLifecycleInformation().setLastOperationStatus(LifecycleInformation.Status.OK); @@ -650,10 +652,14 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI< Document parent = Serialization.asDocument(foundElementsByMatchingPaths.get(0)); - Access toSetAccess = doc.getInfo().getAccess(); + Access toSetAccess = new Access(doc.getInfo().getAccess().getPolicy(),doc.getInfo().getAccess().getLicense()); if(request.getToSetAccess()!=null){ //TODO validate specified Access - toSetAccess = request.getToSetAccess(); + String requestedLicense = request.getToSetAccess().getLicense(); + if(requestedLicense!=null)toSetAccess.setLicense(requestedLicense); + + AccessPolicy requestedPolicy = request.getToSetAccess().getPolicy(); + if(requestedPolicy!=null)toSetAccess.setPolicy(requestedPolicy); } // PREPARE REGISTERED FS @@ -821,7 +827,8 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI< @Override public Configuration getConfiguration() throws ConfigurationException{ - log.debug("Asking configuration for {} in {} ", useCaseDescriptor.getId(), UserUtils.getCurrent().getContext()); + String context = UserUtils.getCurrent().getContext(); + log.debug("Asking configuration for {} in {} ", useCaseDescriptor.getId(), context); Configuration toReturn= new Configuration(); List archives = new ArrayList<>(); toReturn.setArchives(archives); @@ -829,7 +836,7 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI< toReturn.setIndexes(indexes); // Set Basic Info toReturn.setProfileId(this.getUseCaseDescriptor().getId()); - toReturn.setContext(ContextUtils.getCurrentScope()); + toReturn.setContext(context); toReturn.setLastUpdatedTime(LocalDateTime.now()); // Add Mongo Info @@ -953,7 +960,7 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI< private static final RegisteredFileSet prepareRegisteredFileSet(Access toSetAccess,String docID, String profileID, Document attributes,List files, StorageUtils storage,WorkspaceManager ws) throws StorageHubException, StorageException { - log.debug("Preparing Registered FileSet.."); + log.debug("Preparing Registered FileSet {}"); RegisteredFileSet toReturn = new RegisteredFileSet(); if(attributes!=null) toReturn.putAll(attributes); String uuid = UUID.randomUUID().toString(); diff --git a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/UCDMongoManager.java b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/UCDMongoManager.java index c6c48e5..e7eae6f 100644 --- a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/UCDMongoManager.java +++ b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/mongo/UCDMongoManager.java @@ -7,6 +7,7 @@ import com.mongodb.client.model.ReturnDocument; import lombok.extern.slf4j.Slf4j; import org.bson.Document; import org.bson.types.ObjectId; +import org.gcube.application.cms.implementations.utils.UserUtils; import org.gcube.application.cms.serialization.Serialization; import org.gcube.application.geoportal.common.model.rest.ConfigurationException; import org.gcube.application.geoportal.common.model.rest.QueryRequest; @@ -24,7 +25,10 @@ public class UCDMongoManager extends MongoManager implements UCDManagerI{ public UCDMongoManager() throws ConfigurationException { - init("UCD_"+ContextUtils.getCurrentScope().replaceAll("/","_")); + String context = UserUtils.getCurrent().getContext(); + String collectionName ="UCD_"+context.replaceAll("/","_"); + log.debug("Starting UCD mongo manager under {} with collection name {} ",context, collectionName); + init(collectionName); } public long deleteAll(){ diff --git a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/providers/ConfigurationCache.java b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/providers/ConfigurationCache.java index e939540..8912728 100644 --- a/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/providers/ConfigurationCache.java +++ b/geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/providers/ConfigurationCache.java @@ -4,10 +4,12 @@ import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import org.gcube.application.cms.caches.AbstractScopedMap; import org.gcube.application.cms.caches.TimedMap; +import org.gcube.application.cms.implementations.utils.UserUtils; import org.gcube.application.geoportal.common.model.configuration.Configuration; import org.gcube.application.geoportal.common.model.rest.ConfigurationException; import org.gcube.application.geoportal.service.engine.mongo.ProfiledMongoManager; + import java.time.Duration; import java.time.temporal.ChronoUnit; import java.time.temporal.TemporalAmount; @@ -45,6 +47,7 @@ public class ConfigurationCache extends AbstractScopedMap implements UCDMan log.warn("Unable to cache UCD {}",entry.getKey(),e); } } - log.info("Cached {} UCDs in {} ",memCache.size(),ContextUtils.getCurrentScope()); + String context = UserUtils.getCurrent().getContext(); + log.info("Cached {} UCDs in {} ",memCache.size(),context); cacheLock.writeLock().unlock(); } diff --git a/geoportal-service/src/test/java/org/gcube/application/geoportal/service/engine/mongo/LockTests.java b/geoportal-service/src/test/java/org/gcube/application/geoportal/service/engine/mongo/LockTests.java index 6151d6e..14e2d3f 100644 --- a/geoportal-service/src/test/java/org/gcube/application/geoportal/service/engine/mongo/LockTests.java +++ b/geoportal-service/src/test/java/org/gcube/application/geoportal/service/engine/mongo/LockTests.java @@ -2,6 +2,7 @@ package org.gcube.application.geoportal.service.engine.mongo; import org.bson.Document; import org.gcube.application.cms.implementations.faults.*; +import org.gcube.application.cms.implementations.utils.UserUtils; import org.gcube.application.cms.plugins.faults.EventException; import org.gcube.application.cms.plugins.faults.InsufficientPrivileges; import org.gcube.application.cms.plugins.faults.StepException; @@ -16,7 +17,6 @@ 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.gcube.application.geoportal.service.utils.UserUtils; import org.gcube.common.storagehub.model.exceptions.StorageHubException; import org.junit.Before; import org.junit.BeforeClass; @@ -30,7 +30,7 @@ import static org.junit.Assume.assumeTrue; public class LockTests extends BasicServiceTestUnit { - String profileID = "rolesTesting"; + String profileID = "basic"; ProfiledMongoManager manager= null; @BeforeClass @@ -100,7 +100,7 @@ public class LockTests extends BasicServiceTestUnit { // register fileset FileSets.RequestBuilder builder = FileSets.build( - "$.relazioneScavo","fileset","relazioneScavo."+ Field.CHILDREN+"[?(@.fileset)]"); + "$.section","fileset","section."+ Field.CHILDREN+"[?(@.fileset)]"); StorageUtils s= new StorageUtils(); builder.add( s.putOntoStorage(new File(Tests.FOLDER_CONCESSIONI,"pos.shp"),"pos.shp")); @@ -109,7 +109,7 @@ public class LockTests extends BasicServiceTestUnit { checkIsLockCleaned(p.getId()); // delete fileset - p=managerInterface.deleteFileSet(p.getId(),"$.relazioneScavo.fileset",false); + p=managerInterface.deleteFileSet(p.getId(),"$.section.fileset",false); checkIsLockCleaned(p.getId()); // perform step diff --git a/geoportal-service/src/test/java/org/gcube/application/geoportal/service/profiledDocuments/AbstractProfiledDocumentsTests.java b/geoportal-service/src/test/java/org/gcube/application/geoportal/service/profiledDocuments/AbstractProfiledDocumentsTests.java index 1d87e55..ef1f33f 100644 --- a/geoportal-service/src/test/java/org/gcube/application/geoportal/service/profiledDocuments/AbstractProfiledDocumentsTests.java +++ b/geoportal-service/src/test/java/org/gcube/application/geoportal/service/profiledDocuments/AbstractProfiledDocumentsTests.java @@ -9,6 +9,7 @@ import org.gcube.application.cms.tests.TokenSetter; import org.gcube.application.cms.tests.model.BasicTests; import org.gcube.application.geoportal.common.model.configuration.Configuration; import org.gcube.application.geoportal.common.model.document.Project; +import org.gcube.application.geoportal.common.model.document.access.Access; import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation; import org.gcube.application.geoportal.common.model.rest.QueryRequest; import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest; @@ -23,12 +24,14 @@ import org.junit.Before; import org.junit.Test; import org.opengis.service.Interface; +import javax.ws.rs.WebApplicationException; import javax.ws.rs.client.Entity; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import java.io.File; import java.util.List; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeTrue; @@ -158,9 +161,12 @@ public abstract class AbstractProfiledDocumentsTests extends BasicServiceTestUni String fieldDefinitionPath, Document attributes, RegisterFileSetRequest.ClashOptions clashPolicy, - String ...files) throws Exception { + Access access, + String ...files) throws Exception { FileSets.RequestBuilder builder = FileSets.build(parentPath,fieldName,fieldDefinitionPath); + builder.setAccess(access); + builder.setClashPolicy(clashPolicy).setAttributes(attributes); for(String file:files) @@ -169,6 +175,7 @@ public abstract class AbstractProfiledDocumentsTests extends BasicServiceTestUni Project doc = check(baseTarget().path(InterfaceConstants.Methods.REGISTER_FILES_PATH).path(id).request(MediaType.APPLICATION_JSON). post(Entity.entity(Serialization.write(builder.getTheRequest()), MediaType.APPLICATION_JSON)), Project.class); + BasicTests.validate(doc); return doc; } diff --git a/geoportal-service/src/test/java/org/gcube/application/geoportal/service/profiledDocuments/DummyProjectTest.java b/geoportal-service/src/test/java/org/gcube/application/geoportal/service/profiledDocuments/DummyProjectTest.java index 4852a0d..47a10ed 100644 --- a/geoportal-service/src/test/java/org/gcube/application/geoportal/service/profiledDocuments/DummyProjectTest.java +++ b/geoportal-service/src/test/java/org/gcube/application/geoportal/service/profiledDocuments/DummyProjectTest.java @@ -4,6 +4,8 @@ import org.bson.Document; import org.gcube.application.cms.serialization.Serialization; import org.gcube.application.geoportal.common.model.JSONPathWrapper; import org.gcube.application.geoportal.common.model.document.Project; +import org.gcube.application.geoportal.common.model.document.access.Access; +import org.gcube.application.geoportal.common.model.document.access.AccessPolicy; import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFileSet; import org.gcube.application.geoportal.common.model.document.relationships.Relationship; import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest; @@ -31,7 +33,7 @@ public class DummyProjectTest extends AbstractProfiledDocumentsTests{ String fieldName="fileset"; String fieldDefinition="section."+Field.CHILDREN+"[?(@.fileset)]"; - String filename = "sample.tif"; + String filename = "concessioni/sample.tif"; @Override @@ -89,7 +91,7 @@ public class DummyProjectTest extends AbstractProfiledDocumentsTests{ fieldDefinition, new Document("customField","customFieldValue"), RegisterFileSetRequest.ClashOptions.REPLACE_EXISTING, - filename); + new Access(),filename); wrapper = new JSONPathWrapper(doc.getTheDocument().toJson()); assertTrue("Relazione exists",wrapper.getMatchingPaths("section").size()==1); @@ -127,8 +129,9 @@ public class DummyProjectTest extends AbstractProfiledDocumentsTests{ Project doc = createNew(baseDoc); - - + Access access =new Access(); + access.setLicense("test-license"); + access.setPolicy(AccessPolicy.RESTRICTED); // INSERT ONE, MERGE INFO (NB default values already exist) doc = upload( @@ -138,142 +141,21 @@ public class DummyProjectTest extends AbstractProfiledDocumentsTests{ fieldDefinition, new Document("customField","customFieldValue"), RegisterFileSetRequest.ClashOptions.REPLACE_EXISTING, - filename); + access,filename); return doc; } - @Test - public void testUnlock() throws Exception { - assumeTrue(GCubeTest.isTestInfrastructureEnabled()); - // Not automatic, needs generation of locked project - assumeTrue(false); - String id = "627e87bb02ad3d1a2e0e9e18"; - String ucd = "profiledConcessioni"; - Project p =check(target(InterfaceConstants.Methods.PROJECTS).path(ucd).path(InterfaceConstants.Methods.FORCE_UNLOCK).path(id).request(MediaType.APPLICATION_JSON). - put(Entity.entity("", MediaType.APPLICATION_JSON)), Project.class); - assertNull(p.getLock()); - } - - @Test - public void testRelationships() throws Exception { - assumeTrue(GCubeTest.isTestInfrastructureEnabled()); - Project a = createNew(new Document("key","value")); - Project b = createNew(new Document("key","value")); - - // set relation a -- precedes --> b - System.out.println("Setting relation.."); - String relId="precedes"; - a = check(baseTarget(). - path(InterfaceConstants.Methods.RELATIONSHIP). - path(a.getId()). - path(relId). - queryParam(InterfaceConstants.Parameters.TARGET_UCD,b.getProfileID()). - queryParam(InterfaceConstants.Parameters.TARGET_ID,b.getId()). - request(MediaType.APPLICATION_JSON). - put(Entity.json("")), Project.class); - // check set relation in a - System.out.println("Checking relation a->b"); - assertTrue(a.getRelationships()!=null && a.getRelationships().size()==1); - Relationship rel = a.getRelationships().get(0); - assertEquals(rel.getRelationshipName(),relId); - assertEquals(rel.getTargetUCD(),b.getProfileID()); - assertEquals(rel.getTargetID(),b.getId()); - - // TODO TBD check reciprocity : expected relation b -- follows -> a - - // delete relation - System.out.println("Deleting relation a->b"); - a = check(baseTarget(). - path(InterfaceConstants.Methods.RELATIONSHIP). - path(a.getId()). - path(relId). - queryParam(InterfaceConstants.Parameters.TARGET_UCD,b.getProfileID()). - queryParam(InterfaceConstants.Parameters.TARGET_ID,b.getId()). - request(MediaType.APPLICATION_JSON). - delete(), Project.class); - // check deleted - - System.out.println("Checking deleted relation"); - assertTrue(a.getRelationships()==null || a.getRelationships().isEmpty()); - - - } - - + // Not automatic, needs generation of locked project // @Test -// public void testSDI() throws Exception { -// // Create new -// Project doc = createNew(new Document("posizionamentoScavo",new Document("title","Mio pos"))); -// -// // register filesets -// doc = upload( -// new StorageUtils(), -// doc.getId(), -// "posizionamentoScavo","fileset", -// "posizionamentoScavo."+Field.CHILDREN+"[?(@.fileset)]", -// null, -// RegisterFileSetRequest.ClashOptions.REPLACE_EXISTING, -// "pos.shp","pos.shx"); -// -// System.out.println("Registered posizionamento, result is "+ Serialization.write(doc)); -// -// // invoke step SUBMIT-FOR-REVIEW -// StepExecutionRequest req=new StepExecutionRequest(); -// req.setStepID("SUBMIT-FOR-REVIEW"); -// doc=step(doc.getId(),req); -// System.out.println(doc); -// if(doc.getLifecycleInformation().getErrorMessages()!=null) { -// System.out.println("ERROR MESSAGES"); -// doc.getLifecycleInformation().getErrorMessages().forEach(s -> System.out.println(s)); -// } -// if(doc.getLifecycleInformation().getWarningMessages()!=null) { -// System.out.println("WARNING MESSAGES"); -// doc.getLifecycleInformation().getWarningMessages().forEach(s -> System.out.println(s)); -// } -// -// assertTrue(doc.getLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)); -// -// JSONPathWrapper wrapper = new JSONPathWrapper(doc.getTheDocument().toJson()); -// RegisteredFileSet fs = Serialization.convert(wrapper.getByPath("$..fileset").get(0),RegisteredFileSet.class); -// assertTrue(fs!=null); -// assertTrue(fs.getPayloads().size()==2); -// assertTrue(fs.getMaterializations().size()>0); -// -// -// for(Object matObj : wrapper.getByPath("$..[?(@."+ Materialization.TYPE +" == '"+GCubeSDILayer.GCUBE_SDY_LAYER_TYPE+"' )]")){ -// GCubeSDILayer layer = Serialization.convert(matObj, GCubeSDILayer.class); -// System.out.println("Checking Layer : "+layer); -// assertTrue(layer.getType().equals(GCubeSDILayer.GCUBE_SDY_LAYER_TYPE)); -// assertTrue(layer.getOGCLinks().size()>0); -// assertTrue(layer.getPlatformInfo().size()>0); -// assertTrue(layer.getBBox()!=null); -// } -// -// // Checking platform info GeoServer -// for(Object platformObj : wrapper.getByPath("$..[?(@."+ Materialization.TYPE +" == 'GeoServer' )]")){ -// Document platform=Serialization.asDocument(platformObj); -// assertTrue(platform.containsKey("layerName")); -// assertTrue(platform.containsKey("workspace")); -// assertTrue(platform.containsKey("storeName")); -// assertTrue(platform.containsKey("persistencePath")); -// assertTrue(platform.get("files",List.class).size()==2); -// } -// -// -// req.setStepID("APPROVE DRAFT"); -// doc=step(doc.getId(),req); -// if(doc.getLifecycleInformation().getErrorMessages()!=null) { -// System.out.println("ERROR MESSAGES"); -// doc.getLifecycleInformation().getErrorMessages().forEach(s -> System.out.println(s)); -// } -// if(doc.getLifecycleInformation().getWarningMessages()!=null) { -// System.out.println("WARNING MESSAGES"); -// doc.getLifecycleInformation().getWarningMessages().forEach(s -> System.out.println(s)); -// } -// -// assertTrue(doc.getLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)); -// +// public void testUnlock() throws Exception { +// assumeTrue(GCubeTest.isTestInfrastructureEnabled()); +// assumeTrue(false); +// String id = "627e87bb02ad3d1a2e0e9e18"; +// String ucd = "profiledConcessioni"; +// Project p =check(target(InterfaceConstants.Methods.PROJECTS).path(ucd).path(InterfaceConstants.Methods.FORCE_UNLOCK).path(id).request(MediaType.APPLICATION_JSON). +// put(Entity.entity("", MediaType.APPLICATION_JSON)), Project.class); +// assertNull(p.getLock()); // } } diff --git a/geoportal-service/src/test/java/org/gcube/application/geoportal/service/profiledDocuments/ProfiledConcessioniTests.java b/geoportal-service/src/test/java/org/gcube/application/geoportal/service/profiledDocuments/ProfiledConcessioniTests.java index c42b12c..97b91a8 100644 --- a/geoportal-service/src/test/java/org/gcube/application/geoportal/service/profiledDocuments/ProfiledConcessioniTests.java +++ b/geoportal-service/src/test/java/org/gcube/application/geoportal/service/profiledDocuments/ProfiledConcessioniTests.java @@ -2,28 +2,21 @@ package org.gcube.application.geoportal.service.profiledDocuments; import lombok.extern.slf4j.Slf4j; import org.bson.Document; -import org.gcube.application.cms.implementations.ImplementationProvider; -import org.gcube.application.cms.implementations.WorkspaceManager; +import org.gcube.application.cms.implementations.utils.UserUtils; import org.gcube.application.cms.serialization.Serialization; -import org.gcube.application.cms.tests.model.BasicTests; -import org.gcube.application.geoportal.common.model.JSONPathWrapper; import org.gcube.application.geoportal.common.model.document.Project; +import org.gcube.application.geoportal.common.model.document.access.Access; import org.gcube.application.geoportal.common.model.document.identification.SpatialReference; import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation; import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest; import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest; import org.gcube.application.geoportal.common.model.useCaseDescriptor.Field; -import org.gcube.application.geoportal.common.rest.InterfaceConstants; import org.gcube.application.geoportal.common.utils.StorageUtils; import org.gcube.application.geoportal.common.utils.tests.GCubeTest; -import org.gcube.application.geoportal.service.utils.UserUtils; -import org.gcube.common.storagehub.model.exceptions.StorageHubException; + import org.junit.Test; -import javax.management.relation.Relation; -import javax.ws.rs.client.Entity; import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.MediaType; import java.time.LocalDateTime; import static org.junit.Assert.assertEquals; @@ -70,7 +63,7 @@ public class ProfiledConcessioniTests extends AbstractProfiledDocumentsTests{ "fileset", "$.posizionamentoScavo."+ Field.CHILDREN+"[?(@.fileset)]", null, - RegisterFileSetRequest.ClashOptions.MERGE_EXISTING, + RegisterFileSetRequest.ClashOptions.MERGE_EXISTING,new Access(), "concessioni/pos.SHP"); diff --git a/images-plugin/CHANGELOG.md b/images-plugin/CHANGELOG.md index 865c90c..d199889 100644 --- a/images-plugin/CHANGELOG.md +++ b/images-plugin/CHANGELOG.md @@ -1,11 +1,12 @@ -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.2] - 2023-01-10 +- Pom updates ## [v1.0.1] - 2022-12-07 - Pom updates ## [v1.0.0] - 2022-02-24 - First release + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/images-plugin/README.md b/images-plugin/README.md index 85dd719..cf7f63a 100644 --- a/images-plugin/README.md +++ b/images-plugin/README.md @@ -1,7 +1,9 @@ -gCube CMS Suite +gCube CMS Suite : Images Plugin -------------------------------------------------- gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles. + +This module is expected to define handlers for the materializations of images preview. ## Built with * [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework @@ -11,8 +13,8 @@ gCube CMS Suite is a set of components designed to manage complex space-temporal * [Maven](https://maven.apache.org/) - Dependency Management ## Documentation +[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities. -Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service). ## Change log diff --git a/images-plugin/pom.xml b/images-plugin/pom.xml index af0ba97..9e13178 100644 --- a/images-plugin/pom.xml +++ b/images-plugin/pom.xml @@ -5,14 +5,14 @@ 4.0.0 images-plugins - 1.0.1 + 1.0.2 gCube CMS - Images Plugins org.gcube.application.cms gcube-cms-suite - 1.0.3 + 1.0.4 diff --git a/notifications-plugins/CHANGELOG.md b/notifications-plugins/CHANGELOG.md index 086b04f..e151a7a 100644 --- a/notifications-plugins/CHANGELOG.md +++ b/notifications-plugins/CHANGELOG.md @@ -1,11 +1,12 @@ -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.2] - 2023-01-10 +- Pom updates ## [v1.0.1] - 2022-12-07 - Pom updates ## [v1.0.0] - 2022-02-24 - First release + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/notifications-plugins/README.md b/notifications-plugins/README.md index 85dd719..6768c33 100644 --- a/notifications-plugins/README.md +++ b/notifications-plugins/README.md @@ -1,8 +1,11 @@ -gCube CMS Suite +gCube CMS Suite : Notifications Plugin -------------------------------------------------- gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles. - + +This module is expected to contain plugin definitions for the generations of notifications upon certain Lifecycle events. + + ## Built with * [gCube SmartGears] (https://gcube.wiki.gcube-system.org/gcube/SmartGears) - The gCube SmartGears framework * [OpenJDK](https://openjdk.java.net/) - The JDK used @@ -11,8 +14,8 @@ gCube CMS Suite is a set of components designed to manage complex space-temporal * [Maven](https://maven.apache.org/) - Dependency Management ## Documentation +[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities. -Documentation can be found [here](https://gcube.wiki.gcube-system.org/gcube/GeoPortal_Service). ## Change log diff --git a/notifications-plugins/pom.xml b/notifications-plugins/pom.xml index 8a54506..108061c 100644 --- a/notifications-plugins/pom.xml +++ b/notifications-plugins/pom.xml @@ -5,14 +5,14 @@ 4.0.0 notifications-plugins - 1.0.1 + 1.0.2 gCube CMS - Notifications Plugins org.gcube.application.cms gcube-cms-suite - 1.0.3 + 1.0.4 diff --git a/pom.xml b/pom.xml index 69f7642..c3f4017 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ org.gcube.application.cms gcube-cms-suite pom - 1.0.3 + 1.0.4 Gcube CMS Suite gCube CMS Suite is a set of components designed to manage complex space-temporal Documents defined by metadata Profiles. @@ -26,17 +26,15 @@ 2.1.1 3.6.3 [1.0.0,2.0.0-SNAPSHOT) - 1.0.1 - - + 1.0.3 diff --git a/sdi-plugins/CHANGELOG.md b/sdi-plugins/CHANGELOG.md index 5ee7859..a3c4abc 100644 --- a/sdi-plugins/CHANGELOG.md +++ b/sdi-plugins/CHANGELOG.md @@ -1,8 +1,7 @@ -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.2] - 2023-01-10 +- Pom updates ## [v1.0.1] - 2022-12-07 - Pom updates @@ -10,3 +9,5 @@ This library contains gcube-cms plugins for indexing and materializations in gCu ## [v1.0.0] - 2022-02-24 - First release + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/sdi-plugins/README.md b/sdi-plugins/README.md index e88b451..e5c4854 100644 --- a/sdi-plugins/README.md +++ b/sdi-plugins/README.md @@ -1,15 +1,22 @@ gCube CMS Suite : SDI Plugins -------------------------------------------------- - -[gCube CMS Suite](../) module containing references, documentation, guides ad utilities. +This module contains definition of the following plugins : +- SDIIndexerPlugin : indexes Projects in centroid layers in gCube SDI (requires PostGIS DB) +- SDIMaterializerPlugin : materializes layers in gCube SDI (currenlty supported TIF and SHP) + +It uses the SDI in the context of the caller, and requires : +- GeoServer +- Postgis DB registered in Geoserver (indexing only) + + +## Built with +* [gCube SDI] (https://gcube.wiki.gcube-system.org/gcube/) - The gCube SDI +* [OpenJDK](https://openjdk.java.net/) - The JDK used +* [Maven](https://maven.apache.org/) - Dependency Management ## Documentation -* [Dedicated Wiki](https://sublime-and-sphinx-guide.readthedocs.io) - TBD Powered by [Sphynx](https://www.sphinx-doc.org/en/master/) -* [Service Interactive API]() -TBD Powered by [Enunciate](http://enunciate.webcohesion.com/) -* [Gcube System Wiki](https://gcube.wiki.gcube-system.org/gcube/GeoPortal). -* [Guide Notebooks](../use-cases) - Powered by [Jupyter](https://jupyter.org/) -* [Service Wiki src](../use-cases/src/site/suite.rst) +[gCube CMS Suite](../) parent module containing references, documentation, guides ad utilities. ## Change log diff --git a/sdi-plugins/pom.xml b/sdi-plugins/pom.xml index d0f6fe8..e95a416 100644 --- a/sdi-plugins/pom.xml +++ b/sdi-plugins/pom.xml @@ -5,14 +5,14 @@ 4.0.0 sdi-plugins - 1.0.1 + 1.0.2 gCube CMS - SDI Plugins org.gcube.application.cms gcube-cms-suite - 1.0.3 + 1.0.4 diff --git a/sdi-plugins/src/main/java/org/gcube/application/cms/sdi/plugins/SDIMaterializerPlugin.java b/sdi-plugins/src/main/java/org/gcube/application/cms/sdi/plugins/SDIMaterializerPlugin.java index fede17c..e928aff 100644 --- a/sdi-plugins/src/main/java/org/gcube/application/cms/sdi/plugins/SDIMaterializerPlugin.java +++ b/sdi-plugins/src/main/java/org/gcube/application/cms/sdi/plugins/SDIMaterializerPlugin.java @@ -5,6 +5,7 @@ import lombok.Data; import lombok.Synchronized; import lombok.extern.slf4j.Slf4j; import org.bson.Document; +import org.gcube.application.cms.implementations.utils.UserUtils; import org.gcube.application.cms.plugins.MaterializationPlugin; import org.gcube.application.cms.plugins.faults.InitializationException; import org.gcube.application.cms.plugins.faults.InvalidPluginRequestException; @@ -47,7 +48,9 @@ public class SDIMaterializerPlugin extends AbstractPlugin implements Materializa private SDIManagerWrapper getSDIManager(){ - return sdiManagerMap.get(ContextUtils.getCurrentScope()); + String context = UserUtils.getCurrent().getContext(); + log.debug("Getting SDIManagerWrapper from cache map for context {}"); + return sdiManagerMap.get(context); } @Override @@ -55,7 +58,7 @@ public class SDIMaterializerPlugin extends AbstractPlugin implements Materializa public InitializationReport initInContext() throws InitializationException { InitializationReport report = new InitializationReport(); try{ - String context = ContextUtils.getCurrentScope(); + String context = UserUtils.getCurrent().getContext(); if(getSDIManager()==null) { log.info("Initializing in " + context); sdiManagerMap.put(context,new SDIManagerWrapper()); diff --git a/use-cases/CHANGELOG.md b/use-cases/CHANGELOG.md index b8294bf..0125e99 100644 --- a/use-cases/CHANGELOG.md +++ b/use-cases/CHANGELOG.md @@ -1,6 +1,7 @@ -This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +# Changelog for org.gcube.application.cms.use-cases -# Changelog for org.gcube.application.geoportal-client +## [v1.0.4] - 2023-01-10 +- Pom updates ## [v1.0.3] - 2022-12-07 - Pom updates @@ -12,4 +13,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Updated parent ## [v1.0.0] - 2021-09-20 -- First release, extracted from client \ No newline at end of file +- First release, extracted from client + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). \ No newline at end of file diff --git a/use-cases/README.md b/use-cases/README.md index 4a2b307..9fc052e 100644 --- a/use-cases/README.md +++ b/use-cases/README.md @@ -1,19 +1,18 @@ gCube CMS Suite : Use cases -------------------------------------------------- -[gCube CMS Suite](../README.md) module containing references, documentation, guides ad utilities. +This module contains utilities for the management of gCube CMS Suite instances, such as : +- Environment Checks +- Import / Export facilities +- WS Report features +- Stress test +- Collection removal ## Documentation -* [Dedicated Wiki](https://sublime-and-sphinx-guide.readthedocs.io) - TBD Powered by [Sphynx] (https://www.sphinx-doc.org/en/master/) -* [Service Interactive API]() -TBD Powered by [Enunciate] (http://enunciate.webcohesion.com/) -* [Gcube System Wiki] - (https://gcube.wiki.gcube-system.org/gcube/GeoPortal). -* [Guide Notebooks](use-cases) - Powered by [Jupyter] (https://jupyter.org/) -* [Service Wiki src] (use-cases/src/site/suite.rst) - +[gCube CMS Suite](../README.md) module containing references, documentation, guides ad utilities. ## Change log - See [CHANGELOG.md](CHANGELOG.md). ## License diff --git a/use-cases/pom.xml b/use-cases/pom.xml index 263ac22..b45c84c 100644 --- a/use-cases/pom.xml +++ b/use-cases/pom.xml @@ -4,12 +4,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 use-cases - 1.0.3 + 1.0.4 CMS Use cases gcube-cms-suite org.gcube.application.cms - 1.0.3 + 1.0.4 diff --git a/use-cases/src/test/java/org/gcube/application/cms/usecases/ExportConcessioniAsProjects.java b/use-cases/src/test/java/org/gcube/application/cms/usecases/ExportConcessioniAsProjects.java index 5f7b362..fbe41e5 100644 --- a/use-cases/src/test/java/org/gcube/application/cms/usecases/ExportConcessioniAsProjects.java +++ b/use-cases/src/test/java/org/gcube/application/cms/usecases/ExportConcessioniAsProjects.java @@ -250,6 +250,9 @@ public class ExportConcessioniAsProjects { + "[?(@.fileset)]"); req.addAll(convertFiles(content)); req.setAccess(getAccess(rel)); + + + project = client.registerFileSet(project.getId(),req.getTheRequest()); } // upload fileset diff --git a/use-cases/src/test/java/org/gcube/application/cms/usecases/GenericChecks.java b/use-cases/src/test/java/org/gcube/application/cms/usecases/GenericChecks.java new file mode 100644 index 0000000..345adae --- /dev/null +++ b/use-cases/src/test/java/org/gcube/application/cms/usecases/GenericChecks.java @@ -0,0 +1,56 @@ +package org.gcube.application.cms.usecases; + +import org.gcube.application.cms.tests.TokenSetter; +import org.gcube.application.geoportal.client.UseCaseDescriptors; +import org.gcube.application.geoportal.common.model.rest.QueryRequest; +import org.gcube.application.geoportal.common.rest.Projects; +import org.gcube.application.geoportal.common.rest.UseCaseDescriptorsI; +import org.gcube.application.geoportal.common.utils.tests.GCubeTest; +import org.junit.Assert; +import org.junit.Test; + +import java.util.concurrent.atomic.AtomicLong; + +import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects; +import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors; +import static org.junit.Assume.assumeTrue; + +public class GenericChecks { + + + UseCaseDescriptorsI getClient(){ + assumeTrue(GCubeTest.isTestInfrastructureEnabled()); + TokenSetter.set(GCubeTest.getContext()); + return useCaseDescriptors().build(); + } + + @Test + public void getAll() throws Exception { + + UseCaseDescriptorsI client =getClient(); + + QueryRequest request = new QueryRequest(); + // All + + client.query(request).forEachRemaining(u -> { + try { + System.out.println("Obtained UCD "+u.getId()); + + client.getById(u.getId()).getId(); + + Projects pClient = (Projects)projects(u.getId()).build(); + + AtomicLong counter=new AtomicLong(0); + pClient.query(new QueryRequest()).forEachRemaining( M -> counter.incrementAndGet()); + System.out.println("Found "+counter.get()+" elements"); + + } catch (Exception e) { + e.printStackTrace(System.err); + Assert.fail("Unable to check "+u.getId()); + } + }); + + + } + +}