From 08931aed39e6348d7ecfb5190876ef785cef8840 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Thu, 5 May 2016 16:54:15 +0000 Subject: [PATCH] 2521: Explore the possibility to port the StatMan interface onto Dataminer https://support.d4science.org/issues/2521 Added Properties visualization git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@128483 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../computations/ComputationsPanel.java | 24 +++- .../computations/ComputationsProperties.java | 42 ++++++ .../custom/progress/GreenProgressBar.css | 10 ++ .../client/custom/progress/RedProgressBar.css | 10 ++ .../client/dataspace/DataSpaceProperties.java | 40 ++++++ .../client/dataspace/InputDataSetsPanel.java | 19 ++- .../client/dataspace/OutputDataSetsPanel.java | 45 ++++--- .../parametersfield/TabularListFld.java | 5 +- .../server/smservice/SClient4WPS.java | 125 +++++++++--------- .../smservice/wps/ProcessInformations.java | 6 + .../server/storage/StorageUtil.java | 36 ++++- 11 files changed, 279 insertions(+), 83 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/dataminermanager/client/computations/ComputationsProperties.java create mode 100644 src/main/java/org/gcube/portlets/user/dataminermanager/client/dataspace/DataSpaceProperties.java diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/computations/ComputationsPanel.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/computations/ComputationsPanel.java index 614f2da..e8b0838 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/computations/ComputationsPanel.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/computations/ComputationsPanel.java @@ -1,5 +1,10 @@ package org.gcube.portlets.user.dataminermanager.client.computations; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider; import org.gcube.portlets.user.dataminermanager.client.events.DataMinerWorkAreaEvent; import org.gcube.portlets.user.dataminermanager.client.events.DeleteItemRequestEvent; @@ -16,6 +21,7 @@ import org.gcube.portlets.widgets.workspaceuploader.client.uploader.DialogUpload import org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload; import org.gcube.portlets.widgets.wsexplorer.client.explore.WorkspaceResourcesExplorerPanel; import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener; +import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria; import org.gcube.portlets.widgets.wsexplorer.shared.Item; import com.allen_sauer.gwt.log.client.Log; @@ -178,10 +184,24 @@ public class ComputationsPanel extends FramedPanel { return; } - + + List showProperties = new ArrayList(); + showProperties.add(ComputationsProperties.COMPUTATION_ID.getLabel()); + showProperties.add(ComputationsProperties.OPERATOR_NAME.getLabel()); + //showProperties.add(ComputationsProperties.OPERATOR_DESCRIPTION.getLabel()); + showProperties.add(ComputationsProperties.START_DATE.getLabel()); + showProperties.add(ComputationsProperties.END_DATE.getLabel()); + showProperties.add(ComputationsProperties.STATUS.getLabel()); + showProperties.add(ComputationsProperties.VRE.getLabel()); + //showProperties.add(ComputationsProperties.EXECUTION_TYPE.getLabel()); + + FilterCriteria filterCriteria = new FilterCriteria(); + Map map = new HashMap(); + filterCriteria.setRequiredProperties(map); + wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanel( event.getDataMinerWorkArea().getComputations().getFolder() - .getId(), false); + .getId(), false, showProperties, filterCriteria); WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() { @Override public void onSelectedItem(Item item) { diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/computations/ComputationsProperties.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/computations/ComputationsProperties.java new file mode 100644 index 0000000..5f17fd5 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/computations/ComputationsProperties.java @@ -0,0 +1,42 @@ +package org.gcube.portlets.user.dataminermanager.client.computations; + +/** + * + * @author Giancarlo Panichi + * email: g.panichi@isti.cnr.it + * + */ +public enum ComputationsProperties { + OPERATOR_DESCRIPTION("operator_description"), OPERATOR_NAME( + "operator_name:"), END_DATE("end_date"), ERROR("error"), COMPUTATION_ID( + "computation_id"), STATUS("status"), VRE("VRE"), EXECUTION_TYPE( + "execution_type"), START_DATE("start_date"); + + /** + * @param text + */ + private ComputationsProperties(final String id) { + this.id = id; + } + + private final String id; + + @Override + public String toString() { + return id; + } + + public String getLabel() { + return id; + } + + public static ComputationsProperties getFromId(String id) { + for (ComputationsProperties prop : values()) { + if (prop.id.compareToIgnoreCase(id) == 0) { + return prop; + } + } + return null; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/custom/progress/GreenProgressBar.css b/src/main/java/org/gcube/portlets/user/dataminermanager/client/custom/progress/GreenProgressBar.css index 5934b15..1e27d40 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/custom/progress/GreenProgressBar.css +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/custom/progress/GreenProgressBar.css @@ -3,12 +3,14 @@ */ .progressWrapGreen { border: 1px solid #65cf81; + overflow: hidden; } @sprite .progressInnerGreen { background-color: #e0f3e5; gwt-image: 'innerBarGreen'; height: auto; + position: relative; } @sprite .progressBarGreen { @@ -37,4 +39,12 @@ .progressTextBackGreen { color: #399544 !important; z-index: 9 !important; +} + +@if user.agent ie6 ie8 ie9 { + .progressTextBackGreen { + line-height: 15px; + color: #953941 !important; + z-index: 9 !important; + } } \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/custom/progress/RedProgressBar.css b/src/main/java/org/gcube/portlets/user/dataminermanager/client/custom/progress/RedProgressBar.css index fd36b70..306668e 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/custom/progress/RedProgressBar.css +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/custom/progress/RedProgressBar.css @@ -3,12 +3,14 @@ */ .progressWrapRed { border: 1px solid #cf656f; + overflow: hidden; } @sprite .progressInnerRed { background-color: #f3e0e2; gwt-image: 'innerBarRed'; height: auto; + position: relative; } @sprite .progressBarRed { @@ -37,4 +39,12 @@ .progressTextBackRed { color: #953941 !important; z-index: 9 !important; +} + +@if user.agent ie6 ie8 ie9 { + .progressTextBackRed { + line-height: 15px; + color: #953941 !important; + z-index: 9 !important; + } } \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/dataspace/DataSpaceProperties.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/dataspace/DataSpaceProperties.java new file mode 100644 index 0000000..5ae01e2 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/dataspace/DataSpaceProperties.java @@ -0,0 +1,40 @@ +package org.gcube.portlets.user.dataminermanager.client.dataspace; + +/** + * + * @author Giancarlo Panichi email: g.panichi@isti.cnr.it + * + */ +public enum DataSpaceProperties { + COMPUTATION_ID("computation_id"), DATA_ID("data_id"), DATA_TYPE("data_type"), OPERATOR_NAME( + "operator_name"), VRE("VRE"); + + /** + * @param text + */ + private DataSpaceProperties(final String id) { + this.id = id; + } + + private final String id; + + @Override + public String toString() { + return id; + } + + public String getLabel() { + return id; + } + + public static DataSpaceProperties getFromId(String id) { + for (DataSpaceProperties prop : values()) { + if (prop.id.compareToIgnoreCase(id) == 0) { + return prop; + } + } + return null; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/dataspace/InputDataSetsPanel.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/dataspace/InputDataSetsPanel.java index a0bef3a..23c6517 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/dataspace/InputDataSetsPanel.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/dataspace/InputDataSetsPanel.java @@ -1,5 +1,10 @@ package org.gcube.portlets.user.dataminermanager.client.dataspace; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider; import org.gcube.portlets.user.dataminermanager.client.events.DataMinerWorkAreaEvent; import org.gcube.portlets.user.dataminermanager.client.events.DeleteItemRequestEvent; @@ -16,6 +21,7 @@ import org.gcube.portlets.widgets.workspaceuploader.client.uploader.DialogUpload import org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload; import org.gcube.portlets.widgets.wsexplorer.client.explore.WorkspaceResourcesExplorerPanel; import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener; +import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria; import org.gcube.portlets.widgets.wsexplorer.shared.Item; import com.allen_sauer.gwt.log.client.Log; @@ -49,6 +55,7 @@ public class InputDataSetsPanel extends ContentPanel { private TextButton btnDelete; private TextButton btnRefresh; private VerticalLayoutContainer v; + public InputDataSetsPanel() { super(); @@ -177,9 +184,19 @@ public class InputDataSetsPanel extends ContentPanel { } + List showProperties = new ArrayList(); + showProperties.add(DataSpaceProperties.COMPUTATION_ID.getLabel()); + showProperties.add(DataSpaceProperties.DATA_ID.getLabel()); + showProperties.add(DataSpaceProperties.DATA_TYPE.getLabel()); + showProperties.add(DataSpaceProperties.OPERATOR_NAME.getLabel()); + showProperties.add(DataSpaceProperties.VRE.getLabel()); + FilterCriteria filterCriteria = new FilterCriteria(); + Map map = new HashMap(); + filterCriteria.setRequiredProperties(map); + wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanel( event.getDataMinerWorkArea().getInputDataSets().getFolder() - .getId(), false); + .getId(), false, showProperties, filterCriteria); WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() { @Override public void onSelectedItem(Item item) { diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/dataspace/OutputDataSetsPanel.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/dataspace/OutputDataSetsPanel.java index 4c081c6..d81b965 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/dataspace/OutputDataSetsPanel.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/dataspace/OutputDataSetsPanel.java @@ -1,5 +1,10 @@ package org.gcube.portlets.user.dataminermanager.client.dataspace; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider; import org.gcube.portlets.user.dataminermanager.client.events.DataMinerWorkAreaEvent; import org.gcube.portlets.user.dataminermanager.client.events.DeleteItemRequestEvent; @@ -16,6 +21,7 @@ import org.gcube.portlets.widgets.workspaceuploader.client.uploader.DialogUpload import org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload; import org.gcube.portlets.widgets.wsexplorer.client.explore.WorkspaceResourcesExplorerPanel; import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener; +import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria; import org.gcube.portlets.widgets.wsexplorer.shared.Item; import com.allen_sauer.gwt.log.client.Log; @@ -94,21 +100,20 @@ public class OutputDataSetsPanel extends ContentPanel { } }); - + EventBusProvider.INSTANCE - .addHandler( - RefreshDataMinerWorkAreaEvent.TYPE, - new RefreshDataMinerWorkAreaEvent.RefreshDataMinerWorkAreaEventHandler() { + .addHandler( + RefreshDataMinerWorkAreaEvent.TYPE, + new RefreshDataMinerWorkAreaEvent.RefreshDataMinerWorkAreaEventHandler() { - @Override - public void onRefresh( - RefreshDataMinerWorkAreaEvent event) { - manageRefreshDataMinerWorkAreaEvents(event); + @Override + public void onRefresh( + RefreshDataMinerWorkAreaEvent event) { + manageRefreshDataMinerWorkAreaEvents(event); - } - - }); + } + }); } @@ -141,7 +146,7 @@ public class OutputDataSetsPanel extends ContentPanel { } } - + private void manageRefreshDataMinerWorkAreaEvents( RefreshDataMinerWorkAreaEvent event) { switch (event.getDataMinerWorkAreaElementType()) { @@ -157,8 +162,7 @@ public class OutputDataSetsPanel extends ContentPanel { } } - - + private void create(DataMinerWorkAreaEvent event) { try { @@ -179,9 +183,20 @@ public class OutputDataSetsPanel extends ContentPanel { } + List showProperties = new ArrayList(); + showProperties.add(DataSpaceProperties.COMPUTATION_ID.getLabel()); + showProperties.add(DataSpaceProperties.DATA_ID.getLabel()); + showProperties.add(DataSpaceProperties.DATA_TYPE.getLabel()); + showProperties.add(DataSpaceProperties.OPERATOR_NAME.getLabel()); + showProperties.add(DataSpaceProperties.VRE.getLabel()); + FilterCriteria filterCriteria = new FilterCriteria(); + Map map = new HashMap(); + filterCriteria.setRequiredProperties(map); + wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanel( event.getDataMinerWorkArea().getOutputDataSets() - .getFolder().getId(), false); + .getFolder().getId(), false, showProperties, + filterCriteria); WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() { @Override diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/client/parametersfield/TabularListFld.java b/src/main/java/org/gcube/portlets/user/dataminermanager/client/parametersfield/TabularListFld.java index cec3c5b..96a519f 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/client/parametersfield/TabularListFld.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/client/parametersfield/TabularListFld.java @@ -13,7 +13,6 @@ import org.gcube.portlets.user.dataminermanager.client.bean.parameters.TabularPa import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.user.client.ui.Widget; import com.sencha.gxt.core.client.util.Margins; -import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData; import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack; import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer; import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer; @@ -80,8 +79,8 @@ public class TabularListFld extends AbstractFld { descr.addStyleName("workflow-fieldDescription"); } - horiz.add(listContainer, new BoxLayoutData(new Margins(0))); - horiz.add(descr, new BoxLayoutData(new Margins(0))); + horiz.add(listContainer); + horiz.add(descr); fieldContainer.add(horiz, new MarginData(new Margins(0))); fieldContainer.forceLayout(); diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/server/smservice/SClient4WPS.java b/src/main/java/org/gcube/portlets/user/dataminermanager/server/smservice/SClient4WPS.java index 7759fa2..b329547 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/server/smservice/SClient4WPS.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/server/smservice/SClient4WPS.java @@ -1,5 +1,7 @@ package org.gcube.portlets.user.dataminermanager.server.smservice; +import java.io.ByteArrayInputStream; +import java.io.InputStream; import java.math.BigInteger; import java.net.URL; import java.util.ArrayList; @@ -39,11 +41,13 @@ import org.gcube.portlets.user.dataminermanager.client.bean.output.ObjectResourc import org.gcube.portlets.user.dataminermanager.client.bean.output.Resource; import org.gcube.portlets.user.dataminermanager.client.bean.parameters.ObjectParameter; import org.gcube.portlets.user.dataminermanager.client.bean.parameters.Parameter; +import org.gcube.portlets.user.dataminermanager.client.bean.parameters.TabularListParameter; import org.gcube.portlets.user.dataminermanager.server.is.InformationSystemUtils; import org.gcube.portlets.user.dataminermanager.server.smservice.wps.ProcessInformations; import org.gcube.portlets.user.dataminermanager.server.smservice.wps.ResponseWPS; import org.gcube.portlets.user.dataminermanager.server.smservice.wps.StatWPSClientSession; import org.gcube.portlets.user.dataminermanager.server.smservice.wps.WPS2SM; +import org.gcube.portlets.user.dataminermanager.server.storage.StorageUtil; import org.gcube.portlets.user.dataminermanager.server.util.ServiceCredential; import org.gcube.portlets.user.dataminermanager.shared.Constants; import org.gcube.portlets.user.dataminermanager.shared.data.ComputationId; @@ -315,7 +319,7 @@ public class SClient4WPS extends SClient { } catch (Throwable e) { logger.error(e.getLocalizedMessage()); e.printStackTrace(); - throw new Exception(e.getLocalizedMessage(),e); + throw new Exception(e.getLocalizedMessage(), e); } finally { wpsClient.disconnect(wpsProcessingServlet); } @@ -343,7 +347,7 @@ public class SClient4WPS extends SClient { } catch (Throwable e) { e.printStackTrace(); - throw new Exception(e.getLocalizedMessage(),e); + throw new Exception(e.getLocalizedMessage(), e); } finally { if (wpsClient != null) { wpsClient.disconnect(wpsProcessingServlet); @@ -401,7 +405,7 @@ public class SClient4WPS extends SClient { } else { throw new Exception( "Invalid response from service, " - + "response isn't instance of ExecuteResponseDocumentImpl, class is " + + "response isn't instance of ExecuteResponseDocumentImpl, class is " + responseObject.getClass()); } } else { @@ -420,7 +424,8 @@ public class SClient4WPS extends SClient { if (wpsClient != null) wpsClient.disconnect(wpsProcessingServlet); } catch (Exception e) { - logger.debug("Problems in wps disconnect! "+e.getLocalizedMessage()); + logger.debug("Problems in wps disconnect! " + + e.getLocalizedMessage()); } } } @@ -512,34 +517,21 @@ public class SClient4WPS extends SClient { } return urls; } + /* - private static String getExceptionText(String exceptionText) { - try { - String excText = "ExceptionText>"; - int idx = exceptionText.indexOf(excText); - if (idx >= 0) { - String exception = exceptionText.substring(idx - + excText.length()); - exception = exception.substring(0, exception.indexOf("", "") - .replace("/", " ") - .replace("\\", " ") - .replaceAll( - "[\\]\\[!\"#$%&'\\(\\)*+/:;<=>?@\\^_`{\\|}~-]", - "_").trim(); - exception = exception.replaceAll("[ ]+", " "); - if (exception.length() > 200) - exception = exception.substring(0, 200) + "..."; - return exception; - } else - return "Process error in WPS Execution"; - } catch (Exception e) { - e.printStackTrace(); - return "Backend error in WPS Execution"; - } - }*/ + * private static String getExceptionText(String exceptionText) { try { + * String excText = "ExceptionText>"; int idx = + * exceptionText.indexOf(excText); if (idx >= 0) { String exception = + * exceptionText.substring(idx + excText.length()); exception = + * exception.substring(0, exception.indexOf("", "") .replace("/", " ") .replace("\\", + * " ") .replaceAll( "[\\]\\[!\"#$%&'\\(\\)*+/:;<=>?@\\^_`{\\|}~-]", + * "_").trim(); exception = exception.replaceAll("[ ]+", " "); if + * (exception.length() > 200) exception = exception.substring(0, 200) + + * "..."; return exception; } else return "Process error in WPS Execution"; + * } catch (Exception e) { e.printStackTrace(); return + * "Backend error in WPS Execution"; } } + */ private static void getURLFromXML(org.w3c.dom.Node node, ResponseWPS responseWPS) { @@ -680,7 +672,7 @@ public class SClient4WPS extends SClient { } catch (Throwable e) { logger.error("GetParameters: " + e.getLocalizedMessage()); e.printStackTrace(); - throw new Exception(e.getLocalizedMessage(),e); + throw new Exception(e.getLocalizedMessage(), e); } LinkedHashMap inputParameters = new LinkedHashMap<>(); @@ -696,8 +688,8 @@ public class SClient4WPS extends SClient { Map userInputs = new LinkedHashMap<>(); for (Parameter parm : params) { userInputs.put(parm.getName(), parm.getValue()); - logger.debug("UserInputs= key:" + parm.getName() + ", value=" - + parm.getValue()); + logger.debug("UserInputs[key=" + parm.getName() + ", value=" + + parm.getValue() + "]"); } String processUrl = compute(processInformations, userInputs, @@ -727,48 +719,63 @@ public class SClient4WPS extends SClient { // setup the inputs org.n52.wps.client.ExecuteRequestBuilder executeBuilder = new org.n52.wps.client.ExecuteRequestBuilder( processInformations.getProcessDescription()); - // for each input for (InputDescriptionType input : processInformations.getInputs()) { - // retrieve the input from the sm config String value = userInputs.get(input.getIdentifier() .getStringValue()); - if (value != null && value.trim().length() > 0) { - /* - * String[] values = value.split("\\|"); if (values.length - * == 0) { values = new String[1]; values[0] = value; } - */ - // fulfill an input obj for the execution if (input.isSetLiteralData()) { logger.debug("Configuring Literal: " + input.getIdentifier().getStringValue() + " to: " + value); - /* for (String v : values) { */ + executeBuilder.addLiteralData(input.getIdentifier() .getStringValue(), value); - /* } */ + } else if (input.isSetBoundingBoxData()) { logger.debug("Configuring Bounding Box: " + input.getIdentifier().getStringValue() + " to: " + value); - /* for (String v : values) { */ addBoundingBoxInput(executeBuilder, input .getIdentifier().getStringValue(), value); - /* } */ + } else { - logger.debug("Configuring Complex: " - + input.getIdentifier().getStringValue() - + " to: " + value); - SupportedComplexDataInputType complex = input - .getComplexData(); - /* for (String v : values) { */ - executeBuilder.addComplexDataReference(input - .getIdentifier().getStringValue(), value, - complex.getDefault().getFormat().getSchema(), - complex.getDefault().getFormat().getEncoding(), - complex.getDefault().getFormat().getMimeType()); - /* } */ + if (input.isSetComplexData()) { + logger.debug("Configuring Complex: " + + input.getIdentifier().getStringValue() + + " to: " + value); + SupportedComplexDataInputType complex = input + .getComplexData(); + Parameter par = inputParameters.get(input + .getIdentifier().getStringValue()); + + String publicLink; + if (par instanceof TabularListParameter) { + // TabularListParameter tabularListParameter = + // ((TabularListParameter) par); + InputStream tablesStream = new ByteArrayInputStream( + value.getBytes()); + publicLink = StorageUtil + .saveOnStorageInTemporalFile(tablesStream); + } else { + publicLink = value; + } + executeBuilder.addComplexDataReference(input + .getIdentifier().getStringValue(), + publicLink, complex.getDefault() + .getFormat().getSchema(), complex + .getDefault().getFormat() + .getEncoding(), complex + .getDefault().getFormat() + .getMimeType()); + + } else { + logger.error("This input parameter type is not supported by client library: " + + input); + throw new Exception( + "This input parameter is not supported by client library: " + + input); + } } } @@ -1126,7 +1133,7 @@ public class SClient4WPS extends SClient { } catch (Throwable e) { e.printStackTrace(); - throw new Exception(e.getLocalizedMessage(),e); + throw new Exception(e.getLocalizedMessage(), e); } finally { if (wpsClient != null) { wpsClient.disconnect(wpsProcessingServlet); diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/server/smservice/wps/ProcessInformations.java b/src/main/java/org/gcube/portlets/user/dataminermanager/server/smservice/wps/ProcessInformations.java index b9745c8..16eeb30 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/server/smservice/wps/ProcessInformations.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/server/smservice/wps/ProcessInformations.java @@ -7,6 +7,12 @@ import net.opengis.wps.x100.InputDescriptionType; import net.opengis.wps.x100.OutputDescriptionType; import net.opengis.wps.x100.ProcessDescriptionType; +/** + * + * @author Giancarlo Panichi + * email: g.panichi@isti.cnr.it + * + */ public class ProcessInformations implements Serializable { private static final long serialVersionUID = 4729933672312944832L; diff --git a/src/main/java/org/gcube/portlets/user/dataminermanager/server/storage/StorageUtil.java b/src/main/java/org/gcube/portlets/user/dataminermanager/server/storage/StorageUtil.java index eea3616..eab3ba2 100644 --- a/src/main/java/org/gcube/portlets/user/dataminermanager/server/storage/StorageUtil.java +++ b/src/main/java/org/gcube/portlets/user/dataminermanager/server/storage/StorageUtil.java @@ -5,9 +5,12 @@ import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.UUID; import org.apache.log4j.Logger; import org.gcube.common.homelibrary.home.Home; @@ -22,7 +25,11 @@ import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundExcept import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException; import org.gcube.common.homelibrary.home.workspace.exceptions.WrongItemTypeException; import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalImage; +import org.gcube.contentmanagement.blobstorage.service.IClient; import org.gcube.contentmanager.storageclient.model.protocol.smp.SMPURLConnection; +import org.gcube.contentmanager.storageclient.wrapper.AccessType; +import org.gcube.contentmanager.storageclient.wrapper.MemoryType; +import org.gcube.contentmanager.storageclient.wrapper.StorageClient; import org.gcube.portlets.user.dataminermanager.shared.exception.ServiceException; public class StorageUtil { @@ -250,9 +257,7 @@ public class StorageUtil { throw new ServiceException(e.getLocalizedMessage()); } } - - /** * * @param user @@ -263,7 +268,7 @@ public class StorageUtil { throws ServiceException { Workspace ws; try { - logger.debug("User: "+user+", ItemId:"+itemId); + logger.debug("User: " + user + ", ItemId:" + itemId); ws = HomeLibrary.getUserWorkspace(user); ws.removeItems(itemId); @@ -278,5 +283,30 @@ public class StorageUtil { } } + + public static String saveOnStorageInTemporalFile(InputStream is) + throws ServiceException { + try { + logger.debug("SaveOnStorageInTemporalFile()"); + SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMdd_HHmmss"); + Double v=Math.random()*10000; + String tempFile = "P_"+sdf.format(new Date())+"_"+ v.intValue()+".xml"; + String remotePath = "/DataMiner/AlgoritmsParameters/" + tempFile; + IClient client = new StorageClient("DataAnalysis", "DataMiner", + "DataMiner", AccessType.PUBLIC, MemoryType.VOLATILE) + .getClient(); + String storageId=client.put(true).LFile(is).RFile(remotePath); + logger.debug("Storage id: "+storageId); + String publicLink = client.getHttpUrl().RFile(remotePath); + logger.debug("Storage public link: "+publicLink); + return publicLink; + + } catch (Throwable e) { + logger.error(e.getLocalizedMessage()); + e.printStackTrace(); + throw new ServiceException(e.getLocalizedMessage(), e); + } + } + }