Source Code Cross Referenced for InsertElementTypeBinding.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.IdentifierGenerationOptionType;
008:        import net.opengis.wfs.InsertElementType;
009:        import net.opengis.wfs.WfsFactory;
010:
011:        import org.geoserver.wfs.WFSException;
012:        import org.geotools.feature.Feature;
013:        import org.geotools.feature.FeatureCollection;
014:        import org.geotools.gml2.bindings.GML2ParsingUtils;
015:        import org.geotools.gml3.bindings.GML;
016:        import org.geotools.xml.AbstractComplexEMFBinding;
017:        import org.geotools.xml.ElementInstance;
018:        import org.geotools.xml.Node;
019:        import org.opengis.referencing.crs.CoordinateReferenceSystem;
020:        import org.picocontainer.MutablePicoContainer;
021:
022:        import java.net.URI;
023:        import javax.xml.namespace.QName;
024:
025:        /**
026:         * Binding object for the type http://www.opengis.net/wfs:InsertElementType.
027:         *
028:         * <p>
029:         *        <pre>
030:         *         <code>
031:         *  &lt;xsd:complexType name="InsertElementType"&gt;
032:         *      &lt;xsd:annotation&gt;
033:         *          &lt;xsd:documentation&gt;
034:         *              An Insert element may contain a feature collection or one
035:         *              or more feature instances to be inserted into the
036:         *              repository.
037:         *           &lt;/xsd:documentation&gt;
038:         *      &lt;/xsd:annotation&gt;
039:         *      &lt;xsd:choice&gt;
040:         *          &lt;xsd:element ref="gml:_FeatureCollection"/&gt;
041:         *          &lt;xsd:sequence&gt;
042:         *              &lt;xsd:element maxOccurs="unbounded" ref="gml:_Feature"/&gt;
043:         *          &lt;/xsd:sequence&gt;
044:         *      &lt;/xsd:choice&gt;
045:         *      &lt;xsd:attribute default="GenerateNew" name="idgen"
046:         *          type="wfs:IdentifierGenerationOptionType" use="optional"&gt;
047:         *          &lt;xsd:annotation&gt;
048:         *              &lt;xsd:documentation&gt;
049:         *                 The idgen attribute control how a WFS generates identifiers
050:         *                 from newly created feature instances using the Insert action.
051:         *                 The default action is to have the WFS generate a new id for
052:         *                 the features.  This is also backward compatible with WFS 1.0
053:         *                 where the only action was for the WFS to generate an new id.
054:         *              &lt;/xsd:documentation&gt;
055:         *          &lt;/xsd:annotation&gt;
056:         *      &lt;/xsd:attribute&gt;
057:         *      &lt;xsd:attribute name="handle" type="xsd:string" use="optional"&gt;
058:         *          &lt;xsd:annotation&gt;
059:         *              &lt;xsd:documentation&gt;
060:         *                 The handle attribute allows a client application
061:         *                 to assign a client-generated request identifier
062:         *                 to an Insert action.  The handle is included to
063:         *                 facilitate error reporting.  If an Insert action
064:         *                 in a Transaction request fails, then a WFS may
065:         *                 include the handle in an exception report to localize
066:         *                 the error.  If no handle is included of the offending
067:         *                 Insert element then a WFS may employee other means of
068:         *                 localizing the error (e.g. line number).
069:         *              &lt;/xsd:documentation&gt;
070:         *          &lt;/xsd:annotation&gt;
071:         *      &lt;/xsd:attribute&gt;
072:         *      &lt;xsd:attribute default="text/xml; subtype=gml/3.1.1"
073:         *          name="inputFormat" type="xsd:string" use="optional"&gt;
074:         *          &lt;xsd:annotation&gt;
075:         *              &lt;xsd:documentation&gt;
076:         *                 This inputFormat attribute is used to indicate
077:         *                 the format used to encode a feature instance in
078:         *                 an Insert element.  The default value of
079:         *                 'text/xml; subtype=gml/3.1.1' is used to indicate
080:         *                 that feature encoding is GML3.  Another example
081:         *                 might be 'text/xml; subtype=gml/2.1.2' indicating
082:         *                 that the feature us encoded in GML2.  A WFS must
083:         *                 declare in the capabilities document, using a
084:         *                 Parameter element, which version of GML it supports.
085:         *              &lt;/xsd:documentation&gt;
086:         *          &lt;/xsd:annotation&gt;
087:         *      &lt;/xsd:attribute&gt;
088:         *      &lt;xsd:attribute name="srsName" type="xsd:anyURI" use="optional"&gt;
089:         *          &lt;xsd:annotation&gt;
090:         *              &lt;xsd:documentation&gt;
091:         *        The optional srsName attribute is used to assert the SRS of the
092:         *        incoming feature data, which can be useful if the incoming feature
093:         *        data does not have an SRS declared for each geometry. If the
094:         *        srsName attribute exists on an &lt;Insert&gt; element, its value shall
095:         *        be equivalent to the value of &lt;DefaultSRS&gt; or any of the
096:         *        &lt;OtherSRS&gt; of the relevant feature types. If, however, the SRS is
097:         *        not supported, the WFS shall raise an exception as described in
098:         *        subclause 7.7. If the srsName is not specified on the &lt;Insert&gt;
099:         *        element, the WFS shall interpret this to mean that the feature
100:         *        data is given in the &lt;DefaultSRS&gt; list, except where an SRS is
101:         *        specified on the feature geometry. In this case, if the SRS for
102:         *        such a geometry is one of the &lt;DefaultSRS&gt; or &lt;OtherSR&gt; values
103:         *        for the respective feature types, it will be transformed as
104:         *        required before insertion. However, if the aforesaid SRS is not
105:         *        supported for the respective feature type, the entire transaction
106:         *        shall fail and the WFS shall raise an exception as described in
107:         *        subclause 7.7. If atomic transactions are not supported by the
108:         *        underlying DBMS, the WFS shall skip any feature with an
109:         *        unsupported SRS and continue
110:         *             &lt;/xsd:documentation&gt;
111:         *          &lt;/xsd:annotation&gt;
112:         *      &lt;/xsd:attribute&gt;
113:         *  &lt;/xsd:complexType&gt;
114:         *
115:         *          </code>
116:         *         </pre>
117:         * </p>
118:         *
119:         * @generated
120:         */
121:        public class InsertElementTypeBinding extends AbstractComplexEMFBinding {
122:            WfsFactory wfsfactory;
123:
124:            public InsertElementTypeBinding(WfsFactory wfsfactory) {
125:                this .wfsfactory = wfsfactory;
126:            }
127:
128:            /**
129:             * @generated
130:             */
131:            public QName getTarget() {
132:                return WFS.INSERTELEMENTTYPE;
133:            }
134:
135:            /**
136:             * <!-- begin-user-doc -->
137:             * <!-- end-user-doc -->
138:             *
139:             * @generated modifiable
140:             */
141:            public Class getType() {
142:                return InsertElementType.class;
143:            }
144:
145:            public void initializeChildContext(ElementInstance childInstance,
146:                    Node node, MutablePicoContainer context) {
147:                //if an srsName is set for this geometry, put it in the context for 
148:                // children, so they can use it as well
149:                if (node.hasAttribute("srsName")) {
150:                    try {
151:                        CoordinateReferenceSystem crs = GML2ParsingUtils
152:                                .crs(node);
153:                        if (crs != null) {
154:                            context.registerComponentInstance(
155:                                    CoordinateReferenceSystem.class, crs);
156:                        }
157:                    } catch (Exception e) {
158:                        throw new WFSException(e, "InvalidParameterValue");
159:                    }
160:                }
161:            }
162:
163:            /**
164:             * <!-- begin-user-doc -->
165:             * <!-- end-user-doc -->
166:             *
167:             * @generated modifiable
168:             */
169:            public Object parse(ElementInstance instance, Node node,
170:                    Object value) throws Exception {
171:                InsertElementType insertElement = wfsfactory
172:                        .createInsertElementType();
173:
174:                //&lt;xsd:choice&gt;
175:                //   &lt;xsd:element ref="gml:_FeatureCollection"/&gt;
176:                //   &lt;xsd:sequence&gt;
177:                //       &lt;xsd:element maxOccurs="unbounded" ref="gml:_Feature"/&gt;
178:                //   &lt;/xsd:sequence&gt;
179:                //&lt;/xsd:choice&gt;
180:                if (node.hasChild(FeatureCollection.class)) {
181:                    FeatureCollection fc = (FeatureCollection) node
182:                            .getChildValue(FeatureCollection.class);
183:                    insertElement.getFeature().addAll(fc);
184:                } else if (node.hasChild(Feature.class)) {
185:                    insertElement.getFeature().addAll(
186:                            node.getChildValues(Feature.class));
187:                }
188:
189:                //&lt;xsd:attribute default="GenerateNew" name="idgen"
190:                //		type="wfs:IdentifierGenerationOptionType" use="optional"&gt;
191:                if (node.hasAttribute("idgen")) {
192:                    insertElement
193:                            .setIdgen((IdentifierGenerationOptionType) node
194:                                    .getAttributeValue("idgen"));
195:                }
196:
197:                //&lt;xsd:attribute name="handle" type="xsd:string" use="optional"&gt;
198:                if (node.hasAttribute("handle")) {
199:                    insertElement.setHandle((String) node
200:                            .getAttributeValue("handle"));
201:                }
202:
203:                //&lt;xsd:attribute default="text/xml; subtype=gml/3.1.1"
204:                //		 name="inputFormat" type="xsd:string" use="optional"&gt;
205:                if (node.hasAttribute("inputFormat")) {
206:                    insertElement.setInputFormat((String) node
207:                            .getAttributeValue("inputFormat"));
208:                }
209:
210:                //&lt;xsd:attribute name="srsName" type="xsd:anyURI" use="optional"&gt;
211:                if (node.hasAttribute("srsName")) {
212:                    insertElement.setSrsName((URI) node
213:                            .getAttributeValue("srsName"));
214:                }
215:
216:                return insertElement;
217:            }
218:
219:            public Object getProperty(Object object, QName name)
220:                    throws Exception {
221:                InsertElementType insert = (InsertElementType) object;
222:
223:                if (GML._Feature.equals(name)) {
224:                    return insert.getFeature();
225:                }
226:
227:                return super.getProperty(object, name);
228:            }
229:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.