KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opencms > template > CmsCacheDirectives


1 /*
2 * File : $Source: /usr/local/cvs/opencms/src-modules/com/opencms/template/CmsCacheDirectives.java,v $
3 * Date : $Date: 2005/05/17 13:47:32 $
4 * Version: $Revision: 1.1 $
5 *
6 * This library is part of OpenCms -
7 * the Open Source Content Mananagement System
8 *
9 * Copyright (C) 2001 The OpenCms Group
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * For further information about OpenCms, please see the
22 * OpenCms Website: http://www.opencms.org
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 */

28
29 package com.opencms.template;
30
31 import com.opencms.template.cache.CmsTimeout;
32
33 /**
34  * Collection of all information about cacheability and
35  * used keys.
36  *
37  * @author Alexander Lucas
38  * @author Hanjo Riege
39  * @version $Revision: 1.1 $ $Date: 2005/05/17 13:47:32 $
40  *
41  * @deprecated Will not be supported past the OpenCms 6 release.
42  */

43 public class CmsCacheDirectives extends A_CmsCacheDirectives {
44
45
46     /**
47      * Constructor for initializing all caching properties with the same boolean
48      * value.
49      * @param b Boolean value that should be set for all caching properties
50      */

51     public CmsCacheDirectives(boolean b) {
52         if (b) {
53             m_cd = C_CACHE_INTERNAL | C_CACHE_PROXY_PRIVATE | C_CACHE_PROXY_PUBLIC | C_CACHE_EXPORT | C_CACHE_STREAM;
54         } else {
55             m_cd = 0;
56         }
57         m_userSetExport = true;
58         m_userSetProxyPrivate = true;
59         m_userSetProxyPublic = true;
60     }
61
62     /**
63      * Constructor for initializing all caching properties given boolean
64      * values.
65      * @param internal Initial value for "internal cacheable" property.
66      * @param proxyPriv Initial value for "proxy private cacheable" property.
67      * @param proxyPub Initial value for "internal cacheable" property.
68      * @param export Initial value for "exportable" property.
69      * @param stream Initial value for "streamable" property.
70      */

71     public CmsCacheDirectives(boolean internal, boolean proxyPriv, boolean proxyPub, boolean export, boolean stream) {
72         m_cd = 0;
73         m_cd |= internal?C_CACHE_INTERNAL:0;
74         m_cd |= proxyPriv?C_CACHE_PROXY_PRIVATE:0;
75         m_cd |= proxyPub?C_CACHE_PROXY_PUBLIC:0;
76         m_cd |= export?C_CACHE_EXPORT:0;
77         m_cd |= stream?C_CACHE_STREAM:0;
78
79         m_userSetExport = true;
80         m_userSetProxyPrivate = true;
81         m_userSetProxyPublic = true;
82     }
83
84     /**
85      * Constructor.<p>
86      *
87      * @param internal Initial value for "internal cacheable" property.
88      * @param stream Initial value for "streamable" property.
89      */

90     public CmsCacheDirectives(boolean internal, boolean stream) {
91         m_cd = 0;
92         m_cd |= internal?C_CACHE_INTERNAL:0;
93         m_cd |= stream?C_CACHE_STREAM:0;
94     }
95
96     /**
97      * Enables or disables the proxy public cache for this element.<p>
98      * @param proxyPublic true if the flag should be set in the response header.
99      */

100     public void setProxyPublicCacheable(boolean proxyPublic) {
101         m_userSetProxyPublic = true;
102         setExternalCaching(isInternalCacheable(), isProxyPrivateCacheable(),
103                             proxyPublic, isExportable(), isStreamable());
104     }
105
106     /**
107      * Enables or disables the proxy private cache for this element.<p>
108      * @param proxyPrivate true if the flag should be set in the response header.
109      */

110     public void setProxyPrivateCacheable(boolean proxyPrivate) {
111         m_userSetProxyPrivate = true;
112         setExternalCaching(isInternalCacheable(), proxyPrivate,
113                             isProxyPublicCacheable(), isExportable(), isStreamable());
114     }
115
116     /**
117      * Enables or disables the export for this element.<p>
118      * @param export true if the flag should be set in the response header.
119      */

120     public void setExport(boolean export) {
121         m_userSetExport = true;
122         setExternalCaching(isInternalCacheable(), isProxyPrivateCacheable(),
123                             isProxyPublicCacheable(), export, isStreamable());
124     }
125
126     /**
127      * Sset the timeout object(used if the element should be reloaded every x minutes.
128      * if the timeout object says so the proxyCache is disabled.
129      * @param timeout a CmsTimeout object.
130      */

131     public void setTimeout(CmsTimeout timeout) {
132         m_timecheck = true;
133         m_timeout = timeout;
134         if (!m_timeout.isProxyCacheable()) {
135             setProxyPrivateCacheable(false);
136             setProxyPublicCacheable(false);
137         }
138     }
139 }
140
Popular Tags