Package net.opengis.wps10

Examples of net.opengis.wps10.ExecuteResponseType


    }
   
    @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

        processOutputs( outputs, pf, name );
     }
   
    void dataInputs( DataInputsType inputs, ProcessFactory pf, Name name) {
        for(Parameter<?> p : pf.getParameterInfo(name).values()) {
            InputDescriptionType input = wpsf.createInputDescriptionType();
            inputs.getInput().add( input );
           
            input.setIdentifier( Ows11Util.code( p.key ) );
            input.setTitle( Ows11Util.languageString( p.title ) );
            input.setAbstract( Ows11Util.languageString( p.description ) );
           
            // WPS spec specifies non-negative for unlimited inputs, so -1 -> 0
            input.setMaxOccurs( p.maxOccurs == -1
                ? BigInteger.valueOf( Long.MAX_VALUE ) : BigInteger.valueOf( p.maxOccurs ) );
            
            input.setMinOccurs( BigInteger.valueOf( p.minOccurs ) );
           
            List<ProcessParameterIO> ppios = ProcessParameterIO.findAll( p, context);
            if ( ppios.isEmpty() ) {
                throw new WPSException( "Could not find process parameter for type " + p.key + "," + p.type );
            }
          
            //handle the literal case
            if ( ppios.size() == 1 && ppios.get( 0 ) instanceof LiteralPPIO ) {
                LiteralPPIO lppio = (LiteralPPIO) ppios.get( 0 );
               
                LiteralInputType literal = wpsf.createLiteralInputType();
                input.setLiteralData( literal );
               
                //map the java class to an xml type name
                if ( !String.class.equals( lppio.getType() ) ) {
                    Name typeName = xsp.name( lppio.getType() );
                    if ( typeName != null ) {
                        literal.setDataType( Ows11Util.type( typeName.getLocalPart() ) );       
                    }   
                }
                literal.setAnyValue( owsf.createAnyValueType() );

                //TODO: output the default value
            }
            else {
                //handle the complex data case
                SupportedComplexDataInputType complex = wpsf.createSupportedComplexDataInputType();
                input.setComplexData( complex );
               
                complex.setSupported( wpsf.createComplexDataCombinationsType() );
                for ( ProcessParameterIO ppio : ppios ) {
                    ComplexPPIO cppio = (ComplexPPIO) ppio;
View Full Code Here

           
            //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

     * <!-- 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

       
        //parse the inputs for the request
        Map<String, Object> inputs = new HashMap();
       
        for ( Iterator i = request.getDataInputs().getInput().iterator(); i.hasNext(); ) {
            InputType input = (InputType) i.next();
           
            //locate the parameter for this request
            Parameter p = pf.getParameterInfo(processName).get( input.getIdentifier().getValue() );
            if ( p == null ) {
                throw new WPSException( "No such parameter: " + input.getIdentifier().getValue() );
            }
           
            //find the ppio
            ProcessParameterIO ppio = ProcessParameterIO.find( p, context );
            if ( ppio == null ) {
                throw new WPSException( "Unable to decode input: " + input.getIdentifier().getValue() );
            }
           
            //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();
View Full Code Here

       
        DefaultType2 defaultLanguage = wpsf.createDefaultType2();
        languages.setDefault(defaultLanguage);
        defaultLanguage.setLanguage("en-US");
       
        LanguagesType supportedLanguages = wpsf.createLanguagesType();
        languages.setSupported( supportedLanguages );
        supportedLanguages.getLanguage().add( "en-US");
       
        return caps;
        // Version detection and alternative invocation if being implemented.
    }
View Full Code Here

       
        DefaultType2 def = factory.createDefaultType2();
        langs.setDefault( def );
        def.setLanguage( (String) node.getChildValue( "Default") );
       
        LanguagesType supported = (LanguagesType) node.getChildValue( "Supported" );
        langs.setSupported( supported );
       
        return langs;
    }
View Full Code Here

                p.setAbstract(Ows11Util.languageString( pf.getDescription(name).toString()));
            }
           
        }

        LanguagesType1 languages = wpsf.createLanguagesType1();
        caps.setLanguages( languages );
       
        DefaultType2 defaultLanguage = wpsf.createDefaultType2();
        languages.setDefault(defaultLanguage);
        defaultLanguage.setLanguage("en-US");
       
        LanguagesType supportedLanguages = wpsf.createLanguagesType();
        languages.setSupported( supportedLanguages );
        supportedLanguages.getLanguage().add( "en-US");
       
        return caps;
        // Version detection and alternative invocation if being implemented.
    }
View Full Code Here

     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public NotificationChain basicSetLanguages(LanguagesType1 newLanguages, NotificationChain msgs) {
        LanguagesType1 oldLanguages = languages;
        languages = newLanguages;
        if (eNotificationRequired()) {
            ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Wps10Package.WPS_CAPABILITIES_TYPE__LANGUAGES, oldLanguages, newLanguages);
            if (msgs == null) msgs = notification; else msgs.add(notification);
        }
View Full Code Here

TOP

Related Classes of net.opengis.wps10.ExecuteResponseType

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.