From e3960d3d7e348924e22728bb4e1d63fc86bc330d Mon Sep 17 00:00:00 2001 From: Fabio Sinibaldi Date: Tue, 6 Dec 2022 17:55:49 +0100 Subject: [PATCH] Fixes #24235 --- .../cms/sdi/engine/SDIManagerWrapper.java | 16 ++++++++++++---- .../cms/sdi/plugins/SDIMaterializerPlugin.java | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/sdi-plugins/src/main/java/org/gcube/application/cms/sdi/engine/SDIManagerWrapper.java b/sdi-plugins/src/main/java/org/gcube/application/cms/sdi/engine/SDIManagerWrapper.java index 6a483d3..6d1f69f 100644 --- a/sdi-plugins/src/main/java/org/gcube/application/cms/sdi/engine/SDIManagerWrapper.java +++ b/sdi-plugins/src/main/java/org/gcube/application/cms/sdi/engine/SDIManagerWrapper.java @@ -21,7 +21,9 @@ import org.gcube.application.geoportal.common.model.document.filesets.sdi.GeoSer import org.gcube.application.geoportal.common.model.document.filesets.sdi.PlatformInfo; import org.gcube.application.geoportal.common.model.rest.DatabaseConnection; import org.gcube.application.geoportal.common.utils.Files; +import org.gcube.data.transfer.library.DataTransferClient; import org.gcube.data.transfer.library.TransferResult; +import org.gcube.data.transfer.library.client.Client; import org.gcube.data.transfer.library.faults.*; import org.gcube.data.transfer.model.Destination; import org.gcube.data.transfer.model.DestinationClashPolicy; @@ -259,9 +261,15 @@ public class SDIManagerWrapper extends SDIManager{ // remove actual files data // TODO REMOVE HARDCODED PATCH - String path=gsInfo.getPersistencePath().replace("/srv/geoserver_data","geoserver"); - log.info("Deleting files at {} [{}]",path,gsInfo.getPersistencePath()); - getDtGeoServer().getWebClient().delete(path); + String path="geoserver/"+gsInfo.getPersistencePath(); + log.info("Deleting files at {}@{}",path,getGeoserverHostName()); + try{ + Client dtClient = new Client("https://"+getGeoserverHostName()); + dtClient.delete(path); +// getDtGeoServer().getWebClient().delete("geoserver/"+path); + }catch(Exception e){ + throw new Exception("Data Transfer ERROR. Unable to delete files at "+getGeoserverHostName()+" PATH "+path,e); + } break; } @@ -273,7 +281,7 @@ public class SDIManagerWrapper extends SDIManager{ }catch(SDIInteractionException e){ throw e; }catch (Throwable t){ - throw new SDIInteractionException("Unexpected exception while trying to materialize File Set "+t.getMessage(),t); + throw new SDIInteractionException("Unexpected exception while trying to delete Layer : "+t.getMessage(),t); } } 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 af801c7..fede17c 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 @@ -196,7 +196,7 @@ public class SDIMaterializerPlugin extends AbstractPlugin implements Materializa } // Resetting Document - report.setResultingDocument(Serialization.asDocument(wrapper.getValueCTX().jsonString())); + report.setResultingDocument(Document.parse(wrapper.getValueCTX().jsonString())); }catch (SDIInteractionException e){ log.error("Unable to materialize "+request,e); report.setStatus(Report.Status.ERROR);