Source Code Cross Referenced for WFSFeatureSource.java in  » GIS » GeoTools-2.4.1 » org » geotools » data » wfs » 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 » GeoTools 2.4.1 » org.geotools.data.wfs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2004-2006, Geotools Project Managment Committee (PMC)
005:         *
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation; either
009:         *    version 2.1 of the License, or (at your option) any later version.
010:         *
011:         *    This library is distributed in the hope that it will be useful,
012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *    Lesser General Public License for more details.
015:         */
016:        package org.geotools.data.wfs;
017:
018:        import java.io.IOException;
019:
020:        import org.geotools.data.AbstractFeatureSource;
021:        import org.geotools.data.DataStore;
022:        import org.geotools.data.DefaultFeatureResults;
023:        import org.geotools.data.DefaultQuery;
024:        import org.geotools.data.FeatureListener;
025:        import org.geotools.data.FeatureReader;
026:        import org.geotools.data.Query;
027:        import org.geotools.data.Transaction;
028:        import org.geotools.data.store.EmptyFeatureCollection;
029:        import org.geotools.feature.FeatureCollection;
030:        import org.geotools.feature.FeatureType;
031:        import org.geotools.filter.Filter;
032:        import org.geotools.geometry.jts.ReferencedEnvelope;
033:
034:        import com.vividsolutions.jts.geom.Envelope;
035:
036:        /**
037:         * DOCUMENT ME!
038:         *
039:         * @author dzwiers 
040:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/plugin/wfs/src/main/java/org/geotools/data/wfs/WFSFeatureSource.java $
041:         */
042:        public class WFSFeatureSource extends AbstractFeatureSource {
043:            protected WFSDataStore ds;
044:            protected String fname;
045:
046:            protected WFSFeatureSource(WFSDataStore ds, String fname) {
047:                this .ds = ds;
048:                this .fname = fname;
049:            }
050:
051:            /**
052:             * 
053:             * @see org.geotools.data.FeatureSource#getDataStore()
054:             */
055:            public DataStore getDataStore() {
056:                return ds;
057:            }
058:
059:            /**
060:             * 
061:             * @see org.geotools.data.FeatureSource#addFeatureListener(org.geotools.data.FeatureListener)
062:             */
063:            public void addFeatureListener(FeatureListener listener) {
064:                ds.listenerManager.addFeatureListener(this , listener);
065:            }
066:
067:            /**
068:             * 
069:             * @see org.geotools.data.FeatureSource#removeFeatureListener(org.geotools.data.FeatureListener)
070:             */
071:            public void removeFeatureListener(FeatureListener listener) {
072:                ds.listenerManager.removeFeatureListener(this , listener);
073:            }
074:
075:            /**
076:             * 
077:             * @see org.geotools.data.FeatureSource#getSchema()
078:             */
079:            public FeatureType getSchema() {
080:                try {
081:                    return ds.getSchema(fname);
082:                } catch (IOException e) {
083:                    return null;
084:                }
085:            }
086:
087:            /**
088:             * 
089:             * @see org.geotools.data.FeatureSource#getBounds()
090:             */
091:            public Envelope getBounds() throws IOException {
092:                return getBounds((fname == null) ? Query.ALL
093:                        : new DefaultQuery(fname));
094:            }
095:
096:            /**
097:             * 
098:             * @see org.geotools.data.FeatureSource#getBounds(org.geotools.data.Query)
099:             */
100:            public Envelope getBounds(Query query) throws IOException {
101:                return ds.getBounds(namedQuery(query));
102:            }
103:
104:            /**
105:             * 
106:             * @see org.geotools.data.FeatureSource#getFeatures()
107:             */
108:            public FeatureCollection getFeatures() throws IOException {
109:                return getFeatures(new DefaultQuery(getSchema().getTypeName(),
110:                        Filter.INCLUDE));
111:            }
112:
113:            /**
114:             * 
115:             * @see org.geotools.data.FeatureSource#getFeatures(org.geotools.filter.Filter)
116:             */
117:            public FeatureCollection getFeatures(Filter filter)
118:                    throws IOException {
119:                return getFeatures(new DefaultQuery(getSchema().getTypeName(),
120:                        filter));
121:            }
122:
123:            /**
124:             * 
125:             * @see org.geotools.data.FeatureSource#getFeatures(org.geotools.data.Query)
126:             */
127:            public FeatureCollection getFeatures(Query query)
128:                    throws IOException {
129:                FeatureType schema = getSchema();
130:                String typeName = schema.getTypeName();
131:
132:                if (query.getTypeName() == null) { // typeName unspecified we will "any" use a default
133:                    DefaultQuery defaultQuery = new DefaultQuery(query);
134:                    defaultQuery.setTypeName(typeName);
135:                }
136:
137:                if (!typeName.equals(query.getTypeName())) {
138:                    return new EmptyFeatureCollection(schema);
139:                } else {
140:                    return new DefaultFeatureResults(this , query);
141:                }
142:            }
143:
144:            /**
145:             * 
146:             * @see org.geotools.data.AbstractFeatureSource#getTransaction()
147:             */
148:            public Transaction getTransaction() {
149:                return Transaction.AUTO_COMMIT;
150:            }
151:
152:            /**
153:             * 
154:             * @author dzwiers
155:             */
156:            public static class WFSFeatureResults extends DefaultFeatureResults {
157:                private WFSFeatureSource fs;
158:                private Query query;
159:
160:                /**
161:                 * 
162:                 * @param fs
163:                 * @param query
164:                 */
165:                public WFSFeatureResults(WFSFeatureSource fs, Query query)
166:                        throws IOException {
167:                    super (fs, query);
168:                    this .query = query;
169:                    this .fs = fs;
170:                }
171:
172:                /**
173:                 * 
174:                 * @see org.geotools.data.FeatureResults#getSchema()
175:                 */
176:                public FeatureType getSchema() {
177:                    return fs.getSchema();
178:                }
179:
180:                /**
181:                 * 
182:                 * @see org.geotools.data.FeatureResults#reader()
183:                 */
184:                public FeatureReader reader() throws IOException {
185:                    return fs.ds.getFeatureReader(query, fs.getTransaction());
186:                }
187:
188:                /**
189:                 * 
190:                 * @see org.geotools.data.FeatureResults#getBounds()
191:                 */
192:                public ReferencedEnvelope getBounds() {
193:                    try {
194:                        return ReferencedEnvelope
195:                                .reference(fs.getBounds(query));
196:                    } catch (IOException e) {
197:                        e.printStackTrace();
198:                        return null;
199:                    }
200:                }
201:
202:                /**
203:                 * 
204:                 * @see org.geotools.data.FeatureResults#getCount()
205:                 */
206:                public int getCount() throws IOException {
207:                    return fs.getCount(query);
208:                }
209:            }
210:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.