-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
XMLHandlerHints.java
187 lines (162 loc) · 5.2 KB
/
XMLHandlerHints.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*
* GeoTools - The Open Source Java GIS Toolkit
* http://geotools.org
*
* (C) 2002-2008, Open Source Geospatial Foundation (OSGeo)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
package org.geotools.xml;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* Hint object with known parameters for XML parsing.
*
* @author Jesse
*
*
*
* @source $URL$
*/
public class XMLHandlerHints implements Map<String,Object> {
/**
* Declares the schemas to use for parsing.
* Value must be a java.util.Map of <String,URI> objects
* where String is the Namespace and URI is the URL to use to load the schema.
*/
public static final String NAMESPACE_MAPPING = "NAMESPACE_MAPPING";
/** Declares a FlowHandler for the parser to use */
public final static String FLOW_HANDLER_HINT = "FLOW_HANDLER_HINT";
/** Tells the parser to "Stream" */
public static final String STREAM_HINT = "org.geotools.xml.gml.STREAM_HINT";
/** Sets the level of compliance that the filter encoder should use */
public static final String FILTER_COMPLIANCE_STRICTNESS = "org.geotools.xml.filter.FILTER_COMPLIANCE_STRICTNESS";
/** Supplied {@link EntityResolver} for Schema and/or DTD validation */
public final static String ENTITY_RESOLVER ="org.xml.sax.EntityResolver";
/** Supplied {@link SaxParserFactory} */
public final static String SAX_PARSER_FACTORY ="javax.xml.parsers.SAXParserFactory";
/**
* The value so that the parser will encode all Geotools filters with no modifications.
*/
public static final Integer VALUE_FILTER_COMPLIANCE_LOW = new Integer(0);
/**
* The value so the parser will be slightly more compliant to the Filter 1.0.0 spec.
* It will encode:
*
* <pre><code>
* BBoxFilter
* or
* FidFilter
* </code></pre>
*
* as
*
* <pre><code>
* <Filter><BBo>...</BBox><FidFilter fid="fid"/></Filter>
* </code></pre>
*
* It will encode:
* <pre><code>
* BBoxFilter
* and
* FidFilter
* </code></pre>
* as
*
* <pre><code>
* <Filter><FidFilter fid="fid"/></Filter>
* </code></pre>
*
* <p><b>IMPORTANT:</b> If this compliance level is used and a non-strict FilterFactory is used to create
* the filter then the original filter must be ran on the retrieved feature because this hint will sometimes
* cause more features to be returned than is requested. Consider the following filter:
*
* not(fidFilter).
*
* this will return all features and so the filtering must be done on the client.
* </p>
*/
public static final Integer VALUE_FILTER_COMPLIANCE_MEDIUM = new Integer(1);
/**
* The value so the parser will be compliant with the Filter 1.0.0 spec.
*
* It will throw an exception with filters like:
* BBoxFilter
* or
* FidFilter
*
* It will encode:
* <pre><code>
* BBoxFilter
* and
* FidFilter
* </code></pre>
* as
*
* <pre><code>
* <Filter><FidFilter fid="fid"/></Filter>
* </code></pre>
* <p><b>IMPORTANT:</b> If this compliance level is used and a non-strict FilterFactory is used to create
* the filter then the original filter must be ran on the retrieved feature because this hint will sometimes
* cause more features to be returned than is requested. Consider the following filter:
* <p>
* not(fidFilter).
* </p>
* this will return all features and so the filtering must be done on the client.
* </p>
*/
public static final Integer VALUE_FILTER_COMPLIANCE_HIGH = new Integer(2);
private Map<String,Object> map=new HashMap<String,Object>();
public void clear() {
map.clear();
}
public boolean containsKey( Object key ) {
return map.containsKey(key);
}
public boolean containsValue( Object value ) {
return map.containsValue(value);
}
public Set<Entry<String,Object>> entrySet() {
return map.entrySet();
}
public boolean equals( Object o ) {
return map.equals(o);
}
public Object get( Object key ) {
return map.get(key);
}
public int hashCode() {
return map.hashCode();
}
public boolean isEmpty() {
return map.isEmpty();
}
public Set<String> keySet() {
return map.keySet();
}
public Object put( String key, Object value ) {
return map.put(key, value);
}
public void putAll( Map<? extends String,? extends Object> other ) {
map.putAll(other);
}
public Object remove( Object key ) {
return map.remove(key);
}
public int size() {
return map.size();
}
public Collection<Object> values() {
return map.values();
}
}