Source Code Cross Referenced for QueryTypeBinding.java in  » GIS » GeoServer » org » geoserver » wfs » xml » v1_1_0 » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoServer » org.geoserver.wfs.xml.v1_1_0 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
002:         * This code is licensed under the GPL 2.0 license, availible at the root
003:         * application directory.
004:         */
005:        package org.geoserver.wfs.xml.v1_1_0;
006:
007:        import net.opengis.wfs.QueryType;
008:        import net.opengis.wfs.WfsFactory;
009:
010:        import org.geoserver.wfs.WFSException;
011:        import org.geotools.gml2.bindings.GML2ParsingUtils;
012:        import org.geotools.xml.AbstractComplexBinding;
013:        import org.geotools.xml.ElementInstance;
014:        import org.geotools.xml.Node;
015:        import org.opengis.feature.Property;
016:        import org.opengis.filter.Filter;
017:        import org.opengis.filter.expression.Literal;
018:        import org.opengis.filter.expression.PropertyName;
019:        import org.opengis.filter.sort.SortBy;
020:        import org.opengis.referencing.crs.CoordinateReferenceSystem;
021:        import org.picocontainer.MutablePicoContainer;
022:
023:        import java.net.URI;
024:        import java.util.Iterator;
025:        import java.util.List;
026:        import javax.xml.namespace.QName;
027:
028:        /**
029:         * Binding object for the type http://www.opengis.net/wfs:QueryType.
030:         *
031:         * <p>
032:         *        <pre>
033:         *         <code>
034:         *  &lt;xsd:complexType name="QueryType"&gt;
035:         *      &lt;xsd:annotation&gt;
036:         *          &lt;xsd:documentation&gt;
037:         *              The Query element is of type QueryType.
038:         *           &lt;/xsd:documentation&gt;
039:         *      &lt;/xsd:annotation&gt;
040:         *      &lt;xsd:sequence&gt;
041:         *          &lt;xsd:choice maxOccurs="unbounded" minOccurs="0"&gt;
042:         *              &lt;xsd:element ref="wfs:PropertyName"&gt;
043:         *                  &lt;xsd:annotation&gt;
044:         *                      &lt;xsd:documentation&gt;
045:         *                     The Property element is used to specify one or more
046:         *                     properties of a feature whose values are to be retrieved
047:         *                     by a Web Feature Service.
048:         *
049:         *                     While a Web Feature Service should endeavour to satisfy
050:         *                     the exact request specified, in some instance this may
051:         *                     not be possible.  Specifically, a Web Feature Service
052:         *                     must generate a valid GML3 response to a Query operation.
053:         *                     The schema used to generate the output may include
054:         *                     properties that are mandatory.  In order that the output
055:         *                     validates, these mandatory properties must be specified
056:         *                     in the request.  If they are not, a Web Feature Service
057:         *                     may add them automatically to the Query before processing
058:         *                     it.  Thus a client application should, in general, be
059:         *                     prepared to receive more properties than it requested.
060:         *
061:         *                     Of course, using the DescribeFeatureType request, a client
062:         *                     application can determine which properties are mandatory
063:         *                     and request them in the first place.
064:         *                  &lt;/xsd:documentation&gt;
065:         *                  &lt;/xsd:annotation&gt;
066:         *              &lt;/xsd:element&gt;
067:         *              &lt;xsd:element ref="ogc:Function"&gt;
068:         *                  &lt;xsd:annotation&gt;
069:         *                      &lt;xsd:documentation&gt;
070:         *                     A function may be used as a select item in a query.
071:         *                     However, if a function is used, care must be taken
072:         *                     to ensure that the result type matches the type in the
073:         *
074:         *                  &lt;/xsd:documentation&gt;
075:         *                  &lt;/xsd:annotation&gt;
076:         *              &lt;/xsd:element&gt;
077:         *          &lt;/xsd:choice&gt;
078:         *          &lt;xsd:element maxOccurs="1" minOccurs="0" ref="ogc:Filter"&gt;
079:         *              &lt;xsd:annotation&gt;
080:         *                  &lt;xsd:documentation&gt;
081:         *                  The Filter element is used to define spatial and/or non-spatial
082:         *                  constraints on query.  Spatial constrains use GML3 to specify
083:         *                  the constraining geometry.  A full description of the Filter
084:         *                  element can be found in the Filter Encoding Implementation
085:         *                  Specification.
086:         *               &lt;/xsd:documentation&gt;
087:         *              &lt;/xsd:annotation&gt;
088:         *          &lt;/xsd:element&gt;
089:         *          &lt;xsd:element maxOccurs="1" minOccurs="0" ref="ogc:SortBy"&gt;
090:         *              &lt;xsd:annotation&gt;
091:         *                  &lt;xsd:documentation&gt;
092:         *                  The SortBy element is used specify property names whose
093:         *                  values should be used to order (upon presentation) the
094:         *                  set of feature instances that satisfy the query.
095:         *               &lt;/xsd:documentation&gt;
096:         *              &lt;/xsd:annotation&gt;
097:         *          &lt;/xsd:element&gt;
098:         *      &lt;/xsd:sequence&gt;
099:         *      &lt;xsd:attribute name="handle" type="xsd:string" use="optional"&gt;
100:         *          &lt;xsd:annotation&gt;
101:         *              &lt;xsd:documentation&gt;
102:         *                 The handle attribute allows a client application
103:         *                 to assign a client-generated identifier for the
104:         *                 Query.  The handle is included to facilitate error
105:         *                 reporting.  If one Query in a GetFeature request
106:         *                 causes an exception, a WFS may report the handle
107:         *                 to indicate which query element failed.  If the a
108:         *                 handle is not present, the WFS may use other means
109:         *                 to localize the error (e.g. line numbers).
110:         *              &lt;/xsd:documentation&gt;
111:         *          &lt;/xsd:annotation&gt;
112:         *      &lt;/xsd:attribute&gt;
113:         *      &lt;xsd:attribute name="typeName" type="wfs:TypeNameListType" use="required"&gt;
114:         *          &lt;xsd:annotation&gt;
115:         *              &lt;xsd:documentation&gt;
116:         *                The typeName attribute is a list of one or more
117:         *                feature type names that indicate which types
118:         *                of feature instances should be included in the
119:         *                reponse set.  Specifying more than one typename
120:         *                indicates that a join operation is being performed.
121:         *                All the names in the typeName list must be valid
122:         *                types that belong to this query's feature content
123:         *                as defined by the GML Application Schema.
124:         *             &lt;/xsd:documentation&gt;
125:         *          &lt;/xsd:annotation&gt;
126:         *      &lt;/xsd:attribute&gt;
127:         *      &lt;xsd:attribute name="featureVersion" type="xsd:string" use="optional"&gt;
128:         *          &lt;xsd:annotation&gt;
129:         *              &lt;xsd:documentation&gt;
130:         *                For systems that implement versioning, the featureVersion
131:         *                attribute is used to specify which version of a particular
132:         *                feature instance is to be retrieved.  A value of ALL means
133:         *                that all versions should be retrieved.  An integer value
134:         *                'i', means that the ith version should be retrieve if it
135:         *                exists or the most recent version otherwise.
136:         *             &lt;/xsd:documentation&gt;
137:         *          &lt;/xsd:annotation&gt;
138:         *      &lt;/xsd:attribute&gt;
139:         *      &lt;xsd:attribute name="srsName" type="xsd:anyURI" use="optional"&gt;
140:         *          &lt;xsd:annotation&gt;
141:         *              &lt;xsd:documentation&gt;
142:         *                This attribute is used to specify a specific WFS-supported SRS
143:         *                that should be used for returned feature geometries.  The value
144:         *                may be the WFS StorageSRS value, DefaultRetrievalSRS value, or
145:         *                one of AdditionalSRS values.  If no srsName value is supplied,
146:         *                then the features will be returned using either the
147:         *                DefaultRetrievalSRS, if specified, and StorageSRS otherwise.
148:         *                For feature types with no spatial properties, this attribute
149:         *                must not be specified or ignored if it is specified.
150:         *             &lt;/xsd:documentation&gt;
151:         *          &lt;/xsd:annotation&gt;
152:         *      &lt;/xsd:attribute&gt;
153:         *  &lt;/xsd:complexType&gt;
154:         *
155:         *          </code>
156:         *         </pre>
157:         * </p>
158:         *
159:         * @generated
160:         */
161:        public class QueryTypeBinding extends AbstractComplexBinding {
162:            WfsFactory wfsfactory;
163:
164:            public QueryTypeBinding(WfsFactory wfsfactory) {
165:                this .wfsfactory = wfsfactory;
166:            }
167:
168:            /**
169:             * @generated
170:             */
171:            public QName getTarget() {
172:                return WFS.QUERYTYPE;
173:            }
174:
175:            /**
176:             * <!-- begin-user-doc -->
177:             * <!-- end-user-doc -->
178:             *
179:             * @generated modifiable
180:             */
181:            public Class getType() {
182:                return QueryType.class;
183:            }
184:
185:            public void initializeChildContext(ElementInstance childInstance,
186:                    Node node, MutablePicoContainer context) {
187:                //if an srsName is set for this geometry, put it in the context for
188:                // children, so they can use it as well
189:                if (node.hasAttribute("srsName")) {
190:                    try {
191:                        CoordinateReferenceSystem crs = GML2ParsingUtils
192:                                .crs(node);
193:                        if (crs != null) {
194:                            context.registerComponentInstance(
195:                                    CoordinateReferenceSystem.class, crs);
196:                        }
197:                    } catch (Exception e) {
198:                        throw new WFSException(e, "InvalidParameterValue");
199:                    }
200:                }
201:            }
202:
203:            /**
204:             * <!-- begin-user-doc -->
205:             * <!-- end-user-doc -->
206:             *
207:             * @generated modifiable
208:             */
209:            public Object parse(ElementInstance instance, Node node,
210:                    Object value) throws Exception {
211:                QueryType query = wfsfactory.createQueryType();
212:
213:                //&lt;xsd:choice maxOccurs="unbounded" minOccurs="0"&gt;
214:                //&lt;xsd:element ref="wfs:PropertyName"&gt;
215:                if (node.hasChild("PropertyName")) {
216:                    //HACK, stripping of namespace prefix
217:                    for (Iterator p = node.getChildValues("PropertyName")
218:                            .iterator(); p.hasNext();) {
219:                        Object property = p.next();
220:                        String propertyName;
221:                        if (property instanceof  String)
222:                            propertyName = (String) property;
223:                        else
224:                            propertyName = (String) ((PropertyName) property)
225:                                    .getPropertyName();
226:
227:                        if (propertyName.indexOf(':') != -1) {
228:                            propertyName = propertyName.substring(propertyName
229:                                    .indexOf(':') + 1);
230:                        }
231:
232:                        query.getPropertyName().add(propertyName);
233:                    }
234:                }
235:
236:                //&lt;xsd:element ref="ogc:Function"&gt;
237:                if (node.hasChild("Function")) {
238:                    query.getFunction().add(node.getChildValues("Function"));
239:                }
240:
241:                //&lt;/xsd:choice&gt;
242:
243:                //&lt;xsd:element maxOccurs="1" minOccurs="0" ref="ogc:Filter"&gt;
244:                if (node.hasChild(Filter.class)) {
245:                    query.setFilter((Filter) node.getChildValue(Filter.class));
246:                }
247:
248:                //&lt;xsd:element maxOccurs="1" minOccurs="0" ref="ogc:SortBy"&gt;
249:                if (node.hasChild(SortBy[].class)) {
250:                    SortBy[] sortBy = (SortBy[]) node
251:                            .getChildValue(SortBy[].class);
252:
253:                    for (int i = 0; i < sortBy.length; i++)
254:                        query.getSortBy().add(sortBy[i]);
255:                }
256:
257:                //&lt;xsd:attribute name="handle" type="xsd:string" use="optional"&gt;
258:                if (node.hasAttribute("handle")) {
259:                    query.setHandle((String) node.getAttributeValue("handle"));
260:                }
261:
262:                //&lt;xsd:attribute name="typeName" type="wfs:TypeNameListType" use="required"&gt;
263:                query.setTypeName((List) node.getAttributeValue("typeName"));
264:
265:                //&lt;xsd:attribute name="featureVersion" type="xsd:string" use="optional"&gt;
266:                if (node.hasAttribute("featureVersion")) {
267:                    query.setFeatureVersion((String) node
268:                            .getAttributeValue("featureVersion"));
269:                }
270:
271:                //&lt;xsd:attribute name="srsName" type="xsd:anyURI" use="optional"&gt;
272:                if (node.hasAttribute("srsName")) {
273:                    query.setSrsName((URI) node.getAttributeValue("srsName"));
274:                }
275:
276:                return query;
277:            }
278:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.