Source Code Cross Referenced for TigerDataStoreFactory.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:         *    (C) 2001-2003 TOPP - www.openplans.org
007:         *    
008:         *    This library is free software; you can redistribute it and/or
009:         *    modify it under the terms of the GNU Lesser General Public
010:         *    License as published by the Free Software Foundation; either
011:         *    version 2.1 of the License, or (at your option) any later version.
012:         *
013:         *    This library is distributed in the hope that it will be useful,
014:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
016:         *    Lesser General Public License for more details.
017:         */
018:        package org.geotools.data.tiger;
019:
020:        import java.io.File;
021:        import java.io.IOException;
022:        import java.util.Collections;
023:        import java.util.Map;
024:
025:        import org.geotools.data.DataStore;
026:        import org.geotools.data.DataStoreFactorySpi;
027:
028:        /**
029:         * <p>
030:         * Title: GeoTools2 Development
031:         * </p>
032:         * 
033:         * <p>
034:         * Description:
035:         * </p>
036:         * 
037:         * <p>
038:         * Copyright: Copyright (c) 2003
039:         * </p>
040:         * 
041:         * <p>
042:         * Company:
043:         * </p>
044:         *
045:         * @author Julian J. Ray
046:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/tiger/src/main/java/org/geotools/data/tiger/TigerDataStoreFactory.java $
047:         * @version 1.0
048:         */
049:        public class TigerDataStoreFactory implements  DataStoreFactorySpi {
050:            /**
051:             * Creates a new TigerDataStoreFactory object.
052:             */
053:            public TigerDataStoreFactory() {
054:            }
055:
056:            /**
057:             * createDataStore
058:             *
059:             * @param params Map
060:             *
061:             * @return DataStore
062:             *
063:             * @throws IOException
064:             */
065:            public DataStore createDataStore(Map params) throws IOException {
066:                File file = (File) DIRECTORY.lookUp(params);
067:                if (file.exists() && file.isDirectory()) {
068:                    return new TigerDataStore(file);
069:                } else {
070:                    throw new IOException();
071:                }
072:            }
073:
074:            /**
075:             * createNewDataStore
076:             *
077:             * @param params Map
078:             *
079:             * @return DataStore
080:             *
081:             * @throws IOException
082:             */
083:            public DataStore createNewDataStore(Map params) throws IOException {
084:                String dirName = (String) params.get("directory");
085:
086:                File dir = new File(dirName);
087:
088:                if (dir.exists()) {
089:                    throw new IOException("Can't create new data store: " + dir
090:                            + " already exists!");
091:                }
092:
093:                boolean created;
094:                created = dir.mkdir();
095:
096:                if (!created) {
097:                    throw new IOException("Can't create directory: " + dir);
098:                }
099:
100:                return new TigerDataStore(dirName);
101:            }
102:
103:            public String getDisplayName() {
104:                return "Tiger";
105:            }
106:
107:            /**
108:             * getDescription
109:             *
110:             * @return String
111:             */
112:            public String getDescription() {
113:                return "Data Store for TIGER/Line 2002 Line files.";
114:            }
115:
116:            public static final Param DIRECTORY = new Param("directory",
117:                    File.class, "Directory containing TIGER/Line 2002 files.");
118:
119:            //    public DataSourceMetadataEnity createMetadata( Map params ) throws IOException {
120:            //        if( !canProcess( params )){
121:            //            throw new IOException( "Provided params cannot be used to connect");
122:            //        }
123:            //        File dir = (File) DIRECTORY.lookUp( params );
124:            //        return new DataSourceMetadataEnity( dir, "Tiger data source access for " + dir );
125:            //    }
126:            /**
127:             * getParametersInfo
128:             *
129:             * @return Param[]
130:             */
131:            public Param[] getParametersInfo() {
132:                return new Param[] { DIRECTORY };
133:            }
134:
135:            /**
136:             * Test to see if this datastore is available, if it has all the
137:             * appropriate libraries to construct a datastore.  This datastore just
138:             * returns true for now.  This method is used for gui apps, so as to not
139:             * advertise data store capabilities they don't actually have.
140:             *
141:             * @return <tt>true</tt> if and only if this factory is available to create
142:             *         DataStores.
143:             *
144:             * @task REVISIT: I'm just adding this method to compile, maintainer should
145:             *       revisit to check for any libraries that may be necessary for
146:             *       datastore creations. ch.
147:             */
148:            public boolean isAvailable() {
149:                return true;
150:            }
151:
152:            /**
153:             * canProcess
154:             *
155:             * @param params Map
156:             *
157:             * @return boolean
158:             */
159:            public boolean canProcess(Map params) {
160:                try {
161:                    File file = (File) DIRECTORY.lookUp(params);
162:                    return (file.exists() && file.isDirectory());
163:                } catch (Exception e) {
164:                    return false;
165:                }
166:            }
167:
168:            /**
169:             * Returns the implementation hints. The default implementation returns en empty map.
170:             */
171:            public Map getImplementationHints() {
172:                return Collections.EMPTY_MAP;
173:            }
174:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.