Package org.geotools.data

Examples of org.geotools.data.Parameter


        Map<String, Parameter<?>> gtParams = new HashMap<String, Parameter<?>>();
        for (Map.Entry<String,Object> entry : jsParams.entrySet()) {
            gtParams.put(
                entry.getKey(),
                new Parameter(
                    entry.getKey(),
                    (Class)entry.getValue(),
                    Text.text(entry.getKey()),
                    Text.text(entry.getKey())
                )
View Full Code Here


        Map<String, Parameter<?>> gtParams = new HashMap<String, Parameter<?>>();
        for (Map.Entry<String,Object> entry : jsParams.entrySet()) {
            gtParams.put(
                entry.getKey(),
                new Parameter(
                    entry.getKey(),
                    (Class)entry.getValue(),
                    Text.text(entry.getKey()),
                    Text.text(entry.getKey())
                )
View Full Code Here

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

        ParametersSet paramSet = algorithm.getParameters();
        Map<String, Parameter<?>> paramInfo = new HashMap<String, Parameter<?>>();

        for (int i = 0; i < paramSet.getNumberOfParameters(); i++) {
            es.unex.sextante.parameters.Parameter param = paramSet.getParameter(i);
            paramInfo.put(param.getParameterName(), new Parameter(param.getParameterName(),
                    mapToGeoTools(param.getParameterClass()), Text.text(param
                            .getParameterDescription()),
                    Text.text(param.getParameterDescription()), getAdditionalInfoMap(param)));
        }
View Full Code Here

            }
            if (output instanceof OutputText) {
                outputClass = String.class;
            }

            outputInfo.put(output.getName(), new Parameter(output.getName(), outputClass, Text
                    .text(output.getDescription()), Text.text(output.getDescription())));
        }

        return outputInfo;
View Full Code Here

            maxOccurs = ((Number) maxOccursObj).intValue();
            maxOccurs = maxOccurs >= minOccurs ? maxOccurs : Integer.MAX_VALUE;
        }

        @SuppressWarnings({ "rawtypes", "unchecked" })
        Parameter<?> parameter = new Parameter(
                name, binding, i18nTitle, i18nDesc, true, minOccurs, maxOccurs,
                null, null);
       
        return parameter;
    }
View Full Code Here

            }

            String identifier = idt.getIdentifier().getValue();
            InternationalString title = Text.text(idt.getTitle().getValue());
            InternationalString description = Text.text(isAbstractNull(idt) ? "" : idt.getAbstract().getValue());
            Parameter<?> param = new Parameter(identifier, type, title, description, required, idt.getMinOccurs().intValue(), idt.getMaxOccurs().intValue(), null, null);
            map.put(identifier, param);
        }

        return map;
    }
View Full Code Here

                type = getComplexType(encoding, mimetype, schema);
            }

            // create the parameter
            InternationalString description = Text.text(isAbstractNull(odt) ? "" : odt.getAbstract().getValue());
            Parameter param = new Parameter(odt.getIdentifier().getValue(), type, Text.text(odt.getTitle().getValue()), description);
            map.put(odt.getIdentifier().getValue(), param);
        }

        return map;
    }
View Full Code Here

    private GeometryFactory geometryFactory = new GeometryFactory();

    @SuppressWarnings("unchecked")
    public Map<String, Parameter<?>> getResultInfo(Map<String, Object> inputs) {
        Map<String, Parameter<?>> outputInfo = new HashMap<String, Parameter<?>>();
        outputInfo.put("result", new Parameter("result", FeatureCollection.class, Text
                .text("Result"), Text.text("The nearest feature")));
        return outputInfo;
    }
View Full Code Here

                    Map.Entry<String, Object> entry = (Entry<String, Object>) it.next();
                    final String paramName = entry.getKey();
                    final Object paramValue = entry.getValue();

                    // see if we have a parameter with that name
                    Parameter param = parameters.get(paramName);
                    if (param == null) {
                        throw new InvalidParameterException("Parameter " + paramName
                                + " is not among the process parameters: " + parameters.keySet());
                    } else {
                        // if the value is not null, convert to the param target type and add
View Full Code Here

TOP

Related Classes of org.geotools.data.Parameter

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.