Moved ImplementationProvider to framework

This commit is contained in:
Fabio Sinibaldi 2022-02-18 15:34:22 +01:00
parent 25569804ae
commit f383d1b86a
21 changed files with 174 additions and 109 deletions

View File

@ -67,5 +67,8 @@ public abstract class AbstractScopedMap<T> implements Engine<T>{
protected abstract T retrieveObject() throws ConfigurationException; protected abstract T retrieveObject() throws ConfigurationException;
protected abstract void dispose(T toDispose); protected void dispose(T toDispose){};
@Override
public void init() {}
} }

View File

@ -0,0 +1,4 @@
package org.gcube.application.cms.implementations;
public interface ISInterface {
}

View File

@ -0,0 +1,76 @@
package org.gcube.application.cms.implementations;
import lombok.Synchronized;
import org.gcube.application.cms.caches.Engine;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.service.engine.providers.*;
import java.util.concurrent.ConcurrentHashMap;
public class ImplementationProvider {
private static ImplementationProvider instance=null;
@Synchronized
public static ImplementationProvider get() {
if(instance==null) {
instance=new ImplementationProvider();
}
return instance;
}
public <T> T getEngineByClass(Class<T> clazz) throws ConfigurationException {
return (T) implementationsRegistry.get(clazz).getObject();
}
private ConcurrentHashMap<Class,Engine> implementationsRegistry=new ConcurrentHashMap<>();
public <T> void setEngine(Engine<T> engine, Class<T> clazz){
implementationsRegistry.put(clazz,engine);
}
// @Getter
// @Setter
// private MongoClientProvider mongoClientProvider=new MongoClientProvider();
//
//
// @Getter
// @Setter
// private StorageClientProvider storageProvider=new StorageClientProvider();
//
// @Getter
// @Setter
// private PostgisConnectionProvider dbProvider=new PostgisConnectionProvider();
//
// @Getter
// @Setter
// private ISProvider isProvider=new ISProvider();
//
// @Getter
// @Setter
// private ProfileMapCache profiles=new ProfileMapCache();
//
// @Getter
// @Setter
// private PluginManager pluginManager=new PluginManager();
//
// @Getter
// @Setter
// private StorageHubProvider sHubProvider=new StorageHubProvider();
//
// public void shutdown() {
// // Stop JPA
//// AbstractRecordManager.shutdown();
//
// mongoClientProvider.shutdown();
// pluginManager.shutdown();
// }
//
// public void startup() {
//// AbstractRecordManager.setDefaultProvider(emfProvider);
// pluginManager.init();
// mongoClientProvider.init();
// }
}

View File

@ -0,0 +1,4 @@
package org.gcube.application.cms.implementations;
public interface WSInterface {
}

View File

@ -1,18 +1,28 @@
package org.gcube.application.geoportal.service; package org.gcube.application.geoportal.service;
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import jdk.internal.dynalink.linker.LinkerServices;
import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.implementations.ISInterface;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.common.rest.InterfaceConstants; import org.gcube.application.geoportal.common.rest.InterfaceConstants;
import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.service.engine.postgis.PostgisDBManager;
import org.gcube.application.geoportal.service.engine.providers.*;
import org.gcube.application.geoportal.service.model.internal.db.Mongo;
import org.gcube.application.geoportal.service.rest.ConcessioniOverMongo; import org.gcube.application.geoportal.service.rest.ConcessioniOverMongo;
import org.gcube.application.geoportal.service.rest.ProfiledDocuments; import org.gcube.application.geoportal.service.rest.ProfiledDocuments;
import org.gcube.application.geoportal.service.rest.Sections; import org.gcube.application.geoportal.service.rest.Sections;
import org.gcube.application.cms.serialization.Serialization; import org.gcube.application.cms.serialization.Serialization;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.ResourceConfig;
import javax.ws.rs.ApplicationPath; import javax.ws.rs.ApplicationPath;
@ApplicationPath(InterfaceConstants.APPLICATION_PATH) @ApplicationPath(InterfaceConstants.APPLICATION_PATH)
@Slf4j
public class GeoPortalService extends ResourceConfig{ public class GeoPortalService extends ResourceConfig{
@ -25,8 +35,15 @@ public class GeoPortalService extends ResourceConfig{
registerClasses(ProfiledDocuments.class); registerClasses(ProfiledDocuments.class);
registerClasses(Sections.class); registerClasses(Sections.class);
log.info("Setting implementations .. ");
ImplementationProvider.get().setEngine(new ISProvider(),ISInterface.class);
ImplementationProvider.get().setEngine(new MongoClientProvider(), Mongo.class);
ImplementationProvider.get().setEngine(new StorageClientProvider(), StorageUtils.class);
ImplementationProvider.get().setEngine(new PostgisConnectionProvider(), PostgisDBManager.class);
ImplementationProvider.get().setEngine(new ProfileMapCache(), ProfileMapCache.ProfileMap.class);
ImplementationProvider.get().setEngine(new PluginManager(), PluginManager.PluginMap.class);
ImplementationProvider.get().setEngine(new StorageHubProvider(), StorageHubClient.class);

View File

@ -1,67 +0,0 @@
package org.gcube.application.geoportal.service.engine;
//import org.gcube.application.geoportal.managers.AbstractRecordManager;
//import org.gcube.application.geoportal.managers.EMFProvider;
import lombok.Getter;
import lombok.Setter;
import lombok.Synchronized;
import org.gcube.application.cms.plugins.Plugin;
import org.gcube.application.geoportal.service.engine.providers.*;
public class ImplementationProvider {
private static ImplementationProvider instance=null;
@Synchronized
public static ImplementationProvider get() {
if(instance==null) {
instance=new ImplementationProvider();
}
return instance;
}
@Getter
@Setter
private MongoClientProvider mongoClientProvider=new MongoClientProvider();
@Getter
@Setter
private StorageClientProvider storageProvider=new StorageClientProvider();
@Getter
@Setter
private PostgisConnectionProvider dbProvider=new PostgisConnectionProvider();
@Getter
@Setter
private ISProvider isProvider=new ISProvider();
@Getter
@Setter
private ProfileMapCache profiles=new ProfileMapCache();
@Getter
@Setter
private PluginManager pluginManager=new PluginManager();
@Getter
@Setter
private StorageHubProvider sHubProvider=new StorageHubProvider();
// public void shutdown() {
// // Stop JPA
//// AbstractRecordManager.shutdown();
//
// mongoClientProvider.shutdown();
// pluginManager.shutdown();
// }
//
// public void startup() {
//// AbstractRecordManager.setDefaultProvider(emfProvider);
// pluginManager.init();
// mongoClientProvider.init();
// }
}

View File

@ -2,6 +2,7 @@ package org.gcube.application.geoportal.service.engine;
import lombok.*; import lombok.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFile; import org.gcube.application.geoportal.common.model.document.filesets.RegisteredFile;
import org.gcube.application.geoportal.common.model.legacy.WorkspaceContent; import org.gcube.application.geoportal.common.model.legacy.WorkspaceContent;
import org.gcube.application.geoportal.common.utils.Files; import org.gcube.application.geoportal.common.utils.Files;

View File

@ -17,7 +17,7 @@ import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.common.model.rest.TempFile; import org.gcube.application.geoportal.common.model.rest.TempFile;
import org.gcube.application.geoportal.common.utils.Files; import org.gcube.application.geoportal.common.utils.Files;
import org.gcube.application.geoportal.common.utils.StorageUtils; import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.service.engine.ImplementationProvider; import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.service.engine.materialization.SDIManager; import org.gcube.application.geoportal.service.engine.materialization.SDIManager;
import org.gcube.application.geoportal.service.engine.WorkspaceManager; import org.gcube.application.geoportal.service.engine.WorkspaceManager;
import org.gcube.application.geoportal.service.engine.WorkspaceManager.FileOptions; import org.gcube.application.geoportal.service.engine.WorkspaceManager.FileOptions;

View File

@ -11,7 +11,7 @@ import lombok.extern.slf4j.Slf4j;
import org.bson.Document; import org.bson.Document;
import org.bson.types.ObjectId; import org.bson.types.ObjectId;
import org.gcube.application.geoportal.common.model.rest.QueryRequest; import org.gcube.application.geoportal.common.model.rest.QueryRequest;
import org.gcube.application.geoportal.service.engine.ImplementationProvider; import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.service.model.internal.db.Mongo; import org.gcube.application.geoportal.service.model.internal.db.Mongo;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException; import org.gcube.application.geoportal.common.model.rest.ConfigurationException;

View File

@ -1,7 +1,6 @@
package org.gcube.application.geoportal.service.engine.mongo; package org.gcube.application.geoportal.service.engine.mongo;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.jayway.jsonpath.JsonPath;
import com.mongodb.client.MongoDatabase; import com.mongodb.client.MongoDatabase;
import com.vdurmont.semver4j.Semver; import com.vdurmont.semver4j.Semver;
import lombok.Getter; import lombok.Getter;
@ -14,8 +13,6 @@ import org.gcube.application.cms.plugins.faults.EventException;
import org.gcube.application.cms.plugins.faults.StepException; import org.gcube.application.cms.plugins.faults.StepException;
import org.gcube.application.cms.plugins.model.PluginDescriptor; import org.gcube.application.cms.plugins.model.PluginDescriptor;
import org.gcube.application.cms.plugins.reports.DocumentHandlingReport; import org.gcube.application.cms.plugins.reports.DocumentHandlingReport;
import org.gcube.application.cms.plugins.reports.EventExecutionReport;
import org.gcube.application.cms.plugins.reports.Report;
import org.gcube.application.cms.plugins.reports.StepExecutionReport; import org.gcube.application.cms.plugins.reports.StepExecutionReport;
import org.gcube.application.cms.plugins.requests.EventExecutionRequest; import org.gcube.application.cms.plugins.requests.EventExecutionRequest;
import org.gcube.application.cms.plugins.requests.StepExecutionRequest; import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
@ -38,7 +35,7 @@ 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.rest.TempFile;
import org.gcube.application.geoportal.common.model.JSONPathWrapper; import org.gcube.application.geoportal.common.model.JSONPathWrapper;
import org.gcube.application.geoportal.common.utils.StorageUtils; import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.service.engine.ImplementationProvider; import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.service.engine.WorkspaceManager; import org.gcube.application.geoportal.service.engine.WorkspaceManager;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException; import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.service.model.internal.faults.DeletionException; import org.gcube.application.geoportal.service.model.internal.faults.DeletionException;
@ -57,7 +54,6 @@ import java.util.*;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.function.Consumer; import java.util.function.Consumer;
import static org.gcube.application.cms.plugins.reports.Report.*;
import static org.gcube.application.cms.serialization.Serialization.*; import static org.gcube.application.cms.serialization.Serialization.*;
@Slf4j @Slf4j

View File

@ -2,12 +2,14 @@ package org.gcube.application.geoportal.service.engine.postgis;
import lombok.Synchronized; import lombok.Synchronized;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.implementations.ISInterface;
import org.gcube.application.geoportal.common.model.legacy.BBOX; import org.gcube.application.geoportal.common.model.legacy.BBOX;
import org.gcube.application.geoportal.common.model.rest.DatabaseConnection; import org.gcube.application.geoportal.common.model.rest.DatabaseConnection;
import org.gcube.application.geoportal.service.engine.ImplementationProvider; import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.service.model.internal.db.PostgisTable; import org.gcube.application.geoportal.service.model.internal.db.PostgisTable;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException; import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.service.model.internal.faults.DataParsingException; import org.gcube.application.geoportal.service.model.internal.faults.DataParsingException;
import org.gcube.application.geoportal.service.utils.ISUtils;
import java.sql.*; import java.sql.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -23,7 +25,8 @@ public class PostgisDBManager implements PostgisDBManagerI {
// TODO GENERIC // TODO GENERIC
DatabaseConnection defaultConfiguration= DatabaseConnection defaultConfiguration=
ImplementationProvider.get().getIsProvider().getIS().queryForDB("postgis", "Concessioni"); ((ISUtils)ImplementationProvider.get().getEngineByClass(ISInterface.class))
.queryForDB("postgis", "Concessioni");
log.debug("Found configuration : "+defaultConfiguration); log.debug("Found configuration : "+defaultConfiguration);
config=defaultConfiguration; config=defaultConfiguration;

View File

@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import org.gcube.application.geoportal.common.model.legacy.Concessione; import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.rest.DatabaseConnection; import org.gcube.application.geoportal.common.model.rest.DatabaseConnection;
import org.gcube.application.geoportal.common.model.rest.PostgisIndexDescriptor; import org.gcube.application.geoportal.common.model.rest.PostgisIndexDescriptor;
import org.gcube.application.geoportal.service.engine.ImplementationProvider; import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.service.engine.materialization.SDIManager; import org.gcube.application.geoportal.service.engine.materialization.SDIManager;
import org.gcube.application.geoportal.service.model.internal.db.DBConstants; import org.gcube.application.geoportal.service.model.internal.db.DBConstants;
import org.gcube.application.geoportal.service.model.internal.db.PostgisTable; import org.gcube.application.geoportal.service.model.internal.db.PostgisTable;
@ -39,7 +39,7 @@ public class PostgisIndex {
private SDIManager sdiManager; private SDIManager sdiManager;
private String wmsLink=null; private String wmsLink=null;
private static PostgisDBManager getDB() throws ConfigurationException { private static PostgisDBManager getDB() throws ConfigurationException {
return ImplementationProvider.get().getDbProvider().getObject(); return ImplementationProvider.get().getEngineByClass(PostgisDBManager.class);
}; };
public PostgisIndex() throws SDIInteractionException, SQLException, ConfigurationException { public PostgisIndex() throws SDIInteractionException, SQLException, ConfigurationException {
@ -60,7 +60,7 @@ public class PostgisIndex {
public String init() throws SQLException, ConfigurationException, SDIInteractionException { public String init() throws SQLException, ConfigurationException, SDIInteractionException {
log.debug("Contacting postgis DB .. "); log.debug("Contacting postgis DB .. ");
PostgisDBManagerI db=ImplementationProvider.get().getDbProvider().getObject(); PostgisDBManagerI db=getDB();
log.debug("Checking if centroids table exists.."); log.debug("Checking if centroids table exists..");
PostgisTable table=getCentroidsTable(); PostgisTable table=getCentroidsTable();
db.create(table); db.create(table);
@ -77,7 +77,7 @@ public class PostgisIndex {
Map<String,String> centroidRow=evaluateCentroid(record); Map<String,String> centroidRow=evaluateCentroid(record);
log.debug("Contacting postgis DB .. "); log.debug("Contacting postgis DB .. ");
PostgisDBManagerI db=ImplementationProvider.get().getDbProvider().getObject(); PostgisDBManagerI db=getDB();
PostgisTable centroidsTable=getCentroidsTable(); PostgisTable centroidsTable=getCentroidsTable();
log.debug("Inserting / updated centroid Row {} ",centroidRow); log.debug("Inserting / updated centroid Row {} ",centroidRow);
@ -107,7 +107,7 @@ public class PostgisIndex {
public void removeCentroid(Concessione record) { public void removeCentroid(Concessione record) {
try { try {
PostgisDBManagerI db=ImplementationProvider.get().getDbProvider().getObject(); PostgisDBManagerI db=getDB();
PostgisTable centroidsTable=getCentroidsTable(); PostgisTable centroidsTable=getCentroidsTable();
log.debug("Deleting centroid if present. ID is "+record.getMongo_id()); log.debug("Deleting centroid if present. ID is "+record.getMongo_id());
int result= db.deleteByFieldValue(centroidsTable, new Field(DBConstants.Concessioni.PRODUCT_ID,FieldType.TEXT), record.getMongo_id()); int result= db.deleteByFieldValue(centroidsTable, new Field(DBConstants.Concessioni.PRODUCT_ID,FieldType.TEXT), record.getMongo_id());

View File

@ -1,10 +1,25 @@
package org.gcube.application.geoportal.service.engine.providers; package org.gcube.application.geoportal.service.engine.providers;
import org.gcube.application.cms.caches.Engine;
import org.gcube.application.cms.implementations.ISInterface;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.service.utils.ISUtils; import org.gcube.application.geoportal.service.utils.ISUtils;
public class ISProvider { public class ISProvider implements Engine<ISInterface> {
public ISUtils getIS(){
@Override
public void init() { }
@Override
public void shutdown() {}
@Override
public ISInterface getObject() throws ConfigurationException {
return new ISUtils(); return new ISUtils();
} }
} }

View File

@ -2,11 +2,13 @@ package org.gcube.application.geoportal.service.engine.providers;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.caches.AbstractScopedMap; import org.gcube.application.cms.caches.AbstractScopedMap;
import org.gcube.application.cms.implementations.ISInterface;
import org.gcube.application.geoportal.service.ServiceConstants; import org.gcube.application.geoportal.service.ServiceConstants;
import org.gcube.application.geoportal.service.engine.ImplementationProvider; import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.service.model.internal.db.Mongo; import org.gcube.application.geoportal.service.model.internal.db.Mongo;
import org.gcube.application.geoportal.service.model.internal.db.MongoConnection; import org.gcube.application.geoportal.service.model.internal.db.MongoConnection;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException; import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.gcube.application.geoportal.service.utils.ISUtils;
@Slf4j @Slf4j
public class MongoClientProvider extends AbstractScopedMap<Mongo> { public class MongoClientProvider extends AbstractScopedMap<Mongo> {
@ -19,8 +21,9 @@ public class MongoClientProvider extends AbstractScopedMap<Mongo> {
@Override @Override
protected Mongo retrieveObject() throws ConfigurationException { protected Mongo retrieveObject() throws ConfigurationException {
MongoConnection conn=ImplementationProvider.get(). MongoConnection conn=((ISUtils)ImplementationProvider.get().
getIsProvider().getIS().queryForMongoDB( getEngineByClass(ISInterface.class)).
queryForMongoDB(
ServiceConstants.MONGO_SE_PLATFORM, ServiceConstants.MONGO_SE_GNA_FLAG); ServiceConstants.MONGO_SE_PLATFORM, ServiceConstants.MONGO_SE_GNA_FLAG);
log.debug("Connecting to "+conn); log.debug("Connecting to "+conn);

View File

@ -1,5 +1,7 @@
package org.gcube.application.geoportal.service.engine.providers; package org.gcube.application.geoportal.service.engine.providers;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.caches.AbstractScopedMap; import org.gcube.application.cms.caches.AbstractScopedMap;
import org.gcube.application.cms.plugins.InitializablePlugin; import org.gcube.application.cms.plugins.InitializablePlugin;
@ -9,6 +11,7 @@ import org.gcube.application.cms.plugins.PluginManagerInterface;
import org.gcube.application.cms.plugins.faults.InitializationException; import org.gcube.application.cms.plugins.faults.InitializationException;
import org.gcube.application.cms.plugins.faults.ShutDownException; import org.gcube.application.cms.plugins.faults.ShutDownException;
import org.gcube.application.cms.plugins.reports.InitializationReport; import org.gcube.application.cms.plugins.reports.InitializationReport;
import org.gcube.application.geoportal.common.model.profile.Profile;
import org.gcube.application.geoportal.common.utils.ContextUtils; import org.gcube.application.geoportal.common.utils.ContextUtils;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException; import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
@ -20,9 +23,13 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Slf4j @Slf4j
public class PluginManager extends AbstractScopedMap<Map<String, Plugin>> implements PluginManagerInterface { public class PluginManager extends AbstractScopedMap<PluginManager.PluginMap> implements PluginManagerInterface {
Map<String,Plugin> implementations=new HashMap<>();
public static class PluginMap extends HashMap<String,Plugin>{
}
PluginMap implementations=new PluginMap();
public PluginManager(){ public PluginManager(){
@ -70,7 +77,7 @@ public class PluginManager extends AbstractScopedMap<Map<String, Plugin>> implem
@Override @Override
protected Map<String, Plugin> retrieveObject() throws ConfigurationException { protected PluginMap retrieveObject() throws ConfigurationException {
// Init plugins // Init plugins
implementations.forEach((id,p)->{ implementations.forEach((id,p)->{
if(p instanceof InitializablePlugin){ if(p instanceof InitializablePlugin){
@ -89,7 +96,7 @@ public class PluginManager extends AbstractScopedMap<Map<String, Plugin>> implem
} }
@Override @Override
protected void dispose(Map<String, Plugin> toDispose) { protected void dispose(PluginMap toDispose) {
// ShutDown plugins // ShutDown plugins
implementations.forEach((id,p)->{ implementations.forEach((id,p)->{
if(p instanceof InitializablePlugin){ if(p instanceof InitializablePlugin){

View File

@ -1,6 +1,8 @@
package org.gcube.application.geoportal.service.engine.providers; package org.gcube.application.geoportal.service.engine.providers;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.gcube.application.cms.caches.AbstractScopedMap; import org.gcube.application.cms.caches.AbstractScopedMap;
import org.gcube.application.geoportal.common.model.profile.Profile; import org.gcube.application.geoportal.common.model.profile.Profile;
@ -14,7 +16,13 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Slf4j @Slf4j
public class ProfileMapCache extends AbstractScopedMap<Map<String,Profile>> { public class ProfileMapCache extends AbstractScopedMap<ProfileMapCache.ProfileMap> {
@AllArgsConstructor
public static class ProfileMap {
@Getter
Map<String,Profile> profileMap=new HashMap<>();
}
public ProfileMapCache() { public ProfileMapCache() {
super("Profiles CACHE"); super("Profiles CACHE");
@ -27,12 +35,12 @@ public class ProfileMapCache extends AbstractScopedMap<Map<String,Profile>> {
} }
@Override @Override
protected void dispose(Map<String, Profile> toDispose) { protected void dispose(ProfileMap toDispose) {
} }
@Override @Override
protected Map<String, Profile> retrieveObject() throws ConfigurationException { protected ProfileMap retrieveObject() throws ConfigurationException {
// Load from resources // Load from resources
@ -50,7 +58,7 @@ public class ProfileMapCache extends AbstractScopedMap<Map<String,Profile>> {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
return toReturn; return new ProfileMap(toReturn);
} }

View File

@ -13,14 +13,8 @@ public class StorageHubProvider implements Engine<StorageHubClient> {
} }
@Override @Override
public void init() { public void init() {}
// TODO Auto-generated method stub
}
@Override @Override
public void shutdown() { public void shutdown() { }
// TODO Auto-generated method stub
}
} }

View File

@ -1,5 +1,6 @@
package org.gcube.application.geoportal.service.utils; package org.gcube.application.geoportal.service.utils;
import org.gcube.application.cms.implementations.ISInterface;
import org.gcube.application.geoportal.common.model.rest.DatabaseConnection; import org.gcube.application.geoportal.common.model.rest.DatabaseConnection;
import org.gcube.application.geoportal.service.ServiceConstants; import org.gcube.application.geoportal.service.ServiceConstants;
import org.gcube.application.geoportal.service.model.internal.db.MongoConnection; import org.gcube.application.geoportal.service.model.internal.db.MongoConnection;
@ -17,7 +18,7 @@ import java.util.Map;
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor; import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor; import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
public class ISUtils { public class ISUtils implements ISInterface {
public DatabaseConnection queryForDB(String platform, String flag) throws ConfigurationException { public DatabaseConnection queryForDB(String platform, String flag) throws ConfigurationException {
return ISUtils.performQueryForDB(platform,flag); return ISUtils.performQueryForDB(platform,flag);

View File

@ -7,7 +7,7 @@ import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Projections; import com.mongodb.client.model.Projections;
import org.bson.Document; import org.bson.Document;
import org.gcube.application.cms.tests.TokenSetter; import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.service.engine.ImplementationProvider; import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.service.engine.mongo.MongoManager; import org.gcube.application.geoportal.service.engine.mongo.MongoManager;
import org.gcube.application.geoportal.service.engine.providers.MongoClientProvider; import org.gcube.application.geoportal.service.engine.providers.MongoClientProvider;
import org.gcube.application.geoportal.service.model.internal.db.Mongo; import org.gcube.application.geoportal.service.model.internal.db.Mongo;

View File

@ -2,7 +2,7 @@ package org.gcube.application.geoportal.service;
import org.gcube.application.cms.tests.TokenSetter; import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.geoportal.common.utils.StorageUtils; import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.service.engine.ImplementationProvider; import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.service.engine.providers.StorageClientProvider; import org.gcube.application.geoportal.service.engine.providers.StorageClientProvider;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException; import org.gcube.application.geoportal.common.model.rest.ConfigurationException;

View File

@ -7,7 +7,7 @@ import org.gcube.application.cms.tests.TokenSetter;
import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel; import org.gcube.application.cms.tests.model.concessioni.TestConcessioniModel;
import org.gcube.application.geoportal.common.utils.StorageUtils; import org.gcube.application.geoportal.common.utils.StorageUtils;
import org.gcube.application.geoportal.service.BasicServiceTestUnit; import org.gcube.application.geoportal.service.BasicServiceTestUnit;
import org.gcube.application.geoportal.service.engine.ImplementationProvider; import org.gcube.application.cms.implementations.ImplementationProvider;
import org.gcube.application.geoportal.service.engine.mongo.ConcessioniMongoManager; import org.gcube.application.geoportal.service.engine.mongo.ConcessioniMongoManager;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException; import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
import org.junit.Test; import org.junit.Test;