diff --git a/.classpath b/.classpath index 3a44611..2998aa3 100644 --- a/.classpath +++ b/.classpath @@ -10,6 +10,7 @@ + diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index ed342a8..a422758 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,10 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + uses + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 889061a..9dde91d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,11 @@ # Changelog -## [v1.1.7-SNAPSHOT] - 2020-11-11 +## [v1.1.7] - 2020-11-11 ### Fix - Added a printStackTrace in executeRequest + - config Path configurable via web.xml ## [v1.1.6] - 2020-10-15 diff --git a/pom.xml b/pom.xml index 3d5e3ac..8a20a8a 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.gcube.data-analysis wps - 1.1.7-SNAPSHOT + 1.1.7 WPS A service implementing a WPS provider in the D4Science e-Infrastructure @@ -739,7 +739,6 @@ org.apache.maven.plugins maven-war-plugin - 2.4 wps false @@ -780,24 +779,6 @@ - - org.apache.maven.plugins - maven-assembly-plugin - - - descriptor.xml - - - - - servicearchive - install - - single - - - - diff --git a/src/main/java/org/gcube/data/analysis/wps/WebProcessingService.java b/src/main/java/org/gcube/data/analysis/wps/WebProcessingService.java index 0553c7b..090e3e5 100644 --- a/src/main/java/org/gcube/data/analysis/wps/WebProcessingService.java +++ b/src/main/java/org/gcube/data/analysis/wps/WebProcessingService.java @@ -80,7 +80,8 @@ public class WebProcessingService extends HttpServlet { // Should be used here, because HttpServlet implements the java.io.Serializable private static final long serialVersionUID = 8943233273641771839L; public static String PROPERTY_NAME_WEBAPP_PATH = "webappPath"; - public static String BASE_DIR = null; + //public static String BASE_DIR = null; + private String configPath; public static String WEBAPP_PATH = null; public static String SERVLET_PATH = "WebProcessingService"; public static String WPS_NAMESPACE = "http://www.opengis.net/wps/1.0.0"; @@ -108,7 +109,7 @@ public class WebProcessingService extends HttpServlet { int maxComp = Integer.parseInt(context.application().getInitParameter(MAX_COMPUTATION_PARAM)); boolean saveOnStorage = Boolean.parseBoolean(context.application().getInitParameter(SAVEONSTORAGE_PARAM)); boolean simulationMode = Boolean.parseBoolean(context.application().getInitParameter(SIMULATION_MODE_PARAM)); - String configPath = context.application().getInitParameter(CONFIG_PATH); + configPath = context.application().getInitParameter(CONFIG_PATH); String userWriteExcludedValue = context.application().getInitParameter(USER_WIRTE_EXCLUDED_PARAM); @@ -125,7 +126,18 @@ public class WebProcessingService extends HttpServlet { } else LOGGER.debug("all users excluded in write"); - env = new EnvironmentVariableManager(maxComp, saveOnStorage, simulationMode, excludedUserForWrite, configPath); + /* + if(configPath!= null) + try{ + WPSConfig.forceInitialization(configPath); + }catch(Exception e) { + LOGGER.error("error setting configPath",e); + throw new ServletException(e); + } + */ + + env = new EnvironmentVariableManager(maxComp, saveOnStorage, simulationMode, excludedUserForWrite); + LOGGER.info("WPS initialised"); } @@ -174,8 +186,6 @@ public class WebProcessingService extends HttpServlet { System.setProperty("org.geotools.referencing.forceXY", "true"); - LOGGER.info("WebProcessingService initializing..."); - try { if (WPSConfig.getInstance(config) == null) { LOGGER.error("Initialization failed! Please look at the properties file!"); @@ -188,7 +198,7 @@ public class WebProcessingService extends HttpServlet { } LOGGER.info("Initialization of wps properties successful!"); - BASE_DIR = this.getServletContext().getRealPath(""); + //BASE_DIR = this.getServletContext().getRealPath(""); Parser[] parsers = WPSConfig.getInstance().getActiveRegisteredParser(); ParserFactory.initialize(parsers); @@ -211,7 +221,7 @@ public class WebProcessingService extends HttpServlet { LOGGER.info("webappPath is set to: " + customWebappPath); try { - CapabilitiesConfiguration.getInstance(BASE_DIR + File.separator + "config" + CapabilitiesConfiguration.getInstance(configPath + File.separator + "config" + File.separator + "wpsCapabilitiesSkeleton.xml"); } catch (IOException e) { @@ -281,7 +291,7 @@ public class WebProcessingService extends HttpServlet { String webapp = context.application().getContextPath().replace("//", ""); WPSConfig.getInstance().getWPSConfig().getServer().setWebappPath(webapp); - + String protocol = WPSConfig.getInstance().getWPSConfig().getServer().getProtocol(); String host = WPSConfig.getInstance().getWPSConfig().getServer().getHostname(); String port = WPSConfig.getInstance().getWPSConfig().getServer().getHostport(); @@ -295,8 +305,8 @@ public class WebProcessingService extends HttpServlet { LOGGER.debug("Setting server parameters: Host: {}, Port: {} , Webapp: {} ", host, port,webapp); - //TODO: CHANGE the porotocol to enable https via conainer configuration - String webPath = "http://" + host + ":" + port + "/" + webapp + "/WebProcessingService"; + + String webPath = String.format("%s://%s:%s/%s/WebProcessingService", protocol, host, port, webapp); if (CapabilitiesConfiguration.ENDPOINT_URL.contains("localhost")) CapabilitiesConfiguration.ENDPOINT_URL=webPath; @@ -316,9 +326,11 @@ public class WebProcessingService extends HttpServlet { res.setStatus(HttpServletResponse.SC_OK); } catch (ExceptionReport e) { + LOGGER.warn("Error handing request, handling exception",e); handleException(e, res); } catch (RuntimeException e) { + LOGGER.error("Error handing request",e); ExceptionReport er = new ExceptionReport("Error handing request: " + e.getMessage(), ExceptionReport.NO_APPLICABLE_CODE, e); @@ -411,9 +423,11 @@ public class WebProcessingService extends HttpServlet { res.setStatus(HttpServletResponse.SC_OK); } catch (ExceptionReport e) { + LOGGER.warn("Error handing request, handling exception",e); handleException(e, res); } catch (Exception e) { + LOGGER.error("Error handing request",e); ExceptionReport er = new ExceptionReport("Error handing request: " + e.getMessage(), ExceptionReport.NO_APPLICABLE_CODE, e); handleException(er, res); } diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 06a4837..c8fcc75 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -26,7 +26,7 @@ configPath - /home/gcube/wpsconfig + /home/gcube/wps_config @@ -73,7 +73,7 @@ 0 wps.config.file - config/wps_config.xml + /home/gcube/wps_config/config/wps_config.xml