Examples of InputDescriptionType


Examples of net.opengis.wps10.InputDescriptionType

        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

Examples of net.opengis.wps10.InputDescriptionType

        ProcessDescriptionsType processDesc, Geometry geom1) throws ParseException
    {

        // this process takes 2 input, a geometry and a buffer amount.
        ProcessDescriptionType pdt = (ProcessDescriptionType) processDesc.getProcessDescription().get(0);
        InputDescriptionType idt = (InputDescriptionType) pdt.getDataInputs().getInput().get(0);

        // create input buffer
        int bufferAmnt = 350;

        // create and set the input on the exe request
        if (idt.getIdentifier().getValue().equalsIgnoreCase("buffer"))
        {
            // set buffer input
            DataType input = WPSUtils.createInputDataType(bufferAmnt, idt);
            List<EObject> list = new ArrayList<EObject>();
            list.add(input);
            exeRequest.addInput(idt.getIdentifier().getValue(), list);
            // set geom input
            idt = (InputDescriptionType) pdt.getDataInputs().getInput().get(1);

            DataType input2 = WPSUtils.createInputDataType(geom1, idt);
            List<EObject> list2 = new ArrayList<EObject>();
            list2.add(input2);
            exeRequest.addInput(idt.getIdentifier().getValue(), list2);
        }
        else
        {
            // set geom input
            DataType input2 = WPSUtils.createInputDataType(geom1, idt);
            List<EObject> list2 = new ArrayList<EObject>();
            list2.add(input2);
            exeRequest.addInput(idt.getIdentifier().getValue(), list2);
            // set buffer input
            idt = (InputDescriptionType) pdt.getDataInputs().getInput().get(1);

            DataType input = WPSUtils.createInputDataType(bufferAmnt, idt);
            List<EObject> list = new ArrayList<EObject>();
            list.add(input);
            exeRequest.addInput(idt.getIdentifier().getValue(), list);
        }
    }
View Full Code Here

Examples of net.opengis.wps10.InputDescriptionType

        ProcessDescriptionsType processDesc) throws ParseException
    {

        // this process takes 1 input, a building polygon to collapse.
        ProcessDescriptionType pdt = (ProcessDescriptionType) processDesc.getProcessDescription().get(0);
        InputDescriptionType idt = (InputDescriptionType) pdt.getDataInputs().getInput().get(0);

        // create a polygon for the input
        WKTReader reader = new WKTReader(new GeometryFactory());
        Geometry geom1 = (Polygon) reader.read("POLYGON((20 10, 30 0, 40 10, 30 20, 20 10))");

        // create and set the input on the exe request
        DataType input = WPSUtils.createInputDataType(geom1, idt);
        List<EObject> list = new ArrayList<EObject>();
        list.add(input);
        exeRequest.addInput(idt.getIdentifier().getValue(), list);
    }
View Full Code Here

Examples of net.opengis.wps10.InputDescriptionType

        ProcessDescriptionsType processDesc) throws ParseException
    {

        // this process takes 2+ inputs, all geometries to union together.
        ProcessDescriptionType pdt = (ProcessDescriptionType) processDesc.getProcessDescription().get(0);
        InputDescriptionType idt = (InputDescriptionType) pdt.getDataInputs().getInput().get(0);

        // create polygons for the input
        String geom1 = "POLYGON((20 10, 30 0, 40 10, 30 20, 20 10))";
        String geom2 = "POLYGON((20 30, 30 0, 20 20, 80 20, 20 30))";
        String geom3 = "POLYGON((177 10, 30 88, 40 70, 46 20, 177 10))";
        String geom4 = "POLYGON((5 10, 5 0, 13 10, 5 20, 5 10))";

        // create and set the input on the exe request
        if (idt.getIdentifier().getValue().equalsIgnoreCase("geom"))
        {
            // set geom inputs
            List<EObject> list = new ArrayList<EObject>();
            DataType input = WPSUtils.createInputDataType(geom1, WPSUtils.INPUTTYPE_COMPLEXDATA, "application/wkt");
            DataType input2 = WPSUtils.createInputDataType(geom2, WPSUtils.INPUTTYPE_COMPLEXDATA, "application/wkt");
            DataType input3 = WPSUtils.createInputDataType(geom3, WPSUtils.INPUTTYPE_COMPLEXDATA, "application/wkt");
            DataType input4 = WPSUtils.createInputDataType(geom4, WPSUtils.INPUTTYPE_COMPLEXDATA, "application/wkt");
            list.add(input);
            list.add(input2);
            list.add(input3);
            list.add(input4);
            exeRequest.addInput(idt.getIdentifier().getValue(), list);
        }

    }
View Full Code Here

Examples of net.opengis.wps10.InputDescriptionType

        ProcessDescriptionsType processDesc) throws ParseException
    {

        // this process takes 2 inputs, two double to add together.
        ProcessDescriptionType pdt = (ProcessDescriptionType) processDesc.getProcessDescription().get(0);
        InputDescriptionType idt = (InputDescriptionType) pdt.getDataInputs().getInput().get(0);

        // create doubles for the input
        Double d1 = 77.84;
        Double d2 = 40039.229;

        // create and set the input on the exe request
        List<EObject> list = new ArrayList<EObject>();
        DataType input = WPSUtils.createInputDataType(d1, idt);
        list.add(input);
        exeRequest.addInput(idt.getIdentifier().getValue(), list);

        InputDescriptionType idt2 = (InputDescriptionType) pdt.getDataInputs().getInput().get(1);
        List<EObject> list2 = new ArrayList<EObject>();
        DataType input2 = WPSUtils.createInputDataType(d2, idt2);
        list2.add(input2);
        exeRequest.addInput(idt2.getIdentifier().getValue(), list2);

    }
View Full Code Here

Examples of net.opengis.wps10.InputDescriptionType

        }

        Iterator iterator = inputs.iterator();
        while (iterator.hasNext())
        {
            InputDescriptionType idt = (InputDescriptionType) iterator.next();
            // determine if the input is a literal or complex data, and from that
            // find out what type the object should be
            LiteralInputType literalData = idt.getLiteralData();
            SupportedComplexDataInputType complexData = idt.getComplexData();
            Class type = Object.class;
            if (literalData != null)
            {
                String reference = literalData.getDataType().getReference();
                type = getLiteralTypeFromReference(reference);
            }
            else if (complexData != null)
            {
                // TODO: get all supported types and determine how to handle that, not just the
                // default.
                ComplexDataDescriptionType format = complexData.getDefault().getFormat();
                String encoding = format.getEncoding();
                String mimetype = format.getMimeType();
                String schema = format.getSchema();
                if (encoding == null)
                {
                    encoding = "";
                }
                if (mimetype == null)
                {
                    mimetype = "";
                }
                if (schema == null)
                {
                    schema = "";
                }
                type = getComplexType(encoding, mimetype, schema);
            }

            // create the parameter
            boolean required = true;
            if (idt.getMinOccurs().intValue() < 1)
            {
                required = false;
            }

            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

Examples of net.opengis.wps10.InputDescriptionType

    // loop through each expected input in the describeprocess, and set it
    // based on what we have in the provided input map.
    EList inputs = pdt.getDataInputs().getInput();
    Iterator iterator = inputs.iterator();
    while (iterator.hasNext()) {
      InputDescriptionType idt = (InputDescriptionType) iterator.next();
      String identifier = idt.getIdentifier().getValue();
      Object inputValue = input.get(identifier);
      if (inputValue != null) {
        // if our value is some sort of collection, then created multiple
        // dataTypes for this inputdescriptiontype.
        List<EObject> list = new ArrayList<EObject>();
View Full Code Here

Examples of net.opengis.wps10.InputDescriptionType

        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.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()) ) {
                  Class type = lppio.getType();
                  if(PRIMITIVE_TO_WRAPPER.containsKey(type)) {
                    type = PRIMITIVE_TO_WRAPPER.get(type);
                  }
                    Name typeName = xsp.name(type);
                    if ( typeName != null ) {
                        literal.setDataType(Ows11Util.type("xs:" + typeName.getLocalPart()));       
                    }   
                }
                if(lppio.getType().isEnum()) {
                  Object[] enumValues = lppio.getType().getEnumConstants();
                  AllowedValuesType allowed = owsf.createAllowedValuesType();
                  for (Object value : enumValues) {
                    ValueType vt = owsf.createValueType();
                    vt.setValue(value.toString());
            allowed.getValue().add(vt);
          }
                  literal.setAllowedValues(allowed);
                } else {
                  literal.setAnyValue( owsf.createAnyValueType() );
                }

                //TODO: output the default value and see if we can output a valid range as well
            } else if(ppios.get( 0 ) instanceof BoundingBoxPPIO) {
                input.setBoundingBoxData(buildSupportedCRSType());
            } 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

Examples of net.opengis.wps10.InputDescriptionType

            // skip the output mime choice params, they will be filled automatically by WPS
            if (outputMimeParameters.contains(p.key)) {
                continue;
            }

            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.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()) ) {
                  Class type = lppio.getType();
                  if(PRIMITIVE_TO_WRAPPER.containsKey(type)) {
                    type = PRIMITIVE_TO_WRAPPER.get(type);
                  }
                    Name typeName = xsp.name(type);
                    if ( typeName != null ) {
                        literal.setDataType(Ows11Util.type("xs:" + typeName.getLocalPart()));       
                    }   
                }
                if (p.metadata.get(Parameter.OPTIONS) != null) {
                    List<Object> options = (List<Object>) p.metadata.get(Parameter.OPTIONS);
                    Object[] optionsArray = options.toArray(new Object[options.size()]);
                    addAllowedValues(literal, optionsArray);
                } else if (lppio.getType().isEnum()) {
                  Object[] enumValues = lppio.getType().getEnumConstants();
                    addAllowedValues(literal, enumValues);
                } else {
                  literal.setAnyValue( owsf.createAnyValueType() );
                }

                try {
                    if (p.sample != null) {
                        literal.setDefaultValue(lppio.encode(p.sample));
                    }
                } catch (Exception e) {
                    LOGGER.log(Level.WARNING, "Failed to fill the default value for input " + p.key
                            + " of process " + name, e);
                }
            } else if(ppios.get( 0 ) instanceof BoundingBoxPPIO) {
                input.setBoundingBoxData(buildSupportedCRSType());
            } 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
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.