diff --git a/CHANGELOG.md b/CHANGELOG.md
index a1929c5..1b686a3 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-SNAPSHOT] - 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..e75d18f 100644
--- a/ckan-plugin/CHANGELOG.md
+++ b/ckan-plugin/CHANGELOG.md
@@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
This library contains gcube-cms plugins for ckan materializations
+## [v1.0.2-SNAPSHOT] - 2023-01-10
+- Pom updates
+
## [v1.0.1] - 2022-12-07
- Pom updates
diff --git a/ckan-plugin/pom.xml b/ckan-plugin/pom.xml
index ce4336a..266f60c 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-SNAPSHOT
gCube CMS - CKAN Plugins
org.gcube.application.cms
gcube-cms-suite
- 1.0.3
+ 1.0.4-SNAPSHOT
diff --git a/cms-plugin-framework/CHANGELOG.md b/cms-plugin-framework/CHANGELOG.md
index d9194ca..48fbb29 100644
--- a/cms-plugin-framework/CHANGELOG.md
+++ b/cms-plugin-framework/CHANGELOG.md
@@ -2,6 +2,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for org.gcube.application.cms-plugin-framework
+## [v1.0.3-SNAPSHOT] - 2023-01-10
+- UserUtils in framework
+
## [v1.0.2] 2022-01-17
- Fixes #2435
- Introduced module default-lc-managers
diff --git a/cms-plugin-framework/pom.xml b/cms-plugin-framework/pom.xml
index d78566d..b5130b9 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-SNAPSHOT
org.gcube.application.cms
gcube-cms-suite
- 1.0.3
+ 1.0.4-SNAPSHOT
@@ -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..9b07913 100644
--- a/cms-test-commons/CHANGELOG.md
+++ b/cms-test-commons/CHANGELOG.md
@@ -2,6 +2,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for org.gcube.application.cms.cms-test-commons
+## [v1.0.4-SNAPSHOT] - 2023-01-10
+- Pom updates
+
## [v1.0.3] - 2022-12-07
- Pom updates
diff --git a/cms-test-commons/pom.xml b/cms-test-commons/pom.xml
index c66b0d0..c5bba41 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-SNAPSHOT
CMS Test Commons
org.gcube.application.cms
gcube-cms-suite
- 1.0.3
+ 1.0.4-SNAPSHOT
diff --git a/concessioni-lifecycle/CHANGELOG.md b/concessioni-lifecycle/CHANGELOG.md
index 8e4aad8..9a95716 100644
--- a/concessioni-lifecycle/CHANGELOG.md
+++ b/concessioni-lifecycle/CHANGELOG.md
@@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
This library contains custom extensions for the support of GNA "concessioni" use case
+## [v1.0.3-SNAPSHOT] - 2023-01-10
+- Pom updates
+
## [v1.0.2] - 2022-12-07
- Pom updates
- Introduced module default-lc-managers
diff --git a/concessioni-lifecycle/pom.xml b/concessioni-lifecycle/pom.xml
index 6a7dcb8..ddee981 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-SNAPSHOT
GNA Concessioni Lifecycle
org.gcube.application.cms
gcube-cms-suite
- 1.0.3
+ 1.0.4-SNAPSHOT
diff --git a/concessioni-model/CHANGELOG.md b/concessioni-model/CHANGELOG.md
index 7b873d0..22ba985 100644
--- a/concessioni-model/CHANGELOG.md
+++ b/concessioni-model/CHANGELOG.md
@@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
This library contains custom BEANS for the support of GNA "concessioni" use case
+## [v1.0.3-SNAPSHOT] - 2023-01-10
+- Pom updates
+
## [v1.0.2] - 2022-12-07
- Pom updates
diff --git a/concessioni-model/pom.xml b/concessioni-model/pom.xml
index 8916c04..60d5217 100644
--- a/concessioni-model/pom.xml
+++ b/concessioni-model/pom.xml
@@ -6,14 +6,14 @@
org.gcube.application.cms
concessioni-model
- 1.0.2
+ 1.0.3-SNAPSHOT
GNA Concessioni Model
org.gcube.application.cms
gcube-cms-suite
- 1.0.3
+ 1.0.4-SNAPSHOT
diff --git a/dataminer-plugins/CHANGELOG.md b/dataminer-plugins/CHANGELOG.md
index 6d1e27e..f80220f 100644
--- a/dataminer-plugins/CHANGELOG.md
+++ b/dataminer-plugins/CHANGELOG.md
@@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
This library contains gcube-cms plugins for processing via gCube Dataminer
+## [v1.0.2-SNAPSHOT] - 2023-01-10
+- Pom updates
+
## [v1.0.1] - 2022-12-07
- Pom updates
diff --git a/dataminer-plugins/pom.xml b/dataminer-plugins/pom.xml
index 4c8b9e0..41b1f8f 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.3-SNAPSHOT
gCube CMS - Dataminer Plugins
org.gcube.application.cms
gcube-cms-suite
- 1.0.3
+ 1.0.4-SNAPSHOT
diff --git a/default-lc-managers/CHANGELOG.md b/default-lc-managers/CHANGELOG.md
index 6c80f00..acc13d8 100644
--- a/default-lc-managers/CHANGELOG.md
+++ b/default-lc-managers/CHANGELOG.md
@@ -4,5 +4,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
This library contains default Lifecycle Managers handlers
-## [v1.0.0] - 2022-02-24
+## [v1.0.1-SNAPSHOT] - 2023-01-10
+- Pom updates
+
+- ## [v1.0.0] - 2022-02-24
- First release
diff --git a/default-lc-managers/pom.xml b/default-lc-managers/pom.xml
index 7351a94..4e7c601 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-SNAPSHOT
gCube CMS - Default LC Managers
org.gcube.application.cms
gcube-cms-suite
- 1.0.3
+ 1.0.4-SNAPSHOT
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..18402ab 100644
--- a/geoportal-client/CHANGELOG.md
+++ b/geoportal-client/CHANGELOG.md
@@ -2,6 +2,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for org.gcube.application.geoportal-client
+## [v1.1.2-SNAPSHOT] - 2023-01-10
+- Pom updates
+
## [v1.1.1] - 2022-12-07
- Pom updates
diff --git a/geoportal-client/pom.xml b/geoportal-client/pom.xml
index c515295..13bac29 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-SNAPSHOT
Geoportal Client
org.gcube.application.cms
gcube-cms-suite
- 1.0.3
+ 1.0.4-SNAPSHOT
diff --git a/geoportal-common/CHANGELOG.md b/geoportal-common/CHANGELOG.md
index b216451..6ce5fab 100644
--- a/geoportal-common/CHANGELOG.md
+++ b/geoportal-common/CHANGELOG.md
@@ -2,6 +2,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for org.gcube.application.geoportal-common
+## [v1.0.11-SNAPSHOT] - 2023-01-10
+- Pom updates
+
## [v1.0.10] - 2022-12-07
- Pom updates
diff --git a/geoportal-common/pom.xml b/geoportal-common/pom.xml
index 5e0831c..33c1a50 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-SNAPSHOT
Geoportal Common
org.gcube.application.cms
gcube-cms-suite
- 1.0.3
+ 1.0.4-SNAPSHOT
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/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-service/CHANGELOG.md b/geoportal-service/CHANGELOG.md
index c5e8286..6bbc54c 100644
--- a/geoportal-service/CHANGELOG.md
+++ b/geoportal-service/CHANGELOG.md
@@ -2,6 +2,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for org.gcube.application.geoportal-service
+## [v1.0.12-SNAPSHOT] - 2023-01-10
+- Refactored UserUtils into framework plugin
+
## [v1.0.11] - 2022-12-07
- Pom updates
- Introduced module default-lc-managers
diff --git a/geoportal-service/pom.xml b/geoportal-service/pom.xml
index 6b03a01..cb31ec2 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.13-SNAPSHOT
Geoportal Service
war
org.gcube.application.cms
gcube-cms-suite
- 1.0.3
+ 1.0.4-SNAPSHOT
@@ -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 0ff4e5f..ea09823 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;
@@ -50,7 +51,7 @@ 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 +82,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");
@@ -821,7 +822,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 +831,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
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 7effc88..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
@@ -24,6 +24,7 @@ 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;
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 118ec4a..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
@@ -33,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
@@ -146,137 +146,16 @@ public class DummyProjectTest extends AbstractProfiledDocumentsTests{
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 11bfa66..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,11 +2,8 @@ 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;
@@ -14,17 +11,12 @@ import org.gcube.application.geoportal.common.model.document.lifecycle.Lifecycle
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;
diff --git a/images-plugin/CHANGELOG.md b/images-plugin/CHANGELOG.md
index 865c90c..c2c8a3a 100644
--- a/images-plugin/CHANGELOG.md
+++ b/images-plugin/CHANGELOG.md
@@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
This library contains gcube-cms plugins for images materializations
+## [v1.0.2-SNAPSHOT] - 2023-01-10
+- Pom updates
+
## [v1.0.1] - 2022-12-07
- Pom updates
diff --git a/images-plugin/pom.xml b/images-plugin/pom.xml
index af0ba97..b772af5 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-SNAPSHOT
gCube CMS - Images Plugins
org.gcube.application.cms
gcube-cms-suite
- 1.0.3
+ 1.0.4-SNAPSHOT
diff --git a/notifications-plugins/CHANGELOG.md b/notifications-plugins/CHANGELOG.md
index 086b04f..620aaae 100644
--- a/notifications-plugins/CHANGELOG.md
+++ b/notifications-plugins/CHANGELOG.md
@@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
This library contains gcube-cms plugins for notitfications events
+## [v1.0.2-SNAPSHOT] - 2023-01-10
+- Pom updates
+
## [v1.0.1] - 2022-12-07
- Pom updates
diff --git a/notifications-plugins/pom.xml b/notifications-plugins/pom.xml
index 8a54506..91e1c98 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-SNAPSHOT
gCube CMS - Notifications Plugins
org.gcube.application.cms
gcube-cms-suite
- 1.0.3
+ 1.0.4-SNAPSHOT
diff --git a/pom.xml b/pom.xml
index 69f7642..2aece86 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-SNAPSHOT
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
-
-
-
-
-
-
+ 2.1.0-SNAPSHOT
+ 2.2.0-SNAPSHOT
+ 3.7.0-SNAPSHOT
+ [2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)
+ 1.0.3-SNAPSHOT
diff --git a/sdi-plugins/CHANGELOG.md b/sdi-plugins/CHANGELOG.md
index 5ee7859..acee1f6 100644
--- a/sdi-plugins/CHANGELOG.md
+++ b/sdi-plugins/CHANGELOG.md
@@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
This library contains gcube-cms plugins for indexing and materializations in gCube SDI
+## [v1.0.2-SNAPSHOT] - 2023-01-10
+- Pom updates
+
## [v1.0.1] - 2022-12-07
- Pom updates
- Introduced module default-lc-managers
diff --git a/sdi-plugins/pom.xml b/sdi-plugins/pom.xml
index d0f6fe8..4073801 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-SNAPSHOT
gCube CMS - SDI Plugins
org.gcube.application.cms
gcube-cms-suite
- 1.0.3
+ 1.0.4-SNAPSHOT
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..6f75013 100644
--- a/use-cases/CHANGELOG.md
+++ b/use-cases/CHANGELOG.md
@@ -1,6 +1,11 @@
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-# Changelog for org.gcube.application.geoportal-client
+# Changelog for org.gcube.application.cms.use-cases
+
+
+
+## [v1.0.4-SNAPSHOT] - 2023-01-10
+- Pom updates
## [v1.0.3] - 2022-12-07
- Pom updates
diff --git a/use-cases/pom.xml b/use-cases/pom.xml
index 263ac22..0d5e6c8 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-SNAPSHOT
CMS Use cases
gcube-cms-suite
org.gcube.application.cms
- 1.0.3
+ 1.0.4-SNAPSHOT
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());
+ }
+ });
+
+
+ }
+
+}