Package net.opengis.wps10

Examples of net.opengis.wps10.ExecuteType


            error = t;
        }
       
        //build the response
        Wps10Factory f = Wps10Factory.eINSTANCE;
        ExecuteResponseType response = f.createExecuteResponseType();
        response.setLang("en");
        response.setServiceInstance(ResponseUtils.appendQueryString(ResponseUtils.buildURL(request.getBaseUrl(), "ows", null, URLType.SERVICE), ""));
      
        //process
        final ProcessBriefType process = f.createProcessBriefType();
        response.setProcess( process );
        process.setIdentifier(ct);
        process.setProcessVersion(pf.getVersion(processName));
        process.setTitle( Ows11Util.languageString( pf.getTitle(processName).toString() ) );
        process.setAbstract( Ows11Util.languageString( pf.getDescription(processName).toString() ) );
      
        //status
        response.setStatus( f.createStatusType() );
        response.getStatus().setCreationTime( Converters.convert( started, XMLGregorianCalendar.class ));
       
        if ( error != null ) {
            ProcessFailedType failure = f.createProcessFailedType();
            response.getStatus().setProcessFailed( failure );
           
            failure.setExceptionReport( Ows11Util.exceptionReport( new ServiceException( error ), wps.getGeoServer().getGlobal().isVerboseExceptions()) );
        }
        else {
            response.getStatus().setProcessSucceeded( "Process succeeded.");
        }
     
        //inputs
        response.setDataInputs( f.createDataInputsType1() );
        for ( Iterator i = request.getDataInputs().getInput().iterator(); i.hasNext(); ) {
            InputType input = (InputType) i.next();
            response.getDataInputs().getInput().add( EMFUtils.clone( input, f, true ) );
        }
       
        //output definitions
        OutputDefinitionsType outputs = f.createOutputDefinitionsType();
        response.setOutputDefinitions( outputs );
       
        Map<String,Parameter<?>> outs = pf.getResultInfo(processName, null);
        Map<String,ProcessParameterIO> ppios = new HashMap();
       
        for ( String key : result.keySet() ) {
            Parameter p = pf.getResultInfo(processName, null).get( key );
            if ( p == null ) {
                throw new WPSException( "No such output: " + key );
            }
           
            //find the ppio
            ProcessParameterIO ppio = ProcessParameterIO.find( p, context );
            if ( ppio == null ) {
                throw new WPSException( "Unable to encode output: " + p.key );
            }
            ppios.put( p.key, ppio );
           
            DocumentOutputDefinitionType output = f.createDocumentOutputDefinitionType();
            outputs.getOutput().add( output );
           
            output.setIdentifier( Ows11Util.code( p.key ) );
            if ( ppio instanceof ComplexPPIO ) {
                output.setMimeType( ((ComplexPPIO) ppio).getMimeType() );
            }
           
            //TODO: encoding + schema
        }
       
        //process outputs
        ProcessOutputsType1 processOutputs = f.createProcessOutputsType1();
        response.setProcessOutputs( processOutputs );
       
        for ( String key : result.keySet() ) {
            OutputDataType output = f.createOutputDataType();
            output.setIdentifier(Ows11Util.code(key));
            output.setTitle(Ows11Util.languageString(pf.getResultInfo(processName, null).get( key ).description));
View Full Code Here


        if (execute.getResponseForm().getRawDataOutput() == null) {
            // normal execute response encoding
            return standardResponse.getMimeType(value, operation);
        } else {
            // raw response, let's see what the output is
            ExecuteResponseType response = (ExecuteResponseType) value;
            OutputDataType result = (OutputDataType) response
                    .getProcessOutputs().getOutput().get(0);
            LiteralDataType literal = result.getData().getLiteralData();
            if(literal != null) {
                // literals are encoded as plain strings
                return "text/plain";
            } else {
                // Execute should have properly setup the mime type
                OutputDefinitionType definition = (OutputDefinitionType) response
                    .getOutputDefinitions().getOutput().get(0);
                return definition.getMimeType();
            }
        }
View Full Code Here

        if (execute.getResponseForm().getRawDataOutput() == null) {
            // normal execute response encoding
            standardResponse.write(value, output, operation);
        } else {
            // raw response, let's see what the output is
            ExecuteResponseType response = (ExecuteResponseType) value;
            OutputDataType result = (OutputDataType) response
                    .getProcessOutputs().getOutput().get(0);
            LiteralDataType literal = result.getData().getLiteralData();
            if (literal != null) {
                writeLiteral(output, literal);
            } else {
View Full Code Here

    }
   
    @Override
    public String getMimeType(Object value, Operation operation)
            throws ServiceException {
        ExecuteType execute = (ExecuteType) operation.getParameters()[0];
        if (execute.getResponseForm().getRawDataOutput() == null) {
            // normal execute response encoding
            return standardResponse.getMimeType(value, operation);
        } else {
            // raw response, let's see what the output is
            ExecuteResponseType response = (ExecuteResponseType) value;
View Full Code Here

    }

    @Override
    public void write(Object value, OutputStream output, Operation operation)
            throws IOException, ServiceException {
        ExecuteType execute = (ExecuteType) operation.getParameters()[0];
        if (execute.getResponseForm().getRawDataOutput() == null) {
            // normal execute response encoding
            standardResponse.write(value, output, operation);
        } else {
            // raw response, let's see what the output is
            ExecuteResponseType response = (ExecuteResponseType) value;
View Full Code Here

        Configuration config = new WPSConfiguration();
        Encoder encoder = new Encoder(config);
        encoder.setIndenting(true);

        // http://schemas.opengis.net/wps/1.0.0/wpsExecute_request.xsd
        ExecuteType request = createExecuteType();
        encoder.encode(request, WPS.Execute, outputStream);
        // System.out.println(outputStream.toString());
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    private ExecuteType createExecuteType()
    {
        ExecuteType request = Wps10Factory.eINSTANCE.createExecuteType();

        // identifier
        CodeType codetype = Ows11Factory.eINSTANCE.createCodeType();
        String iden = (String) this.properties.get(this.IDENTIFIER);
        codetype.setValue(iden);
        request.setIdentifier(codetype);

        // service and version
        request.setService("WPS"); // TODO: un-hardcode
        request.setVersion("1.0.0"); // TODO: un-hardcode

        // inputs - loop through inputs and add them
        if ((this.inputs != null) && !this.inputs.isEmpty())
        {
            DataInputsType1 inputtypes = Wps10Factory.eINSTANCE.createDataInputsType1();

            Set<Object> keyset = this.inputs.keySet();
            Iterator<Object> iterator = keyset.iterator();
            while (iterator.hasNext())
            {
                Object key = iterator.next();
                List<DataType> objects = (List<DataType>) this.inputs.get(key);

                // go through the list and create on input for each datatype in the list
                Iterator<DataType> iterator2 = objects.iterator();
                while (iterator2.hasNext())
                {
                    // identifier
                    EObject oInput = iterator2.next();
                    if (oInput instanceof DataType) {
                      DataType dt = (DataType) oInput;
                      InputType input = Wps10Factory.eINSTANCE.createInputType();
                      CodeType ct = Ows11Factory.eINSTANCE.createCodeType();
                      ct.setValue((String) key);
                      input.setIdentifier(ct);
                      input.setData((DataType) dt);
                      inputtypes.getInput().add(input);
                    } else if (oInput instanceof InputReferenceType) {
                      InputReferenceType rt = (InputReferenceType) oInput;
                      InputType input = Wps10Factory.eINSTANCE.createInputType();
                      CodeType ct = Ows11Factory.eINSTANCE.createCodeType();
                      ct.setValue((String) key);
                      input.setIdentifier(ct);
                      input.setReference(rt);
                      inputtypes.getInput().add(input);
                    } else {
                        throw new IllegalStateException("The input for key " + key + " contain an unsupported object of type " + oInput.getClass());
                    }
                }
            }

            request.setDataInputs(inputtypes);
        }

        if (this.responseForm != null)
        {
            // responsetype
            request.setResponseForm(this.responseForm);
        }

        return request;
    }
View Full Code Here

*/
public class ExecuteTest extends XMLTestSupport {

    public void testExecuteEncode() throws Exception {
        Wps10Factory f = Wps10Factory.eINSTANCE;
        ExecuteType ex = f.createExecuteType();

        CodeType id = Ows11Factory.eINSTANCE.createCodeType();
        ex.setIdentifier(id);
        id.setValue("foo");

        DataInputsType1 inputs = f.createDataInputsType1();
        ex.setDataInputs(inputs);

        InputType in = f.createInputType();
        inputs.getInput().add(in);

        DataType data = f.createDataType();
View Full Code Here

    }


    public void testParserDelegateNamespaces() throws Exception {
        Parser p = new Parser(new WPSConfiguration());
        ExecuteType exec = (ExecuteType)
            p.parse(getClass().getResourceAsStream("wpsExecute_inlineGetFeature_request.xml"));
        assertNotNull(exec);
        assertEquals(1, exec.getDataInputs().getInput().size());

        InputType in = (InputType) exec.getDataInputs().getInput().get(0);
        InputReferenceType ref = in.getReference();
        assertNotNull(ref);

        assertTrue(ref.getBody() instanceof GetFeatureType);
        GetFeatureType gft = (GetFeatureType) ref.getBody();
View Full Code Here

        assertEquals("http://usa.org", typeName.getNamespaceURI());
    }
   
    public void testFilterParserDelegate() throws Exception {
        Parser p = new Parser(new WPSConfiguration());
        ExecuteType exec = (ExecuteType)
            p.parse(getClass().getResourceAsStream("wpsExecuteFilterInline.xml"));
        assertNotNull(exec);
        assertEquals(1, exec.getDataInputs().getInput().size());

        InputType in = (InputType) exec.getDataInputs().getInput().get(0);
        ComplexDataType cd = in.getData().getComplexData();
        assertNotNull(cd);
        Filter filter = (Filter) cd.getData().get(0);
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
        Filter expected = ff.or(ff.greaterOrEqual(ff.property("PERSONS"), ff.literal("10000000")), ff.lessOrEqual(ff.property("PERSONS"), ff.literal("20000000")));
View Full Code Here

TOP

Related Classes of net.opengis.wps10.ExecuteType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.