Examples of InputReferenceType


Examples of net.opengis.wps10.InputReferenceType

           
            //read the data
            Object decoded = null;
            if ( input.getReference() != null ) {
                //this is a reference
                InputReferenceType ref = input.getReference();
               
                //grab the location and method
                String href = ref.getHref();
                MethodType meth = ref.getMethod() != null ? ref.getMethod() : MethodType.GET_LITERAL;
               
                //handle get vs post
                if ( meth == MethodType.POST_LITERAL ) {
                    //post, handle the body
                }
                else {
                    //get, parse kvp
                }
            }
            else {
                //actual data, figure out which type
                DataType data = input.getData();
              
                if ( data.getLiteralData() != null ) {
                    LiteralDataType literal = data.getLiteralData();
                    decoded = ((LiteralPPIO)ppio).decode( literal.getValue() );
                }
                else if ( data.getComplexData() != null ) {
                    ComplexDataType complex = data.getComplexData();
                    decoded = complex.getData().get( 0 );
                    try {
                        decoded = ((ComplexPPIO)ppio).decode( decoded );
                    }
                    catch (Exception e) {
                        throw new WPSException( "Unable to decode input: " + input.getIdentifier().getValue() );
                    }
                }
               
            }
           
            //decode the input
            inputs.put( p.key, decoded );
        }
       
        //execute the process
        Map<String,Object> result = null;
        Throwable error = null;
        try {
            Process p = pf.create(processName);
            result = p.execute( inputs, null );   
        }
        catch( Throwable t ) {
            //save the error to report back
            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));
            processOutputs.getOutput().add( output );
           
            final Object o = result.get( key );
            ProcessParameterIO ppio = ppios.get( key );
           
            if ( ppio instanceof ReferencePPIO ) {
                //encode as a reference
                OutputReferenceType ref = f.createOutputReferenceType();
                output.setReference( ref );
               
                //TODO: mime type
                ref.setHref( ((ReferencePPIO) ppio).encode(o).toString() );
            }
            else {
                //encode as data
                DataType data = f.createDataType();
                output.setData( data );
View Full Code Here

Examples of net.opengis.wps10.InputReferenceType

     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public NotificationChain basicSetReference(InputReferenceType newReference, NotificationChain msgs) {
        InputReferenceType oldReference = reference;
        reference = newReference;
        if (eNotificationRequired()) {
            ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Wps10Package.INPUT_TYPE__REFERENCE, oldReference, newReference);
            if (msgs == null) msgs = notification; else msgs.add(notification);
        }
View Full Code Here

Examples of net.opengis.wps10.InputReferenceType

                      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);
View Full Code Here

Examples of net.opengis.wps10.InputReferenceType

            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();

        QName typeName = (QName) ((QueryType)gft.getQuery().get(0)).getTypeName().get(0);
        assertEquals("states", typeName.getLocalPart());
        assertEquals("http://usa.org", typeName.getNamespaceURI());
    }
View Full Code Here

Examples of net.opengis.wps10.InputReferenceType

        ExecuteType execute = (ExecuteType) parse(WPS.Execute);
       
        assertEquals("orci:Bounds", execute.getIdentifier().getValue());
        InputType input = (InputType) execute.getDataInputs().getInput().get(0);
        assertEquals("features", input.getIdentifier().getValue());
        InputReferenceType ref = input.getReference();
        assertNotNull(ref);
        assertEquals("http://demo.opengeo.org/geoserver/wfs", ref.getHref());
        assertEquals(MethodType.POST_LITERAL, ref.getMethod());
        // we cannot do this still as the parser strips the white space out of CDATA sections
        // assertEquals(body, ref.getBody());
        // cannot run this either, could not find a way to extract the content element from the parser...
        // assertNull(ref.getContentElement());
    }
View Full Code Here

Examples of net.opengis.wps10.InputReferenceType

        ExecuteType execute = (ExecuteType) parse(WPS.Execute);
       
        assertEquals("orci:Bounds", execute.getIdentifier().getValue());
        InputType input = (InputType) execute.getDataInputs().getInput().get(0);
        assertEquals("features", input.getIdentifier().getValue());
        InputReferenceType ref = input.getReference();
        assertNotNull(ref);
        assertEquals("http://demo.opengeo.org/geoserver/wfs", ref.getHref());
        assertEquals(MethodType.POST_LITERAL, ref.getMethod());
        assertTrue(ref.getBody() instanceof GetFeatureType);
        // could not find any way to extract the content element...
        // assertEquals(WFS.GetFeature, ref.getContentElement());
    }
View Full Code Here

Examples of net.opengis.wps10.InputReferenceType

        return result;
    }

    private InputReferenceType parseReferenceType(InputType it, Wps10Factory factory,
            IOParam param) {
        InputReferenceType ref = factory.createInputReferenceType();
        if(param.attributes.containsKey("href")) {
            ref.setHref(param.attributes.get("href"));
        } else {
            ref.setHref(param.attributes.get("xlink:href"));
        }
        ref.setEncoding(param.attributes.get("encoding"));
        ref.setMimeType(param.attributes.get("mimetype"));
        ref.setSchema(param.attributes.get("schema"));
       
        return ref;
    }
View Full Code Here

Examples of net.opengis.wps10.InputReferenceType

            // read the data
            Object decoded = null;
            try {
                if (input.getReference() != null) {
                    // this is a reference
                    InputReferenceType ref = input.getReference();

                    // grab the location and method
                    String href = ref.getHref();

                    if (href.startsWith("http://geoserver/wfs")) {
                        decoded = handleAsInternalWFS(ppio, ref);
                    } else if (href.startsWith("http://geoserver/wcs")) {
                        decoded = handleAsInternalWCS(ppio, ref);
View Full Code Here

Examples of net.opengis.wps10.InputReferenceType

        return result;
    }

    private InputReferenceType parseReferenceType(InputType it, Wps10Factory factory,
            IOParam param) {
        InputReferenceType ref = factory.createInputReferenceType();
        if(param.attributes.containsKey("href")) {
            ref.setHref(param.attributes.get("href"));
        } else {
            ref.setHref(param.attributes.get("xlink:href"));
        }
        ref.setEncoding(param.attributes.get("encoding"));
        ref.setMimeType(param.attributes.get("mimetype"));
        ref.setSchema(param.attributes.get("schema"));
       
        return ref;
    }
View Full Code Here

Examples of net.opengis.wps10.InputReferenceType

   
    public boolean longParse() {
        if(input.getReference() == null) {
            return false;
        } else {
            InputReferenceType ref = input.getReference();

            // grab the location and method
            String href = ref.getHref();

            if (href.startsWith("http://geoserver/wfs")) {
                // we get a collection almost instantly
                return false;
            } else if (href.startsWith("http://geoserver/wcs")) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.