max computation, saveOnStorage, simulationMode become init parameters of web.xml
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/wps@173382 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3929c94f04
commit
0c5874e9f1
|
@ -11,6 +11,20 @@
|
||||||
<param-name>algorithmDirectory</param-name>
|
<param-name>algorithmDirectory</param-name>
|
||||||
<param-value>/home/gcube/wps_algorithms/algorithms</param-value>
|
<param-value>/home/gcube/wps_algorithms/algorithms</param-value>
|
||||||
</context-param>
|
</context-param>
|
||||||
|
|
||||||
|
<context-param>
|
||||||
|
<param-name>maxComputation</param-name>
|
||||||
|
<param-value>4</param-value>
|
||||||
|
</context-param>
|
||||||
|
<context-param>
|
||||||
|
<param-name>saveOnStorage</param-name>
|
||||||
|
<param-value>true</param-value>
|
||||||
|
</context-param>
|
||||||
|
<context-param>
|
||||||
|
<param-name>simulationMode</param-name>
|
||||||
|
<param-value>false</param-value>
|
||||||
|
</context-param>
|
||||||
|
|
||||||
|
|
||||||
<!-- security-constraint> <web-resource-collection> <web-resource-name>My
|
<!-- security-constraint> <web-resource-collection> <web-resource-name>My
|
||||||
JSP</web-resource-name> <url-pattern>/webAdmin/index.jsp</url-pattern> <http-method>GET</http-method>
|
JSP</web-resource-name> <url-pattern>/webAdmin/index.jsp</url-pattern> <http-method>GET</http-method>
|
||||||
|
|
|
@ -43,6 +43,7 @@ import org.apache.xmlbeans.XmlException;
|
||||||
import org.apache.xmlbeans.XmlObject;
|
import org.apache.xmlbeans.XmlObject;
|
||||||
import org.apache.xmlbeans.XmlOptions;
|
import org.apache.xmlbeans.XmlOptions;
|
||||||
import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping.AbstractEcologicalEngineMapper;
|
import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping.AbstractEcologicalEngineMapper;
|
||||||
|
import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping.EnvironmentVariableManager;
|
||||||
import org.n52.wps.commons.context.ExecutionContext;
|
import org.n52.wps.commons.context.ExecutionContext;
|
||||||
import org.n52.wps.commons.context.ExecutionContextFactory;
|
import org.n52.wps.commons.context.ExecutionContextFactory;
|
||||||
import org.n52.wps.io.data.IComplexData;
|
import org.n52.wps.io.data.IComplexData;
|
||||||
|
@ -70,7 +71,8 @@ public class ExecuteRequest extends Request implements IObserver {
|
||||||
private ExecuteDocument execDom;
|
private ExecuteDocument execDom;
|
||||||
private Map<String, IData> returnResults;
|
private Map<String, IData> returnResults;
|
||||||
private ExecuteResponseBuilder execRespType;
|
private ExecuteResponseBuilder execRespType;
|
||||||
|
private EnvironmentVariableManager env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an ExecuteRequest based on a Document (HTTP_POST)
|
* Creates an ExecuteRequest based on a Document (HTTP_POST)
|
||||||
*
|
*
|
||||||
|
@ -78,8 +80,9 @@ public class ExecuteRequest extends Request implements IObserver {
|
||||||
* The clients submission
|
* The clients submission
|
||||||
* @throws ExceptionReport
|
* @throws ExceptionReport
|
||||||
*/
|
*/
|
||||||
public ExecuteRequest(Document doc) throws ExceptionReport {
|
public ExecuteRequest(Document doc, EnvironmentVariableManager env) throws ExceptionReport {
|
||||||
super(doc);
|
super(doc);
|
||||||
|
this.env = env;
|
||||||
initWpsID();
|
initWpsID();
|
||||||
try {
|
try {
|
||||||
LOGGER.debug("Preparing the ExecuteRequest for POST");
|
LOGGER.debug("Preparing the ExecuteRequest for POST");
|
||||||
|
@ -113,8 +116,9 @@ public class ExecuteRequest extends Request implements IObserver {
|
||||||
* treated as non case sensitive. @param ciMap The client input @throws
|
* treated as non case sensitive. @param ciMap The client input @throws
|
||||||
* ExceptionReport
|
* ExceptionReport
|
||||||
*/
|
*/
|
||||||
public ExecuteRequest(CaseInsensitiveMap ciMap) throws ExceptionReport {
|
public ExecuteRequest(CaseInsensitiveMap ciMap, EnvironmentVariableManager env) throws ExceptionReport {
|
||||||
super(ciMap);
|
super(ciMap);
|
||||||
|
this.env = env;
|
||||||
initWpsID();
|
initWpsID();
|
||||||
initForGET(ciMap);
|
initForGET(ciMap);
|
||||||
// validate the client input
|
// validate the client input
|
||||||
|
@ -598,9 +602,12 @@ public class ExecuteRequest extends Request implements IObserver {
|
||||||
}
|
}
|
||||||
if (algorithm instanceof AbstractEcologicalEngineMapper) {
|
if (algorithm instanceof AbstractEcologicalEngineMapper) {
|
||||||
((AbstractEcologicalEngineMapper) algorithm).setWpsExternalID(wpsid);
|
((AbstractEcologicalEngineMapper) algorithm).setWpsExternalID(wpsid);
|
||||||
|
((AbstractEcologicalEngineMapper) algorithm).setEnvironmentVariableManager(env);
|
||||||
((AbstractEcologicalEngineMapper) algorithm).setObserver(GCubeObserver.getObserver());
|
((AbstractEcologicalEngineMapper) algorithm).setObserver(GCubeObserver.getObserver());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//TODO: running algorithm
|
||||||
if (algorithm instanceof AbstractTransactionalAlgorithm) {
|
if (algorithm instanceof AbstractTransactionalAlgorithm) {
|
||||||
returnResults = ((AbstractTransactionalAlgorithm) algorithm).run(execDom);
|
returnResults = ((AbstractTransactionalAlgorithm) algorithm).run(execDom);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -43,6 +43,7 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||||
import org.apache.commons.collections.map.CaseInsensitiveMap;
|
import org.apache.commons.collections.map.CaseInsensitiveMap;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.gcube.common.authorization.library.AuthorizedTasks;
|
import org.gcube.common.authorization.library.AuthorizedTasks;
|
||||||
|
import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping.EnvironmentVariableManager;
|
||||||
import org.gcube.smartgears.utils.InnerMethodName;
|
import org.gcube.smartgears.utils.InnerMethodName;
|
||||||
import org.n52.wps.server.ExceptionReport;
|
import org.n52.wps.server.ExceptionReport;
|
||||||
import org.n52.wps.server.WebProcessingService;
|
import org.n52.wps.server.WebProcessingService;
|
||||||
|
@ -74,6 +75,8 @@ public class RequestHandler {
|
||||||
|
|
||||||
protected Request req;
|
protected Request req;
|
||||||
|
|
||||||
|
private EnvironmentVariableManager env;
|
||||||
|
|
||||||
// Empty constructor due to classes which extend the RequestHandler
|
// Empty constructor due to classes which extend the RequestHandler
|
||||||
protected RequestHandler() {
|
protected RequestHandler() {
|
||||||
|
|
||||||
|
@ -90,10 +93,11 @@ public class RequestHandler {
|
||||||
* @throws ExceptionReport
|
* @throws ExceptionReport
|
||||||
* If the requested operation is not supported
|
* If the requested operation is not supported
|
||||||
*/
|
*/
|
||||||
public RequestHandler(Map<String, String[]> params, OutputStream os)
|
public RequestHandler(Map<String, String[]> params, OutputStream os, EnvironmentVariableManager env)
|
||||||
throws ExceptionReport {
|
throws ExceptionReport {
|
||||||
this.os = os;
|
this.os = os;
|
||||||
this.params=params;
|
this.params=params;
|
||||||
|
this.env = env;
|
||||||
//sleepingTime is 0, by default.
|
//sleepingTime is 0, by default.
|
||||||
/*if(WPSConfiguration.getInstance().exists(PROPERTY_NAME_COMPUTATION_TIMEOUT)) {
|
/*if(WPSConfiguration.getInstance().exists(PROPERTY_NAME_COMPUTATION_TIMEOUT)) {
|
||||||
this.sleepingTime = Integer.parseInt(WPSConfiguration.getInstance().getProperty(PROPERTY_NAME_COMPUTATION_TIMEOUT));
|
this.sleepingTime = Integer.parseInt(WPSConfiguration.getInstance().getProperty(PROPERTY_NAME_COMPUTATION_TIMEOUT));
|
||||||
|
@ -138,7 +142,7 @@ public class RequestHandler {
|
||||||
InnerMethodName.instance.set("DescribeProcess");
|
InnerMethodName.instance.set("DescribeProcess");
|
||||||
}
|
}
|
||||||
else if (requestType.equalsIgnoreCase("Execute")) {
|
else if (requestType.equalsIgnoreCase("Execute")) {
|
||||||
req = new ExecuteRequest(ciMap);
|
req = new ExecuteRequest(ciMap, env);
|
||||||
setResponseMimeType((ExecuteRequest)req);
|
setResponseMimeType((ExecuteRequest)req);
|
||||||
InnerMethodName.instance.set("Execute");
|
InnerMethodName.instance.set("Execute");
|
||||||
}
|
}
|
||||||
|
@ -259,7 +263,7 @@ public class RequestHandler {
|
||||||
// get the request type
|
// get the request type
|
||||||
if (nodeURI.equals(WebProcessingService.WPS_NAMESPACE) && localName.equals("Execute")) {
|
if (nodeURI.equals(WebProcessingService.WPS_NAMESPACE) && localName.equals("Execute")) {
|
||||||
LOGGER.debug("Detected Request to Execute!");
|
LOGGER.debug("Detected Request to Execute!");
|
||||||
req = new ExecuteRequest(doc);
|
req = new ExecuteRequest(doc, env);
|
||||||
setResponseMimeType((ExecuteRequest)req);
|
setResponseMimeType((ExecuteRequest)req);
|
||||||
InnerMethodName.instance.set("Execute");
|
InnerMethodName.instance.set("Execute");
|
||||||
LOGGER.debug("Request to Execute Configured!");
|
LOGGER.debug("Request to Execute Configured!");
|
||||||
|
|
|
@ -50,6 +50,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.gcube.data.analysis.wps.repository.AlgorithmUpdater;
|
import org.gcube.data.analysis.wps.repository.AlgorithmUpdater;
|
||||||
import org.gcube.data.analysis.wps.repository.GcubeAlgorithmRepository;
|
import org.gcube.data.analysis.wps.repository.GcubeAlgorithmRepository;
|
||||||
|
import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping.EnvironmentVariableManager;
|
||||||
import org.gcube.smartgears.ContextProvider;
|
import org.gcube.smartgears.ContextProvider;
|
||||||
import org.gcube.smartgears.context.application.ApplicationContext;
|
import org.gcube.smartgears.context.application.ApplicationContext;
|
||||||
import org.n52.wps.GeneratorDocument.Generator;
|
import org.n52.wps.GeneratorDocument.Generator;
|
||||||
|
@ -85,9 +86,12 @@ public class WebProcessingService extends HttpServlet {
|
||||||
|
|
||||||
private static final String DIRECTORY_PARAM = "algorithmDirectory";
|
private static final String DIRECTORY_PARAM = "algorithmDirectory";
|
||||||
|
|
||||||
|
private static final String MAX_COMPUTATION_PARAM = "maxComputation";
|
||||||
|
private static final String SAVEONSTORAGE_PARAM = "saveOnStorage";
|
||||||
|
private static final String SIMULATION_MODE_PARAM = "simulationMode";
|
||||||
|
|
||||||
private ApplicationContext context = ContextProvider.get();
|
private ApplicationContext context = ContextProvider.get();
|
||||||
|
private EnvironmentVariableManager env ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -95,6 +99,12 @@ public class WebProcessingService extends HttpServlet {
|
||||||
LOGGER.info("initialising WPS");
|
LOGGER.info("initialising WPS");
|
||||||
String dir = (String)context.application().getInitParameter(DIRECTORY_PARAM);
|
String dir = (String)context.application().getInitParameter(DIRECTORY_PARAM);
|
||||||
GcubeAlgorithmRepository.setUpdater(new AlgorithmUpdater(dir));
|
GcubeAlgorithmRepository.setUpdater(new AlgorithmUpdater(dir));
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
env = new EnvironmentVariableManager(maxComp, saveOnStorage, simulationMode);
|
||||||
LOGGER.info("WPS initialised");
|
LOGGER.info("WPS initialised");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +287,7 @@ public class WebProcessingService extends HttpServlet {
|
||||||
OutputStream out = res.getOutputStream(); // closed by res.flushBuffer();
|
OutputStream out = res.getOutputStream(); // closed by res.flushBuffer();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
RequestHandler handler = new RequestHandler((Map<String, String[]>) req.getParameterMap(), out);
|
RequestHandler handler = new RequestHandler((Map<String, String[]>) req.getParameterMap(), out, env);
|
||||||
String mimeType = handler.getResponseMimeType();
|
String mimeType = handler.getResponseMimeType();
|
||||||
res.setContentType(mimeType);
|
res.setContentType(mimeType);
|
||||||
handler.handle();
|
handler.handle();
|
||||||
|
|
|
@ -25,7 +25,7 @@ no. 654119), SoBigData (grant no. 654024), AGINFRA PLUS (grant no. 731001).
|
||||||
Version
|
Version
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
|
||||||
1.1.1-SNAPSHOT (2018-06-14)
|
1.1.1-SNAPSHOT (2018-10-12)
|
||||||
|
|
||||||
Please see the file named "changelog.xml" in this directory for the release notes.
|
Please see the file named "changelog.xml" in this directory for the release notes.
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,20 @@
|
||||||
<param-name>algorithmDirectory</param-name>
|
<param-name>algorithmDirectory</param-name>
|
||||||
<param-value>/home/gcube/wps_algorithms/algorithms</param-value>
|
<param-value>/home/gcube/wps_algorithms/algorithms</param-value>
|
||||||
</context-param>
|
</context-param>
|
||||||
|
|
||||||
|
<context-param>
|
||||||
|
<param-name>maxComputation</param-name>
|
||||||
|
<param-value>4</param-value>
|
||||||
|
</context-param>
|
||||||
|
<context-param>
|
||||||
|
<param-name>saveOnStorage</param-name>
|
||||||
|
<param-value>true</param-value>
|
||||||
|
</context-param>
|
||||||
|
<context-param>
|
||||||
|
<param-name>simulationMode</param-name>
|
||||||
|
<param-value>false</param-value>
|
||||||
|
</context-param>
|
||||||
|
|
||||||
|
|
||||||
<!-- security-constraint> <web-resource-collection> <web-resource-name>My
|
<!-- security-constraint> <web-resource-collection> <web-resource-name>My
|
||||||
JSP</web-resource-name> <url-pattern>/webAdmin/index.jsp</url-pattern> <http-method>GET</http-method>
|
JSP</web-resource-name> <url-pattern>/webAdmin/index.jsp</url-pattern> <http-method>GET</http-method>
|
||||||
|
|
Loading…
Reference in New Issue