Source Code Cross Referenced for KMLMapProducerFactory.java in  » GIS » GeoServer » org » vfny » geoserver » wms » responses » map » kml » 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 » GeoServer » org.vfny.geoserver.wms.responses.map.kml 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org.  All rights reserved.
002:         * This code is licensed under the GPL 2.0 license, availible at the root
003:         * application directory.
004:         */
005:        package org.vfny.geoserver.wms.responses.map.kml;
006:
007:        import org.vfny.geoserver.global.WMS;
008:        import org.vfny.geoserver.wms.GetMapProducer;
009:        import org.vfny.geoserver.wms.GetMapProducerFactorySpi;
010:        import java.util.Collections;
011:        import java.util.Map;
012:        import java.util.Set;
013:
014:        /**
015:         * KMLMapProducerFactory
016:         * This class is used as part of the SPI auto discovery process which enables
017:         * new format producers to be plugged in.
018:         *
019:         * @version $Id: KMLMapProducerFactory.java 7467 2007-08-28 22:29:03Z afabiani $
020:         */
021:        public class KMLMapProducerFactory implements  GetMapProducerFactorySpi {
022:            /**
023:             * this is just to check the requested mime type starts with this string,
024:             * since the most common error when performing the HTTP request is not to
025:             * escape the '+' sign in "kml+xml", which is decoded as a space
026:             * character at server side.
027:             */
028:            private static final String PRODUCE_TYPE = "kml";
029:
030:            /** Official KML mime type
031:             * @TODO add KMZ support
032:             */
033:            public static final String MIME_TYPE = "application/vnd.google-earth.kml+xml";
034:
035:            /** Set of supported mime types for the producers made by this Factory
036:             */
037:            private static final Set SUPPORTED_FORMATS = Collections
038:                    .singleton(MIME_TYPE);
039:
040:            /**
041:             * Creates a new KMLMapProducerFactory object.
042:             */
043:            public KMLMapProducerFactory() {
044:            }
045:
046:            /**
047:             * Human readable description of output format.
048:             */
049:            public String getName() {
050:                return "Keyhole markup language producer";
051:            }
052:
053:            /**
054:             * Discover what output formats are supported by the producers made by this factory.
055:             *
056:             * @return Set of supported mime types
057:             */
058:            public Set getSupportedFormats() {
059:                return SUPPORTED_FORMATS;
060:            }
061:
062:            /**
063:             * Reports on the availability of this factory.  As no external libraries are
064:             * required for KML this should always be true.
065:             *
066:             * @return <code>true</code>
067:             */
068:            public boolean isAvailable() {
069:                return true;
070:            }
071:
072:            /**
073:             * evaluates if this Map producer can generate the map format specified by
074:             * <code>mapFormat</code>
075:             *
076:             * <p>
077:             * In this case, true if <code>mapFormat</code> starts with "kml", as
078:             * both <code>"kml"</code> and <code>"kml+xml"</code> are
079:             * commonly passed.  Also true if <code>application/vnd.google-earth.kml</code>
080:             * is passed, since that is as close as we can get to the value advertised in the
081:             * capabilities document taking into account the common mistake of not escaping '+'.
082:             * We must do this as the most way to request an output format is to use the name
083:             * in the caps document.
084:             * </p>
085:             *
086:             * @TODO should this be image/kml and image/kml+xml?
087:             * @param mapFormat the mime type of the output map format requiered
088:             *
089:             * @return true if class can produce a map in the passed format.
090:             */
091:            public boolean canProduce(String mapFormat) {
092:                //MIME TYPE is spec compliant, as its what we advertise in the caps
093:                //document.  Keeping the startsWith kml, so shortcuts can be used. -ch
094:                return (mapFormat != null)
095:                        && (mapFormat.startsWith(PRODUCE_TYPE) || mapFormat
096:                                .startsWith("application/vnd.google-earth.kml"));
097:            }
098:
099:            /**
100:             * Create an actual instance of a KMLMapProducer.
101:             *
102:             * @param mapFormat
103:             *            String which MUST match the supported formats. Call canProcess
104:             *            fisrt if you are unsure.
105:             *
106:             * @return GetMapProducer instance.
107:             *
108:             * @throws IllegalArgumentException
109:             *             DOCUMENT ME!
110:             */
111:            public GetMapProducer createMapProducer(String mapFormat, WMS wms)
112:                    throws IllegalArgumentException {
113:                if (canProduce(mapFormat)) {
114:                    return new KMLMapProducer(mapFormat, MIME_TYPE);
115:                }
116:
117:                throw new IllegalArgumentException("Unable to produce format "
118:                        + mapFormat);
119:            }
120:
121:            /* (non-Javadoc)
122:             * @see org.geotools.factory.Factory#getImplementationHints()
123:             * This just returns java.util.Collections.EMPTY_MAP
124:             */
125:            public Map getImplementationHints() {
126:                return java.util.Collections.EMPTY_MAP;
127:            }
128:        }
w_w__w___._ja___va2__s___._c__o__m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.