Examples of LiteralDataType


Examples of net.opengis.wps10.LiteralDataType

            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 );
          
                if ( ppio instanceof LiteralPPIO ) {
                    LiteralDataType literal = f.createLiteralDataType();
                    data.setLiteralData( literal );
                   
                    literal.setValue( ((LiteralPPIO) ppio).encode( o ) );
                }
                else if ( ppio instanceof ComplexPPIO ) {
                    ComplexDataType complex = f.createComplexDataType();
                    data.setComplexData( complex );
                   
View Full Code Here

Examples of net.opengis.wps10.LiteralDataType

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

Examples of net.opengis.wps10.LiteralDataType

        } 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 {
                writeComplex(output, result);
            }
View Full Code Here

Examples of net.opengis.wps10.LiteralDataType

     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public NotificationChain basicSetLiteralData(LiteralDataType newLiteralData, NotificationChain msgs) {
        LiteralDataType oldLiteralData = literalData;
        literalData = newLiteralData;
        if (eNotificationRequired()) {
            ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Wps10Package.DATA_TYPE__LITERAL_DATA, oldLiteralData, newLiteralData);
            if (msgs == null) msgs = notification; else msgs.add(notification);
        }
View Full Code Here

Examples of net.opengis.wps10.LiteralDataType

        // check result correctness
        EList outputs = executeResponse.getProcessOutputs().getOutput();
        assertTrue(!outputs.isEmpty());

        OutputDataType output = (OutputDataType) outputs.get(0);
        LiteralDataType literalData = output.getData().getLiteralData();
        String value = literalData.getValue();
        Double result = new Double(value);
        Double expected = 77.84 + 40039.229;
        assertEquals(result, expected);

    }
View Full Code Here

Examples of net.opengis.wps10.LiteralDataType

        DataType dt = Wps10Factory.eINSTANCE.createDataType();

        if (type == INPUTTYPE_LITERAL)
        {

            LiteralDataType ldt = Wps10Factory.eINSTANCE.createLiteralDataType();
            ldt.setValue(obj.toString());
            dt.setLiteralData(ldt);
        }
        else
        {
            // assume complex data
View Full Code Here

Examples of net.opengis.wps10.LiteralDataType

        while (iterator.hasNext())
        {
            OutputDataType odt = (OutputDataType) iterator.next();
            DataType data = odt.getData();
            ComplexDataType complexData = data.getComplexData();
            LiteralDataType literalData = data.getLiteralData();
            if (literalData != null)
            {
                // use the converters api to try and create an object of the type
                // we want (default to the String value if it failed).
                Object value = literalData.getValue();
                if (literalData.getDataType() != null)
                {
                    Class type = getLiteralTypeFromReference(literalData.getDataType());
                    Object convertedValue = Converters.convert(literalData.getValue(), type);
                    if (convertedValue != null)
                    {
                        value = convertedValue;
                    }
                }
View Full Code Here

Examples of net.opengis.wps10.LiteralDataType

    @Override
    public DataType createLiteralInputValue(String literalValue)
    {
        DataType literalInputValue = wpsFactory.createDataType();
        LiteralDataType literalDataType = wpsFactory.createLiteralDataType();
        literalDataType.setValue(literalValue);
        literalInputValue.setLiteralData(literalDataType);

        return literalInputValue;
    }
View Full Code Here

Examples of net.opengis.wps10.LiteralDataType

            throw new WPSException("Failed to parse the bounding box", e);
        }
    }

    private LiteralDataType parseLiteral(InputType it, Wps10Factory factory, IOParam param) {
        LiteralDataType literal = factory.createLiteralDataType();
        literal.setValue(param.value);
        literal.setDataType(param.attributes.get("datatype"));
        literal.setUom(param.attributes.get("uom"));
       
        return literal;
    }
View Full Code Here

Examples of net.opengis.wps10.LiteralDataType

                DataType data = f.createDataType();
                output.setData(data);

                try {
                  if (ppio instanceof LiteralPPIO) {
                      LiteralDataType literal = f.createLiteralDataType();
                      data.setLiteralData(literal);
 
                      literal.setValue(((LiteralPPIO) ppio).encode(o));
                  } else if (ppio instanceof BoundingBoxPPIO) {
                      BoundingBoxType bbox = ((BoundingBoxPPIO) ppio).encode(o);
                      data.setBoundingBoxData(bbox);
                  } else if (ppio instanceof ComplexPPIO) {
                      ComplexDataType complex = f.createComplexDataType();
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.