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/data-analysis/data-miner-manager-cl@142789 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1d79c41a3b
commit
600e94be77
|
@ -1,6 +1,8 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.data.analysis.data-miner-manager-cl.1-1-0">
|
||||
<Change>Updated Monitor interface</Change>
|
||||
<Change>Added encoded parameters in equivalent http request [ticket
|
||||
#7167]</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.data.analysis.data-miner-manager-cl.1-0-0">
|
||||
<Change>first release</Change>
|
||||
|
|
|
@ -2,8 +2,10 @@ package org.gcube.data.analysis.dataminermanagercl.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;
|
||||
|
@ -849,15 +851,8 @@ public class SClient4WPS extends SClient {
|
|||
throw new ServiceException("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);
|
||||
|
@ -868,6 +863,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,
|
||||
|
@ -1388,15 +1406,8 @@ public class SClient4WPS extends SClient {
|
|||
throw new ServiceException("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"),
|
||||
|
@ -1408,6 +1419,29 @@ 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 ServiceException {
|
||||
|
|
Loading…
Reference in New Issue