Merged from patches
This commit is contained in:
parent
f1b7790cda
commit
4d52bf7123
|
@ -8,6 +8,7 @@ import org.gcube.application.geoportal.common.rest.InterfaceConstants;
|
|||
import org.gcube.application.geoportal.common.utils.StorageUtils;
|
||||
import org.gcube.application.geoportal.service.engine.mongo.UCDManagerI;
|
||||
import org.gcube.application.geoportal.service.engine.postgis.PostgisDBManager;
|
||||
import org.gcube.application.geoportal.service.engine.postgis.PostgisDBManagerI;
|
||||
import org.gcube.application.geoportal.service.engine.providers.*;
|
||||
import org.gcube.application.geoportal.service.engine.providers.ucd.ProfileMap;
|
||||
import org.gcube.application.geoportal.service.engine.providers.ucd.LocalFolderProfileMapCache;
|
||||
|
@ -50,7 +51,7 @@ public class GeoPortalService extends ResourceConfig{
|
|||
|
||||
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 PostgisConnectionProvider(), PostgisDBManagerI.class);
|
||||
ImplementationProvider.get().setEngine(new SingleISResourceUCDProvider(), ProfileMap.class);
|
||||
ImplementationProvider.get().setEngine(new PluginManager(), PluginManager.PluginMap.class);
|
||||
ImplementationProvider.get().setEngine(new StorageHubProvider(), StorageHubClient.class);
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package org.gcube.application.geoportal.service.engine.postgis;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.gcube.application.cms.implementations.ImplementationProvider;
|
||||
import org.gcube.application.cms.serialization.Serialization;
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
|
||||
import org.gcube.application.geoportal.common.model.rest.DatabaseConnection;
|
||||
import org.gcube.application.geoportal.common.model.rest.PostgisIndexDescriptor;
|
||||
import org.gcube.application.geoportal.service.engine.ImplementationProvider;
|
||||
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.PostgisTable;
|
||||
import org.gcube.application.geoportal.service.model.internal.db.PostgisTable.Field;
|
||||
import org.gcube.application.geoportal.service.model.internal.db.PostgisTable.FieldType;
|
||||
import org.gcube.application.geoportal.service.model.internal.faults.ConfigurationException;
|
||||
import org.gcube.application.geoportal.service.model.internal.faults.PublishException;
|
||||
import org.gcube.application.geoportal.service.model.internal.faults.SDIInteractionException;
|
||||
import org.gcube.application.geoportal.service.utils.Serialization;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
@ -39,7 +39,7 @@ public class PostgisIndex {
|
|||
private SDIManager sdiManager;
|
||||
private String wmsLink=null;
|
||||
private static PostgisDBManagerI getDB() throws ConfigurationException {
|
||||
return ImplementationProvider.get().getDbProvider().getObject();
|
||||
return ImplementationProvider.get().getProvidedObjectByClass(PostgisDBManagerI.class);
|
||||
};
|
||||
|
||||
public PostgisIndex() throws SDIInteractionException, SQLException, ConfigurationException {
|
||||
|
@ -60,7 +60,7 @@ public class PostgisIndex {
|
|||
|
||||
public String init() throws SQLException, ConfigurationException, SDIInteractionException {
|
||||
log.debug("Contacting postgis DB .. ");
|
||||
PostgisDBManagerI db=ImplementationProvider.get().getDbProvider().getObject();
|
||||
PostgisDBManagerI db=ImplementationProvider.get().getProvidedObjectByClass(PostgisDBManagerI.class);
|
||||
log.debug("Checking if centroids table exists..");
|
||||
PostgisTable table=getCentroidsTable();
|
||||
db.create(table);
|
||||
|
@ -77,7 +77,7 @@ public class PostgisIndex {
|
|||
Map<String,String> centroidRow=evaluateCentroid(record);
|
||||
|
||||
log.debug("Contacting postgis DB .. ");
|
||||
PostgisDBManagerI db=ImplementationProvider.get().getDbProvider().getObject();
|
||||
PostgisDBManagerI db=ImplementationProvider.get().getProvidedObjectByClass(PostgisDBManagerI.class);
|
||||
|
||||
PostgisTable centroidsTable=getCentroidsTable();
|
||||
log.debug("Inserting / updated centroid Row {} ",centroidRow);
|
||||
|
@ -107,7 +107,7 @@ public class PostgisIndex {
|
|||
|
||||
public void removeCentroid(Concessione record) {
|
||||
try {
|
||||
PostgisDBManagerI db=ImplementationProvider.get().getDbProvider().getObject();
|
||||
PostgisDBManagerI db=ImplementationProvider.get().getProvidedObjectByClass(PostgisDBManagerI.class);
|
||||
PostgisTable centroidsTable=getCentroidsTable();
|
||||
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());
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package org.gcube.application.geoportal.service.engine.providers;
|
||||
|
||||
import org.gcube.application.cms.caches.AbstractScopedMap;
|
||||
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
|
||||
import org.gcube.application.geoportal.service.engine.postgis.PostgisDBManager;
|
||||
import org.gcube.application.geoportal.service.engine.postgis.PostgisDBManagerI;
|
||||
import org.gcube.application.geoportal.service.model.internal.faults.ConfigurationException;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.time.Duration;
|
||||
|
@ -17,7 +18,7 @@ public class PostgisConnectionProvider extends AbstractScopedMap<PostgisDBManage
|
|||
}
|
||||
|
||||
@Override
|
||||
protected PostgisDBManagerI retrieveObject() throws ConfigurationException {
|
||||
protected PostgisDBManagerI retrieveObject(String key) throws ConfigurationException {
|
||||
try {
|
||||
return PostgisDBManager.get();
|
||||
} catch (SQLException throwables) {
|
||||
|
|
Loading…
Reference in New Issue