This commit is contained in:
Giancarlo Panichi 2019-06-13 09:49:21 +00:00
parent 924ecdbdb9
commit 54dacbf31c
1 changed files with 182 additions and 151 deletions

View File

@ -15,23 +15,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.opengis.ows.x11.OperationDocument.Operation;
import net.opengis.wps.x100.CapabilitiesDocument;
import net.opengis.wps.x100.ComplexDataType;
import net.opengis.wps.x100.ExecuteDocument;
import net.opengis.wps.x100.ExecuteResponseDocument;
import net.opengis.wps.x100.ExecuteResponseDocument.ExecuteResponse.ProcessOutputs;
import net.opengis.wps.x100.InputDescriptionType;
import net.opengis.wps.x100.InputType;
import net.opengis.wps.x100.OutputDataType;
import net.opengis.wps.x100.OutputDescriptionType;
import net.opengis.wps.x100.ProcessBriefType;
import net.opengis.wps.x100.ProcessDescriptionType;
import net.opengis.wps.x100.ResponseDocumentType;
import net.opengis.wps.x100.StatusType;
import net.opengis.wps.x100.SupportedComplexDataInputType;
import net.opengis.wps.x100.impl.ExecuteResponseDocumentImpl;
import org.apache.xmlbeans.XmlString;
import org.gcube.data.analysis.dataminermanagercl.server.dmservice.wps.ProcessInformations;
import org.gcube.data.analysis.dataminermanagercl.server.dmservice.wps.ResponseWPS;
@ -70,6 +53,23 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import net.opengis.ows.x11.OperationDocument.Operation;
import net.opengis.wps.x100.CapabilitiesDocument;
import net.opengis.wps.x100.ComplexDataType;
import net.opengis.wps.x100.ExecuteDocument;
import net.opengis.wps.x100.ExecuteResponseDocument;
import net.opengis.wps.x100.ExecuteResponseDocument.ExecuteResponse.ProcessOutputs;
import net.opengis.wps.x100.InputDescriptionType;
import net.opengis.wps.x100.InputType;
import net.opengis.wps.x100.OutputDataType;
import net.opengis.wps.x100.OutputDescriptionType;
import net.opengis.wps.x100.ProcessBriefType;
import net.opengis.wps.x100.ProcessDescriptionType;
import net.opengis.wps.x100.ResponseDocumentType;
import net.opengis.wps.x100.StatusType;
import net.opengis.wps.x100.SupportedComplexDataInputType;
import net.opengis.wps.x100.impl.ExecuteResponseDocumentImpl;
/**
* Client 4 WPS Service
*
@ -224,7 +224,6 @@ public class SClient4WPS extends SClient {
}
}
@Override
public Operator getOperatorById(String id) throws Exception {
return getOperatorById(id, false);
@ -374,7 +373,6 @@ public class SClient4WPS extends SClient {
return operatorsClass;
}
private ProcessInformations describeProcess(String processId) throws ServiceException {
return describeProcess(processId, null);
}
@ -483,8 +481,13 @@ public class SClient4WPS extends SClient {
for (OutputDescriptionType odt : odts) {
// executeBuilder.setMimeTypeForOutput("text/xml",
// "result");
if (odt.isSetComplexOutput())
if (odt.isSetComplexOutput()) {
executeBuilder.setMimeTypeForOutput("text/xml", odt.getIdentifier().getStringValue());
if (odt.getIdentifier().getStringValue().compareTo("non_deterministic_output") != 0) {
executeBuilder.setAsReference(odt.getIdentifier().getStringValue(), true);
}
}
}
} catch (Exception e) {
logger.debug("Execute Process-> Warning, no xml structured objects will be provided: "
@ -506,6 +509,14 @@ public class SClient4WPS extends SClient {
documentType.setStoreExecuteResponse(true);
documentType.setStatus(true);
documentType.setLineage(false);
/*
* DocumentOutputDefinitionType[]
* documentOutputDefinitionType=documentType.getOutputArray();
* for(DocumentOutputDefinitionType
* dodt:documentOutputDefinitionType){
* dodt.getIdentifier().getStringValue()
* dodt.setAsReference(true); }
*/
execute.getExecute().getResponseForm().setResponseDocument(documentType);
}
Object responseObject = wpsClient.execute(wpsProcessingServlet, execute);
@ -1109,8 +1120,28 @@ public class SClient4WPS extends SClient {
for (OutputDataType out : outputData) {
String outputID = out.getIdentifier().getStringValue();
logger.debug("Output Identifier: " + outputID);
if (out.isSetData()) {
logger.debug("Is Data");
readOutputOfTypeData(outputParameters, outputResource, out, outputID);
} else {
if(out.isSetReference()){
logger.debug("Is Reference: "+out.getReference());
logger.debug("This parameter is not recovered");
} else {
logger.debug("Unknow type, this parameter is not recovered");
}
}
}
}
}
private void readOutputOfTypeData(Map<String, Parameter> outputParameters, Map<String, Resource> outputResource,
OutputDataType out, String outputID) {
String value = "";
if (out.getData().isSetLiteralData()) {
logger.debug("Is Literal Data");
value = out.getData().getLiteralData().getStringValue();
Parameter paramLiteral = outputParameters.get(outputID);
if (paramLiteral != null) {
@ -1122,6 +1153,7 @@ public class SClient4WPS extends SClient {
}
} else {
if (out.getData().isSetComplexData()) {
logger.debug("Is Complex Data");
if (out.getReference() != null) {
value = out.getReference().getHref();
Parameter paramComplexData = outputParameters.get(outputID);
@ -1234,13 +1266,12 @@ public class SClient4WPS extends SClient {
}
}
} else {
logger.debug("Not is Literal or Complex");
value = out.getData().getLiteralData().getStringValue();
}
}
}
}
}
@Override
public String cancelComputation(ComputationId computationId) throws ServiceException {