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


001:        package org.geotools.data.gml;
002:
003:        import java.io.IOException;
004:        import java.util.Map;
005:
006:        import org.geotools.data.DataStore;
007:        import org.geotools.data.DataStoreFactorySpi;
008:        import org.geotools.gml3.ApplicationSchemaConfiguration;
009:        import org.geotools.xml.Configuration;
010:
011:        /**
012:         * Datastore factory for gml datastore.
013:         * <p>
014:         * <br>
015:         * <h2>Usage</h2>
016:         * <br>
017:         * <br>
018:         * When creating an instance of the datastore, the {@link #LOCATION} parameter must 
019:         * be specified. 
020:         * <pre>
021:         * <code>
022:         * GMLDataStoreFactory factory = new GMLDataStoreFactory();
023:         * 
024:         * Map params = new HashMap();
025:         * params.put( GMLDataStoreFactory.LOCATION, "instanceDocument.xml" );
026:         * 
027:         * GMLDataStore dataStore = factory.createDataStore( params );
028:         * </code>
029:         * </pre>
030:         * Creating a datastore with only the location parameter causes the datastore to deduce 
031:         * all the information about the schema from the instance document directly. Which means 
032:         * the schemaLocation must be properly specifed in the instance document. As this is not 
033:         * always the case, there are ways to specify information about the schema to the datastore.
034:         * <br>
035:         * <ol>
036:         *  <li>Specifying the targetNamespace and schemaLocation directly.
037:         *  <li>Specifying a {@link org.geotools.xml.Configuration} 
038:         * </ol>
039:         * </p>
040:         * <br>
041:         * <p>
042:         * <h3>Target namespace and Schema Location</h3>
043:         * <pre>
044:         * <code>
045:         * GMLDataStoreFactory factory = new GMLDataStoreFactory();
046:         * 
047:         * Map params = new HashMap();
048:         * params.put( GMLDataStoreFactory.LOCATION, "instanceDocument.xml" );
049:         * params.put( GMLDataStoreFactory.NAMESPACE, "http://myApplicationSchemaNamespaceUri" );
050:         * params.put( GMLDataStoreFactory.SCHEMALOCATION, "/path/to/applicationSchema.xsd" );
051:         * 
052:         * GMLDataStore dataStore = factory.createDataStore( params );
053:         * </code>
054:         * </pre>
055:         * </p>
056:         * <p>
057:         * <h3>Configuration</h3>
058:         * <br>
059:         * A {@link org.geotools.xml.Configuration} is used to specify information about a schema and 
060:         * configure the xml parser to parse instances of the schema. The 
061:         * {@link org.geotools.gml3.ApplicationSchemaConfiguration} is a subclass that can be extented
062:         * in order to create a configuration specific to an application schema:
063:         * <pre>
064:         * <code>
065:         * class MyApplictionSchemaConfiguration extends ApplicationSchemaConfiguration {
066:         *   
067:         *   public MyApplicationSchema() {
068:         *     super( "http://myApplicationSchemaNamespaceUri", "/path/to/applicationSchema.xsd" );
069:         *   }
070:         *   
071:         * }
072:         * </pre>
073:         * </code>
074:         * The class of the application schema can then be supplied with the {@link #CONFIGURATION}
075:         * paramter:
076:         * <pre>
077:         * <code>
078:         * GMLDataStoreFactory factory = new GMLDataStoreFactory();
079:         * 
080:         * Map params = new HashMap();
081:         * params.put( GMLDataStoreFactory.LOCATION, "instanceDocument.xml" );
082:         * params.put( GMLDataStoreFactory.CONFIGURATION, MyApplicationSchemaConfiguration.class );
083:         * 
084:         * GMLDataStore dataStore = factory.createDataStore( params );
085:         * </code>
086:         * </pre>
087:         * It is important to note that when using the CONFIGURATION parameter the configuration class
088:         * must have a no-argument constructor.
089:         * </p>
090:         * <br>
091:         * <p>
092:         * TODO: document support for application schema defined types
093:         * 
094:         * </p>
095:         * @author Justin Deoliveira, The Open Planning Project
096:         *
097:         */
098:        public class GMLDataStoreFactory implements  DataStoreFactorySpi {
099:
100:            /**
101:             * The location of the instance document.
102:             */
103:            public static Param LOCATION = new Param("location", String.class,
104:                    "Instance document location", true);
105:
106:            /**
107:             * The application schema configuration
108:             */
109:            public static Param CONFIGURATION = new Param("configuration",
110:                    Class.class, "Application schema configuration", false);
111:
112:            /**
113:             * Application schema namespace
114:             */
115:            public static Param NAMESPACE = new Param("namespace",
116:                    String.class, "Application schema namespace", false);
117:            /**
118:             * Location of application schema
119:             */
120:            public static Param SCHEMALOCATION = new Param("schemaLocation",
121:                    String.class, "Application schema location", false);
122:
123:            public DataStore createDataStore(Map params) throws IOException {
124:                String location = (String) LOCATION.lookUp(params);
125:
126:                if (location != null) {
127:                    Class configuration = (Class) CONFIGURATION.lookUp(params);
128:                    if (configuration != null) {
129:                        try {
130:                            return new GMLDataStore(location,
131:                                    (Configuration) configuration.newInstance());
132:                        } catch (Exception e) {
133:                            throw (IOException) new IOException().initCause(e);
134:                        }
135:                    } else {
136:                        String namespace = (String) NAMESPACE.lookUp(params);
137:                        String schemaLocation = (String) SCHEMALOCATION
138:                                .lookUp(params);
139:
140:                        if (namespace != null && schemaLocation != null) {
141:                            return new GMLDataStore(location,
142:                                    new ApplicationSchemaConfiguration(
143:                                            namespace, schemaLocation));
144:                        }
145:                    }
146:
147:                    return new GMLDataStore(location);
148:                }
149:
150:                return null;
151:            }
152:
153:            public DataStore createNewDataStore(Map params) throws IOException {
154:                throw new UnsupportedOperationException();
155:            }
156:
157:            public String getDisplayName() {
158:                return "GML";
159:            }
160:
161:            public String getDescription() {
162:                return "Geographic Markup Language";
163:            }
164:
165:            public Param[] getParametersInfo() {
166:                return new Param[] { LOCATION, CONFIGURATION, NAMESPACE,
167:                        SCHEMALOCATION };
168:            }
169:
170:            public boolean canProcess(Map params) {
171:                return params.containsKey(LOCATION.key);
172:            }
173:
174:            public boolean isAvailable() {
175:                return true;
176:            }
177:
178:            public Map getImplementationHints() {
179:                return null;
180:            }
181:
182:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.