config path configurable via web.xml
This commit is contained in:
parent
b49789681a
commit
99f738b81a
|
@ -10,6 +10,7 @@
|
|||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
|
|
|
@ -1,10 +1,76 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-module deploy-name="wps">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<dependent-module archiveName="storagehub-client-library-1.2.1.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/storagehub-client/storagehub-client">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<property name="context-root" value="wps"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<property name="java-output-path" value="/wps/target/classes"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</project-modules>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
21
pom.xml
21
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.data-analysis</groupId>
|
||||
<artifactId>wps</artifactId>
|
||||
<version>1.1.7-SNAPSHOT</version>
|
||||
<version>1.1.7</version>
|
||||
<name>WPS</name>
|
||||
<description>A service implementing a WPS provider in the D4Science e-Infrastructure</description>
|
||||
|
||||
|
@ -739,7 +739,6 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<warName>wps</warName>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
|
@ -780,24 +779,6 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>descriptor.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>servicearchive</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
</context-param>
|
||||
<context-param>
|
||||
<param-name>configPath</param-name>
|
||||
<param-value>/home/gcube/wpsconfig</param-value>
|
||||
<param-value>/home/gcube/wps_config</param-value>
|
||||
</context-param>
|
||||
|
||||
|
||||
|
@ -73,7 +73,7 @@
|
|||
<load-on-startup>0</load-on-startup>
|
||||
<init-param>
|
||||
<param-name>wps.config.file</param-name>
|
||||
<param-value>config/wps_config.xml</param-value>
|
||||
<param-value>/home/gcube/wps_config/config/wps_config.xml</param-value>
|
||||
</init-param>
|
||||
</servlet>
|
||||
<servlet>
|
||||
|
|
Loading…
Reference in New Issue