public void setStatus(StatusType status) { //workaround, should be generated either at the creation of the document or when the process has been finished. status.setCreationTime(creationTime); doc.getExecuteResponse().setStatus(status); }
private OutputDataType prepareOutput(ExecuteResponseDocument res){ OutputDataType output = res.getExecuteResponse().getProcessOutputs().addNewOutput(); CodeType identifierCode = output.addNewIdentifier(); identifierCode.setStringValue(id); output.setTitle(title); return output; }
/** * delivers just the URL of a referenced output identified by index * @param index index of the output * @return URL of the stored output * @throws WPSClientException */ public String getComplexReferenceByIndex(int index) throws WPSClientException { ExecuteResponseDocument doc = null; if(response instanceof ExecuteResponseDocument){ doc = (ExecuteResponseDocument) response; }else{ throw new WPSClientException("Output cannot be determined by index since it is either raw data or an exception report"); } OutputDataType[] outputs = doc.getExecuteResponse().getProcessOutputs().getOutputArray(); int counter = 0; for(OutputDataType output : outputs) { if(output.getReference() != null) { if(counter == index) { return output.getReference().getHref(); } counter ++; } } RuntimeException rte = new RuntimeException("No reference found in response"); LOGGER.error(rte.getMessage()); throw rte; }
public ExecuteResponseBuilder(ExecuteRequest request) throws ExceptionReport{ this.request = request; doc = ExecuteResponseDocument.Factory.newInstance(); doc.addNewExecuteResponse(); XmlCursor c = doc.newCursor(); c.toFirstChild(); c.toLastAttribute(); c.setAttributeText(new QName(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "schemaLocation"), "http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd"); doc.getExecuteResponse().setServiceInstance(CapabilitiesConfiguration.ENDPOINT_URL+"?REQUEST=GetCapabilities&SERVICE=WPS"); doc.getExecuteResponse().setLang(WebProcessingService.DEFAULT_LANGUAGE); doc.getExecuteResponse().setService("WPS"); doc.getExecuteResponse().setVersion(Request.SUPPORTED_VERSION); this.identifier = request.getExecute().getIdentifier().getStringValue().trim(); ExecuteResponse responseElem = doc.getExecuteResponse(); responseElem.addNewProcess().addNewIdentifier().setStringValue(identifier); description = RepositoryManager.getInstance().getProcessDescription(this.identifier); if(description==null){ throw new RuntimeException("Error while accessing the process description for "+ identifier); } responseElem.getProcess().setTitle(description.getTitle()); responseElem.getProcess().setProcessVersion(description.getProcessVersion()); creationTime = Calendar.getInstance(); }
public InputStream getAsStream() throws ExceptionReport{ if(request.isRawData() && rawDataHandler != null) { return rawDataHandler.getAsStream(); } if(request.isStoreResponse()) { String id = request.getUniqueId().toString(); String statusLocation = DatabaseFactory.getDatabase().generateRetrieveResultURL(id); doc.getExecuteResponse().setStatusLocation(statusLocation); } try { return doc.newInputStream(XMLBeansHelper.getXmlOptions()); } catch(Exception e) { throw new RuntimeException(e); } }
/** * delivers the parsed ComplexData by index * @param index index of the output element starting with 0 * @param binding Class of the output binding, e.g. GenericFileDataBinding * @return the parsed ComplexData in the requested format defined by the binding * @throws WPSClientException */ public IData getComplexDataByIndex(int index, Class<?> binding) throws WPSClientException { ExecuteResponseDocument doc = null; if(response instanceof ExecuteResponseDocument){ doc = (ExecuteResponseDocument) response; }else{ throw new WPSClientException("Output cannot be determined by index since it is either raw data or an exception report"); } OutputDataType[] outputs = doc.getExecuteResponse().getProcessOutputs().getOutputArray(); int counter = 0; for(OutputDataType output : outputs) { if(output.getData().getComplexData() != null) { if(counter == index) { return this.parseProcessOutput(output.getIdentifier().getStringValue(), binding); } counter ++; } } return null; }
}else if (response instanceof ExecuteResponseDocument){ ExecuteResponseDocument responseDocument = (ExecuteResponseDocument) response; OutputDataType[] processOutputs = responseDocument.getExecuteResponse().getProcessOutputs().getOutputArray(); for(OutputDataType processOutput : processOutputs){ if(processOutput.getIdentifier().getStringValue().equalsIgnoreCase(outputID)){
public void update() throws ExceptionReport { ExecuteResponse responseElem = doc.getExecuteResponse();