Source Code Cross Referenced for PDFMapProducerFactory.java in  » GIS » GeoServer » org » vfny » geoserver » wms » responses » map » pdf » 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.pdf 
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.pdf;
006:
007:        import java.util.Collections;
008:        import java.util.Map;
009:        import java.util.Set;
010:
011:        import org.vfny.geoserver.global.WMS;
012:        import org.vfny.geoserver.wms.GetMapProducer;
013:        import org.vfny.geoserver.wms.GetMapProducerFactorySpi;
014:
015:        /**
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:         * @author Pierre-Emmanuel Balageas, ALCER (http://www.alcer.com)
020:         * @author Simone Giannecchini - GeoSolutions
021:         * @version $Id: PDFMapProducerFactory.java 7467 2007-08-28 22:29:03Z afabiani $
022:         */
023:        public class PDFMapProducerFactory implements  GetMapProducerFactorySpi {
024:            /** the only MIME type this map producer supports */
025:            static final String MIME_TYPE = "application/pdf";
026:
027:            /**
028:             * convenient singleton Set to expose the output format this producer
029:             * supports
030:             */
031:            private static final Set SUPPORTED_FORMATS = Collections
032:                    .singleton(MIME_TYPE);
033:
034:            /**
035:             * Creates a new PdfMapProducerFactory object.
036:             */
037:            public PDFMapProducerFactory() {
038:                super ();
039:            }
040:
041:            /**
042:             * get a readable name of the supported MIME type
043:             * 
044:             * @return DOCUMENT ME!
045:             */
046:            public String getName() {
047:                return "Portable Document Format (PDF) map producer";
048:            }
049:
050:            /**
051:             * Returns the Set of output format this producer supports
052:             * 
053:             * @return Set of output format this producer supports (actually
054:             *         "application/pdf")
055:             */
056:            public Set getSupportedFormats() {
057:                return SUPPORTED_FORMATS;
058:            }
059:
060:            /**
061:             * PDFMapProducer depends of iText-1.3.6.jar
062:             * 
063:             * @return <code>true</code> if iText.jar is loaded <code>false</code>
064:             *         otherwise
065:             */
066:            public boolean isAvailable() {
067:                try {
068:                    Class.forName("com.lowagie.text.pdf.PdfTemplate");
069:                    Class.forName("com.lowagie.text.Document");
070:                    Class.forName("com.lowagie.text.FontFactory");
071:                    Class.forName("com.lowagie.text.pdf.DefaultFontMapper");
072:                    Class.forName("com.lowagie.text.pdf.PdfContentByte");
073:                    Class.forName("com.lowagie.text.pdf.PdfTemplate");
074:                    Class.forName("com.lowagie.text.pdf.PdfWriter");
075:
076:                    return true;
077:                } catch (ClassNotFoundException e) {
078:                    return false;
079:                }
080:            }
081:
082:            /**
083:             * Returns wether the map producers created by this factory can create maps
084:             * in the passed output format.
085:             * 
086:             * @param mapFormat
087:             *            a MIME type string to check if this producer is able to
088:             *            handle.
089:             * 
090:             * @return <code>true</code> if <code>mapFormat ==
091:             *         "application/pdf"</code>,
092:             *         <code>false</code> otherwise.
093:             */
094:            public boolean canProduce(String mapFormat) {
095:                return MIME_TYPE.equals(mapFormat);
096:            }
097:
098:            /**
099:             * DOCUMENT ME!
100:             * 
101:             * @param mapFormat
102:             *            a MIME type string to check if this producer is able to
103:             *            handle.
104:             * @param config
105:             *            DOCUMENT ME!
106:             * 
107:             * @return an instance of the PDFMapProducer if mapFormat is supported an
108:             *         IllegalArgumentException otherwise
109:             * 
110:             * @throws IllegalArgumentException
111:             *             if mapFormat is not supported
112:             */
113:            public GetMapProducer createMapProducer(String mapFormat, WMS wms)
114:                    throws IllegalArgumentException {
115:                if (!canProduce(mapFormat)) {
116:                    throw new IllegalArgumentException(mapFormat
117:                            + " not supported by this map producer");
118:                }
119:
120:                return new PDFMapProducer(mapFormat, MIME_TYPE);
121:            }
122:
123:            /*
124:             * (non-Javadoc)
125:             * 
126:             * @see org.geotools.factory.Factory#getImplementationHints() This just
127:             *      returns java.util.Collections.EMPTY_MAP
128:             */
129:            public Map getImplementationHints() {
130:                return java.util.Collections.EMPTY_MAP;
131:            }
132:        }
w___w___w.__j___a__v_a__2___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.