Source Code Cross Referenced for ReadOnlyOutputHandler.java in  » RSS-RDF » curn » org » clapper » curn » 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 » RSS RDF » curn » org.clapper.curn 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*---------------------------------------------------------------------------*\
002:          $Id: ReadOnlyOutputHandler.java 7041 2007-09-09 01:04:47Z bmc $
003:          ---------------------------------------------------------------------------
004:          This software is released under a BSD-style license:
005:
006:          Copyright (c) 2004-2007 Brian M. Clapper. All rights reserved.
007:
008:          Redistribution and use in source and binary forms, with or without
009:          modification, are permitted provided that the following conditions are
010:          met:
011:
012:          1. Redistributions of source code must retain the above copyright notice,
013:             this list of conditions and the following disclaimer.
014:
015:          2. The end-user documentation included with the redistribution, if any,
016:             must include the following acknowlegement:
017:
018:                "This product includes software developed by Brian M. Clapper
019:                (bmc@clapper.org, http://www.clapper.org/bmc/). That software is
020:                copyright (c) 2004-2007 Brian M. Clapper."
021:
022:             Alternately, this acknowlegement may appear in the software itself,
023:             if wherever such third-party acknowlegements normally appear.
024:
025:          3. Neither the names "clapper.org", "curn", nor any of the names of the
026:             project contributors may be used to endorse or promote products
027:             derived from this software without prior written permission. For
028:             written permission, please contact bmc@clapper.org.
029:
030:          4. Products derived from this software may not be called "curn", nor may
031:             "clapper.org" appear in their names without prior written permission
032:             of Brian M. Clapper.
033:
034:          THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
035:          WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
036:          MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
037:          NO EVENT SHALL BRIAN M. CLAPPER BE LIABLE FOR ANY DIRECT, INDIRECT,
038:          INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
039:          NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
040:          DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
041:          THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
042:          (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
043:          THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
044:        \*---------------------------------------------------------------------------*/
045:
046:        package org.clapper.curn;
047:
048:        import java.io.File;
049:
050:        import org.clapper.curn.parser.RSSChannel;
051:
052:        import org.clapper.util.config.ConfigurationException;
053:
054:        /**
055:         * Wrapper for an {@link OutputHandler} that renders it read-only, for
056:         * passing to plug-ins.
057:         *
058:         * @see Curn
059:         * @see OutputHandler
060:         * @see PlugIn
061:         *
062:         * @version <tt>$Revision: 7041 $</tt>
063:         */
064:        public class ReadOnlyOutputHandler implements  OutputHandler {
065:            /*----------------------------------------------------------------------*\
066:                                    Private Data Items
067:            \*----------------------------------------------------------------------*/
068:
069:            /**
070:             * The wrapped output handler
071:             */
072:            private final OutputHandler outputHandler;
073:
074:            /*----------------------------------------------------------------------*\
075:                                        Constructor
076:            \*----------------------------------------------------------------------*/
077:
078:            /**
079:             * Create a new <tt>ReadOnlyOutputHandler</tt> that wraps the specified
080:             * output handler.
081:             *
082:             * @param outputHandler the {@link OutputHandler} to wrap.
083:             */
084:            public ReadOnlyOutputHandler(OutputHandler outputHandler) {
085:                this .outputHandler = outputHandler;
086:            }
087:
088:            /*----------------------------------------------------------------------*\
089:                                      Public Methods
090:            \*----------------------------------------------------------------------*/
091:
092:            /**
093:             * Get the name of this output handler. The name must be unique.
094:             *
095:             * @return the name
096:             */
097:            public String getName() {
098:                return outputHandler.getName();
099:            }
100:
101:            /**
102:             * Set the name of this output handler. Called by <i>curn</i>.
103:             *
104:             * @param name  the name
105:             */
106:            public void setName(final String name) throws CurnException {
107:                throw new CurnException(Constants.BUNDLE_NAME,
108:                        "ReadOnlyOutputHandler.readOnlyMethod",
109:                        "Illegal call to read-only OutputHandler "
110:                                + "method {0}()", new Object[] { "setName" });
111:            }
112:
113:            /**
114:             * Initializes the output handler for another set of RSS channels.
115:             * Note: This version of <tt>init()</tt> throws an unconditional
116:             * exception.
117:             *
118:             * @param config     the parsed <i>curn</i> configuration data. The
119:             *                   output handler is responsible for retrieving its
120:             *                   own parameters from the configuration, by calling
121:             *                   <tt>config.getOutputHandlerSpecificVariables()</tt>
122:             * @param cfgHandler the <tt>ConfiguredOutputHandler</tt> wrapper
123:             *                   containing this object; the wrapper has some useful
124:             *                   metadata, such as the object's configuration section
125:             *                   name and extra variables.
126:             *
127:             * @throws ConfigurationException configuration error
128:             * @throws CurnException          some other initialization error
129:             *
130:             * @see CurnConfig
131:             * @see ConfiguredOutputHandler
132:             */
133:            public void init(final CurnConfig config,
134:                    final ConfiguredOutputHandler cfgHandler)
135:                    throws ConfigurationException, CurnException {
136:                throw new CurnException(Constants.BUNDLE_NAME,
137:                        "ReadOnlyOutputHandler.readOnlyMethod",
138:                        "Illegal call to read-only OutputHandler "
139:                                + "method {0}()", new Object[] { "init" });
140:            }
141:
142:            /**
143:             * Display the list of <tt>RSSItem</tt> news items to whatever output
144:             * is defined for the underlying class. Output should be written to the
145:             * <tt>PrintWriter</tt> that was passed to the {@link #init init()} method.
146:             * Note: This version of <tt>init()</tt> throws an unconditional
147:             * exception.
148:             *
149:             * @param channel  The parsed channel data
150:             * @param feedInfo The feed.
151:             *
152:             * @throws CurnException  unable to write output
153:             */
154:            public void displayChannel(final RSSChannel channel,
155:                    final FeedInfo feedInfo) throws CurnException {
156:                throw new CurnException(Constants.BUNDLE_NAME,
157:                        "ReadOnlyOutputHandler.readOnlyMethod",
158:                        "Illegal call to read-only OutputHandler "
159:                                + "method {0}()",
160:                        new Object[] { "displayChannel" });
161:            }
162:
163:            /**
164:             * Flush any buffered-up output and close the underlying output
165:             * stream(s), if any. <i>curn</i> calls this method once, after calling
166:             * <tt>displayChannelItems()</tt> for all channels. If the output
167:             * handler doesn't need to flush any output, it can simply return
168:             * without doing anything. Note: This version of <tt>init()</tt> throws
169:             * an unconditional exception.
170:             *
171:             * @throws CurnException  unable to write output
172:             */
173:            public void flush() throws CurnException {
174:                throw new CurnException(Constants.BUNDLE_NAME,
175:                        "ReadOnlyOutputHandler.readOnlyMethod",
176:                        "Illegal call to read-only OutputHandler "
177:                                + "method {0}()", new Object[] { "flush" });
178:            }
179:
180:            /**
181:             * Get the content (i.e., MIME) type for output produced by this output
182:             * handler.
183:             *
184:             * @return the content type
185:             *
186:             * @see #hasGeneratedOutput
187:             * @see #getGeneratedOutput
188:             */
189:            public String getContentType() {
190:                return outputHandler.getContentType();
191:            }
192:
193:            /**
194:             * Get the <tt>File</tt> that represents the output produced by the
195:             * handler, if applicable. (Use of a <tt>File</tt>, rather than an
196:             * <tt>InputStream</tt>, is more efficient when mailing the output,
197:             * since the email API ultimately wants files and will create
198:             * temporary files for <tt>InputStream</tt>s.)
199:             *
200:             * @return the output file, or null if no suitable output was produced
201:             *
202:             * @throws CurnException an error occurred
203:             */
204:            public File getGeneratedOutput() throws CurnException {
205:                return outputHandler.getGeneratedOutput();
206:            }
207:
208:            /**
209:             * Get the output encoding.
210:             *
211:             * @return the encoding
212:             */
213:            public String getOutputEncoding() {
214:                return outputHandler.getOutputEncoding();
215:            }
216:
217:            /**
218:             * Determine whether this handler has produced any actual output (i.e.,
219:             * whether {@link #getGeneratedOutput()} will return a non-null
220:             * <tt>InputStream</tt> if called).
221:             *
222:             * @return <tt>true</tt> if the handler has produced output,
223:             *         <tt>false</tt> if not
224:             *
225:             * @see #getGeneratedOutput
226:             * @see #getContentType
227:             */
228:            public boolean hasGeneratedOutput() {
229:                return outputHandler.hasGeneratedOutput();
230:            }
231:
232:            /**
233:             * Make a copy of the output handler.
234:             *
235:             * @return a clean, initialized copy of the output handler
236:             *
237:             * @throws CurnException on error
238:             */
239:            public OutputHandler makeCopy() throws CurnException {
240:                return new ReadOnlyOutputHandler(outputHandler);
241:            }
242:
243:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.