/** * Gets the Execute that is associated with this Request * * @return The Execute */ public Execute getExecute() { return execDom.getExecute(); }
public boolean isRawData() { if (execDom.getExecute().getResponseForm() == null) { return false; } if (execDom.getExecute().getResponseForm().getRawDataOutput() != null) { return true; } else { return false; } }
public boolean isStoreResponse() { if (execDom.getExecute().getResponseForm() == null) { return false; } if (execDom.getExecute().getResponseForm().getRawDataOutput() != null) { return false; } return execDom.getExecute().getResponseForm().getResponseDocument() .getStoreExecuteResponse(); }
public boolean isQuickStatus() { if (execDom.getExecute().getResponseForm() == null) { return false; } if (execDom.getExecute().getResponseForm().getRawDataOutput() != null) { return false; } return execDom.getExecute().getResponseForm().getResponseDocument() .getStatus(); }
/** * Executes a process at a WPS * * @param url url of server not the entry additionally defined in the caps. * @param execute Execute document * @return either an ExecuteResponseDocument or an InputStream if asked for RawData or an Exception Report */ public Object execute(String serverID, ExecuteDocument execute) throws WPSClientException{ if(execute.getExecute().isSetResponseForm()==true && execute.getExecute().isSetResponseForm()==true && execute.getExecute().getResponseForm().isSetRawDataOutput()==true){ return execute(serverID, execute,true); }else{ return execute(serverID, execute,false); } }
/** * this sets store for the specific output. * @param parentInput * @return */ public boolean setStatus(String outputName, boolean status) { if (!execute.getExecute().isSetResponseForm()) { execute.getExecute().addNewResponseForm(); } ResponseFormType responseForm = execute.getExecute().getResponseForm(); if (!responseForm.isSetResponseDocument()) { responseForm.addNewResponseDocument(); } ResponseDocumentType responseDocument = responseForm.getResponseDocument(); responseDocument.setStatus(status); return true; }
if (!execute.getExecute().isSetResponseForm()) { execute.getExecute().addNewResponseForm(); ResponseFormType responseForm = execute.getExecute().getResponseForm();
private DocumentOutputDefinitionType getOutputDefinition(String outputName) { DocumentOutputDefinitionType[] outputs = execute.getExecute() .getResponseForm().getResponseDocument().getOutputArray(); for (DocumentOutputDefinitionType outputDef : outputs) { if (outputDef.getIdentifier().getStringValue().equals(outputName)) { return outputDef; } } return null; }
InputType[] currentInputTypeArray = execute.getExecute().getDataInputs().getInputArray(); execute.getExecute().getDataInputs().setInputArray(newInputTypeArray);
/** * this sets store for the specific output. * @param parentInput * @return */ public boolean setAsReference(String outputName, boolean asReference) { DocumentOutputDefinitionType outputDef = null; if (!execute.getExecute().isSetResponseForm()) { execute.getExecute().addNewResponseForm(); } if (!execute.getExecute().getResponseForm().isSetResponseDocument()) { execute.getExecute().getResponseForm().addNewResponseDocument(); } for(DocumentOutputDefinitionType outputDefTemp: execute.getExecute().getResponseForm().getResponseDocument().getOutputArray()) { if(outputDefTemp.getIdentifier().getStringValue().equals(outputName)) { outputDef = outputDefTemp; break; } } if (outputDef == null) { outputDef = execute.getExecute().getResponseForm() .getResponseDocument().addNewOutput(); } for (OutputDescriptionType outputDesc : processDesc.getProcessOutputs().getOutputArray()) { if (outputDesc.getIdentifier().getStringValue().equals(outputName)) { outputDef.setAsReference(asReference); } } return true; }
public boolean setResponseDocument(String outputIdentifier, String schema, String encoding, String mimeType){ if (!execute.getExecute().isSetResponseForm()) { execute.getExecute().addNewResponseForm(); } if (!execute.getExecute().getResponseForm().isSetResponseDocument()) { execute.getExecute().getResponseForm().addNewResponseDocument(); } OutputDescriptionType outputDesc = getOutputDescription(outputIdentifier); DocumentOutputDefinitionType outputDef = getOutputDefinition(outputIdentifier); if (outputDef == null) { outputDef = execute.getExecute().getResponseForm() .getResponseDocument().addNewOutput(); outputDef.setIdentifier(outputDesc.getIdentifier()); if(schema != null){ outputDef.setSchema(schema); } if(encoding != null){ outputDef.setEncoding(encoding); } if(mimeType != null){ outputDef.setMimeType(mimeType); } } return false; }
private void createDeserialized(ProcessDescriptionType pProcessDescription, ExecuteDocument pExecuteDocument, Map<String, List<String>> pSerializedInputData, Map<String, List<IData>> pDeSerializedInputData) throws ExceptionReport InputType[] inputParameterList = pExecuteDocument.getExecute().getDataInputs().getInputArray();
if (!execute.getExecute().isSetResponseForm()) { execute.getExecute().addNewResponseForm(); if (!execute.getExecute().getResponseForm().isSetResponseDocument()) { execute.getExecute().getResponseForm().addNewResponseDocument(); outputDef = execute.getExecute().getResponseForm() .getResponseDocument().addNewOutput(); outputDef.setIdentifier(outputDesc.getIdentifier());
if (!execute.getExecute().isSetResponseForm()) { execute.getExecute().addNewResponseForm(); if (!execute.getExecute().getResponseForm().isSetResponseDocument()) { execute.getExecute().getResponseForm().addNewResponseDocument(); outputDef = execute.getExecute().getResponseForm() .getResponseDocument().addNewOutput(); outputDef.setIdentifier(outputDesc.getIdentifier());
/** * add an input element. sets the data in the xml request * * @param parameterID the ID of the input (see process description) * @param value the actual value as String (for xml data xml for binary data is should be base64 encoded data) * @param schema schema if applicable otherwise null * @param encoding encoding if not the default encoding (for default encoding set it to null) (i.e. binary data, use base64) * @param mimeType mimetype of the data, has to be set * @throws WPSClientException */ public void addComplexData(String parameterID, String value, String schema, String encoding, String mimeType) throws WPSClientException { InputDescriptionType inputDesc = getParameterDescription(parameterID); if (inputDesc == null) { throw new IllegalArgumentException("inputDesription is null for: " + parameterID); } if (inputDesc.getComplexData() == null) { throw new IllegalArgumentException("inputDescription is not of type ComplexData: " + parameterID); } InputType input = execute.getExecute().getDataInputs().addNewInput(); input.addNewIdentifier().setStringValue(inputDesc.getIdentifier().getStringValue()); ComplexDataType data = input.addNewData().addNewComplexData(); setComplexData(data, value, schema, mimeType, encoding); }
/** * Executes a process at a WPS * * @param url url of server not the entry additionally defined in the caps. * @param execute Execute document * @return either an ExecuteResponseDocument or an InputStream if asked for RawData or an Exception Report */ private Object execute(String serverID, ExecuteDocument execute, boolean rawData) throws WPSClientException{ String url = connectURL; if (!useConnectURL) { CapabilitiesDocument caps = loggedServices.get(serverID); Operation[] operations = caps.getCapabilities().getOperationsMetadata().getOperationArray(); for (Operation operation : operations) { if (operation.getName().equals("Execute")) { url = operation.getDCPArray()[0].getHTTP().getPostArray()[0].getHref(); } } if (url == null) { throw new WPSClientException( "Capabilities do not contain any information about the entry point for Execute operation."); } } execute.getExecute().setVersion(SUPPORTED_VERSION); return retrieveExecuteResponseViaPOST(url, execute,rawData); }
/** * Asks for data as raw data, i.e. without WPS XML wrapping * @param schema if applicable otherwise null * @param encoding if default encoding = null, otherwise base64 * @param mimeType requested mimetype of the output according to the process description. if not set, default mime type is used. * @return */ public boolean setRawData(String outputIdentifier, String schema, String encoding, String mimeType) { OutputDefinitionType output = execute.getExecute().addNewResponseForm().addNewRawDataOutput(); output.addNewIdentifier().setStringValue(outputIdentifier); if (schema != null) { output.setSchema(schema); } if (mimeType != null) { output.setMimeType(mimeType); } if (encoding != null) { output.setEncoding(encoding); } return true; }
InputType input = execute.getExecute().getDataInputs() .addNewInput(); input.addNewIdentifier().setStringValue(
/** * Add literal data to the request * @param parameterID the ID of the input paramter according to the describe process * @param value the value. other types than strings have to be converted to string. The datatype is automatically determined and set accordingly to the process description */ public void addLiteralData(String parameterID, String value) { InputDescriptionType inputDesc = this.getParameterDescription(parameterID); if (inputDesc == null) { throw new IllegalArgumentException("inputDescription is null for: " + parameterID); } if (inputDesc.getLiteralData() == null) { throw new IllegalArgumentException("inputDescription is not of type literalData: " + parameterID); } InputType input = execute.getExecute().getDataInputs().addNewInput(); input.addNewIdentifier().setStringValue(parameterID); input.addNewData().addNewLiteralData().setStringValue(value); DomainMetadataType dataType = inputDesc.getLiteralData().getDataType(); if (dataType != null) { input.getData().getLiteralData().setDataType(dataType.getReference()); } }
InputType input = execute.getExecute().getDataInputs().addNewInput(); input.addNewIdentifier().setStringValue(parameterID); input.addNewReference().setHref(value);