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


001:        /*
002:         *    Geotools2 - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2005-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;
009:         *    version 2.1 of the License.
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:         */
017:        package org.geotools.data.feature.adapter;
018:
019:        import java.io.IOException;
020:        import java.net.URI;
021:        import java.util.ArrayList;
022:        import java.util.List;
023:
024:        import org.geotools.catalog.ServiceInfo;
025:        import org.geotools.data.DataStore;
026:        import org.geotools.data.FeatureReader;
027:        import org.geotools.data.FeatureSource;
028:        import org.geotools.data.FeatureWriter;
029:        import org.geotools.data.LockingManager;
030:        import org.geotools.data.Query;
031:        import org.geotools.data.Source;
032:        import org.geotools.data.Transaction;
033:        import org.geotools.data.feature.FeatureAccess;
034:        import org.geotools.data.feature.FeatureSource2;
035:        import org.geotools.feature.FeatureType;
036:        import org.geotools.feature.SchemaException;
037:        import org.geotools.feature.iso.Types;
038:        import org.opengis.feature.simple.SimpleFeatureFactory;
039:        import org.opengis.feature.type.AttributeDescriptor;
040:        import org.opengis.feature.type.Name;
041:        import org.opengis.filter.Filter;
042:
043:        /**
044:         * 
045:         * @author Gabriel Roldan, Axios Engineering
046:         * @version $Id: FeatureAccessAdapter.java 26649 2007-08-22 09:55:31Z groldan $
047:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/community-schemas/community-schema-ds/src/main/java/org/geotools/data/feature/adapter/FeatureAccessAdapter.java $
048:         * @since 2.4
049:         */
050:        public class FeatureAccessAdapter implements  FeatureAccess {
051:
052:            private DataStore store;
053:
054:            private SimpleFeatureFactory attributeFactory;
055:
056:            public FeatureAccessAdapter(DataStore dataStore,
057:                    SimpleFeatureFactory attributeFactory) {
058:                if (dataStore == null) {
059:                    throw new NullPointerException("dataStore");
060:                }
061:                this .attributeFactory = attributeFactory;
062:                this .store = dataStore;
063:            }
064:
065:            public void createSchema(FeatureType featureType)
066:                    throws IOException {
067:                store.createSchema(featureType);
068:            }
069:
070:            public FeatureReader getFeatureReader(Query query,
071:                    Transaction transaction) throws IOException {
072:                return store.getFeatureReader(query, transaction);
073:            }
074:
075:            public FeatureSource getFeatureSource(String typeName)
076:                    throws IOException {
077:                return store.getFeatureSource(typeName);
078:            }
079:
080:            public FeatureWriter getFeatureWriter(String typeName,
081:                    Filter filter, Transaction transaction) throws IOException {
082:                return store.getFeatureWriter(typeName, filter, transaction);
083:            }
084:
085:            public FeatureWriter getFeatureWriter(String typeName,
086:                    Transaction transaction) throws IOException {
087:                return store.getFeatureWriter(typeName, transaction);
088:            }
089:
090:            public FeatureWriter getFeatureWriterAppend(String typeName,
091:                    Transaction transaction) throws IOException {
092:                return store.getFeatureWriterAppend(typeName, transaction);
093:            }
094:
095:            public LockingManager getLockingManager() {
096:                return store.getLockingManager();
097:            }
098:
099:            public FeatureType getSchema(String typeName) throws IOException {
100:                return store.getSchema(typeName);
101:            }
102:
103:            public String[] getTypeNames() throws IOException {
104:                return store.getTypeNames();
105:            }
106:
107:            public FeatureSource getView(Query query) throws IOException,
108:                    SchemaException {
109:                return store.getView(query);
110:            }
111:
112:            public void updateSchema(String typeName, FeatureType featureType)
113:                    throws IOException {
114:                store.updateSchema(typeName, featureType);
115:            }
116:
117:            // ///////////////////////////////////////////////////
118:
119:            public Source access(Name typeName) {
120:                FeatureSource2 source;
121:                if (store instanceof  FeatureAccess) {
122:                    FeatureAccess faccess = (FeatureAccess) store;
123:                    source = (FeatureSource2) faccess.access(typeName);
124:                } else {
125:                    try {
126:                        String localPart = typeName.getLocalPart();
127:                        FeatureSource featureSource = store
128:                                .getFeatureSource(localPart);
129:                        source = new FeatureSource2Adapter(this , featureSource,
130:                                attributeFactory);
131:                    } catch (IOException e) {
132:                        e.printStackTrace();
133:                        throw (RuntimeException) new RuntimeException(e
134:                                .getMessage()).initCause(e);
135:                    }
136:                }
137:                return source;
138:            }
139:
140:            public Object describe(Name typeName) {
141:                AttributeDescriptor descriptor;
142:                if (store instanceof  FeatureAccess) {
143:                    FeatureAccess faccess = (FeatureAccess) store;
144:                    descriptor = (AttributeDescriptor) faccess
145:                            .describe(typeName);
146:                } else {
147:                    Source source = access(typeName);
148:                    descriptor = (AttributeDescriptor) source.describe();
149:                }
150:                return descriptor;
151:            }
152:
153:            public void dispose() {
154:                if (store instanceof  FeatureAccess) {
155:                    FeatureAccess faccess = (FeatureAccess) store;
156:                    faccess.dispose();
157:                }
158:            }
159:
160:            public ServiceInfo getInfo() {
161:                if (store instanceof  FeatureAccess) {
162:                    FeatureAccess faccess = (FeatureAccess) store;
163:                    return faccess.getInfo();
164:                }
165:                throw new UnsupportedOperationException("Not yet implemented");
166:            }
167:
168:            public List getNames() {
169:                if (store instanceof  FeatureAccess) {
170:                    FeatureAccess faccess = (FeatureAccess) store;
171:                    return faccess.getNames();
172:                }
173:
174:                String[] typeNames;
175:                try {
176:                    typeNames = getTypeNames();
177:                } catch (IOException e) {
178:                    throw (RuntimeException) new RuntimeException()
179:                            .initCause(e);
180:                }
181:                int len = typeNames.length;
182:                List names = new ArrayList(len);
183:                try {
184:                    for (int i = 0; i < i; i++) {
185:                        String featureName = typeNames[i];
186:                        FeatureType schema;
187:                        schema = getSchema(featureName);
188:                        URI namespace = schema.getNamespace();
189:                        String nsUri = namespace == null ? null : namespace
190:                                .toString();
191:                        Name name = Types.typeName(nsUri, featureName);
192:                        names.add(name);
193:                    }
194:                } catch (IOException e) {
195:                    throw (RuntimeException) new RuntimeException()
196:                            .initCause(e);
197:                }
198:                return names;
199:            }
200:
201:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.