This commit is contained in:
Lucio Lelii 2019-04-17 15:37:05 +00:00
parent e2ad125949
commit 835c8737c8
4 changed files with 22 additions and 15 deletions

10
pom.xml
View File

@ -24,7 +24,7 @@
<apache.axis2.version>1.5.1</apache.axis2.version> <apache.axis2.version>1.5.1</apache.axis2.version>
<n52version>3.6.1</n52version> <n52version>3.6.1</n52version>
</properties> </properties>
<repositories> <repositories>
<repository> <repository>
<id>n52-releases</id> <id>n52-releases</id>
@ -37,7 +37,7 @@
<enabled>false</enabled> <enabled>false</enabled>
</snapshots> </snapshots>
</repository> </repository>
<repository> <repository>
<id>Apache</id> <id>Apache</id>
<name>Apache repository</name> <name>Apache repository</name>
<url>http://repo1.maven.org/maven2</url> <url>http://repo1.maven.org/maven2</url>
@ -56,9 +56,9 @@
<repository> <repository>
<id>OpenGEO</id> <id>OpenGEO</id>
<name>opengeo repository</name> <name>opengeo repository</name>
<url>http://repo.opengeo.org</url> <url>https://repo.boundlessgeo.com</url>
</repository> </repository>
</repositories> </repositories>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>

View File

@ -15,6 +15,7 @@ import org.gcube.data.analysis.wps.repository.GcubeAlgorithmRepository;
import org.gcube.dataanalysis.ecoengine.processing.factories.ProcessorsFactory; import org.gcube.dataanalysis.ecoengine.processing.factories.ProcessorsFactory;
import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.infrastructure.InfrastructureDialoguer; import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.infrastructure.InfrastructureDialoguer;
import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping.ConfigurationManager; import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping.ConfigurationManager;
import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping.EnvironmentVariableManager;
import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping.TokenManager; import org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mapping.TokenManager;
import org.n52.wps.commons.WPSConfig; import org.n52.wps.commons.WPSConfig;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -43,7 +44,7 @@ public class GetCapabilitiesBuilder {
return rightClassification; return rightClassification;
} }
public String buildGetCapabilities(Map<String, String[]> parameters) throws Exception { public String buildGetCapabilities(Map<String, String[]> parameters, EnvironmentVariableManager env) throws Exception {
LinkedHashMap<String, Object> basicInputs = new LinkedHashMap<String, Object>(); LinkedHashMap<String, Object> basicInputs = new LinkedHashMap<String, Object>();
// DONE get scope and username from SmartGears to build the get // DONE get scope and username from SmartGears to build the get
@ -63,7 +64,7 @@ public class GetCapabilitiesBuilder {
* basicInputs.put(ConfigurationManager.usernameParameter, * basicInputs.put(ConfigurationManager.usernameParameter,
* ConfigurationManager.defaultUsername); } } * ConfigurationManager.defaultUsername); } }
*/ */
ConfigurationManager configManager = new ConfigurationManager(); ConfigurationManager configManager = new ConfigurationManager(env);
TokenManager tokenm = new TokenManager(); TokenManager tokenm = new TokenManager();
tokenm.getCredentials(); tokenm.getCredentials();
String scope = tokenm.getScope(); String scope = tokenm.getScope();

View File

@ -142,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, env); req = new ExecuteRequest(ciMap, this.env);
setResponseMimeType((ExecuteRequest)req); setResponseMimeType((ExecuteRequest)req);
InnerMethodName.instance.set("Execute"); InnerMethodName.instance.set("Execute");
} }
@ -171,11 +171,12 @@ public class RequestHandler {
* The OutputStream to write the response to. * The OutputStream to write the response to.
* @throws ExceptionReport * @throws ExceptionReport
*/ */
public RequestHandler(InputStream is, OutputStream os) public RequestHandler(InputStream is, OutputStream os, EnvironmentVariableManager env)
throws ExceptionReport { throws ExceptionReport {
String nodeName, localName, nodeURI, version = null; String nodeName, localName, nodeURI, version = null;
Document doc; Document doc;
this.os = os; this.os = os;
this.env= env;
boolean isCapabilitiesNode = false; boolean isCapabilitiesNode = false;
@ -263,7 +264,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, env); req = new ExecuteRequest(doc, this.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!");
@ -396,7 +397,7 @@ public class RequestHandler {
GetCapabilitiesBuilder builder = new GetCapabilitiesBuilder(); GetCapabilitiesBuilder builder = new GetCapabilitiesBuilder();
String getCapabilitiesStringFromInfra = ""; String getCapabilitiesStringFromInfra = "";
try { try {
getCapabilitiesStringFromInfra = builder.buildGetCapabilities(params); getCapabilitiesStringFromInfra = builder.buildGetCapabilities(params, env);
} catch (Exception e) { } catch (Exception e) {
throw new ExceptionReport("Error in building GetCapabilities","getcapabilities",e); throw new ExceptionReport("Error in building GetCapabilities","getcapabilities",e);
} }

View File

@ -110,13 +110,18 @@ public class WebProcessingService extends HttpServlet {
String userWriteExcludedValue = context.application().getInitParameter(USER_WIRTE_EXCLUDED_PARAM); String userWriteExcludedValue = context.application().getInitParameter(USER_WIRTE_EXCLUDED_PARAM);
List<String> excludedUserForWrite = null; List<String> excludedUserForWrite = null;
if (userWriteExcludedValue.isEmpty() || userWriteExcludedValue==null) if (userWriteExcludedValue.isEmpty() || userWriteExcludedValue==null) {
excludedUserForWrite = Collections.emptyList(); excludedUserForWrite = Collections.emptyList();
else if(!userWriteExcludedValue.equals("*")){ LOGGER.debug("none is excluded in write");
}else if(!userWriteExcludedValue.equals("*")){
excludedUserForWrite = Arrays.asList(userWriteExcludedValue.split(",")); excludedUserForWrite = Arrays.asList(userWriteExcludedValue.split(","));
excludedUserForWrite.stream().forEach(i -> i.trim()); excludedUserForWrite.stream().forEach(i -> i.trim());
} LOGGER.debug("users excluded in write are {}",excludedUserForWrite);
} else
LOGGER.debug("all users excluded in write");
env = new EnvironmentVariableManager(maxComp, saveOnStorage, simulationMode, excludedUserForWrite); env = new EnvironmentVariableManager(maxComp, saveOnStorage, simulationMode, excludedUserForWrite);
LOGGER.info("WPS initialised"); LOGGER.info("WPS initialised");
@ -391,7 +396,7 @@ public class WebProcessingService extends HttpServlet {
LOGGER.info("This is a standard xml document"); LOGGER.info("This is a standard xml document");
RequestHandler handler = new RequestHandler(new ByteArrayInputStream(documentString.getBytes("UTF-8")), RequestHandler handler = new RequestHandler(new ByteArrayInputStream(documentString.getBytes("UTF-8")),
res.getOutputStream()); res.getOutputStream(), env);
LOGGER.debug("POST Request Handler created"); LOGGER.debug("POST Request Handler created");
String mimeType = handler.getResponseMimeType(); String mimeType = handler.getResponseMimeType();
LOGGER.debug("Request mimeType: "+mimeType); LOGGER.debug("Request mimeType: "+mimeType);