KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > flex > CmsFlexDummyLoader


1 /*
2  * File : $Source: /usr/local/cvs/opencms/test/org/opencms/flex/CmsFlexDummyLoader.java,v $
3  * Date : $Date: 2005/09/11 13:27:06 $
4  * Version: $Revision: 1.1 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
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 Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.flex;
33
34 import org.opencms.file.CmsObject;
35 import org.opencms.file.CmsResource;
36 import org.opencms.loader.I_CmsFlexCacheEnabledLoader;
37 import org.opencms.loader.I_CmsResourceLoader;
38
39 import java.util.HashMap JavaDoc;
40 import java.util.Locale JavaDoc;
41 import java.util.Map JavaDoc;
42
43 import javax.servlet.ServletException JavaDoc;
44 import javax.servlet.ServletRequest JavaDoc;
45 import javax.servlet.ServletResponse JavaDoc;
46 import javax.servlet.http.HttpServletRequest JavaDoc;
47 import javax.servlet.http.HttpServletResponse JavaDoc;
48
49 /**
50  * A resource loader which does nothing, except provide access to the last flex cache instance set
51  * with {@link #setFlexCache}.<p>
52  *
53  * The instance can be accessed via the package static variable {@link #m_flexCache}.
54  * This allows unit tests in this package to do some white-box testing on the flex cache system.
55  *
56  * @author Jason Trump
57  *
58  * @version $Revision: 1.1 $
59  *
60  * @since 6.0.1
61  */

62 public class CmsFlexDummyLoader implements I_CmsResourceLoader, I_CmsFlexCacheEnabledLoader {
63
64     /** The dummy id of this dummy loader. */
65     public static final int LOADER_ID = 100;
66
67     /** Loader info. */
68     public static final String JavaDoc LOADER_INFO = "Dummy Loader, which provides test classes access to the CmsFlexCache instance";
69
70     /** Provides access to the Flex cache. */
71     static CmsFlexCache m_flexCache;
72
73     /** Holds the loder configuration. */
74     private HashMap JavaDoc m_config = new HashMap JavaDoc();
75
76     /**
77      * @see org.opencms.configuration.I_CmsConfigurationParameterHandler#addConfigurationParameter(java.lang.String, java.lang.String)
78      */

79     public void addConfigurationParameter(String JavaDoc paramName, String JavaDoc paramValue) {
80
81         m_config.put(paramName, paramValue);
82     }
83
84     /**
85      * @see org.opencms.loader.I_CmsResourceLoader#destroy()
86      */

87     public void destroy() {
88
89         m_flexCache = null;
90         m_config.clear();
91     }
92
93     /**
94      * @see org.opencms.loader.I_CmsResourceLoader#dump(org.opencms.file.CmsObject, org.opencms.file.CmsResource, java.lang.String, java.util.Locale, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
95      */

96     public byte[] dump(
97         CmsObject cms,
98         CmsResource resource,
99         String JavaDoc element,
100         Locale JavaDoc locale,
101         HttpServletRequest JavaDoc req,
102         HttpServletResponse JavaDoc res) throws ServletException JavaDoc {
103
104         throw new ServletException JavaDoc("Not implemented");
105     }
106
107     /**
108      * @see org.opencms.loader.I_CmsResourceLoader#export(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
109      */

110     public byte[] export(CmsObject cms, CmsResource resource, HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc res)
111     throws ServletException JavaDoc {
112
113         throw new ServletException JavaDoc("Not implemented");
114     }
115
116     /**
117      * @see org.opencms.configuration.I_CmsConfigurationParameterHandler#getConfiguration()
118      */

119     public Map JavaDoc getConfiguration() {
120
121         return m_config;
122     }
123
124     /**
125      * @see org.opencms.loader.I_CmsResourceLoader#getLoaderId()
126      */

127     public int getLoaderId() {
128
129         return LOADER_ID;
130     }
131
132     /**
133      * @see org.opencms.loader.I_CmsResourceLoader#getResourceLoaderInfo()
134      */

135     public String JavaDoc getResourceLoaderInfo() {
136
137         return LOADER_INFO;
138     }
139
140     /**
141      * @see org.opencms.configuration.I_CmsConfigurationParameterHandler#initConfiguration()
142      */

143     public void initConfiguration() {
144
145         // not implemented
146
}
147
148     /**
149      * @see org.opencms.loader.I_CmsResourceLoader#isStaticExportEnabled()
150      */

151     public boolean isStaticExportEnabled() {
152
153         return false;
154     }
155
156     /**
157      * @see org.opencms.loader.I_CmsResourceLoader#isStaticExportProcessable()
158      */

159     public boolean isStaticExportProcessable() {
160
161         return false;
162     }
163
164     /**
165      * @see org.opencms.loader.I_CmsResourceLoader#isUsableForTemplates()
166      */

167     public boolean isUsableForTemplates() {
168
169         return false;
170     }
171
172     /**
173      * @see org.opencms.loader.I_CmsResourceLoader#isUsingUriWhenLoadingTemplate()
174      */

175     public boolean isUsingUriWhenLoadingTemplate() {
176
177         return false;
178     }
179
180     /**
181      * @see org.opencms.loader.I_CmsResourceLoader#load(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
182      */

183     public void load(CmsObject cms, CmsResource resource, HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc res)
184     throws ServletException JavaDoc {
185
186         throw new ServletException JavaDoc("Not implemented");
187     }
188
189     /**
190      * @see org.opencms.loader.I_CmsResourceLoader#service(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.ServletRequest, javax.servlet.ServletResponse)
191      */

192     public void service(CmsObject cms, CmsResource resource, ServletRequest JavaDoc req, ServletResponse JavaDoc res)
193     throws ServletException JavaDoc {
194
195         throw new ServletException JavaDoc("Not implemented");
196     }
197
198     /**
199      * @see org.opencms.loader.I_CmsFlexCacheEnabledLoader#setFlexCache(org.opencms.flex.CmsFlexCache)
200      */

201     public void setFlexCache(CmsFlexCache cache) {
202
203         m_flexCache = cache;
204     }
205 }
Popular Tags