Source Code Cross Referenced for GTComlexFeatureTypeAdapter.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.net.URI;
020:        import java.net.URISyntaxException;
021:        import java.util.ArrayList;
022:        import java.util.Collection;
023:        import java.util.Iterator;
024:        import java.util.LinkedHashMap;
025:        import java.util.LinkedList;
026:        import java.util.List;
027:
028:        import org.geotools.feature.AttributeType;
029:        import org.geotools.feature.Feature;
030:        import org.geotools.feature.FeatureType;
031:        import org.geotools.feature.GeometryAttributeType;
032:        import org.geotools.feature.IllegalAttributeException;
033:        import org.opengis.feature.type.AttributeDescriptor;
034:        import org.opengis.feature.type.ComplexType;
035:        import org.opengis.feature.type.GeometryType;
036:
037:        /**
038:         * Adapts an ISO complex feature type to a GeoTools FeatureType by eliminating
039:         * complex properties.
040:         * <p>
041:         * This is of almost any use but to allow the geoserver Data module to deal with
042:         * ComplexDataStore as a normal DataStore instead of FeatureAccess, while we're
043:         * not allowed to merge Feature implementations
044:         * </p>
045:         * 
046:         * @author Gabriel Roldan, Axios Engineering
047:         * @version $Id: GTComlexFeatureTypeAdapter.java 28577 2008-01-03 15:44:29Z groldan $
048:         * @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/GTComlexFeatureTypeAdapter.java $
049:         * @since 2.4
050:         */
051:        public class GTComlexFeatureTypeAdapter implements  FeatureType {
052:
053:            private AttributeDescriptor adaptee;
054:
055:            private LinkedHashMap properties;
056:
057:            private GeometryAttributeType defaultGeom;
058:
059:            public GTComlexFeatureTypeAdapter(
060:                    AttributeDescriptor featureDescriptor) {
061:                if (featureDescriptor.type() instanceof  ISOFeatureTypeAdapter) {
062:                    throw new IllegalArgumentException(
063:                            "No need to adapt ISOFEatureTypeAdapter, use getAdaptee() instead");
064:                }
065:                this .adaptee = featureDescriptor;
066:                this .properties = new LinkedHashMap();
067:
068:                org.opengis.feature.type.FeatureType type;
069:                type = (org.opengis.feature.type.FeatureType) adaptee.type();
070:
071:                List props = new LinkedList(type.getProperties());
072:
073:                for (Iterator it = props.iterator(); it.hasNext();) {
074:                    AttributeDescriptor att = (AttributeDescriptor) it.next();
075:                    if (att.type() instanceof  ComplexType) {
076:                        it.remove();
077:                    } else {
078:                        AttributeType gtAttType;
079:                        gtAttType = GTAttributeTypeAdapter.adapter(att);
080:
081:                        if (att.type() instanceof  GeometryType) {
082:                            defaultGeom = (GeometryAttributeType) gtAttType;
083:                        }
084:                        properties.put(att.getName().getLocalPart(), gtAttType);
085:                    }
086:                }
087:
088:            }
089:
090:            public AttributeDescriptor getAdaptee() {
091:                return adaptee;
092:            }
093:
094:            public Feature create(Object[] attributes)
095:                    throws IllegalAttributeException {
096:                throw new UnsupportedOperationException();
097:            }
098:
099:            public Feature create(Object[] attributes, String featureID)
100:                    throws IllegalAttributeException {
101:                throw new UnsupportedOperationException();
102:            }
103:
104:            public Feature duplicate(Feature feature)
105:                    throws IllegalAttributeException {
106:                throw new UnsupportedOperationException();
107:            }
108:
109:            public int find(AttributeType type) {
110:                return find(type.getName());
111:            }
112:
113:            public int find(String attName) {
114:                int index = 0;
115:                for (Iterator it = properties.keySet().iterator(); it.hasNext();) {
116:                    String name = (String) it.next();
117:                    if (name.equals(attName)) {
118:                        return index;
119:                    }
120:                    index++;
121:                }
122:                return -1;
123:            }
124:
125:            public FeatureType[] getAncestors() {
126:                return new FeatureType[0];
127:            }
128:
129:            public int getAttributeCount() {
130:                return properties.size();
131:            }
132:
133:            public AttributeType getAttributeType(String xPath) {
134:                AttributeType att = (AttributeType) properties.get(xPath);
135:                return att;
136:            }
137:
138:            public AttributeType getAttributeType(int position) {
139:                ArrayList arrayList = new ArrayList(properties.values());
140:                Object object = arrayList.get(position);
141:                return (AttributeType) object;
142:            }
143:
144:            public AttributeType[] getAttributeTypes() {
145:                Collection collection = properties.values();
146:                AttributeType[] types = (AttributeType[]) collection
147:                        .toArray(new AttributeType[0]);
148:                return types;
149:            }
150:
151:            public final GeometryAttributeType getDefaultGeometry() {
152:                return getPrimaryGeometry();
153:            }
154:
155:            public GeometryAttributeType getPrimaryGeometry() {
156:                return defaultGeom;
157:            }
158:
159:            public URI getNamespace() {
160:                try {
161:                    URI ns = new URI(adaptee.getName().getNamespaceURI());
162:                    return ns;
163:                } catch (URISyntaxException e) {
164:                    throw (RuntimeException) new RuntimeException()
165:                            .initCause(e);
166:                }
167:            }
168:
169:            public String getTypeName() {
170:                return adaptee.getName().getLocalPart();
171:            }
172:
173:            public boolean hasAttributeType(String xPath) {
174:                return properties.containsKey(xPath);
175:            }
176:
177:            public boolean isAbstract() {
178:                return adaptee.type().isAbstract();
179:            }
180:
181:            public boolean isDescendedFrom(URI nsURI, String typeName) {
182:                return false;
183:            }
184:
185:            public boolean isDescendedFrom(FeatureType type) {
186:                return false;
187:            }
188:
189:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.