/** * 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); } } }
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(); }