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


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2005-2006, Geotools Project Managment Committee (PMC)
005:         *    (C) 2003-2004, Julian J. Ray, All Rights Reserved
006:         *
007:         *    This library is free software; you can redistribute it and/or
008:         *    modify it under the terms of the GNU Lesser General Public
009:         *    License as published by the Free Software Foundation; either
010:         *    version 2.1 of the License, or (at your option) any later version.
011:         *
012:         *    This library is distributed in the hope that it will be useful,
013:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         *    Lesser General Public License for more details.
016:         */
017:        package org.geotools.data.tiger;
018:
019:        import java.io.File;
020:        import java.io.FilenameFilter;
021:        import java.io.IOException;
022:        import java.util.ArrayList;
023:
024:        import org.geotools.data.AbstractDataStore;
025:        import org.geotools.data.DataSourceException;
026:        import org.geotools.data.DataUtilities;
027:        import org.geotools.data.FeatureReader;
028:        import org.geotools.feature.FeatureType;
029:        import org.geotools.feature.SchemaException;
030:
031:        /**
032:         * <p>
033:         * Title: GeoTools2 Development
034:         * </p>
035:         * 
036:         * <p>
037:         * Description:
038:         * </p>
039:         * 
040:         * <p>
041:         * Copyright: Copyright (c) 2003
042:         * </p>
043:         * 
044:         * <p>
045:         * Company:
046:         * </p>
047:         *
048:         * @author Julian J. Ray
049:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/tiger/src/main/java/org/geotools/data/tiger/TigerDataStore.java $
050:         * @version 1.0
051:         */
052:        public class TigerDataStore extends AbstractDataStore {
053:            /** DOCUMENT ME! */
054:            protected File directory;
055:
056:            /**
057:             * Creates a new TigerDataStore object.
058:             *
059:             * @param dirName DOCUMENT ME!
060:             *
061:             * @throws IllegalArgumentException DOCUMENT ME!
062:             */
063:            public TigerDataStore(String dirName) {
064:                this (new File(dirName));
065:            }
066:
067:            public TigerDataStore(File dir) {
068:                // Do not allow writes
069:                super (false);
070:                directory = dir;
071:
072:                if (!dir.exists() || !dir.isDirectory()) {
073:                    throw new IllegalArgumentException(directory
074:                            + " is not a directory!");
075:                }
076:
077:            }
078:
079:            /**
080:             * Returns a list of logical tiger files. This routine searches for tiger Type1 (RT1) files in the data store
081:             * directory and returns the file names. File search is case insensetive so RT1 and rt1 work equally well.
082:             *
083:             * @return String[]
084:             */
085:            public String[] getTypeNames() {
086:                String[] list = directory.list(new TigerFilenameFilter());
087:                String[] schemaTypeNames = TigerSchemaManager.getTypeNames();
088:
089:                ArrayList array = new ArrayList();
090:
091:                for (int i = 0; i < list.length; i++) {
092:                    list[i] = list[i].substring(0, list[i].lastIndexOf('.'));
093:
094:                    for (int j = 0; j < schemaTypeNames.length; j++) {
095:                        array.add(list[i] + "_" + schemaTypeNames[j]);
096:                    }
097:                }
098:
099:                String[] typeNames = new String[array.size()];
100:
101:                for (int i = 0; i < array.size(); i++) {
102:                    typeNames[i] = (String) array.get(i);
103:                }
104:
105:                return typeNames;
106:            }
107:
108:            /**
109:             * getSchema
110:             *
111:             * @param typeName String
112:             *
113:             * @return FeatureType
114:             *
115:             * @throws IOException
116:             * @throws DataSourceException DOCUMENT ME!
117:             */
118:            public FeatureType getSchema(String typeName) throws IOException {
119:                try {
120:                    TigerSchemaManager manager = new TigerSchemaManager();
121:
122:                    FeatureType featureType = DataUtilities.createType(
123:                            directory.getName() + "." + typeName, manager
124:                                    .getTypeSpec(typeName));
125:
126:                    return featureType;
127:                } catch (SchemaException e) {
128:                    e.printStackTrace();
129:                    throw new DataSourceException(typeName
130:                            + " schema format error", e);
131:                }
132:            }
133:
134:            /**
135:             * getFeatureReader
136:             *
137:             * @param typeName String
138:             *
139:             * @return FeatureReader
140:             *
141:             * @throws IOException
142:             */
143:            protected FeatureReader getFeatureReader(String typeName)
144:                    throws IOException {
145:                return new TigerFeatureReader(directory, typeName);
146:            }
147:
148:            /**
149:             * <p>
150:             * Title: GeoTools2 Development
151:             * </p>
152:             * 
153:             * <p>
154:             * Description:
155:             * </p>
156:             * 
157:             * <p>
158:             * Copyright: Copyright (c) 2003
159:             * </p>
160:             * 
161:             * <p>
162:             * Company:
163:             * </p>
164:             *
165:             * @author Julian J. Ray
166:             * @version 1.0
167:             */
168:            private class TigerFilenameFilter implements  FilenameFilter {
169:                //~ Constructors -----------------------------------------------------------------------------------------------
170:
171:                /**
172:                 * Creates a new TigerFilenameFilter object.
173:                 */
174:                TigerFilenameFilter() {
175:                }
176:
177:                //~ Methods ----------------------------------------------------------------------------------------------------
178:
179:                /**
180:                 * DOCUMENT ME!
181:                 *
182:                 * @param dir DOCUMENT ME!
183:                 * @param name DOCUMENT ME!
184:                 *
185:                 * @return DOCUMENT ME!
186:                 */
187:                public boolean accept(File dir, String name) {
188:                    if (name.endsWith("RT1") || name.endsWith("rt1")) {
189:                        return true;
190:                    } else {
191:                        return false;
192:                    }
193:                }
194:            }
195:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.