public String getProcessID(){ return processDescription.getIdentifier().getStringValue(); }
InputDescriptionType getInputReferenceDescriptionType(String inputId) { for (InputDescriptionType tempDesc : this.processDesc.getDataInputs().getInputArray()) { if (inputId.equals(tempDesc.getIdentifier().getStringValue())) { return tempDesc; } } return null; }
private OutputDescriptionType getOutputDescription(String outputName) { for (OutputDescriptionType outputDesc : processDesc.getProcessOutputs() .getOutputArray()) { if (outputDesc.getIdentifier().getStringValue().equals(outputName)) { return outputDesc; } } return null; }
static ProcessDescriptionType filterProcessDescription(ProcessDescriptionType description){ description.setStatusSupported(true); description.setStoreSupported(true); return description; }
private void addAlgorithm(File processDescriptionFile){ ProcessDescriptionType pd = this.loadProcessDescription(processDescriptionFile); String processID = pd.getIdentifier().getStringValue(); LOGGER.debug("Registering: " + processID); this.registeredProcessDescriptions.put(processID, pd); ToolParameter[] params = this.loadParameters(pd); this.registeredAlgorithmParameters.put(processID, params); if (!pd.validate()){ LOGGER.debug("ProcessDescription is not valid. Removing " + processID + " from Repository."); this.registeredProcessDescriptions.remove(processID); this.registeredAlgorithmParameters.remove(processID); } }
public String getDefaultMimeType(String paramID){ String mimeType = null; // check inputs for a match for (InputDescriptionType currentInput : processDescription.getDataInputs().getInputArray()){ if (currentInput.getIdentifier().getStringValue().equalsIgnoreCase(paramID)){ mimeType = currentInput.getComplexData().getDefault().getFormat().getMimeType(); } } for (OutputDescriptionType currentOutput : processDescription.getProcessOutputs().getOutputArray()){ if (currentOutput.getIdentifier().getStringValue().equalsIgnoreCase(paramID)){ mimeType = currentOutput.getComplexOutput().getDefault().getFormat().getMimeType(); } } return mimeType; }
for(InputDescriptionType tempDesc : this.processDesc.getDataInputs().getInputArray()) { if(inputID.equals(tempDesc.getIdentifier().getStringValue())) { inputPD = tempDesc; LOGGER.debug("Input cannot be found in description for " + this.processDesc.getIdentifier().getStringValue() + "," + inputID); throw new RuntimeException("Input cannot be found in description for " + this.processDesc.getIdentifier().getStringValue() + "," + inputID);
public boolean processDescriptionIsValid() { return processDescription.validate(); }
public ProcessDescriptionType createDescribeProcessType(GeoAlgorithm algorithm) throws NullParameterAdditionalInfoException, UnsupportedGeoAlgorithmException{ ProcessDescriptionType pdt = ProcessDescriptionType.Factory.newInstance(); pdt.setStatusSupported(true); pdt.setStoreSupported(true); pdt.addNewAbstract().setStringValue(algorithm.getName()); pdt.addNewTitle().setStringValue(algorithm.getName()); pdt.addNewIdentifier().setStringValue(algorithm.getCommandLineName()); pdt.setProcessVersion("1.0.0"); //inputs DataInputs inputs = pdt.addNewDataInputs(); ParametersSet params = algorithm.getParameters(); for (int i = 0; i < params.getNumberOfParameters(); i++) { Parameter param = params.getParameter(i); addParameter(inputs, param); } //grid extent for raster layers (if needed) if (algorithm.getUserCanDefineAnalysisExtent()){ addGridExtent(inputs, algorithm.requiresRasterLayers()); } //outputs ProcessOutputs outputs = pdt.addNewProcessOutputs(); OutputObjectsSet ooset = algorithm.getOutputObjects(); for (int i = 0; i < ooset.getOutputObjectsCount(); i++) { Output out = ooset.getOutput(i); addOutput(outputs, out); } return pdt; }
/** * Enriches the capabilities skeleton by creating the process offerings. * * @param skel * the skeleton to enrich */ private static void initProcessOfferings(CapabilitiesDocument skel) { ProcessOfferings processes = skel.getCapabilities() .addNewProcessOfferings(); for (String algorithmName : RepositoryManager.getInstance() .getAlgorithms()) { try { ProcessDescriptionType description = RepositoryManager .getInstance().getProcessDescription(algorithmName); if (description != null) { ProcessBriefType process = processes.addNewProcess(); CodeType ct = process.addNewIdentifier(); ct.setStringValue(algorithmName); LanguageStringType title = description.getTitle(); String processVersion = description.getProcessVersion(); process.setProcessVersion(processVersion); process.setTitle(title); } } catch (RuntimeException e) { LOG.warn("Exception during instantiation of process {}", algorithmName, e); } } }
private synchronized void writeObject(java.io.ObjectOutputStream oos) throws IOException { try { oos.writeObject(processDescription.xmlText()); oos.writeObject(executeDocument.xmlText()); oos.writeObject(applicationFiles); oos.writeObject(config); Map<String, List<String>> serializedInputData = new HashMap<String, List<String>>(); createSerialized(input, processDescription, executeDocument, serializedInputData); oos.writeObject(serializedInputData); } catch (ExceptionReport e) { LOGGER.error(e); throw new IOException(e.getMessage()); } }
String toolName = this.processDescription.getTitle().getStringValue(); LOGGER.info("Executing ArcGIS tool " + toolName + " . Parameter array contains " + this.parameterCount + " parameters."); try {
description.getDataInputs()); if (inputDesc == null) { throw new ExceptionReport("Data Identifier not supported: " ProcessDescriptionType description = RepositoryManager.getInstance().getProcessDescription(processID); OutputDescriptionType outputDesc = XMLBeansHelper .findOutputByID(outputDataInput, description.getProcessOutputs() .getOutputArray()); if (outputDesc == null) { OutputDescriptionType outputDesc = XMLBeansHelper.findOutputByID( rawDataInput, description.getProcessOutputs().getOutputArray()); if (outputDesc == null) { throw new ExceptionReport(
if (!processDescription.getIdentifier().getStringValue().equals(this.getClass().getName()) && !processDescription.getIdentifier().getStringValue().equals(this.getWellKnownName())) processDescription.getIdentifier().setStringValue(this.getClass().getName()); LOGGER.warn("Identifier was not correct, was changed now temporary for server use to " + this.getClass().getName() + ". Please change it later in the description!"); validationOptions.setErrorListener(validationErrors); boolean isValid = processDescription.validate(validationOptions);
public boolean processDescriptionIsValid() { return processDescription.validate(); }
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(); }
private synchronized void writeObject(java.io.ObjectOutputStream oos) throws IOException { try { oos.writeObject(processDescription.xmlText()); oos.writeObject(executeDocument.xmlText()); oos.writeObject(applicationFiles); oos.writeObject(config); Map serializedData = new HashMap(); createSerialized(output, processDescription, executeDocument, serializedData); oos.writeObject(serializedData); } catch (ExceptionReport e) { LOGGER.error(e); throw new IOException(e.getMessage()); } }
@Override public String getWellKnownName() { return getDescription().getIdentifier().getStringValue(); }
@Override public Class< ? > getOutputDataType(String id) { OutputDescriptionType[] outputs = this.getDescription().getProcessOutputs().getOutputArray();
/** * * @param id * @return the specified parameterdescription. if not available it returns null. */ private InputDescriptionType getParameterDescription(String id) { InputDescriptionType[] inputDescs = processDesc.getDataInputs().getInputArray(); for (InputDescriptionType inputDesc : inputDescs) { if(inputDesc.getIdentifier().getStringValue().equals(id)) { return inputDesc; } } return null; }