Source Code Cross Referenced for CacheSettings.java in  » RSS-RDF » informa » de » nava » informa » utils » 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 » informa » de.nava.informa.utils 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //
002:        //Informa -- RSS Library for Java
003:        //Copyright (c) 2002 by Niko Schmuck
004:        //
005:        //Niko Schmuck
006:        //http://sourceforge.net/projects/informa
007:        //mailto:niko_schmuck@users.sourceforge.net
008:        //
009:        //This library is free software.
010:        //
011:        //You may redistribute it and/or modify it under the terms of the GNU
012:        //Lesser General Public License as published by the Free Software Foundation.
013:        //
014:        //Version 2.1 of the license should be included with this distribution in
015:        //the file LICENSE. If the license is not included with this distribution,
016:        //you may find a copy at the FSF web site at 'www.gnu.org' or 'www.fsf.org',
017:        //or you may write to the Free Software Foundation, 675 Mass Ave, Cambridge,
018:        //MA 02139 USA.
019:        //
020:        //This library is distributed in the hope that it will be useful,
021:        //but WITHOUT ANY WARRANTY; without even the implied waranty of
022:        //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
023:        //Lesser General Public License for more details.
024:        //
025:        // $Id: CacheSettings.java,v 1.4 2004/06/22 18:52:30 jga Exp $
026:
027:        package de.nava.informa.utils;
028:
029:        import de.nava.informa.core.ChannelIF;
030:        import de.nava.informa.core.ChannelFormat;
031:
032:        /**
033:         * delegation class for the various CacheSettingsIF implementation.
034:         * 
035:         * 
036:         * default behavior : ttl (or update period) in feed is always respected.
037:         * without such indication, the ttl specified by the informa user is used.
038:         * @author Jean-Guy Avelin
039:         */
040:        public class CacheSettings implements  CacheSettingsIF {
041:
042:            static private CacheSettingsIF v_091;
043:            static private CacheSettingsIF v_100;
044:            static private CacheSettingsIF v_200;
045:            static private CacheSettingsIF v_A030;
046:            /* default settings */
047:            /* can read properties file to instantiate alternative implementations*/
048:            /* TODO : property file handling */
049:            static {
050:                v_091 = new RSS091Settings();
051:                v_100 = new RSS100Settings();
052:                v_200 = new RSS200Settings();
053:                v_A030 = new Atom030Settings();
054:            }
055:
056:            /**
057:             * determine ttl for the feed, depending on ttl specified by the
058:             * feed producer and the ttl wanted by the informa user.
059:             */
060:            public long getTtl(ChannelIF channel, long ttl) {
061:
062:                if (channel.getFormat().equals(ChannelFormat.RSS_0_91)
063:                        || channel.getFormat().equals(ChannelFormat.RSS_0_92)
064:                        || channel.getFormat().equals(ChannelFormat.RSS_0_93)
065:                        || channel.getFormat().equals(ChannelFormat.RSS_0_94)) {
066:                    return v_091.getTtl(channel, ttl);
067:                } else if (channel.getFormat().equals(ChannelFormat.RSS_1_0)) {
068:                    return v_100.getTtl(channel, ttl);
069:                } else if (channel.getFormat().equals(ChannelFormat.RSS_2_0)) {
070:                    return v_200.getTtl(channel, ttl);
071:                } else if (channel.getFormat().equals(ChannelFormat.ATOM_0_3)) {
072:                    return v_A030.getTtl(channel, ttl);
073:                }
074:
075:                return CacheSettingsIF.DEFAULT_TTL;
076:            }
077:
078:            /**
079:             * TODO : remove ?
080:             */
081:            public void setDefaultTtl(long defTtl) {
082:                v_091.setDefaultTtl(defTtl);
083:                v_100.setDefaultTtl(defTtl);
084:                v_200.setDefaultTtl(defTtl);
085:                v_A030.setDefaultTtl(defTtl);
086:            }
087:
088:            public void setDefaultTtl(String type, long defTtl) {
089:                if (ChannelFormat.RSS_0_91.equals(type)
090:                        || ChannelFormat.RSS_0_92.equals(type)
091:                        || ChannelFormat.RSS_0_93.equals(type)
092:                        || ChannelFormat.RSS_0_94.equals(type)) {
093:                    v_091.setDefaultTtl(defTtl);
094:                    return;
095:                }
096:
097:                if (ChannelFormat.RSS_1_0.equals(type)) {
098:                    v_100.setDefaultTtl(defTtl);
099:                    return;
100:                }
101:
102:                if (ChannelFormat.RSS_2_0.equals(type)) {
103:                    v_200.setDefaultTtl(defTtl);
104:                    return;
105:                }
106:
107:                if (ChannelFormat.ATOM_0_3.equals(type)) {
108:                    v_A030.setDefaultTtl(defTtl);
109:                    return;
110:                }
111:
112:            }
113:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.