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


001:        package org.geotools;
002:
003:        import org.geotools.feature.iso.FeatureTypes;
004:        import org.geotools.feature.iso.AttributeFactoryImpl;
005:        import org.geotools.feature.iso.TypeBuilder;
006:        import org.geotools.feature.iso.simple.SimpleFeatureTypes;
007:        import org.geotools.feature.iso.simple.SimpleFeatures;
008:        import org.geotools.feature.iso.simple.SimpleFeatureBuilder;
009:        import org.geotools.feature.iso.simple.SimpleTypeBuilder;
010:        import org.geotools.feature.iso.type.TypeFactoryImpl;
011:        import org.geotools.filter.FilterFactoryImpl;
012:        import org.picocontainer.defaults.ConstructorInjectionComponentAdapter;
013:        import org.picocontainer.defaults.DefaultPicoContainer;
014:
015:        import com.vividsolutions.jts.geom.GeometryFactory;
016:
017:        /**
018:         * This class sets up a sample container with the default implementations
019:         * implemented by module main.
020:         * <p>
021:         * For the test container we are using PicoContainer because it is well suited
022:         * to quick sanity checks like test cases. For a real industrial strength
023:         * solution please use something like Spring or JBoss containers (both of which
024:         * can be used in a client application and can be configured via XML).
025:         * </p>
026:         * <p>
027:         * The following are avaiable:
028:         * <ul>
029:         * <li>TypeFactory - TypeFactoryImpl
030:         * <li>AttributeFactory - TypeFactoryImpl
031:         * </ul>
032:         * <p>
033:         * <p>
034:         * With this as a base instances of the following builders can be requested,
035:         * they will arrive ready to go with no additional setup.
036:         * <ul>
037:         * <li>TypeBuilder - TypeBuilderImpl
038:         * <li>ComplexAttributeBuilder - ComplexAttributeBuilderImpl
039:         * </ul>
040:         * <p>
041:         * Here is a sample use:
042:         * 
043:         * <pre><code>
044:         * TestContainer container = new TestContainer();
045:         * ComplexAttributeBuilder builder = TestContainer
046:         * 		.getComponentInstanceOfType(ComplexAttributeBuilder.class);
047:         * 
048:         * build.setType(roadFeatureType); // aka a FeatureType
049:         * Feature road1, road2;
050:         * 
051:         * road1 = builder.add(&quot;name&quot;, &quot;hwy 31a&quot;).add(&quot;geom&quot;, hwy1).build(&quot;Road.31a&quot;);
052:         * road2 = builder.add(&quot;name&quot;, &quot;hwy 32&quot;).add(&quot;geom&quot;, hwy2).build(&quot;Road.32&quot;);
053:         * </code></pre>
054:         * 
055:         * For a discussion of the pros/cons using a container please review the
056:         * developers documentation. Or try writing any geotools program using the
057:         * "traditional" FactoryFinder approach.
058:         * </p>
059:         * 
060:         * @author Jody Garnett, Refractions Research Inc.
061:         */
062:        public class TestContainer extends DefaultPicoContainer {
063:            private static final long serialVersionUID = 654566278905574585L;
064:
065:            private TestContainer() {
066:            }
067:
068:            /**
069:             * This will produce a TestContainer for use with the "default"
070:             * implementation of the feature model.
071:             * <ul>
072:             * <li>TypeFactoryImpl - creates "default" implementation
073:             * <li>AttributeFactoryImpl - creates "default" implementations
074:             * </ul>
075:             * We have also included support for the following builders interfaces and
076:             * utility classes "out of the box".
077:             * <ul>
078:             * <li>AttributeTypeBuilder
079:             * <li>GeometryTypeBuilder
080:             * <li>ComplexTypeBuilder
081:             * <li>FeatureTypeBuilder
082:             * <li>FeatureCollectionTypeBuilder
083:             * <li>FeatureBuilder
084:             * <li>FeatureCollectionBuilder
085:             * <li>FeatureTypes
086:             * </ul>
087:             * 
088:             * @return Test Container used to test the "default" implementation of the
089:             *         type system.
090:             */
091:            public static TestContainer normal() {
092:                TestContainer c = new TestContainer();
093:
094:                // factories
095:                c.registerComponentImplementation(TypeFactoryImpl.class);
096:                c.registerComponentImplementation(AttributeFactoryImpl.class);
097:                c.registerComponentImplementation(GeometryFactory.class);
098:                c.registerComponentImplementation(FilterFactoryImpl.class);
099:
100:                // builders (utility classes for creation)
101:                c.registerComponent(new ConstructorInjectionComponentAdapter(
102:                        TypeBuilder.class, TypeBuilder.class));
103:
104:                // utilities
105:                c.registerComponentImplementation(FeatureTypes.class);
106:
107:                return c;
108:            }
109:
110:            /**
111:             * TestContainer used to work with the "simple" implementation of the
112:             * feature model.
113:             * <ul>
114:             * <li>TypeFactorySimple - TODO implement simple factory support
115:             * <li>AttributeFactorySimple - TODO implement simple feature support
116:             * </ul>
117:             * We have also included support for the following builders and utility
118:             * classes "out of the box".
119:             * <ul>
120:             * <li>SimpleFeatureTypeBuilder
121:             * <li>SimpleFeatureCollectionTypeBuilder
122:             * <li>SimpleFeatureBuilder
123:             * <li>SimpleFeatureCollectionBuilder
124:             * <li>SimpleFeatureTypes
125:             * <li>SimpleFeatures
126:             * </ul>
127:             * 
128:             * @return
129:             */
130:            public static TestContainer simple() {
131:                TestContainer c = new TestContainer();
132:
133:                // factories
134:                c.registerComponentImplementation(TypeFactoryImpl.class);
135:                c.registerComponentImplementation(AttributeFactoryImpl.class);
136:                c.registerComponentImplementation(GeometryFactory.class);
137:                c.registerComponentImplementation(FilterFactoryImpl.class);
138:
139:                // builders (utility classes for creation)
140:                c.registerComponentImplementation(SimpleTypeBuilder.class);
141:                c.registerComponentImplementation(SimpleFeatureBuilder.class);
142:
143:                // utilities
144:                c.registerComponentImplementation(SimpleFeatureTypes.class);
145:                c.registerComponentImplementation(SimpleFeatures.class);
146:
147:                return c;
148:            }
149:
150:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.