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


001:        /*---------------------------------------------------------------------------*\
002:          $Id: RSSLink.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.parser;
047:
048:        import java.net.URL;
049:        import java.util.Collection;
050:        import java.util.LinkedHashSet;
051:
052:        /**
053:         * An <tt>RSSLink</tt> object describes a link to a URL, including any
054:         * metadata about the URL's content (if available).
055:         *
056:         * @see RSSItem
057:         * @see RSSChannel
058:         *
059:         * @version <tt>$Revision: 7041 $</tt>
060:         */
061:        public class RSSLink {
062:            /*----------------------------------------------------------------------*\
063:                                         Constants
064:            \*----------------------------------------------------------------------*/
065:
066:            /**
067:             * Link types.
068:             */
069:            public enum Type {
070:                /**
071:                 * The link refers back to the RSS feed.
072:                 */
073:                SELF,
074:
075:                /**
076:                 * The link refers to an alternate page containing the same
077:                 * information, but perhaps in a different format (e.g., HTML).
078:                 */
079:                ALTERNATE
080:            };
081:
082:            /*----------------------------------------------------------------------*\
083:                                   Private Instance Data
084:            \*----------------------------------------------------------------------*/
085:
086:            private URL url = null;
087:            private String mimeType = null;
088:            private Type linkType = Type.SELF;
089:
090:            private Collection<RSSLinkChangeListener> changeListeners = new LinkedHashSet<RSSLinkChangeListener>();
091:
092:            /*----------------------------------------------------------------------*\
093:                                       Constructors
094:            \*----------------------------------------------------------------------*/
095:
096:            /**
097:             * Create an empty <tt>RSSLink</tt> object.
098:             *
099:             * @see #RSSLink(URL,String,Type)
100:             */
101:            public RSSLink() {
102:                // nothing to do
103:            }
104:
105:            /**
106:             * Create and populate a new <tt>RSSLink</tt> object.
107:             *
108:             * @param url      the link's URL
109:             * @param mimeType the MIME type. Must not be null.
110:             * @param linkType the link type
111:             */
112:            public RSSLink(URL url, String mimeType, Type linkType) {
113:                this (url, mimeType, linkType, null);
114:            }
115:
116:            /**
117:             * Create and populate a new <tt>RSSLink</tt> object.
118:             *
119:             * @param url            the link's URL
120:             * @param mimeType       the MIME type. Must not be null.
121:             * @param linkType       the link type
122:             * @param changeListener initial {@link RSSLinkChangeListener} to add to
123:             *                       this object. Can be null.
124:             */
125:            public RSSLink(URL url, String mimeType, Type linkType,
126:                    RSSLinkChangeListener changeListener) {
127:                this .url = url;
128:                this .mimeType = mimeType;
129:                this .linkType = linkType;
130:
131:                if (changeListener != null)
132:                    addChangeListener(changeListener);
133:            }
134:
135:            /*----------------------------------------------------------------------*\
136:                                      Public Methods
137:            \*----------------------------------------------------------------------*/
138:
139:            /**
140:             * Add a change listener to this <tt>RSSLink</tt>.
141:             *
142:             * @param listener the listener to add
143:             *
144:             * @see #removeChangeListener
145:             */
146:            public void addChangeListener(RSSLinkChangeListener listener) {
147:                changeListeners.add(listener);
148:            }
149:
150:            /**
151:             * Remove a change listener from this <tt>RSSLink</tt>.
152:             *
153:             * @param listener the listener to remove
154:             *
155:             * @see #addChangeListener
156:             */
157:            public void removeChangeListener(RSSLinkChangeListener listener) {
158:                changeListeners.remove(listener);
159:            }
160:
161:            /**
162:             * Get the URL for this link.
163:             *
164:             * @return the URL, or null if not set yet.
165:             *
166:             * @see #setURL
167:             */
168:            public URL getURL() {
169:                return url;
170:            }
171:
172:            /**
173:             * Set the URL for this link.
174:             *
175:             * @param url  the URL, or null if not set yet.
176:             *
177:             * @see #getURL
178:             */
179:            public void setURL(URL url) {
180:                URL oldURL = this .url;
181:                this .url = url;
182:
183:                for (RSSLinkChangeListener listener : changeListeners)
184:                    listener.onURLChange(this , oldURL, this .url);
185:            }
186:
187:            /**
188:             * Get the MIME type for this link.
189:             *
190:             * @return the MIME type, or null if not set yet.
191:             *
192:             * @see #setMIMEType
193:             */
194:            public String getMIMEType() {
195:                return mimeType;
196:            }
197:
198:            /**
199:             * Set the MIME type for this link.
200:             *
201:             * @param mimeType  the MIME Type, or null if not set yet.
202:             *
203:             * @see #getMIMEType
204:             */
205:            public void setMIMEType(String mimeType) {
206:                String oldMIMEType = this .mimeType;
207:                this .mimeType = mimeType;
208:
209:                for (RSSLinkChangeListener listener : changeListeners)
210:                    listener.onMIMETypeChange(this , oldMIMEType, this .mimeType);
211:            }
212:
213:            /**
214:             * Get the link type for this link.
215:             *
216:             * @return the link type, or null if not set yet.
217:             *
218:             * @see #setLinkType
219:             */
220:            public Type getLinkType() {
221:                return linkType;
222:            }
223:
224:            /**
225:             * Set the link type for this link.
226:             *
227:             * @param linkType  the link Type, or null if not set yet.
228:             *
229:             * @see #getLinkType
230:             */
231:            public void setLinkType(Type linkType) {
232:                Type oldType = this .linkType;
233:                this .linkType = linkType;
234:
235:                for (RSSLinkChangeListener listener : changeListeners)
236:                    listener.onLinkTypeChange(this , oldType, this .linkType);
237:            }
238:
239:            /**
240:             * Get the string representation of this link (the URL).
241:             *
242:             * @return the string version
243:             */
244:            @Override
245:            public String toString() {
246:                return (url == null) ? "null" : url.toExternalForm();
247:            }
248:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.