⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 propertynametypebinding.java

📁 电子地图服务器,搭建自己的地图服务
💻 JAVA
字号:
/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
 * This code is licensed under the GPL 2.0 license, availible at the root
 * application directory.
 */
package org.geoserver.wfs.xml.filter.v1_1;

import org.geoserver.wfs.WFSException;
import org.geotools.filter.v1_0.OGCPropertyNameTypeBinding;
import org.geotools.gml3.bindings.GML;
import org.geotools.xml.ElementInstance;
import org.geotools.xml.Node;
import org.opengis.filter.FilterFactory;
import org.opengis.filter.expression.PropertyName;
import org.vfny.geoserver.global.Data;
import org.xml.sax.helpers.NamespaceSupport;


/**
 * A binding for ogc:PropertyName which does a special case check for an empty
 * property name.
 *
 * @author Justin Deoliveira, The Open Planning Project
 *
 */
public class PropertyNameTypeBinding extends OGCPropertyNameTypeBinding {
    /** the geoserver catalog */
    Data catalog;

    /** parser namespace mappings */
    NamespaceSupport namespaceSupport;

    public PropertyNameTypeBinding(FilterFactory filterFactory, NamespaceSupport namespaceSupport,
        Data catalog) {
        super(filterFactory);
        this.namespaceSupport = namespaceSupport;
        this.catalog = catalog;
    }

    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        PropertyName propertyName = (PropertyName) super.parse(instance, node, value);

        //JD: temporary hack, this should be carried out at evaluation time
        String name = propertyName.getPropertyName();

        if (name != null && name.matches("\\w+:\\w+")) {
            //namespace qualified name, ensure the prefix is valid
            String prefix = name.substring(0, name.indexOf(':'));
            String namespaceURI = namespaceSupport.getURI(prefix);

            //only accept if its an application schema namespace, or gml
            if (!GML.NAMESPACE.equals(namespaceURI)
                    && (catalog.getNameSpaceFromURI(namespaceURI) == null)) {
                throw new WFSException("Illegal attribute namespace: " + namespaceURI);
            }
        }

        return propertyName;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -