From 19e2c641d7fc000ff0ea9ce811a1ea88995d84ab Mon Sep 17 00:00:00 2001 From: Lucio Date: Thu, 19 Nov 2020 17:40:20 +0100 Subject: [PATCH] configuration for external build dir added --- .classpath | 10 - .settings/org.eclipse.jdt.core.prefs | 3 + CHANGELOG.md | 36 +++ changelog.xml | 7 +- descriptor.xml | 1 + .../analysis/wps/ExecuteResponseBuilder.java | 293 ++++++++++-------- .../analysis/wps/WebProcessingService.java | 4 +- src/main/webapp/WEB-INF/web.xml | 6 + 8 files changed, 213 insertions(+), 147 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.classpath b/.classpath index 6acf3ee..3a44611 100644 --- a/.classpath +++ b/.classpath @@ -6,22 +6,12 @@ - - - - - - - - - - diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 6e80039..cac0df4 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -3,6 +3,9 @@ org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=1.8 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c6d193c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,36 @@ +# Changelog + + + +## [v1.1.5] [r4.24.0] - 2020-06-05 + +### Fixes + +- Updated ExecuteResponseBuilder for support protocol option [#19423] +- Updated to Git and Jenkins [#18120] + + + +## [v1.1.3] - 2018-12-13 + +### Features + +- Added https support [#13024] + + + +## [v1.1.0] - 2017-09-24 + +### Features + +- Dynamic adding, removing and updating of algorithms added +- Moved to SocialNetworkingService 2.0 + + + +## [v1.0.0] - 2017-09-01 + +- First Release + + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/changelog.xml b/changelog.xml index e4e1858..69d08f2 100644 --- a/changelog.xml +++ b/changelog.xml @@ -1,11 +1,12 @@ - Updated to Git and Jenkins [ticket #18120] + date="2020-06-05"> + Updated ExecuteResponseBuilder for support protocol option [#19129] + Updated to Git and Jenkins [#18120] - Added https support [ticket #13024] + Added https support [#13024] diff --git a/descriptor.xml b/descriptor.xml index 779594a..43b4b2f 100644 --- a/descriptor.xml +++ b/descriptor.xml @@ -14,6 +14,7 @@ README.md LICENSE.md + CHANGELOG.md gcube-app.xml changelog.xml profile.xml diff --git a/src/main/java/org/gcube/data/analysis/wps/ExecuteResponseBuilder.java b/src/main/java/org/gcube/data/analysis/wps/ExecuteResponseBuilder.java index cd01948..cca3510 100644 --- a/src/main/java/org/gcube/data/analysis/wps/ExecuteResponseBuilder.java +++ b/src/main/java/org/gcube/data/analysis/wps/ExecuteResponseBuilder.java @@ -1,4 +1,5 @@ package org.gcube.data.analysis.wps; + import java.io.InputStream; import java.net.Inet4Address; import java.net.UnknownHostException; @@ -19,6 +20,7 @@ import net.opengis.wps.x100.ProcessDescriptionType; import net.opengis.wps.x100.StatusType; import org.apache.xmlbeans.XmlCursor; +import org.n52.wps.ServerDocument.Server; import org.n52.wps.commons.WPSConfig; import org.n52.wps.io.data.IBBOXData; import org.n52.wps.io.data.IData; @@ -33,10 +35,24 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * WPS Execute operation response. By default, this XML document is delivered to the client in response to an Execute request. If "status" is "false" in the Execute operation request, this document is normally returned when process execution has been completed. - * If "status" in the Execute request is "true", this response shall be returned as soon as the Execute request has been accepted for processing. In this case, the same XML document is also made available as a web-accessible resource from the URL identified in the statusLocation, and the WPS server shall repopulate it once the process has completed. It may repopulate it on an ongoing basis while the process is executing. - * However, the response to an Execute request will not include this element in the special case where the output is a single complex value result and the Execute request indicates that "store" is "false". - * Instead, the server shall return the complex result (e.g., GIF image or GML) directly, without encoding it in the ExecuteResponse. If processing fails in this special case, the normal ExecuteResponse shall be sent, with the error condition indicated. This option is provided to simplify the programming required for simple clients and for service chaining. + * WPS Execute operation response. By default, this XML document is delivered to + * the client in response to an Execute request. If "status" is "false" in the + * Execute operation request, this document is normally returned when process + * execution has been completed. If "status" in the Execute request is "true", + * this response shall be returned as soon as the Execute request has been + * accepted for processing. In this case, the same XML document is also made + * available as a web-accessible resource from the URL identified in the + * statusLocation, and the WPS server shall repopulate it once the process has + * completed. It may repopulate it on an ongoing basis while the process is + * executing. However, the response to an Execute request will not include this + * element in the special case where the output is a single complex value result + * and the Execute request indicates that "store" is "false". Instead, the + * server shall return the complex result (e.g., GIF image or GML) directly, + * without encoding it in the ExecuteResponse. If processing fails in this + * special case, the normal ExecuteResponse shall be sent, with the error + * condition indicated. This option is provided to simplify the programming + * required for simple clients and for service chaining. + * * @author Timon ter Braak * */ @@ -44,7 +60,7 @@ public class ExecuteResponseBuilder { private String identifier; private DataInputsType dataInputs; - //private DocumentOutputDefinitionType[] outputDefs; + // private DocumentOutputDefinitionType[] outputDefs; private ExecuteRequest request; private ExecuteResponseDocument doc; private RawData rawDataHandler = null; @@ -53,10 +69,8 @@ public class ExecuteResponseBuilder { private Calendar creationTime; String webPath; String webStatus; - - - - public ExecuteResponseBuilder(ExecuteRequest request) throws ExceptionReport{ + + public ExecuteResponseBuilder(ExecuteRequest request) throws ExceptionReport { LOGGER.debug("Building Doc"); this.request = request; doc = ExecuteResponseDocument.Factory.newInstance(); @@ -64,46 +78,61 @@ public class ExecuteResponseBuilder { XmlCursor c = doc.newCursor(); c.toFirstChild(); c.toLastAttribute(); - c.setAttributeText(new QName(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "schemaLocation"), "http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd"); - - String webapp = WPSConfig.getInstance().getWPSConfig().getServer().getWebappPath(); + c.setAttributeText(new QName(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "schemaLocation"), + "http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd"); + + Server docServer = WPSConfig.getInstance().getWPSConfig().getServer(); + + String webapp = docServer.getWebappPath(); if (webapp == null) webapp = "wps"; - String host = WPSConfig.getInstance().getWPSConfig().getServer().getHostname(); + String host = docServer.getHostname(); if (host.toLowerCase().equals("localhost")) try { host = Inet4Address.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { - LOGGER.error("error",e); + LOGGER.error("error", e); } - - String port = WPSConfig.getInstance().getWPSConfig().getServer().getHostport(); - LOGGER.debug("Host: " + host + " Port: " + port + " Webapp: " + webapp + " "); - webPath = "http://" + host + ":" + port + "/" + webapp + "/WebProcessingService"; - webStatus = "http://" + host + ":" + port + "/" + webapp + "/RetrieveResultServlet"; - - //statistical-manager-new.d4science.org:8080/wps/WebProcessingService?Request=GetCapabilities&Service=WPS - -// doc.getExecuteResponse().setServiceInstance(webPath+"?REQUEST=GetCapabilities&SERVICE=WPS"); + + String port = docServer.getHostport(); + + String protocol = docServer.getProtocol(); + + if (protocol == null || protocol.isEmpty()) { + LOGGER.info("Protocol not found, use https in default mode."); + protocol = "https"; + } + + LOGGER.debug("Service Config: [Protocol: {}, Host: {} , Port: {}, Webapp: {} ]", protocol, host, port, webapp); + webPath = protocol + "://" + host + ":" + port + "/" + webapp + "/WebProcessingService"; + webStatus = protocol + "://" + host + ":" + port + "/" + webapp + "/RetrieveResultServlet"; + + LOGGER.debug("WebPath: {}", webPath); + LOGGER.debug("WebStatus: {}", webStatus); + + // statistical-manager-new.d4science.org:8080/wps/WebProcessingService?Request=GetCapabilities&Service=WPS + + // doc.getExecuteResponse().setServiceInstance(webPath+"?REQUEST=GetCapabilities&SERVICE=WPS"); doc.getExecuteResponse().setServiceInstance(webPath); doc.getExecuteResponse().setLang(WebProcessingService.DEFAULT_LANGUAGE); doc.getExecuteResponse().setService("WPS"); doc.getExecuteResponse().setVersion(Request.SUPPORTED_VERSION); - + LOGGER.debug("Doc attributes set"); - + this.identifier = request.getExecute().getIdentifier().getStringValue().trim(); - LOGGER.debug("Identifier: "+identifier); + LOGGER.debug("Identifier: " + identifier); ExecuteResponse responseElem = doc.getExecuteResponse(); responseElem.addNewProcess().addNewIdentifier().setStringValue(identifier); - - LOGGER.debug("Getting description for "+identifier); - + + LOGGER.debug("Getting description for " + identifier); + description = RepositoryManager.getInstance().getProcessDescription(this.identifier); - - LOGGER.debug("Description "+description); - if(description==null){ -// throw new RuntimeException("Error while accessing the process description for "+ identifier); + + LOGGER.debug("Description " + description); + if (description == null) { + // throw new RuntimeException("Error while accessing the process + // description for "+ identifier); } responseElem.getProcess().setTitle(description.getTitle()); @@ -118,9 +147,11 @@ public class ExecuteResponseBuilder { // if status succeeded, update reponse with result if (responseElem.getStatus().isSetProcessSucceeded()) { - // the response only include dataInputs, if the property is set to true; - //if(Boolean.getBoolean(WPSConfiguration.getInstance().getProperty(WebProcessingService.PROPERTY_NAME_INCLUDE_DATAINPUTS_IN_RESPONSE))) { - if(new Boolean(WPSConfig.getInstance().getWPSConfig().getServer().getIncludeDataInputsInResponse())){ + // the response only include dataInputs, if the property is set to + // true; + // if(Boolean.getBoolean(WPSConfiguration.getInstance().getProperty(WebProcessingService.PROPERTY_NAME_INCLUDE_DATAINPUTS_IN_RESPONSE))) + // { + if (new Boolean(WPSConfig.getInstance().getWPSConfig().getServer().getIncludeDataInputsInResponse())) { dataInputs = request.getExecute().getDataInputs(); responseElem.setDataInputs(dataInputs); } @@ -130,11 +161,11 @@ public class ExecuteResponseBuilder { // Get the outputdescriptions from the algorithm OutputDescriptionType[] outputDescs = description.getProcessOutputs().getOutputArray(); - if(request.isRawData()) { + if (request.isRawData()) { OutputDefinitionType rawDataOutput = request.getExecute().getResponseForm().getRawDataOutput(); String id = rawDataOutput.getIdentifier().getStringValue(); OutputDescriptionType desc = XMLBeansHelper.findOutputByID(id, outputDescs); - if(desc.isSetComplexOutput()) { + if (desc.isSetComplexOutput()) { String encoding = ExecuteResponseBuilder.getEncoding(desc, rawDataOutput); String schema = ExecuteResponseBuilder.getSchema(desc, rawDataOutput); String responseMimeType = getMimeType(rawDataOutput); @@ -147,85 +178,89 @@ public class ExecuteResponseBuilder { String encoding = null; DomainMetadataType dataType = desc.getLiteralOutput().getDataType(); String reference = dataType != null ? dataType.getReference() : null; - generateLiteralDataOutput(id, doc, true, reference, schema, mimeType, encoding, desc.getTitle()); - } - else if (desc.isSetBoundingBoxOutput()) { + generateLiteralDataOutput(id, doc, true, reference, schema, mimeType, encoding, + desc.getTitle()); + } else if (desc.isSetBoundingBoxOutput()) { generateBBOXOutput(id, doc, true, desc.getTitle()); } return; } // Get the outputdefinitions from the clients request // For each request of output - for(int i = 0; isimulationMode false + + configPath + /home/gcube/wpsconfig + + + excludeWritesOnSH