CPD Results

The following document contains the results of PMD's CPD 4.3.

Duplications

File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 148
org/deegree/filter/xml/Filter110XMLDecoder.java 151
    private static final QName GML_OBJECT_ID_ELEMENT = new QName( OGC_NS, "GmlObjectId" );

    private static final Map<Expression.Type, QName> expressionTypeToElementName = new HashMap<Expression.Type, QName>();

    private static final Map<QName, Expression.Type> elementNameToExpressionType = new HashMap<QName, Expression.Type>();

    private static final Map<QName, Operator.Type> elementNameToOperatorType = new HashMap<QName, Operator.Type>();

    private static final Map<QName, SpatialOperator.SubType> elementNameToSpatialOperatorType = new HashMap<QName, SpatialOperator.SubType>();

    private static final Map<SpatialOperator.SubType, QName> spatialOperatorTypeToElementName = new HashMap<SpatialOperator.SubType, QName>();

    private static final Map<QName, ComparisonOperator.SubType> elementNameToComparisonOperatorType = new HashMap<QName, ComparisonOperator.SubType>();

    private static final Map<ComparisonOperator.SubType, QName> comparisonOperatorTypeToElementName = new HashMap<ComparisonOperator.SubType, QName>();

    private static final Map<QName, LogicalOperator.SubType> elementNameToLogicalOperatorType = new HashMap<QName, LogicalOperator.SubType>();

    private static final Map<LogicalOperator.SubType, QName> logicalOperatorTypeToElementName = new HashMap<LogicalOperator.SubType, QName>();

    static {

        // element name <-> expression type
        addElementToExpressionMapping( new QName( OGC_NS, "Add" ), Expression.Type.ADD );
        addElementToExpressionMapping( new QName( OGC_NS, "Sub" ), Expression.Type.SUB );
        addElementToExpressionMapping( new QName( OGC_NS, "Mul" ), Expression.Type.MUL );
        addElementToExpressionMapping( new QName( OGC_NS, "Div" ), Expression.Type.DIV );
        addElementToExpressionMapping( new QName( OGC_NS, "PropertyName" ), Expression.Type.VALUE_REFERENCE );
        addElementToExpressionMapping( new QName( OGC_NS, "Function" ), Expression.Type.FUNCTION );
        addElementToExpressionMapping( new QName( OGC_NS, "Literal" ), Expression.Type.LITERAL );

        // element name <-> expression type (custom expressions)
        for ( CustomExpression ce : CustomExpressionManager.getCustomExpressions().values() ) {
            addElementToExpressionMapping( ce.getElementName(), Expression.Type.CUSTOM );
        }

        // element name <-> spatial operator type
        addElementToSpatialOperatorMapping( new QName( OGC_NS, "BBOX" ), SpatialOperator.SubType.BBOX );
        addElementToSpatialOperatorMapping( new QName( OGC_NS, "Beyond" ), SpatialOperator.SubType.BEYOND );
        addElementToSpatialOperatorMapping( new QName( OGC_NS, "Contains" ), SpatialOperator.SubType.CONTAINS );
        addElementToSpatialOperatorMapping( new QName( OGC_NS, "Crosses" ), SpatialOperator.SubType.CROSSES );
        addElementToSpatialOperatorMapping( new QName( OGC_NS, "Equals" ), SpatialOperator.SubType.EQUALS );
        addElementToSpatialOperatorMapping( new QName( OGC_NS, "Disjoint" ), SpatialOperator.SubType.DISJOINT );
        addElementToSpatialOperatorMapping( new QName( OGC_NS, "DWithin" ), SpatialOperator.SubType.DWITHIN );
        addElementToSpatialOperatorMapping( new QName( OGC_NS, "Intersects" ), SpatialOperator.SubType.INTERSECTS );
        addElementToSpatialOperatorMapping( new QName( OGC_NS, "Overlaps" ), SpatialOperator.SubType.OVERLAPS );
        addElementToSpatialOperatorMapping( new QName( OGC_NS, "Touches" ), SpatialOperator.SubType.TOUCHES );
        addElementToSpatialOperatorMapping( new QName( OGC_NS, "Within" ), SpatialOperator.SubType.WITHIN );

        // element name <-> logical operator type
        addElementToLogicalOperatorMapping( new QName( OGC_NS, "And" ), LogicalOperator.SubType.AND );
        addElementToLogicalOperatorMapping( new QName( OGC_NS, "Or" ), LogicalOperator.SubType.OR );
        addElementToLogicalOperatorMapping( new QName( OGC_NS, "Not" ), LogicalOperator.SubType.NOT );

        // element name <-> comparison operator type
        addElementToComparisonOperatorMapping( new QName( OGC_NS, "PropertyIsBetween" ),
                                               ComparisonOperator.SubType.PROPERTY_IS_BETWEEN );
        addElementToComparisonOperatorMapping( new QName( OGC_NS, "PropertyIsEqualTo" ),
                                               ComparisonOperator.SubType.PROPERTY_IS_EQUAL_TO );
        addElementToComparisonOperatorMapping( new QName( OGC_NS, "PropertyIsGreaterThan" ),
                                               ComparisonOperator.SubType.PROPERTY_IS_GREATER_THAN );
        addElementToComparisonOperatorMapping( new QName( OGC_NS, "PropertyIsGreaterThanOrEqualTo" ),
                                               ComparisonOperator.SubType.PROPERTY_IS_GREATER_THAN_OR_EQUAL_TO );
        addElementToComparisonOperatorMapping( new QName( OGC_NS, "PropertyIsLessThan" ),
                                               ComparisonOperator.SubType.PROPERTY_IS_LESS_THAN );
        addElementToComparisonOperatorMapping( new QName( OGC_NS, "PropertyIsLessThanOrEqualTo" ),
                                               ComparisonOperator.SubType.PROPERTY_IS_LESS_THAN_OR_EQUAL_TO );
        addElementToComparisonOperatorMapping( new QName( OGC_NS, "PropertyIsLike" ),
                                               ComparisonOperator.SubType.PROPERTY_IS_LIKE );
        addElementToComparisonOperatorMapping( new QName( OGC_NS, "PropertyIsNotEqualTo" ),
                                               ComparisonOperator.SubType.PROPERTY_IS_NOT_EQUAL_TO );
        addElementToComparisonOperatorMapping( new QName( OGC_NS, "PropertyIsNull" ),
                                               ComparisonOperator.SubType.PROPERTY_IS_NULL );
    }

    private static void addElementToExpressionMapping( QName elementName, Expression.Type type ) {
        elementNameToExpressionType.put( elementName, type );
        expressionTypeToElementName.put( type, elementName );
    }

    private static void addElementToSpatialOperatorMapping( QName elementName, SpatialOperator.SubType type ) {
        elementNameToOperatorType.put( elementName, Operator.Type.SPATIAL );
        elementNameToSpatialOperatorType.put( elementName, type );
        spatialOperatorTypeToElementName.put( type, elementName );
    }

    private static void addElementToLogicalOperatorMapping( QName elementName, LogicalOperator.SubType type ) {
        elementNameToOperatorType.put( elementName, Operator.Type.LOGICAL );
        elementNameToLogicalOperatorType.put( elementName, type );
        logicalOperatorTypeToElementName.put( type, elementName );
    }

    private static void addElementToComparisonOperatorMapping( QName elementName, ComparisonOperator.SubType type ) {
        elementNameToOperatorType.put( elementName, Operator.Type.COMPARISON );
        elementNameToComparisonOperatorType.put( elementName, type );
        comparisonOperatorTypeToElementName.put( type, elementName );
    }

    /**
     * Returns the object representation for the given <code>wfs:Filter</code> element event that the cursor of the
     * associated <code>XMLStreamReader</code> points at.
     * <ul>
     * <li>Precondition: cursor must point at the <code>START_ELEMENT</code> event (&lt;wfs:Filter&gt;)</li>
     * <li>Postcondition: cursor points at the corresponding <code>END_ELEMENT</code> event (&lt;/wfs:Filter&gt;)</li>
     * </ul>
     * 
     * @param xmlStream
     *            cursor must point at the <code>START_ELEMENT</code> event (&lt;wfs:Filter&gt;), points at the
     *            corresponding <code>END_ELEMENT</code> event (&lt;/wfs:Filter&gt;) afterwards
     * @return corresponding {@link Filter} object
     * @throws XMLParsingException
     *             if the element is not a valid "wfs:Filter" element
     * @throws XMLStreamException
     */
    public static Filter parse( XMLStreamReader xmlStream )
                            throws XMLParsingException, XMLStreamException {

        Filter filter = null;
        xmlStream.require( START_ELEMENT, OGC_NS, "Filter" );
        nextElement( xmlStream );
        if ( xmlStream.getEventType() != START_ELEMENT ) {
            throw new XMLParsingException( xmlStream, Messages.getMessage( "FILTER_PARSER_FILTER_EMPTY",
                                                                           new QName( OGC_NS, "Filter" ) ) );
        }
        QName elementName = xmlStream.getName();
        if ( FEATURE_ID_ELEMENT.equals( elementName ) ) {
File Line
org/deegree/feature/i18n/Messages.java 74
org/deegree/filter/i18n/Messages.java 74
org/deegree/gml/i18n/Messages.java 74
    private static Properties defaultProps = new Properties();

    private static Map<Locale, Properties> props = new HashMap<Locale, Properties>();

    private static String lang;

    private static Logger LOG = LoggerFactory.getLogger( Messages.class );

    /**
     * Initialization done at class loading time.
     */
    static {
        InputStream is = null;
        try {
            // load all messages from default file ("org/deegree/model/i18n/message_en.properties")
            String fileName = "messages_en.properties";
            is = Messages.class.getResourceAsStream( fileName );
            if ( is == null ) {
                LOG.error( "Error while initializing " + Messages.class.getName() + " : " + " default message file: '"
                           + fileName + " not found." );
            } else {
                defaultProps.load( is );

                // override messages using file "/message_en.properties"
                fileName = "/messages_en.properties";
                overrideMessages( fileName, defaultProps );

                lang = Locale.getDefault().getLanguage();
                if ( !"".equals( lang ) && !"en".equals( lang ) ) {
                    // override messages using file "org/deegree/i18n/message_LANG.properties"
                    fileName = "messages_" + lang + ".properties";
                    overrideMessages( fileName, defaultProps );
                    // override messages using file "/message_LANG.properties"
                    fileName = "/messages_" + lang + ".properties";
                    overrideMessages( fileName, defaultProps );
                }
            }
        } catch ( IOException e ) {
            LOG.error( "Error while initializing " + Messages.class.getName() + " : " + e.getMessage(), e );
        } finally {
            closeQuietly( is );
        }
    }

    private static void overrideMessages( String propertiesFile, Properties props )
                            throws IOException {
        InputStream is = null;
        try {
            is = Messages.class.getResourceAsStream( propertiesFile );
            if ( is != null ) {
                // override default messages
                Properties overrideProps = new Properties();
                overrideProps.load( is );
                is.close();
                for ( Entry<?, ?> e : overrideProps.entrySet() ) {
                    props.put( e.getKey(), e.getValue() );
                }
            }
        } finally {
            closeQuietly( is );
        }
    }

    private static String get( Properties props, String key, Object... args ) {
        String s = (String) props.get( key );
        if ( s != null ) {
            return MessageFormat.format( s, args );
        }

        return "$Message with key: " + key + " not found$";
    }

    /**
     * @param loc
     *            the locale to be used
     * @param key
     *            to get
     * @param arguments
     *            to fill in the message
     * @return the localized message
     */
    public static synchronized String getMessage( Locale loc, String key, Object... arguments ) {
        if ( loc.getLanguage().equals( lang ) ) {
            return getMessage( key, arguments );
        }

        if ( !props.containsKey( loc ) ) {
            Properties p = new Properties();

            String l = loc.getLanguage();

            if ( !"".equals( l ) ) {
                try {
                    // override messages in this order:
                    // messages_en.properties
                    // /messages_en.properties
                    // messages_lang.properties
                    // /messages_lang.properties
                    String fileName = "messages_en.properties";
                    overrideMessages( fileName, p );
                    fileName = "/messages_en.properties";
                    overrideMessages( fileName, p );
                    fileName = "messages_" + l + ".properties";
                    overrideMessages( fileName, p );
                    fileName = "/messages_" + l + ".properties";
                    overrideMessages( fileName, p );
                } catch ( IOException e ) {
                    LOG.error( "Error loading language file for language '" + l + "': ", e );
                }
            }

            props.put( loc, p );
        }

        return get( props.get( loc ), key, arguments );
    }

    /**
     * Returns the message assigned to the passed key. If no message is assigned, an error message will be returned that
     * indicates the missing key.
     * 
     * @see MessageFormat for conventions on string formatting and escape characters.
     * 
     * @param key
     * @param arguments
     * @return the message assigned to the passed key
     */
    public static String getMessage( String key, Object... arguments ) {
        return get( defaultProps, key, arguments );
    }

    /**
     * Short version for lazy people.
     * 
     * @param key
     * @param arguments
     * @return the same as #getMessage
     */
    public static String get( String key, Object... arguments ) {
        return getMessage( key, arguments );
    }

}
File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 602
org/deegree/filter/xml/Filter110XMLDecoder.java 624
        requireNextTag( xmlStream, END_ELEMENT );

        switch ( type ) {
        case PROPERTY_IS_EQUAL_TO:
            comparisonOperator = new PropertyIsEqualTo( parameter1, parameter2, matchCase, null );
            break;
        case PROPERTY_IS_NOT_EQUAL_TO:
            comparisonOperator = new PropertyIsNotEqualTo( parameter1, parameter2, matchCase, null );
            break;
        case PROPERTY_IS_LESS_THAN:
            comparisonOperator = new PropertyIsLessThan( parameter1, parameter2, matchCase, null );
            break;
        case PROPERTY_IS_LESS_THAN_OR_EQUAL_TO:
            comparisonOperator = new PropertyIsLessThanOrEqualTo( parameter1, parameter2, matchCase, null );
            break;
        case PROPERTY_IS_GREATER_THAN:
            comparisonOperator = new PropertyIsGreaterThan( parameter1, parameter2, matchCase, null );
            break;
        case PROPERTY_IS_GREATER_THAN_OR_EQUAL_TO:
            comparisonOperator = new PropertyIsGreaterThanOrEqualTo( parameter1, parameter2, matchCase, null );
            break;
        default:
            assert false;
        }
        return comparisonOperator;
    }

    private static Literal<?> parseLiteral( XMLStreamReader xmlStream )
                            throws XMLStreamException {

        Map<QName, PrimitiveValue> attrs = parseAttrs( xmlStream );
        List<TypedObjectNode> children = new ArrayList<TypedObjectNode>();
        while ( xmlStream.next() != END_ELEMENT ) {
            int eventType = xmlStream.getEventType();
            if ( eventType == START_ELEMENT ) {
                children.add( parseElement( xmlStream ) );
            } else if ( eventType == CHARACTERS || eventType == CDATA ) {
                children.add( new PrimitiveValue( xmlStream.getText() ) );
            }
        }
        TypedObjectNode value = null;
        if ( attrs.isEmpty() && children.size() == 1 ) {
            value = children.get( 0 );
        } else if ( attrs.isEmpty() && children.isEmpty() ) {
            value = new PrimitiveValue( "" );
        } else {
            value = new GenericXMLElement( null, null, attrs, children );
        }
        return new Literal<TypedObjectNode>( value, null );
    }

    private static GenericXMLElement parseElement( XMLStreamReader xmlStream )
                            throws IllegalArgumentException, XMLStreamException {
        Map<QName, PrimitiveValue> attrs = parseAttrs( xmlStream );
        List<TypedObjectNode> children = new ArrayList<TypedObjectNode>();
        while ( xmlStream.next() != END_ELEMENT ) {
            int eventType = xmlStream.getEventType();
            if ( eventType == START_ELEMENT ) {
                children.add( parseElement( xmlStream ) );
            } else if ( eventType == CHARACTERS || eventType == CDATA ) {
                children.add( new PrimitiveValue( xmlStream.getText() ) );
            }
        }
        return new GenericXMLElement( xmlStream.getName(), null, attrs, children );
    }

    private static Map<QName, PrimitiveValue> parseAttrs( XMLStreamReader xmlStream ) {
        Map<QName, PrimitiveValue> attrs = new LinkedHashMap<QName, PrimitiveValue>();
        for ( int i = 0; i < xmlStream.getAttributeCount(); i++ ) {
            QName name = xmlStream.getAttributeName( i );
            String value = xmlStream.getAttributeValue( i );
            PrimitiveValue xmlValue = new PrimitiveValue( value );
            attrs.put( name, xmlValue );
        }
        return attrs;
    }

    private static ValueReference parsePropertyName( XMLStreamReader xmlStream )
File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 425
org/deegree/filter/xml/Filter110XMLDecoder.java 425
            function = provider.create( params );
        } else {
            function = new Function( name, params );
        }
        return function;
    }

    /**
     * Returns the object representation for the given custom <code>ogc:expression</code> element event that the cursor
     * of the associated <code>XMLStreamReader</code> points at.
     * <p>
     * <ul>
     * <li>Precondition: cursor must point at the <code>START_ELEMENT</code> event (&lt;ogc:expression&gt;)</li>
     * <li>Postcondition: cursor points at the corresponding <code>END_ELEMENT</code> event (&lt;/ogc:expression&gt;)</li>
     * </ul>
     * </p>
     * 
     * @param xmlStream
     *            cursor must point at the <code>START_ELEMENT</code> event (&lt;ogc:expression&gt;), points at the
     *            corresponding <code>END_ELEMENT</code> event (&lt;/ogc:expression&gt;) afterwards
     * @return corresponding {@link CustomExpression} object
     * @throws XMLParsingException
     *             if the element is not a known or valid custom "ogc:expression" element
     * @throws XMLStreamException
     */
    public static CustomExpression parseCustomExpression( XMLStreamReader xmlStream )
                            throws XMLStreamException {

        CustomExpression expr = CustomExpressionManager.getExpression( xmlStream.getName() );
        if ( expr == null ) {
            String msg = Messages.getMessage( "FILTER_PARSER_UNKNOWN_CUSTOM_EXPRESSION", xmlStream.getName() );
            throw new XMLParsingException( xmlStream, msg );
        }
        return expr.parse100( xmlStream );
    }

    /**
     * Returns the object representation for the given <code>ogc:comparisonOps</code> element event that the cursor of
     * the associated <code>XMLStreamReader</code> points at.
     * <p>
     * The element must be one of the following:
     * <ul>
     * <li>ogc:PropertyIsEqualTo</li>
     * <li>ogc:PropertyIsGreaterThan</li>
     * <li>ogc:PropertyIsGreaterThanOrEqualTo</li>
     * <li>ogc:PropertyIsLessThan</li>
     * <li>ogc:PropertyIsLessThanOrEqualTo</li>
     * <li>ogc:PropertyIsNotEqualTo</li>
     * <li>ogc:PropertyIsBetween</li>
     * <li>ogc:PropertyIsLike</li>
     * <li>ogc:PropertyIsNull</li>
     * </ul>
     * </p>
     * <p>
     * <ul>
     * <li>Precondition: cursor must point at the <code>START_ELEMENT</code> event (&lt;ogc:comparisonOps&gt;)</li>
     * <li>Postcondition: cursor points at the corresponding <code>END_ELEMENT</code> event (&lt;/ogc:comparisonOps&gt;)
     * </li>
     * </ul>
     * </p>
     * 
     * @param xmlStream
     *            cursor must point at the <code>START_ELEMENT</code> event (&lt;ogc:comparisonOps&gt;), points at the
     *            corresponding <code>END_ELEMENT</code> event (&lt;/ogc:comparisonOps&gt;) afterwards
     * @return corresponding {@link Expression} object
     * @throws XMLParsingException
     *             if the element is not a valid "ogc:comparisonOps" element
     * @throws XMLStreamException
     */
    public static ComparisonOperator parseComparisonOperator( XMLStreamReader xmlStream )
                            throws XMLStreamException {

        ComparisonOperator comparisonOperator = null;

        // check if element name is a valid comparison operator element
        ComparisonOperator.SubType type = elementNameToComparisonOperatorType.get( xmlStream.getName() );
        if ( type == null ) {
            String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT",
                                              xmlStream.getName(),
                                              elemNames( ComparisonOperator.SubType.class,
                                                         comparisonOperatorTypeToElementName ) );
            throw new XMLParsingException( xmlStream, msg );
        }

        switch ( type ) {
        case PROPERTY_IS_EQUAL_TO:
        case PROPERTY_IS_GREATER_THAN:
        case PROPERTY_IS_GREATER_THAN_OR_EQUAL_TO:
        case PROPERTY_IS_LESS_THAN:
        case PROPERTY_IS_LESS_THAN_OR_EQUAL_TO:
        case PROPERTY_IS_NOT_EQUAL_TO:
            comparisonOperator = parseBinaryComparisonOperator( xmlStream, type );
            break;
        case PROPERTY_IS_BETWEEN:
            comparisonOperator = parsePropertyIsBetweenOperator( xmlStream );
            break;
        case PROPERTY_IS_LIKE:
            comparisonOperator = parsePropertyIsLikeOperator( xmlStream );
            break;
        case PROPERTY_IS_NULL:
            comparisonOperator = parsePropertyIsNullOperator( xmlStream );
            break;
        }
        return comparisonOperator;
    }

    private static Operator parseOperator( XMLStreamReader xmlStream )
                            throws XMLStreamException {

        Operator operator = null;

        // check if element name is a valid operator element
        Operator.Type type = elementNameToOperatorType.get( xmlStream.getName() );
        if ( type == null ) {
            String expectedList = elemNames( Operator.Type.class, logicalOperatorTypeToElementName ) + ", "
                                  + elemNames( Operator.Type.class, spatialOperatorTypeToElementName ) + ", "
                                  + elemNames( Operator.Type.class, comparisonOperatorTypeToElementName );
            String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT", xmlStream.getName(), expectedList );
            throw new XMLParsingException( xmlStream, msg );
        }

        switch ( type ) {
        case COMPARISON:
            LOG.debug( "Building comparison operator" );
            operator = parseComparisonOperator( xmlStream );
            break;
        case LOGICAL:
            LOG.debug( "Building logical operator" );
            operator = parseLogicalOperator( xmlStream );
            break;
        case SPATIAL:
            LOG.debug( "Building spatial operator" );
            operator = parseSpatialOperator( xmlStream );
            break;
        }
        return operator;
    }

    private static IdFilter parseIdFilter( XMLStreamReader xmlStream )
                            throws XMLStreamException {

        Set<String> matchingIds = new HashSet<String>();
File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 741
org/deegree/filter/xml/Filter110XMLDecoder.java 770
        ValueReference propName = parsePropertyName( xmlStream );
        nextElement( xmlStream );
        return new PropertyIsNull( propName, null );
    }

    private static LogicalOperator parseLogicalOperator( XMLStreamReader xmlStream )
                            throws XMLStreamException {

        LogicalOperator logicalOperator = null;

        // check if element name is a valid logical operator element
        LogicalOperator.SubType type = elementNameToLogicalOperatorType.get( xmlStream.getName() );
        if ( type == null ) {
            String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT",
                                              xmlStream.getName(),
                                              elemNames( LogicalOperator.SubType.class,
                                                         logicalOperatorTypeToElementName ) );
            throw new XMLParsingException( xmlStream, msg );
        }

        switch ( type ) {
        case AND: {
            List<Operator> innerOperators = new ArrayList<Operator>();
            while ( nextElement( xmlStream ) == START_ELEMENT ) {
                innerOperators.add( parseOperator( xmlStream ) );
            }
            if ( innerOperators.size() < 2 ) {
                String msg = "Error while parsing And operator. Must have at least two arguments.";
                throw new XMLParsingException( xmlStream, msg );
            }
            logicalOperator = new And( innerOperators.toArray( new Operator[innerOperators.size()] ) );
            break;
        }
        case OR: {
            List<Operator> innerOperators = new ArrayList<Operator>();
            while ( nextElement( xmlStream ) == START_ELEMENT ) {
                innerOperators.add( parseOperator( xmlStream ) );
            }
            if ( innerOperators.size() < 2 ) {
                String msg = "Error while parsing Or operator. Must have at least two arguments.";
                throw new XMLParsingException( xmlStream, msg );
            }
            logicalOperator = new Or( innerOperators.toArray( new Operator[innerOperators.size()] ) );
            break;
        }
        case NOT: {
            nextElement( xmlStream );
            Operator parameter = parseOperator( xmlStream );
            logicalOperator = new Not( parameter );
            nextElement( xmlStream );
            break;
        }
        }
        return logicalOperator;
    }

    private static SpatialOperator parseSpatialOperator( XMLStreamReader xmlStream )
                            throws XMLStreamException {
        SpatialOperator spatialOperator = null;

        require( xmlStream, START_ELEMENT );
        // check if element name is a valid spatial operator element name
        SpatialOperator.SubType type = elementNameToSpatialOperatorType.get( xmlStream.getName() );
        if ( type == null ) {
            String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT",
                                              xmlStream.getName(),
                                              elemNames( SpatialOperator.SubType.class,
                                                         spatialOperatorTypeToElementName ) );
            throw new XMLParsingException( xmlStream, msg );
        }

        nextElement( xmlStream );
File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 743
org/deegree/filter/xml/Filter110XMLDecoder.java 772
org/deegree/filter/xml/Filter200XMLDecoder.java 935
        return new PropertyIsNull( propName, null );
    }

    private static LogicalOperator parseLogicalOperator( XMLStreamReader xmlStream )
                            throws XMLStreamException {

        LogicalOperator logicalOperator = null;

        // check if element name is a valid logical operator element
        LogicalOperator.SubType type = elementNameToLogicalOperatorType.get( xmlStream.getName() );
        if ( type == null ) {
            String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT",
                                              xmlStream.getName(),
                                              elemNames( LogicalOperator.SubType.class,
                                                         logicalOperatorTypeToElementName ) );
            throw new XMLParsingException( xmlStream, msg );
        }

        switch ( type ) {
        case AND: {
            List<Operator> innerOperators = new ArrayList<Operator>();
            while ( nextElement( xmlStream ) == START_ELEMENT ) {
                innerOperators.add( parseOperator( xmlStream ) );
            }
            if ( innerOperators.size() < 2 ) {
                String msg = "Error while parsing And operator. Must have at least two arguments.";
                throw new XMLParsingException( xmlStream, msg );
            }
            logicalOperator = new And( innerOperators.toArray( new Operator[innerOperators.size()] ) );
            break;
        }
        case OR: {
            List<Operator> innerOperators = new ArrayList<Operator>();
            while ( nextElement( xmlStream ) == START_ELEMENT ) {
                innerOperators.add( parseOperator( xmlStream ) );
            }
            if ( innerOperators.size() < 2 ) {
                String msg = "Error while parsing Or operator. Must have at least two arguments.";
                throw new XMLParsingException( xmlStream, msg );
            }
            logicalOperator = new Or( innerOperators.toArray( new Operator[innerOperators.size()] ) );
            break;
        }
        case NOT: {
            nextElement( xmlStream );
            Operator parameter = parseOperator( xmlStream );
            logicalOperator = new Not( parameter );
            nextElement( xmlStream );
            break;
        }
        }
        return logicalOperator;
    }

    private static SpatialOperator parseSpatialOperator( XMLStreamReader xmlStream )
                            throws XMLStreamException {
        SpatialOperator spatialOperator = null;

        require( xmlStream, START_ELEMENT );
        // check if element name is a valid spatial operator element name
        SpatialOperator.SubType type = elementNameToSpatialOperatorType.get( xmlStream.getName() );
        if ( type == null ) {
            String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT",
                                              xmlStream.getName(),
                                              elemNames( SpatialOperator.SubType.class,
                                                         spatialOperatorTypeToElementName ) );
            throw new XMLParsingException( xmlStream, msg );
        }

        nextElement( xmlStream );
File Line
org/deegree/gml/geometry/GML3SurfacePatchReader.java 174
org/deegree/gml/geometry/GML3SurfacePatchReader.java 236
    private Cone parseCone( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS )
                            throws XMLStreamException, XMLParsingException, UnknownCRSException {
        validateAttribute( xmlStream, "horizontalCurveType", "circularArc3Points" );
        validateAttribute( xmlStream, "verticalCurveType", "linear" );

        xmlStream.nextTag();
        xmlStream.require( START_ELEMENT, gmlNs, "row" );

        List<Points> grid = new ArrayList<Points>();
        while ( xmlStream.getLocalName().equals( "row" ) ) {
            xmlStream.nextTag();
            List<Point> currentRow = new LinkedList<Point>();
            if ( xmlStream.getLocalName().equals( "posList" ) ) {
                currentRow = geometryParser.parsePosList( xmlStream, defaultCRS );
                xmlStream.nextTag();
            } else {
                while ( xmlStream.getLocalName().equals( "pos" ) || xmlStream.getLocalName().equals( "pointProperty" ) ) {
                    if ( xmlStream.getLocalName().equals( "pos" ) ) {
                        Point point = geometryParser.parsePoint( xmlStream, defaultCRS );
                        currentRow.add( point );
                    } else {
                        Point point = geometryParser.parsePointProperty( xmlStream, defaultCRS );
                        currentRow.add( point );
                    }
                    xmlStream.nextTag();
                }
            }
            grid.add( geomFac.createPoints( currentRow ) );
            xmlStream.require( END_ELEMENT, gmlNs, "row" );
            xmlStream.nextTag();
        }

        xmlStream.require( START_ELEMENT, gmlNs, "rows" );
        xmlStream.getElementTextAsPositiveInteger(); // redundant; one can determine it from the grid
        xmlStream.require( END_ELEMENT, gmlNs, "rows" );
        xmlStream.nextTag();
        xmlStream.require( START_ELEMENT, gmlNs, "columns" );
        xmlStream.getElementTextAsPositiveInteger(); // redundant; one can determine it from the grid
        xmlStream.require( END_ELEMENT, gmlNs, "columns" );
        xmlStream.nextTag();
        xmlStream.require( END_ELEMENT, gmlNs, "Cone" );
File Line
org/deegree/gml/geometry/GML3SurfacePatchReader.java 177
org/deegree/gml/geometry/GML3SurfacePatchReader.java 239
org/deegree/gml/geometry/GML3SurfacePatchReader.java 301
        validateAttribute( xmlStream, "verticalCurveType", "linear" );

        xmlStream.nextTag();
        xmlStream.require( START_ELEMENT, gmlNs, "row" );

        List<Points> grid = new ArrayList<Points>();
        while ( xmlStream.getLocalName().equals( "row" ) ) {
            xmlStream.nextTag();
            List<Point> currentRow = new LinkedList<Point>();
            if ( xmlStream.getLocalName().equals( "posList" ) ) {
                currentRow = geometryParser.parsePosList( xmlStream, defaultCRS );
                xmlStream.nextTag();
            } else {
                while ( xmlStream.getLocalName().equals( "pos" ) || xmlStream.getLocalName().equals( "pointProperty" ) ) {
                    if ( xmlStream.getLocalName().equals( "pos" ) ) {
                        Point point = geometryParser.parsePoint( xmlStream, defaultCRS );
                        currentRow.add( point );
                    } else {
                        Point point = geometryParser.parsePointProperty( xmlStream, defaultCRS );
                        currentRow.add( point );
                    }
                    xmlStream.nextTag();
                }
            }
            grid.add( geomFac.createPoints( currentRow ) );
            xmlStream.require( END_ELEMENT, gmlNs, "row" );
            xmlStream.nextTag();
        }

        xmlStream.require( START_ELEMENT, gmlNs, "rows" );
        xmlStream.getElementTextAsPositiveInteger(); // redundant; one can determine it from the grid
        xmlStream.require( END_ELEMENT, gmlNs, "rows" );
        xmlStream.nextTag();
        xmlStream.require( START_ELEMENT, gmlNs, "columns" );
        xmlStream.getElementTextAsPositiveInteger(); // redundant; one can determine it from the grid
        xmlStream.require( END_ELEMENT, gmlNs, "columns" );
        xmlStream.nextTag();
        xmlStream.require( END_ELEMENT, gmlNs, "Cone" );
File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 285
org/deegree/filter/xml/Filter110XMLDecoder.java 286
        xmlStream.require( XMLStreamConstants.END_ELEMENT, OGC_NS, "Filter" );
        return filter;
    }

    /**
     * Returns the object representation for the given <code>ogc:expression</code> element event that the cursor of the
     * associated <code>XMLStreamReader</code> points at.
     * <p>
     * The element must be one of the following:
     * <ul>
     * <li>ogc:Add</li>
     * <li>ogc:Sub</li>
     * <li>ogc:Div</li>
     * <li>ogc:Mul</li>
     * <li>ogc:PropertyName</li>
     * <li>ogc:Literal</li>
     * <li>ogc:Function</li>
     * <li>substitution for ogc:expression (handled by {@link CustomExpression} instance)</li>
     * </ul>
     * </p>
     * <p>
     * <ul>
     * <li>Precondition: cursor must point at the <code>START_ELEMENT</code> event (&lt;ogc:expression&gt;)</li>
     * <li>Postcondition: cursor points at the corresponding <code>END_ELEMENT</code> event (&lt;/ogc:expression&gt;)</li>
     * </ul>
     * </p>
     * 
     * @param xmlStream
     *            cursor must point at the <code>START_ELEMENT</code> event (&lt;ogc:expression&gt;), points at the
     *            corresponding <code>END_ELEMENT</code> event (&lt;/ogc:expression&gt;) afterwards
     * @return corresponding {@link Expression} object
     * @throws XMLParsingException
     *             if the element is not a valid "ogc:expression" element
     * @throws XMLStreamException
     */
    public static Expression parseExpression( XMLStreamReader xmlStream )
                            throws XMLStreamException {

        Expression expression = null;

        // check if element name is a valid expression element
        require( xmlStream, START_ELEMENT );
        Expression.Type type = elementNameToExpressionType.get( xmlStream.getName() );
        if ( type == null ) {
            String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT", xmlStream.getName(),
                                              elemNames( Expression.Type.class, expressionTypeToElementName ) );
            throw new XMLParsingException( xmlStream, msg );
        }

        switch ( type ) {
        case ADD: {
            nextElement( xmlStream );
            Expression param1 = parseExpression( xmlStream );
            nextElement( xmlStream );
            Expression param2 = parseExpression( xmlStream );
            expression = new Add( param1, param2 );
            nextElement( xmlStream );
            break;
        }
        case SUB: {
            nextElement( xmlStream );
            Expression param1 = parseExpression( xmlStream );
            nextElement( xmlStream );
            Expression param2 = parseExpression( xmlStream );
            expression = new Sub( param1, param2 );
            nextElement( xmlStream );
            break;
        }
        case MUL: {
            nextElement( xmlStream );
            Expression param1 = parseExpression( xmlStream );
            nextElement( xmlStream );
            Expression param2 = parseExpression( xmlStream );
            expression = new Mul( param1, param2 );
            nextElement( xmlStream );
            break;
        }
        case DIV: {
            nextElement( xmlStream );
            Expression param1 = parseExpression( xmlStream );
            nextElement( xmlStream );
            Expression param2 = parseExpression( xmlStream );
            expression = new Div( param1, param2 );
            nextElement( xmlStream );
            break;
        }
        case VALUE_REFERENCE: {
            expression = parsePropertyName( xmlStream );
File Line
org/deegree/gml/geometry/GML2GeometryReader.java 858
org/deegree/gml/geometry/GML3GeometryBaseReader.java 209
    }

    /**
     * @param xmlStream
     * @return
     * @throws XMLStreamException
     */
    protected double[] parseCoordType( XMLStreamReaderWrapper xmlStream )
                            throws XMLStreamException {

        int event = xmlStream.nextTag();

        // must be a 'gml:X' element
        if ( event != XMLStreamConstants.START_ELEMENT || !GML_X.equals( xmlStream.getName() ) ) {
            String msg = "Invalid 'gml:coords' element. Must contain an 'gml:X' element.";
            throw new XMLParsingException( xmlStream, msg );
        }
        double x = xmlStream.getElementTextAsDouble();
        event = xmlStream.nextTag();
        if ( event == XMLStreamConstants.END_ELEMENT ) {
            return new double[] { x };
        }

        // must be a 'gml:Y' element
        if ( event != XMLStreamConstants.START_ELEMENT || !GML_Y.equals( xmlStream.getName() ) ) {
            String msg = "Invalid 'gml:coords' element. Second child element must be a 'gml:Y' element.";
            throw new XMLParsingException( xmlStream, msg );
        }
        double y = xmlStream.getElementTextAsDouble();
        event = xmlStream.nextTag();
        if ( event == XMLStreamConstants.END_ELEMENT ) {
            return new double[] { x, y };
        }

        // must be a 'gml:Z' element
        if ( event != XMLStreamConstants.START_ELEMENT || !GML_Z.equals( xmlStream.getName() ) ) {
            String msg = "Invalid 'gml:coords' element. Third child element must be a 'gml:Z' element.";
            throw new XMLParsingException( xmlStream, msg );
        }
        double z = xmlStream.getElementTextAsDouble();

        event = xmlStream.nextTag();
        if ( event != XMLStreamConstants.END_ELEMENT ) {
            xmlStream.skipElement();
        }
        return new double[] { x, y, z };
    }
File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 148
org/deegree/filter/xml/Filter110XMLDecoder.java 151
org/deegree/filter/xml/Filter200XMLDecoder.java 158
    private static final QName GML_OBJECT_ID_ELEMENT = new QName( OGC_NS, "GmlObjectId" );

    private static final Map<Expression.Type, QName> expressionTypeToElementName = new HashMap<Expression.Type, QName>();

    private static final Map<QName, Expression.Type> elementNameToExpressionType = new HashMap<QName, Expression.Type>();

    private static final Map<QName, Operator.Type> elementNameToOperatorType = new HashMap<QName, Operator.Type>();

    private static final Map<QName, SpatialOperator.SubType> elementNameToSpatialOperatorType = new HashMap<QName, SpatialOperator.SubType>();

    private static final Map<SpatialOperator.SubType, QName> spatialOperatorTypeToElementName = new HashMap<SpatialOperator.SubType, QName>();

    private static final Map<QName, ComparisonOperator.SubType> elementNameToComparisonOperatorType = new HashMap<QName, ComparisonOperator.SubType>();

    private static final Map<ComparisonOperator.SubType, QName> comparisonOperatorTypeToElementName = new HashMap<ComparisonOperator.SubType, QName>();

    private static final Map<QName, LogicalOperator.SubType> elementNameToLogicalOperatorType = new HashMap<QName, LogicalOperator.SubType>();

    private static final Map<LogicalOperator.SubType, QName> logicalOperatorTypeToElementName = new HashMap<LogicalOperator.SubType, QName>();
File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 650
org/deegree/filter/xml/Filter110XMLDecoder.java 673
org/deegree/filter/xml/Filter200XMLDecoder.java 802
        return new Literal<TypedObjectNode>( value, null );
    }

    private static GenericXMLElement parseElement( XMLStreamReader xmlStream )
                            throws IllegalArgumentException, XMLStreamException {
        Map<QName, PrimitiveValue> attrs = parseAttrs( xmlStream );
        List<TypedObjectNode> children = new ArrayList<TypedObjectNode>();
        while ( xmlStream.next() != END_ELEMENT ) {
            int eventType = xmlStream.getEventType();
            if ( eventType == START_ELEMENT ) {
                children.add( parseElement( xmlStream ) );
            } else if ( eventType == CHARACTERS || eventType == CDATA ) {
                children.add( new PrimitiveValue( xmlStream.getText() ) );
            }
        }
        return new GenericXMLElement( xmlStream.getName(), null, attrs, children );
    }

    private static Map<QName, PrimitiveValue> parseAttrs( XMLStreamReader xmlStream ) {
        Map<QName, PrimitiveValue> attrs = new LinkedHashMap<QName, PrimitiveValue>();
        for ( int i = 0; i < xmlStream.getAttributeCount(); i++ ) {
            QName name = xmlStream.getAttributeName( i );
            String value = xmlStream.getAttributeValue( i );
            PrimitiveValue xmlValue = new PrimitiveValue( value );
            attrs.put( name, xmlValue );
        }
        return attrs;
    }

    private static ValueReference parsePropertyName( XMLStreamReader xmlStream )
File Line
org/deegree/gml/geometry/GML3CurveSegmentReader.java 439
org/deegree/gml/geometry/GML3CurveSegmentReader.java 507
        xmlStream.nextTag();
        Points points = parseControlPoints( xmlStream, defaultCRS );

        // TODO are the any more semantic constraints to be considered?

        int degree = xmlStream.getElementTextAsPositiveInteger( gmlNs, "degree" );

        List<Knot> knots = new LinkedList<Knot>();
        while ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
            if ( !"knot".equals( xmlStream.getLocalName() ) ) {
                break;
            }
            xmlStream.nextTag();
            xmlStream.require( XMLStreamConstants.START_ELEMENT, gmlNs, "Knot" );
            xmlStream.nextTag();
            double value = xmlStream.getElementTextAsDouble( gmlNs, "value" );
            xmlStream.nextTag();
            int multiplicity = xmlStream.getElementTextAsPositiveInteger( gmlNs, "multiplicity" );
            xmlStream.nextTag();
            double weight = xmlStream.getElementTextAsDouble( gmlNs, "weight" );
            xmlStream.nextTag();
            xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "Knot" );
            xmlStream.nextTag();
            xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "knot" );
            knots.add( new Knot( value, multiplicity, weight ) );
        }
        if ( knots.size() != 2 ) {
File Line
org/deegree/gml/geometry/GML2GeometryReader.java 927
org/deegree/gml/geometry/GML3GeometryBaseReader.java 188
        }

        List<Point> points = new ArrayList<Point>( tuples.size() );
        for ( int i = 0; i < tuples.size(); i++ ) {
            StringTokenizer coordinateTokenizer = new StringTokenizer( tuples.get( i ), coordinateSeparator );
            List<String> tokens = new ArrayList<String>();
            while ( coordinateTokenizer.hasMoreTokens() ) {
                tokens.add( coordinateTokenizer.nextToken() );
            }
            double[] tuple = new double[tokens.size()];
            for ( int j = 0; j < tuple.length; j++ ) {
                try {
                    tuple[j] = Double.parseDouble( tokens.get( j ) );
                } catch ( NumberFormatException e ) {
                    String msg = "Value '" + tokens.get( j ) + "' cannot be parsed as a double.";
                    throw new XMLParsingException( xmlStream, msg );
                }
            }
            points.add( geomFac.createPoint( null, tuple, crs ) );
        }
        return points;
    }
File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 690
org/deegree/filter/xml/Filter110XMLDecoder.java 716
        return new ValueReference( propName, new NamespaceBindings( xmlStream.getNamespaceContext(), prefixes ) );
    }

    private static PropertyIsBetween parsePropertyIsBetweenOperator( XMLStreamReader xmlStream )
                            throws XMLStreamException {

        // this is a deegree extension over Filter 1.0.0 spec.
        boolean matchCase = getAttributeValueAsBoolean( xmlStream, null, "matchCase", true );

        nextElement( xmlStream );
        Expression expression = parseExpression( xmlStream );

        nextElement( xmlStream );
        xmlStream.require( START_ELEMENT, OGC_NS, "LowerBoundary" );
        nextElement( xmlStream );
        Expression lowerBoundary = parseExpression( xmlStream );

        nextElement( xmlStream ); // </ expression >
        nextElement( xmlStream ); // </LowerBoundary>

        xmlStream.require( START_ELEMENT, OGC_NS, "UpperBoundary" );
        nextElement( xmlStream );
        Expression upperBoundary = parseExpression( xmlStream );

        nextElement( xmlStream ); // </ expression >
        nextElement( xmlStream ); // </UowerBoundary>
        return new PropertyIsBetween( expression, lowerBoundary, upperBoundary, matchCase, null );
    }

    private static PropertyIsLike parsePropertyIsLikeOperator( XMLStreamReader xmlStream )
                            throws XMLStreamException {

        // this is a deegree extension over Filter 1.0.0
        boolean matchCase = getAttributeValueAsBoolean( xmlStream, null, "matchCase", true );

        String wildCard = getRequiredAttributeValue( xmlStream, "wildCard" );
        String singleChar = getRequiredAttributeValue( xmlStream, "singleChar" );
        String escapeChar = getRequiredAttributeValue( xmlStream, "escape" );
File Line
org/deegree/gml/props/GMLStdPropsReader.java 113
org/deegree/gml/props/GMLStdPropsReader.java 142
    private GMLStdProps readGML2( XMLStreamReader xmlStream )
                            throws XMLStreamException {

        int event = xmlStream.nextTag();

        // 'gml:metaDataProperty' (0...unbounded)
        TypedObjectNode[] metadata = null;
        while ( event == START_ELEMENT && new QName( GMLNS, "metaDataProperty" ).equals( xmlStream.getName() ) ) {
            readMetadataProperty( xmlStream );
            xmlStream.nextTag();
        }

        // 'gml:description' (0...1)
        StringOrRef description = null;
        if ( event == START_ELEMENT && new QName( GMLNS, "description" ).equals( xmlStream.getName() ) ) {
            description = readDescription( xmlStream );
            xmlStream.nextTag();
        }

        // 'gml:name' (0...1)
        List<CodeType> names = new LinkedList<CodeType>();
        while ( event == START_ELEMENT && new QName( GMLNS, "name" ).equals( xmlStream.getName() ) ) {
            names.add( readName( xmlStream ) );
            xmlStream.nextTag();
        }

        return new GMLStdPropsImpl( metadata, description, null, names.toArray( new CodeType[names.size()] ) );
    }

    private GMLStdProps readGML31( XMLStreamReader xmlStream )
File Line
org/deegree/gml/schema/GMLAppSchemaReader.java 152
org/deegree/gml/schema/GMLAppSchemaReader.java 218
        analyzer = new GMLSchemaInfoSet( gmlVersion, schemaUrls );
        this.gmlVersion = analyzer.getVersion();

        for ( Entry<String, String> nsToPrefix : analyzer.getNamespacePrefixes().entrySet() ) {
            this.nsToPrefix.put( nsToPrefix.getKey(), nsToPrefix.getValue() );
            this.prefixToNs.put( nsToPrefix.getValue(), nsToPrefix.getKey() );
        }

        if ( namespaceHints != null ) {
            for ( Entry<String, String> prefixToNs : namespaceHints.entrySet() ) {
                nsToPrefix.put( prefixToNs.getValue(), prefixToNs.getKey() );
                this.prefixToNs.put( prefixToNs.getKey(), prefixToNs.getValue() );
            }
        }

        List<XSElementDeclaration> featureElementDecls = analyzer.getFeatureElementDeclarations( null, false );

        // feature element declarations
        for ( XSElementDeclaration elementDecl : featureElementDecls ) {
            QName ftName = createQName( elementDecl.getNamespace(), elementDecl.getName() );
            ftNameToFtElement.put( ftName, elementDecl );
File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 529
org/deegree/filter/xml/Filter110XMLDecoder.java 529
org/deegree/filter/xml/Filter200XMLDecoder.java 639
    }

    private static Operator parseOperator( XMLStreamReader xmlStream )
                            throws XMLStreamException {

        Operator operator = null;

        // check if element name is a valid operator element
        Operator.Type type = elementNameToOperatorType.get( xmlStream.getName() );
        if ( type == null ) {
            String expectedList = elemNames( Operator.Type.class, logicalOperatorTypeToElementName ) + ", "
                                  + elemNames( Operator.Type.class, spatialOperatorTypeToElementName ) + ", "
                                  + elemNames( Operator.Type.class, comparisonOperatorTypeToElementName );
            String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT", xmlStream.getName(), expectedList );
            throw new XMLParsingException( xmlStream, msg );
        }

        switch ( type ) {
        case COMPARISON:
            LOG.debug( "Building comparison operator" );
            operator = parseComparisonOperator( xmlStream );
            break;
        case LOGICAL:
            LOG.debug( "Building logical operator" );
            operator = parseLogicalOperator( xmlStream );
            break;
        case SPATIAL:
            LOG.debug( "Building spatial operator" );
            operator = parseSpatialOperator( xmlStream );
            break;
        }
        return operator;
    }

    private static IdFilter parseIdFilter( XMLStreamReader xmlStream )
                            throws XMLStreamException {
File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 632
org/deegree/filter/xml/Filter110XMLDecoder.java 654
org/deegree/filter/xml/Filter200XMLDecoder.java 781
        Map<QName, PrimitiveValue> attrs = parseAttrs( xmlStream );
        List<TypedObjectNode> children = new ArrayList<TypedObjectNode>();
        while ( xmlStream.next() != END_ELEMENT ) {
            int eventType = xmlStream.getEventType();
            if ( eventType == START_ELEMENT ) {
                children.add( parseElement( xmlStream ) );
            } else if ( eventType == CHARACTERS || eventType == CDATA ) {
                children.add( new PrimitiveValue( xmlStream.getText() ) );
            }
        }
        TypedObjectNode value = null;
        if ( attrs.isEmpty() && children.size() == 1 ) {
            value = children.get( 0 );
        } else if ( attrs.isEmpty() && children.isEmpty() ) {
            value = new PrimitiveValue( "" );
        } else {
            value = new GenericXMLElement( null, null, attrs, children );
        }
        return new Literal<TypedObjectNode>( value, null );
File Line
org/deegree/gml/geometry/GML3CurveSegmentReader.java 791
org/deegree/gml/geometry/GML3CurveSegmentReader.java 844
    private Geodesic parseGeodesic( XMLStreamReaderWrapper xmlStream, ICRS defaultCRS )
                            throws XMLParsingException, XMLStreamException, UnknownCRSException {

        validateInterpolationAttribute( xmlStream, "geodesic" );

        // the #parseControlPoints(String) method is not used here, because the GML 3.1.1 schema defines a slightly
        // different model here (no 'gml:coordinates' and no 'gml:coordinates' element)
        List<Point> points = null;
        if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
            String name = xmlStream.getLocalName();
            if ( "posList".equals( name ) ) {
                points = parsePosList( xmlStream, defaultCRS );
                xmlStream.nextTag();
            } else {
                points = new LinkedList<Point>();
                do {
                    name = xmlStream.getLocalName();
                    if ( "pos".equals( name ) ) {
                        points.add( parseDirectPositionType( xmlStream, defaultCRS ) );
                    } else if ( "pointProperty".equals( name ) ) {
                        points.add( geometryParser.parsePointProperty( xmlStream, defaultCRS ) );
                    } else {
                        break;
                    }
                } while ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT );
            }
        }

        if ( points.size() != 2 ) {
File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 220
org/deegree/filter/xml/Filter110XMLDecoder.java 223
org/deegree/filter/xml/Filter200XMLDecoder.java 248
                                               ComparisonOperator.SubType.PROPERTY_IS_NULL );
    }

    private static void addElementToExpressionMapping( QName elementName, Expression.Type type ) {
        elementNameToExpressionType.put( elementName, type );
        expressionTypeToElementName.put( type, elementName );
    }

    private static void addElementToSpatialOperatorMapping( QName elementName, SpatialOperator.SubType type ) {
        elementNameToOperatorType.put( elementName, Operator.Type.SPATIAL );
        elementNameToSpatialOperatorType.put( elementName, type );
        spatialOperatorTypeToElementName.put( type, elementName );
    }

    private static void addElementToLogicalOperatorMapping( QName elementName, LogicalOperator.SubType type ) {
        elementNameToOperatorType.put( elementName, Operator.Type.LOGICAL );
        elementNameToLogicalOperatorType.put( elementName, type );
        logicalOperatorTypeToElementName.put( type, elementName );
    }

    private static void addElementToComparisonOperatorMapping( QName elementName, ComparisonOperator.SubType type ) {
        elementNameToOperatorType.put( elementName, Operator.Type.COMPARISON );
        elementNameToComparisonOperatorType.put( elementName, type );
        comparisonOperatorTypeToElementName.put( type, elementName );
    }
File Line
org/deegree/gml/props/GMLStdPropsWriter.java 132
org/deegree/gml/props/GMLStdPropsWriter.java 159
    private void writeGML3( GMLStdProps props )
                            throws XMLStreamException {

        StringOrRef description = props.getDescription();
        if ( description != null ) {
            writer.writeStartElement( "gml", "description", gmlNs );
            if ( description.getRef() != null ) {
                writer.writeAttribute( XLNNS, "xlink", description.getRef() );
            }
            if ( description.getString() != null ) {
                writer.writeCharacters( description.getString() );
            }
            writer.writeEndElement();
        }

        for ( CodeType name : props.getNames() ) {
            writer.writeStartElement( "gml", "name", gmlNs );
            if ( name.getCodeSpace() != null ) {
                writer.writeAttribute( "codeSpace", name.getCodeSpace() );
            }
            if ( name.getCode() != null ) {
                writer.writeCharacters( name.getCode() );
            }
            writer.writeEndElement();
        }
    }
File Line
org/deegree/gml/props/GMLStdPropsWriter.java 103
org/deegree/gml/props/GMLStdPropsWriter.java 132
org/deegree/gml/props/GMLStdPropsWriter.java 159
    private void writeGML2( GMLStdProps props )
                            throws XMLStreamException {

        StringOrRef description = props.getDescription();
        if ( description != null ) {
            writer.writeStartElement( "gml", "description", gmlNs );
            if ( description.getRef() != null ) {
                writer.writeAttribute( XLNNS, "xlink", description.getRef() );
            }
            if ( description.getString() != null ) {
                writer.writeCharacters( description.getString() );
            }
            writer.writeEndElement();
        }

        for ( CodeType name : props.getNames() ) {
            writer.writeStartElement( "gml", "name", gmlNs );
            if ( name.getCodeSpace() != null ) {
                writer.writeAttribute( "codeSpace", name.getCodeSpace() );
            }
            if ( name.getCode() != null ) {
                writer.writeCharacters( name.getCode() );
            }
            writer.writeEndElement();
File Line
org/deegree/gml/geometry/GML2GeometryReader.java 488
org/deegree/gml/geometry/GML3GeometryReader.java 2519
                            throws XMLStreamException {
        Point point = null;
        String href = xmlStream.getAttributeValue( CommonNamespaces.XLNNS, "href" );
        if ( href != null && href.length() > 0 ) {
            LOG.debug( "Found geometry reference (xlink): '" + href + "'" );
            point = new PointReference( idContext, href, xmlStream.getSystemId() );
            idContext.addReference( (GeometryReference<?>) point );
            if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
                String msg = "Unexpected element '" + xmlStream.getName()
                             + "'. Point value has already been specified using xlink.";
                throw new XMLParsingException( xmlStream, msg );
            }
        } else if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
            // must be a 'gml:Point' element
            if ( !xmlStream.getLocalName().equals( "Point" ) ) {
                String msg = "Error in point property element. Expected a 'gml:Point' element.";
                throw new XMLParsingException( xmlStream, msg );
            }
            point = parsePoint( xmlStream, crs );
File Line
org/deegree/gml/geometry/GML2GeometryReader.java 417
org/deegree/gml/geometry/GML3GeometryReader.java 2568
                            throws XMLStreamException {
        LineString lineString = null;
        String href = xmlStream.getAttributeValue( CommonNamespaces.XLNNS, "href" );
        if ( href != null && href.length() > 0 ) {
            LOG.debug( "Found geometry reference (xlink): '" + href + "'" );
            lineString = new LineStringReference( idContext, href, xmlStream.getSystemId() );
            idContext.addReference( (GeometryReference<?>) lineString );
            if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
                String msg = "Unexpected element '" + xmlStream.getName()
                             + "'. LineString value has already been specified using xlink.";
                throw new XMLParsingException( xmlStream, msg );
            }
        } else if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
            // must be a 'gml:LineString' element
            if ( !xmlStream.getLocalName().equals( "LineString" ) ) {
                String msg = "Error in LineString property element. Expected a 'gml:LineString' element.";
                throw new XMLParsingException( xmlStream, msg );
            }
            lineString = parseLineString( xmlStream, crs );
File Line
org/deegree/gml/geometry/GML2GeometryReader.java 345
org/deegree/gml/geometry/GML3GeometryReader.java 2661
                            throws XMLStreamException {
        Polygon polygon = null;
        String href = xmlStream.getAttributeValue( CommonNamespaces.XLNNS, "href" );
        if ( href != null && href.length() > 0 ) {
            LOG.debug( "Found geometry reference (xlink): '" + href + "'" );
            polygon = new PolygonReference( idContext, href, xmlStream.getSystemId() );
            idContext.addReference( (GeometryReference<?>) polygon );
            if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
                String msg = "Unexpected element '" + xmlStream.getName()
                             + "'. Polygon value has already been specified using xlink.";
                throw new XMLParsingException( xmlStream, msg );
            }
        } else if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
            // must be a 'gml:Polygon' element
            if ( !xmlStream.getLocalName().equals( "Polygon" ) ) {
                String msg = "Error in polygon property element. Expected a 'gml:Polygon' element.";
                throw new XMLParsingException( xmlStream, msg );
            }
            polygon = parsePolygon( xmlStream, crs );
File Line
org/deegree/gml/geometry/GML3CurveSegmentReader.java 308
org/deegree/gml/geometry/GML3CurveSegmentReader.java 599
                         + points.size() + ".";
            throw new XMLParsingException( xmlStream, msg );
        }
        xmlStream.require( XMLStreamConstants.START_ELEMENT, gmlNs, "radius" );
        Length radius = parseLengthType( xmlStream );
        xmlStream.nextTag();

        Angle startAngle = null;
        if ( xmlStream.getEventType() == START_ELEMENT ) {
            String localName = xmlStream.getName().getLocalPart();
            if ( "startAngle".equals( localName ) ) {
                startAngle = parseAngleType( xmlStream );
                xmlStream.nextTag();
            }
        }
        Angle endAngle = null;
        if ( xmlStream.getEventType() == START_ELEMENT ) {
            String localName = xmlStream.getName().getLocalPart();
            if ( "endAngle".equals( localName ) ) {
                endAngle = parseAngleType( xmlStream );
                xmlStream.nextTag();
            }
        }
File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 571
org/deegree/filter/xml/Filter110XMLDecoder.java 594
                String id = xmlStream.getAttributeValue( null, "fid" );
                if ( id == null || id.length() == 0 ) {
                    String msg = Messages.getMessage( "FILTER_PARSER_ID_FILTER_NO_ID", FEATURE_ID_ELEMENT,
                                                      FID_ATTR_NAME );
                    throw new XMLParsingException( xmlStream, msg );
                }
                matchingIds.add( id );
                nextElement( xmlStream );
                xmlStream.require( XMLStreamConstants.END_ELEMENT, OGC_NS, "FeatureId" );
            } else {
                String msg = Messages.getMessage( "FILTER_PARSER_ID_FILTER_UNEXPECTED_ELEMENT", childElementName,
                                                  GML_OBJECT_ID_ELEMENT, FEATURE_ID_ELEMENT );
                throw new XMLParsingException( xmlStream, msg );
            }
            nextElement( xmlStream );
        }
        return new IdFilter( matchingIds );
    }

    private static ComparisonOperator parseBinaryComparisonOperator( XMLStreamReader xmlStream, SubType type )
                            throws XMLStreamException {

        BinaryComparisonOperator comparisonOperator = null;

        // this is a deegree extension over Filter 1.0.0 spec.
        boolean matchCase = getAttributeValueAsBoolean( xmlStream, null, "matchCase", true );
File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 458
org/deegree/filter/xml/Filter110XMLDecoder.java 458
org/deegree/filter/xml/Filter200XMLDecoder.java 451
        return expr.parse100( xmlStream );
    }

    /**
     * Returns the object representation for the given <code>ogc:comparisonOps</code> element event that the cursor of
     * the associated <code>XMLStreamReader</code> points at.
     * <p>
     * The element must be one of the following:
     * <ul>
     * <li>ogc:PropertyIsEqualTo</li>
     * <li>ogc:PropertyIsGreaterThan</li>
     * <li>ogc:PropertyIsGreaterThanOrEqualTo</li>
     * <li>ogc:PropertyIsLessThan</li>
     * <li>ogc:PropertyIsLessThanOrEqualTo</li>
     * <li>ogc:PropertyIsNotEqualTo</li>
     * <li>ogc:PropertyIsBetween</li>
     * <li>ogc:PropertyIsLike</li>
     * <li>ogc:PropertyIsNull</li>
     * </ul>
     * </p>
     * <p>
     * <ul>
     * <li>Precondition: cursor must point at the <code>START_ELEMENT</code> event (&lt;ogc:comparisonOps&gt;)</li>
     * <li>Postcondition: cursor points at the corresponding <code>END_ELEMENT</code> event (&lt;/ogc:comparisonOps&gt;)
     * </li>
     * </ul>
     * </p>
     * 
     * @param xmlStream
     *            cursor must point at the <code>START_ELEMENT</code> event (&lt;ogc:comparisonOps&gt;), points at the
     *            corresponding <code>END_ELEMENT</code> event (&lt;/ogc:comparisonOps&gt;) afterwards
     * @return corresponding {@link Expression} object
     * @throws XMLParsingException
     *             if the element is not a valid "ogc:comparisonOps" element
     * @throws XMLStreamException
     */
    public static ComparisonOperator parseComparisonOperator( XMLStreamReader xmlStream )
                            throws XMLStreamException {

        ComparisonOperator comparisonOperator = null;

        // check if element name is a valid comparison operator element
        ComparisonOperator.SubType type = elementNameToComparisonOperatorType.get( xmlStream.getName() );
        if ( type == null ) {
            String msg = Messages.getMessage( "FILTER_PARSER_UNEXPECTED_ELEMENT",
                                              xmlStream.getName(),
                                              elemNames( ComparisonOperator.SubType.class,
                                                         comparisonOperatorTypeToElementName ) );
            throw new XMLParsingException( xmlStream, msg );
        }

        switch ( type ) {
        case PROPERTY_IS_EQUAL_TO:
        case PROPERTY_IS_GREATER_THAN:
        case PROPERTY_IS_GREATER_THAN_OR_EQUAL_TO:
        case PROPERTY_IS_LESS_THAN:
        case PROPERTY_IS_LESS_THAN_OR_EQUAL_TO:
        case PROPERTY_IS_NOT_EQUAL_TO:
            comparisonOperator = parseBinaryComparisonOperator( xmlStream, type );
            break;
        case PROPERTY_IS_BETWEEN:
            comparisonOperator = parsePropertyIsBetweenOperator( xmlStream );
            break;
        case PROPERTY_IS_LIKE:
            comparisonOperator = parsePropertyIsLikeOperator( xmlStream );
            break;
        case PROPERTY_IS_NULL:
            comparisonOperator = parsePropertyIsNullOperator( xmlStream );
            break;
File Line
org/deegree/filter/expression/Add.java 78
org/deegree/filter/expression/Div.java 80
org/deegree/filter/expression/Mul.java 78
org/deegree/filter/expression/Sub.java 78
    }

    @Override
    public <T> TypedObjectNode[] evaluate( T obj, XPathEvaluator<T> xpathEvaluator )
                            throws FilterEvaluationException {

        TypedObjectNode[] values1 = param1.evaluate( obj, xpathEvaluator );
        TypedObjectNode[] values2 = param2.evaluate( obj, xpathEvaluator );

        List<TypedObjectNode> resultValues = new ArrayList<TypedObjectNode>( values1.length * values2.length );
        for ( TypedObjectNode value1 : values1 ) {
            if ( value1 != null ) {
                try {
                    BigDecimal bd1 = new BigDecimal( value1.toString() );
                    for ( TypedObjectNode value2 : values2 ) {
                        if ( value2 != null ) {
                            BigDecimal bd2 = new BigDecimal( value2.toString() );
                            resultValues.add( new PrimitiveValue( bd1.add( bd2 ) ) );
File Line
org/deegree/feature/xpath/TypedObjectNodeXPathEvaluator.java 154
org/deegree/feature/xpath/TypedObjectNodeXPathEvaluator.java 182
            selectedNodes = xpath.selectNodes( new XMLElementNode( null, element ) );
            resultValues = new TypedObjectNode[selectedNodes.size()];
            int i = 0;
            for ( Object node : selectedNodes ) {
                if ( node instanceof XPathNode<?> ) {
                    resultValues[i++] = ( (XPathNode<?>) node ).getValue();
                } else if ( node instanceof String || node instanceof Double || node instanceof Boolean ) {
                    resultValues[i++] = new PrimitiveValue( node );
                } else {
                    throw new RuntimeException( "Internal error. Encountered unexpected value of type '"
                                                + node.getClass().getName() + "' (=" + node
                                                + ") during XPath-evaluation." );
                }
            }
        } catch ( JaxenException e ) {
            throw new FilterEvaluationException( e.getMessage() );
        }
        return resultValues;
    }
File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 372
org/deegree/filter/xml/Filter110XMLDecoder.java 372
            expression = parsePropertyName( xmlStream );
            break;
        }
        case LITERAL: {
            expression = parseLiteral( xmlStream );
            break;
        }
        case FUNCTION: {
            expression = parseFunction( xmlStream );
            break;
        }
        case CUSTOM: {
            expression = parseCustomExpression( xmlStream );
            break;
        }
        }
        return expression;
    }

    /**
     * Returns the object representation for the given <code>ogc:Function</code> element event that the cursor of the
     * associated <code>XMLStreamReader</code> points at.
     * <p>
     * <ul>
     * <li>Precondition: cursor must point at the <code>START_ELEMENT</code> event (&lt;ogc:Function&gt;)</li>
     * <li>Postcondition: cursor points at the corresponding <code>END_ELEMENT</code> event (&lt;/ogc:Function&gt;)</li>
     * </ul>
     * </p>
     * 
     * @param xmlStream
     *            cursor must point at the <code>START_ELEMENT</code> event (&lt;ogc:Function&gt;), points at the
     *            corresponding <code>END_ELEMENT</code> event (&lt;/ogc:Function&gt;) afterwards
     * @return corresponding {@link Function} object
     * @throws XMLParsingException
     *             if the element is not a valid "ogc:Function" element
     * @throws XMLStreamException
     */
    public static Function parseFunction( XMLStreamReader xmlStream )
                            throws XMLStreamException {

        xmlStream.require( START_ELEMENT, OGC_NS, "Function" );
        String name = getRequiredAttributeValue( xmlStream, "name" );
        nextElement( xmlStream );
        List<Expression> params = new ArrayList<Expression>();
        while ( xmlStream.getEventType() == START_ELEMENT ) {
            params.add( parseExpression( xmlStream ) );
            nextElement( xmlStream );
        }
        xmlStream.require( END_ELEMENT, OGC_NS, "Function" );

        Function function = null;
        FunctionProvider provider = FunctionManager.getFunctionProvider( name );
File Line
org/deegree/gml/geometry/GML2GeometryReader.java 559
org/deegree/gml/geometry/GML3GeometryReader.java 2847
                            throws XMLStreamException {
        Geometry geometry = null;
        String href = xmlStream.getAttributeValue( CommonNamespaces.XLNNS, "href" );
        if ( href != null && href.length() > 0 ) {
            LOG.debug( "Found geometry reference (xlink): '" + href + "'" );
            geometry = new GeometryReference<Geometry>( idContext, href, xmlStream.getSystemId() );
            idContext.addReference( (GeometryReference<?>) geometry );
            if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
                String msg = "Unexpected element '" + xmlStream.getName()
                             + "'. Geometry value has already been specified using xlink.";
                throw new XMLParsingException( xmlStream, msg );
            }
        } else if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
            geometry = parse( xmlStream, crs );
File Line
org/deegree/gml/geometry/GML3GeometryBaseReader.java 99
org/deegree/gml/geometry/GML3GeometryBaseReader.java 331
        String s = xmlStream.getElementText();
        // don't use String.split(regex) here (speed)
        StringTokenizer st = new StringTokenizer( s );
        List<String> tokens = new ArrayList<String>();
        while ( st.hasMoreTokens() ) {
            tokens.add( st.nextToken() );
        }
        double[] doubles = new double[tokens.size()];
        for ( int i = 0; i < doubles.length; i++ ) {
            try {
                doubles[i] = Double.parseDouble( tokens.get( i ) );
            } catch ( NumberFormatException e ) {
                String msg = "Value '" + tokens.get( i ) + "' cannot be parsed as a double.";
                throw new XMLParsingException( xmlStream, msg );
            }
        }
        return geomFac.createPoint( null, doubles, crs );
File Line
org/deegree/gml/schema/GMLAppSchemaReader.java 359
org/deegree/gml/schema/GMLAppSchemaReader.java 430
        XSComplexTypeDefinition typeDef = (XSComplexTypeDefinition) featureElementDecl.getTypeDefinition();

        // element contents
        switch ( typeDef.getContentType() ) {
        case XSComplexTypeDefinition.CONTENTTYPE_ELEMENT: {
            XSParticle particle = typeDef.getParticle();
            int minOccurs = particle.getMinOccurs();
            int maxOccurs = particle.getMaxOccursUnbounded() ? -1 : particle.getMaxOccurs();
            XSTerm term = particle.getTerm();
            switch ( term.getType() ) {
            case XSConstants.MODEL_GROUP: {
                addPropertyTypes( pts, (XSModelGroup) term, minOccurs, maxOccurs );
                break;
            }
            case XSConstants.ELEMENT_DECLARATION: {
                pts.add( buildPropertyType( (XSElementDeclaration) term, minOccurs, maxOccurs ) );
                break;
            }
            case XSConstants.WILDCARD: {
                String msg = "Broken GML application schema: Feature element '" + ftName
File Line
org/deegree/gml/schema/GMLSchemaInfoSet.java 705
org/deegree/gml/schema/GMLSchemaInfoSet.java 1178
        case XSComplexTypeDefinition.CONTENTTYPE_ELEMENT: {
            LOG.trace( "CONTENTTYPE_ELEMENT" );
            XSParticle particle = typeDef.getParticle();
            XSTerm term = particle.getTerm();
            switch ( term.getType() ) {
            case XSConstants.MODEL_GROUP: {
                XSModelGroup modelGroup = (XSModelGroup) term;
                switch ( modelGroup.getCompositor() ) {
                case XSModelGroup.COMPOSITOR_ALL: {
                    LOG.debug( "Unhandled model group: COMPOSITOR_ALL" );
                    break;
                }
                case XSModelGroup.COMPOSITOR_CHOICE:
                case XSModelGroup.COMPOSITOR_SEQUENCE: {
                    LOG.trace( "Found sequence / choice." );
                    XSObjectList sequence = modelGroup.getParticles();
                    if ( sequence.getLength() != 1 ) {
                        LOG.trace( "Length = '" + sequence.getLength() + "' -> cannot be a feature property." );
File Line
org/deegree/gml/geometry/GML2GeometryReader.java 600
org/deegree/gml/geometry/GML2GeometryReader.java 653
        ICRS crs = determineActiveCRS( xmlStream, defaultCRS );
        xmlStream.nextTag();

        List<Point> points = null;
        if ( xmlStream.getEventType() == XMLStreamConstants.START_ELEMENT ) {
            String name = xmlStream.getLocalName();
            if ( "coordinates".equals( name ) ) {
                points = parseCoordinates( xmlStream, crs );
                xmlStream.nextTag();
            } else {
                points = new LinkedList<Point>();
                do {
                    if ( "coord".equals( name ) ) {
                        double[] coords = parseCoordType( xmlStream );
                        // anonymous point (no registering necessary)
                        points.add( geomFac.createPoint( null, coords, crs ) );
                    } else {
                        String msg = "Error in 'gml:Envelope' element.";
File Line
org/deegree/gml/geometry/GML3GeometryWriter.java 244
org/deegree/gml/geometry/GML3GeometryWriter.java 262
        case MULTI_CURVE: {
            MultiCurve<Curve> multiCurve = (MultiCurve<Curve>) geometry;
            startGeometry( "MultiCurve", geometry );
            for ( Curve curve : multiCurve ) {
                writer.writeStartElement( "gml", "curveMember", gmlNs );
                if ( !exportSf && curve.getId() != null && referenceExportStrategy.isObjectExported( curve.getId() ) ) {
                    writer.writeAttribute( XLNNS, "href", "#" + curve.getId() );
                } else if ( curve instanceof CompositeCurve ) {
                    exportCompositeCurve( (CompositeCurve) curve );
                } else {
                    exportCurve( curve );
                }
                writer.writeEndElement();
            }
            writer.writeEndElement(); // MultiCurve
File Line
org/deegree/filter/xml/Filter100XMLDecoder.java 900
org/deegree/filter/xml/Filter110XMLDecoder.java 963
                Geometry param2 = geomParser.parseGeometryOrBox( wrapper );
                spatialOperator = new Within( param1, param2 );
            }
            }
        } catch ( UnknownCRSException e ) {
            throw new XMLParsingException( xmlStream, e.getMessage() );
        }
        nextElement( xmlStream );
        return spatialOperator;
    }

    /**
     * Return a String with all element names of the given enum class.
     * 
     * @param enumClass
     * @param map
     *            the operator type -> element name map
     * @return a coma separated list of element names
     */
    private static String elemNames( Class<? extends Enum<?>> enumClass, Map<? extends Enum<?>, QName> map ) {
        List<String> names = new LinkedList<String>();
        for ( Enum<?> e : enumClass.getEnumConstants() ) {
            QName qname = map.get( e );
            if ( qname == null ) {
File Line
org/deegree/gml/geometry/GML3GeometryWriter.java 311
org/deegree/gml/geometry/GML3GeometryWriter.java 360
                MultiSurface<Surface> multiSurface = (MultiSurface<Surface>) geometry;
                startGeometry( "MultiSurface", geometry );
                for ( Surface surface : multiSurface ) {
                    writer.writeStartElement( gmlNs, "surfaceMember" );
                    if ( !exportSf && surface.getId() != null
                         && referenceExportStrategy.isObjectExported( surface.getId() ) ) {
                        writer.writeAttribute( XLNNS, "href", "#" + surface.getId() );
                    } else if ( surface instanceof CompositeSurface ) {
                        exportCompositeSurface( (CompositeSurface) surface );
                    } else {
                        exportSurface( surface );
                    }

                    writer.writeEndElement(); // surfaceMember
                }
                writer.writeEndElement();
File Line
org/deegree/feature/xpath/TypedObjectNodeXPathEvaluator.java 124
org/deegree/feature/xpath/TypedObjectNodeXPathEvaluator.java 154
org/deegree/feature/xpath/TypedObjectNodeXPathEvaluator.java 182
                selectedNodes = xpath.selectNodes( new GMLObjectNode<GMLObject, GMLObject>( null, context ) );
                resultValues = new TypedObjectNode[selectedNodes.size()];
                int i = 0;
                for ( Object node : selectedNodes ) {
                    if ( node instanceof XPathNode<?> ) {
                        resultValues[i++] = ( (XPathNode<?>) node ).getValue();
                    } else if ( node instanceof String || node instanceof Double || node instanceof Boolean ) {
                        resultValues[i++] = new PrimitiveValue( node );
                    } else {
                        throw new RuntimeException( "Internal error. Encountered unexpected value of type '"
                                                    + node.getClass().getName() + "' (=" + node
                                                    + ") during XPath-evaluation." );
                    }
                }
            }
File Line
org/deegree/filter/xml/Filter110XMLDecoder.java 972
org/deegree/filter/xml/Filter200XMLDecoder.java 1171
    }

    /**
     * Return a String with all element names of the given enum class.
     * 
     * @param enumClass
     * @param map
     *            the operator type -> element name map
     * @return a coma separated list of element names
     */
    private static String elemNames( Class<? extends Enum<?>> enumClass, Map<? extends Enum<?>, QName> map ) {
        List<String> names = new LinkedList<String>();
        for ( Enum<?> e : enumClass.getEnumConstants() ) {
            QName qname = map.get( e );
            if ( qname != null ) {
                LOG.debug( qname.toString() );
                names.add( qname.toString() );
            }

        }
        return ArrayUtils.join( ", ", names );
    }
}
File Line
org/deegree/gml/feature/GMLFeatureReader.java 343
org/deegree/gml/feature/StreamFeatureCollection.java 178
                while ( declIter.hasNext() && findConcretePropertyType( propName, activeDecl ) == null ) {
                    if ( propOccurences < activeDecl.getMinOccurs() ) {
                        String msg = null;
                        if ( activeDecl.getMinOccurs() == 1 ) {
                            msg = Messages.getMessage( "ERROR_PROPERTY_MANDATORY", activeDecl.getName(), ft.getName() );
                        } else {
                            msg = Messages.getMessage( "ERROR_PROPERTY_TOO_FEW_OCCURENCES", activeDecl.getName(),
                                                       activeDecl.getMinOccurs(), ft.getName() );
                        }
                        throw new XMLParsingException( xmlStream, msg );
                    }
                    activeDecl = declIter.next();
                    propOccurences = 0;
                }
                if ( findConcretePropertyType( propName, activeDecl ) == null ) {
File Line
org/deegree/gml/geometry/GML3GeometryReader.java 1586
org/deegree/gml/geometry/GML3GeometryReader.java 1634
                            throws XMLStreamException, UnknownCRSException {

        QName elName = xmlStream.getName();
        GMLObjectType type = getType( xmlStream );
        String gid = parseGeometryId( xmlStream );
        ICRS crs = determineActiveCRS( xmlStream, defaultCRS );
        List<Property> props = readStandardProperties( xmlStream, type, crs );

        List<Triangle> memberPatches = new LinkedList<Triangle>();
        xmlStream.require( START_ELEMENT, gmlNs, "trianglePatches" );
        while ( xmlStream.nextTag() == START_ELEMENT ) {
            memberPatches.add( surfacePatchParser.parseTriangle( xmlStream, crs ) );
        }
        xmlStream.require( END_ELEMENT, gmlNs, "trianglePatches" );
File Line
org/deegree/gml/schema/GMLAppSchemaReader.java 183
org/deegree/gml/schema/GMLAppSchemaReader.java 244
            }
        }

        // geometry element declarations
        List<XSElementDeclaration> geometryElementDecls = analyzer.getGeometryElementDeclarations( null, false );
        for ( XSElementDeclaration elementDecl : geometryElementDecls ) {
            QName elName = createQName( elementDecl.getNamespace(), elementDecl.getName() );
            geometryNameToGeometryElement.put( elName, elementDecl );
            XSElementDeclaration substitutionElement = elementDecl.getSubstitutionGroupAffiliation();
            if ( substitutionElement != null ) {
                QName substitutionElementName = createQName( substitutionElement.getNamespace(),
                                                             substitutionElement.getName() );
                geometryNameToSubstitutionGroupName.put( elName, substitutionElementName );
            }
        }
    }

    /**
     * Creates a new {@link GMLAppSchemaReader} from the given <code>LSInput</code>s.
     * 
     * @param gmlVersion
     *            gml version of the schema files, can be null (auto-detect GML version)
     * @param namespaceHints
     *            optional hints (key: prefix, value: namespaces) for generating 'nice' qualified feature type and
     *            property type names, may be null
     * @param inputs
     * @throws ClassCastException
     * @throws ClassNotFoundException
     * @throws InstantiationException
     * @throws IllegalAccessException
     */
    public GMLAppSchemaReader( GMLVersion gmlVersion, Map<String, String> namespaceHints, LSInput... inputs )
File Line
org/deegree/filter/xml/Filter110XMLDecoder.java 420
org/deegree/filter/xml/Filter200XMLDecoder.java 413
        xmlStream.require( END_ELEMENT, OGC_NS, "Function" );

        Function function = null;
        FunctionProvider cf = FunctionManager.getFunctionProvider( name );
        if ( cf != null ) {
            function = cf.create( params );
        } else {
            function = new Function( name, params );
        }
        return function;
    }

    /**
     * Returns the object representation for the given custom <code>ogc:expression</code> element event that the cursor
     * of the associated <code>XMLStreamReader</code> points at.
     * <p>
     * <ul>
     * <li>Precondition: cursor must point at the <code>START_ELEMENT</code> event (&lt;ogc:expression&gt;)</li>
     * <li>Postcondition: cursor points at the corresponding <code>END_ELEMENT</code> event (&lt;/ogc:expression&gt;)</li>
     * </ul>
     * </p>
     * 
     * @param xmlStream
     *            cursor must point at the <code>START_ELEMENT</code> event (&lt;ogc:expression&gt;), points at the
     *            corresponding <code>END_ELEMENT</code> event (&lt;/ogc:expression&gt;) afterwards
     * @return corresponding {@link CustomExpression} object
     * @throws XMLParsingException
     *             if the element is not a known or valid custom "ogc:expression" element
     * @throws XMLStreamException
     */
    public static CustomExpression parseCustomExpression( XMLStreamReader xmlStream )
                            throws XMLStreamException {

        CustomExpression expr = CustomExpressionManager.getExpression( xmlStream.getName() );
        if ( expr == null ) {
            String msg = Messages.getMessage( "FILTER_PARSER_UNKNOWN_CUSTOM_EXPRESSION", xmlStream.getName() );
            throw new XMLParsingException( xmlStream, msg );
        }
        return expr.parse100( xmlStream );
File Line
org/deegree/gml/geometry/GML3GeometryBaseReader.java 252
org/deegree/gml/geometry/GML3GeometryBaseReader.java 271
org/deegree/gml/geometry/GML3GeometryBaseReader.java 290
    protected Length parseLengthType( XMLStreamReaderWrapper xmlStream )
                            throws XMLStreamException {
        String uom = xmlStream.getAttributeValue( null, "uom" );
        if ( uom == null ) {
            String msg = "Required attribute 'uom' missing in element '" + xmlStream.getName() + "'.";
            throw new XMLParsingException( xmlStream, msg );
        }
        String s = xmlStream.getElementText();
        BigDecimal value = new BigDecimal( 0.0 );
        try {
            value = new BigDecimal( s );
        } catch ( NumberFormatException e ) {
            String msg = "Error in element '" + xmlStream.getName() + "': expected a double value, but found '" + s
                         + "'.";
            throw new XMLParsingException( xmlStream, msg );
        }
        return new Length( value, uom );
File Line
org/deegree/gml/geometry/GML3GeometryReader.java 387
org/deegree/gml/geometry/GML3GeometryReader.java 410
            if ( geomHierarchy.getPrimitiveElementNames().contains( elName ) ) {
                geometry = parseGeometricPrimitive( xmlStream, defaultCRS );
            } else if ( ringElements.contains( name ) ) {
                geometry = parseAbstractRing( xmlStream, defaultCRS );
            } else if ( aggregateElements.contains( name ) ) {
                geometry = parseGeometricAggregate( xmlStream, defaultCRS );
            } else if ( "GeometricComplex".equals( name ) ) {
                geometry = parseGeometricComplex( xmlStream, defaultCRS );
            } else if ( implictGeometryElements.contains( name ) ) {
                geometry = parseImplicitGeometry( xmlStream, defaultCRS );
            } else {
                String msg = "Invalid GML geometry: '" + xmlStream.getName()
                             + "' does not denote a well-known/application-schema defined GML geometry element.";
File Line
org/deegree/feature/utils/DBUtils.java 173
org/deegree/feature/utils/DBUtils.java 216
    public static LinkedList<String> fetchGeometrySchemas( String connId, DeegreeWorkspace workspace ) {
        Connection conn = null;
        PreparedStatement stmt = null;
        ResultSet set = null;
        LinkedList<String> result = new LinkedList<String>();
        try {
            ConnectionManager mgr = workspace.getSubsystemManager( ConnectionManager.class );
            conn = mgr.get( connId );
            try {
                // make this configurable via argument?
                stmt = conn.prepareStatement( "select probe_geometry_columns()" );
                stmt.executeQuery();
            } catch ( SQLException e ) {
                LOG.debug( "Could not update the geometry_columns table: '{}'", e.getLocalizedMessage() );
                LOG.trace( "Stack trace:", e );
            } finally {
                JDBCUtils.close( stmt );
            }
File Line
org/deegree/gml/commons/AbstractGMLObjectReader.java 505
org/deegree/gml/commons/AbstractGMLObjectReader.java 542
        case CONTENTTYPE_ELEMENT: {
            // TODO respect order + multiplicity of child elements
            int eventType = 0;
            while ( ( eventType = xmlStream.next() ) != END_ELEMENT ) {
                if ( eventType == START_ELEMENT ) {
                    QName childElName = xmlStream.getName();
                    if ( !childElementDecls.containsKey( new QName( "*" ) )
                         && !childElementDecls.containsKey( childElName ) ) {
                        String msg = "Element '" + childElName + "' is not allowed at this position.";
                        throw new XMLParsingException( xmlStream, msg );
                    }
                    TypedObjectNode child = parseGenericXMLElement( xmlStream,
                                                                    (XSElementDeclaration) childElementDecls.get( childElName ),
                                                                    crs );
                    // LOG.debug( "adding: " + childElName + ", " + child.getClass().getName() );
                    children.add( child );
                }
File Line
org/deegree/gml/commons/AbstractGMLObjectReader.java 635
org/deegree/gml/commons/AbstractGMLObjectReader.java 708
        for ( int i = 0; i < xsdValueType.getAttributeUses().getLength(); i++ ) {
            XSAttributeUse attrUse = (XSAttributeUse) xsdValueType.getAttributeUses().item( i );
            if ( attrUse.getRequired() ) {
                XSAttributeDeclaration attrDecl = attrUse.getAttrDeclaration();
                QName name = new QName( attrDecl.getNamespace(), attrDecl.getName() );
                if ( !attrs.containsKey( name ) ) {
                    String msg = "Required attribute '" + name + "' is missing.";
                    throw new XMLParsingException( xmlStream, msg );
                }
            }
        }