@Override public ResourceMetadata<OWS> createFromLocation( Workspace workspace, ResourceLocation<OWS> location ) { return new WpsMetadata( workspace, location, this ); }
@Override public OWS build() { return new WPService( metadata, workspace, config ); }
private static ExceptionCustomizer lookupExceptionCustomizer( CodeType processId, Map<CodeType, WPSProcess> idToProcess ) { ExceptionCustomizer result = idToProcess.get( processId ).getExceptionCustomizer(); if ( result == null ) { result = new DefaultExceptionCustomizer( processId ); } return result; }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); boolean crosses = geometry1.crosses( geometry2 ); LiteralOutput crossesOutput = (LiteralOutput) out.getParameter( "Crosses" ); crossesOutput.setValue( String.valueOf( crosses ) ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); Geometry union = geometry1.getUnion( geometry2 ); ComplexOutput unionOutput = (ComplexOutput) out.getParameter( "Union" ); writeGeometry( unionOutput, union ); }
private String getLiteralInputValue( ProcessletInputs in, String paramId ) { LiteralInput input = ( (LiteralInput) in.getParameter( paramId ) ); return input == null ? null : input.getValue(); }
private void doGetCapabilities( GetCapabilities request, HttpResponseBuffer response ) throws OWSException, XMLStreamException, IOException { LOG.trace( "doGetCapabilities invoked, request: " + request ); // generic check if requested version is supported (currently this is only 1.0.0) negotiateVersion( request ); response.setContentType( "text/xml; charset=UTF-8" ); XMLStreamWriter xmlWriter = response.getXMLWriter(); WSDL serviceWSDL = new WSDL( "services" + File.separatorChar + "wps.wsdl" ); CapabilitiesXMLWriter.export100( xmlWriter, processManager.getProcesses(), mainMetadataConf, serviceWSDL ); LOG.trace( "doGetCapabilities finished" ); }
@Override public void destroy() { for ( WPSProcess process : idToProcess.values() ) { process.getProcesslet().destroy(); } }
private void doGetResponseDocument( String responseId, HttpResponseBuffer response ) { LOG.trace( "doGetResponseDocument invoked, requested stored response document: " + responseId ); ResponseDocumentStorage resource = storageManager.lookupResponseDocumentStorage( responseId, getHttpGetURL() ); executeHandler.sendResponseDocument( response, resource ); LOG.trace( "doGetResponseDocument finished" ); }
/** * This method should be called in lieu of the constructor directly to ensure the ProcessExecution gets added to the * processList. See {@link ProcessExecution} for a definition of the parameters. */ private ProcessExecution createProcessletExecution( ExecuteRequest request, StorageLocation responseStorage, URL serviceInstance, List<RequestedOutput> outputParams, ProcessletOutputs outputs ) { ProcessExecution result = new ProcessExecution( request, responseStorage, serviceInstance, outputParams, outputs ); synchronized ( processStateList ) { if ( processStateList.size() == maxEntries ) { processStateList.poll(); } processStateList.add( result ); } return result; }
private void sendServiceException( OWSException ex, HttpResponseBuffer response ) throws ServletException { sendException( null, new OWS110ExceptionReportSerializer( VERSION_100 ), ex, response ); }
private CodeType parseRequiredIdentifier( OMElement el, ExceptionCustomizer eCustomizer ) throws OWSException { OMElement codeTypeElement = el.getFirstChildWithName( new QName( OWS110_NS, "Identifier" ) ); if ( codeTypeElement == null ) { throw eCustomizer.missingParameter( el.getLocalName() + "/" + new QName( OWS110_NS, "Identifier" ) ); } // "codeSpace" attribute (optional) String codeSpace = codeTypeElement.getAttributeValue( new QName( "codeSpace" ) ); // text value String value = codeTypeElement.getText(); return new CodeType( value, codeSpace ); } }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); boolean touches = geometry1.touches( geometry2 ); LiteralOutput touchesOutput = (LiteralOutput) out.getParameter( "Touches" ); touchesOutput.setValue( String.valueOf( touches ) ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); Geometry intersection = geometry1.getIntersection( geometry2 ); ComplexOutput intersectionOutput = (ComplexOutput) out.getParameter( "Intersection" ); writeGeometry( intersectionOutput, intersection ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); boolean equals = geometry1.equals( geometry2 ); LiteralOutput equalsOutput = (LiteralOutput) out.getParameter( "Equals" ); equalsOutput.setValue( String.valueOf( equals ) ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); Geometry difference = geometry1.getDifference( geometry2 ); ComplexOutput differenceOutput = (ComplexOutput) out.getParameter( "Difference" ); writeGeometry( differenceOutput, difference ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); boolean contains = geometry1.contains( geometry2 ); LiteralOutput containsOutput = (LiteralOutput) out.getParameter( "Contains" ); containsOutput.setValue( String.valueOf( contains ) ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput = (ComplexInput) in.getParameter( "GMLInput" ); Geometry geometry = readGeometry( gmlInput ); Point centroid = geometry.getCentroid(); ComplexOutput centroidOutput = (ComplexOutput) out.getParameter( "Centroid" ); writeGeometry( centroidOutput, centroid ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput1 = (ComplexInput) in.getParameter( "GMLInput1" ); ComplexInput gmlInput2 = (ComplexInput) in.getParameter( "GMLInput2" ); Geometry geometry1 = readGeometry( gmlInput1 ); Geometry geometry2 = readGeometry( gmlInput2 ); Measure distance = geometry1.getDistance( geometry2, null ); LiteralOutput distanceOutput = (LiteralOutput) out.getParameter( "Distance" ); distanceOutput.setValue( String.valueOf( distance.getValueAsDouble() ) ); }
@Override public void process( ProcessletInputs in, ProcessletOutputs out, ProcessletExecutionInfo info ) throws ProcessletException { ComplexInput gmlInput = (ComplexInput) in.getParameter( "GMLInput" ); Geometry geometry = readGeometry( gmlInput ); Geometry hulledGeometry = geometry.getConvexHull(); ComplexOutput hullOutput = (ComplexOutput) out.getParameter( "ConvexHull" ); writeGeometry( hullOutput, hulledGeometry ); }