ref 7167:DataMiner interface should report encoded parameters in the URL
https://support.d4science.org/issues/7167 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@142790 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
20f7d9f02e
commit
843733bae1
|
@ -2,6 +2,8 @@
|
|||
<Changeset component="org.gcube.portlets-user.data-miner-manager.1-3-0"
|
||||
date="2016-02-15">
|
||||
<Change>Updated PortalContext [ticket #6278]</Change>
|
||||
<Change>Added encoded parameters in equivalent http request [ticket
|
||||
#7167]</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets-user.data-miner-manager.1-2-0"
|
||||
date="2016-12-01">
|
||||
|
|
|
@ -2,8 +2,10 @@ package org.gcube.portlets.user.dataminermanager.server.dmservice;
|
|||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
@ -556,12 +558,11 @@ public class SClient4WPS extends SClient {
|
|||
if (node == null)
|
||||
return;
|
||||
|
||||
|
||||
logger.debug("Node Name: " + node.getNodeName());
|
||||
if (node.getNodeName() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (node.getFirstChild() != null) {
|
||||
logger.debug("Node Value: " + node.getFirstChild().getNodeValue());
|
||||
} else {
|
||||
|
@ -569,7 +570,6 @@ public class SClient4WPS extends SClient {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
String text;
|
||||
switch (node.getNodeName()) {
|
||||
case "d4science:Data":
|
||||
|
@ -733,15 +733,8 @@ public class SClient4WPS extends SClient {
|
|||
throw new Exception("Invalid processLocation: " + processUrl);
|
||||
}
|
||||
|
||||
String equivalentRequest = wpsProcessingServlet + "?"
|
||||
+ "request=Execute&service=WPS&Version=1.0.0&gcube-token="
|
||||
+ wpsToken + "&lang=en-US&Identifier=" + operator.getId()
|
||||
+ "&DataInputs=";
|
||||
|
||||
for (String key : equivalentRequestMap.keySet()) {
|
||||
equivalentRequest = equivalentRequest + key + "="
|
||||
+ equivalentRequestMap.get(key) + ";";
|
||||
}
|
||||
String equivalentRequest = extractEquivalentRequestForComputation(operator,
|
||||
equivalentRequestMap);
|
||||
|
||||
ComputationId computationId = new ComputationId(id, processUrl,
|
||||
operator.getId(), operator.getName(), equivalentRequest);
|
||||
|
@ -752,6 +745,29 @@ public class SClient4WPS extends SClient {
|
|||
return computationId;
|
||||
}
|
||||
|
||||
private String extractEquivalentRequestForComputation(Operator operator,
|
||||
LinkedHashMap<String, String> equivalentRequestMap) {
|
||||
String equivalentRequest = wpsProcessingServlet + "?"
|
||||
+ "request=Execute&service=WPS&Version=1.0.0&gcube-token="
|
||||
+ wpsToken + "&lang=en-US&Identifier=" + operator.getId()
|
||||
+ "&DataInputs=";
|
||||
|
||||
for (String key : equivalentRequestMap.keySet()) {
|
||||
String value="";
|
||||
try {
|
||||
value = URLEncoder.encode(equivalentRequestMap.get(key),
|
||||
"UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
logger.error("Error in equivalent request creation: Unsupported Encoding for key="
|
||||
+ key,e);
|
||||
}
|
||||
|
||||
equivalentRequest = equivalentRequest + key + "="
|
||||
+ value + ";";
|
||||
}
|
||||
return equivalentRequest;
|
||||
}
|
||||
|
||||
private String compute(ProcessInformations processInformations,
|
||||
Map<String, String> userInputs,
|
||||
Map<String, Parameter> inputParameters,
|
||||
|
@ -887,8 +903,7 @@ public class SClient4WPS extends SClient {
|
|||
if ((failure != null && !failure.isEmpty())) {
|
||||
logger.debug("WPS FAILURE: " + failure);
|
||||
computationStatus = new ComputationStatus(
|
||||
new ServiceException(
|
||||
failure));
|
||||
new ServiceException(failure));
|
||||
} else {
|
||||
String paused = statusType
|
||||
.getProcessPaused() == null ? null
|
||||
|
@ -897,8 +912,7 @@ public class SClient4WPS extends SClient {
|
|||
if (paused != null && !paused.isEmpty()) {
|
||||
logger.debug("WPS PAUSED: " + paused);
|
||||
computationStatus = new ComputationStatus(
|
||||
new ServiceException(
|
||||
paused));
|
||||
new ServiceException(paused));
|
||||
} else {
|
||||
String success = statusType
|
||||
.getProcessSucceeded() == null ? null
|
||||
|
@ -1274,15 +1288,9 @@ public class SClient4WPS extends SClient {
|
|||
throw new Exception("Invalid processLocation: " + processUrl);
|
||||
}
|
||||
|
||||
String equivalentRequest = wpsProcessingServlet + "?"
|
||||
+ "request=Execute&service=WPS&Version=1.0.0&gcube-token="
|
||||
+ wpsToken + "&lang=en-US&Identifier="
|
||||
+ computationProperties.get("operator_id") + "&DataInputs=";
|
||||
|
||||
for (String key : equivalentRequestMap.keySet()) {
|
||||
equivalentRequest = equivalentRequest + key + "="
|
||||
+ equivalentRequestMap.get(key) + ";";
|
||||
}
|
||||
|
||||
String equivalentRequest = extractEquivalentRequestForResubmit(
|
||||
computationProperties, equivalentRequestMap);
|
||||
|
||||
ComputationId computationId = new ComputationId(id, processUrl,
|
||||
computationProperties.get("operator_id"),
|
||||
|
@ -1294,6 +1302,28 @@ public class SClient4WPS extends SClient {
|
|||
return computationId;
|
||||
}
|
||||
|
||||
private String extractEquivalentRequestForResubmit(
|
||||
Map<String, String> computationProperties,
|
||||
LinkedHashMap<String, String> equivalentRequestMap) {
|
||||
String equivalentRequest = wpsProcessingServlet + "?"
|
||||
+ "request=Execute&service=WPS&Version=1.0.0&gcube-token="
|
||||
+ wpsToken + "&lang=en-US&Identifier="
|
||||
+ computationProperties.get("operator_id") + "&DataInputs=";
|
||||
|
||||
for (String key : equivalentRequestMap.keySet()) {
|
||||
String value="";
|
||||
try {
|
||||
value = URLEncoder.encode(equivalentRequestMap.get(key),
|
||||
"UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
logger.error("Error in equivalent request creation: Unsupported Encoding for key="
|
||||
+ key,e);
|
||||
}
|
||||
equivalentRequest = equivalentRequest + key + "=" + value + ";";
|
||||
}
|
||||
return equivalentRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComputationData getComputationDataByComputationProperties(
|
||||
Map<String, String> computationProperties) throws Exception {
|
||||
|
|
Loading…
Reference in New Issue