1/*2 * Copyright 2000-2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.services.resources;
1819import org.apache.turbine.services.resources.TurbineResources;
2021/***22 * This class defines the Jetspeed properties keys.23 * All properties can be retrieved using TurbineResources or JetspeedResources24 * directly.25 *26 * This class also overrides the covers for many of the get routines. It handles the cases27 * where we want a single value, perhaps as a boolean or float, but the configuration may have28 * an array of values. In these cases, we let the first value override all the others and use it.29 *30 * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>31 * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>32 * @author <a href="mailto:tom@PIsoftware.com">Tom Adams</a>33 * @author <a href="mailto:kimptoc_mail@yahoo.com">Chris Kimpton</a>34 * @author <a href="mailto:ggolden@apache.org">Glenn R. Golden</a>35 * @version $Id: JetspeedResources.java,v 1.19 2004/02/23 03:29:53 jford Exp $36 */37publicclassJetspeedResourcesextends TurbineResources {
3839//Added by sbelt for GenericNavigation.class40publicstaticfinal String SITE_HEADER_LOGO_KEY = "site.header.logo";
41publicstaticfinal String SITE_HEADER_WELCOME_KEY = "site.header.welcome";
42publicstaticfinal String SITE_FOOTER_LOGO_KEY = "site.footer.logo";
4344//Keys for use within external code4546publicstaticfinal String PROFILER_DEFAULT_CLASSNAME_KEY = "profiler.default.classname";
47publicstaticfinal String PROFILER_CONFIGURATION_KEY = "profiler.configuration";
48publicstaticfinal String SKIN_DEFAULT_KEY = "skin.default";
49publicstaticfinal String PORTLETCONTROL_DEFAULT_CLASSNAME_KEY = "portletcontrol.default.classname";
50publicstaticfinal String PORTLETCONTROL_MAXIMIZED_CLASSNAME_KEY = "portletcontrol.maximized.classname";
51publicstaticfinal String PORTLETCONTROLLER_DEFAULT_CLASSNAME_KEY = "portletcontroller.default.classname";
5253//Disk Cache (URLManager) parameters54publicstaticfinal String CACHE_DIRECTORY_KEY = "cache.directory";
55publicstaticfinal String CACHE_REQUIRE_CACHED_KEY = "cache.require.cached";
56publicstaticfinal String DEFAULT_DCE_EXPIRATION_TIME_KEY = "cache.default.expiration";
5758publicstaticfinal String DEFAULTPORTLETCONTROL_WIDTH_KEY = "defaultportletcontrol.width";
59publicstaticfinal String DEFAULTPORTLETCONTROLLER_NUMCOLUMNS_KEY = "defaultportletcontroller.numcolumns";
60publicstaticfinal String DEFAULTPORTLETCONTROLLER_WIDTH_KEY = "defaultportletcontroller.width";
61publicstaticfinal String XMLPORTLETCONTROLLER_WIDTH_KEY = "xmlportletcontroller.width";
62publicstaticfinal String XMLPORTLETCONTROLLER_STYLESHEET_KEY = "xmlportletcontroller.stylesheet";
63publicstaticfinal String PORTLETMARKUP_ALL_KEY = "portletmarkup.all";
64publicstaticfinal String CONTENTFEEDS_STYLESHEET_URL_KEY = "contentfeeds.stylesheet.url";
65publicstaticfinal String CONTENTFEEDS_FETCHALL_KEY = "contentfeeds.fetchall";
66publicstaticfinal String CONTENTFEEDS_PORTLETBROWSER_PREVIEW_MAXPORTLETS_KEY = "contentfeeds.portletbrowser.preview.maxportlets";
67publicstaticfinal String CONTENTFEEDS_PORTLETBROWSER_OVERVIEW_MAXPORTLETS_KEY = "contentfeeds.portletbrowser.overview.maxportlets";
68publicstaticfinal String CONFIGURATION_DIRECTORY_KEY = "configuration.directory";
69publicstaticfinal String CONTENT_ROOT_URL_KEY = "content.root.url";
70publicstaticfinal String TEMP_DIRECTORY_KEY = "temp.directory";
71publicstaticfinal String ADMIN_PORTLET_NAME_KEY = "admin.portlet.name";
72publicstaticfinal String ADMIN_USERNAME_KEY = "admin.username";
73publicstaticfinal String ADMIN_PASSWORD_KEY = "admin.password";
74publicstaticfinal String DAEMON_ENTRY = "daemon.entry";
75publicstaticfinal String PSML_REGISTRY_URL_KEY = "psml.registry.url";
76publicstaticfinal String NAVIGATIONS_TOP_KEY = "navigations.top";
77publicstaticfinal String NAVIGATIONS_BOTTOM_KEY = "navigations.bottom";
78publicstaticfinal String AUTOCREATE_PORTLETS_KEY = "autocreate.portlets";
79publicstaticfinal String CONTENT_PROVIDER_LIST_KEY = "content.provider.list";
80publicstaticfinal String DEFAULT_TITLE_KEY = "metadata.default.title";
81publicstaticfinal String DEFAULT_DESCRIPTION_KEY = "metadata.default.description";
82publicstaticfinal String DEFAULT_IMAGE_KEY = "metadata.default.image";
83publicstaticfinal String JETSPEED_CONFIG_KEY = "jetspeed.config";
8485publicstaticfinal String CONTENT_ENCODING_KEY = "content.defaultencoding";
8687publicstaticfinal String CUSTOMIZATION_RESOURCE_KEY = "customization.psml";
88publicstaticfinal String CUSTOMIZATION_MAX_NUMBER = "customization.display.maxNumberOfPortlets";
8990// glucode customizer91publicstaticfinal String HTML_HEX_COLOR_KEY = "html.hex.color.";
92publicstaticfinal String HTML_COLOR_NAME_KEY = "html.color.name.";
93publicstaticfinal String MANDATORY_PORTLET = "portlet.mandatory";
9495publicstaticfinal String CHANGE_PASSWORD_TEMPLATE = "template.change.password";
9697// Images for the portal9899publicstaticfinal String MAX_IMAGE = getString( CONTENT_ROOT_URL_KEY, "" ) + "images/max.gif";
100publicstaticfinal String INFO_IMAGE = getString( CONTENT_ROOT_URL_KEY, "" ) + "images/info.gif";
101publicstaticfinal String EDIT_IMAGE = getString( CONTENT_ROOT_URL_KEY, "" ) + "images/edit.gif";
102publicstaticfinal String TRANSPARENT_IMAGE = getString( CONTENT_ROOT_URL_KEY, "" ) + "images/dot.gif";
103publicstaticfinal String RESTORE_IMAGE = getString( CONTENT_ROOT_URL_KEY, "" ) + "images/restore.gif";
104publicstaticfinal String SITE_HEADER_LOGO = getString( CONTENT_ROOT_URL_KEY, "" ) + getString( SITE_HEADER_LOGO_KEY, "images/jetspeed-logo.gif" );
105publicstaticfinal String SITE_FOOTER_LOGO = getString( CONTENT_ROOT_URL_KEY, "" ) + getString( SITE_FOOTER_LOGO_KEY, "images/feather.gif");
106publicstaticfinal String SITE_WELCOME = getString( SITE_HEADER_WELCOME_KEY, "Welcome to Jetspeed" );
107publicstaticfinal String SITE_STYLESHEET = getString( CONTENT_ROOT_URL_KEY, "" ) + getString( "site.stylesheet" );
108109// this is the value that is stored in the database for confirmed users110publicstaticfinal String CONFIRM_VALUE = "CONFIRMED";
111publicstaticfinal String CONFIRM_VALUE_PENDING = "PENDING";
112publicstaticfinal String CONFIRM_VALUE_REJECTED = "REJECTED";
113114// parameter names for the Jetspeed path framework elements 115publicstaticfinal String PATH_ACTION_KEY = "action";
116publicstaticfinal String PATH_PANEID_KEY = "js_pane";
117publicstaticfinal String PATH_PANENAME_KEY = "js_panename";
118publicstaticfinal String PATH_PORTLETID_KEY = "js_peid";
119publicstaticfinal String PATH_SCREEN_KEY = "screen";
120publicstaticfinal String PATH_TEMPLATE_KEY = "template";
121publicstaticfinal String PATH_PORTLET_KEY = "portlet";
122publicstaticfinal String PATH_SUBPANE_SEPARATOR = ",";
123124// product information125publicstaticfinal String JETSPEED_NAME_KEY = "jetspeed.name";
126publicstaticfinal String JETSPEED_VERSION_KEY = "jetspeed.version";
127128/***129 * Special portlet registry parameter used to override default portlet cache expiration value130 */131publicstaticfinal String TIME_TO_LIVE = "_TimeToLive";
132133/***134 * @depracated Use PATH_PANEID_KEY or PATH_PANENAME_KEY135 */136publicstaticfinal String PATH_PANEL_KEY = "select-panel";
137138/***139 * The purpose of this method is to get the configuration resource140 * with the given name as a boolean value.141 *142 * @param name The resource name.143 * @return The value of the named resource as a boolean.144 */145publicstaticboolean getBoolean(String name)
146 {
147try148 {
149return TurbineResources.getBoolean (name);
150 }
151catch (ClassCastException e)
152 {
153// get the possible list154 String[] values = getStringArray(name);
155156// try again with the first157if ((values != null) && (values.length > 0))
158returnnew Boolean(values[0]).booleanValue();
159160// otherwise, just throw the exception161throw e;
162 }
163 }
164165/***166 * The purppose of this method is to get the configuration167 * resource with the given name as a boolean value, or a default168 * value.169 *170 * @param name The resource name.171 * @param def The default value of the resource.172 * @return The value of the named resource as a boolean.173 */174publicstaticboolean getBoolean(String name,
175boolean def)
176 {
177try178 {
179return TurbineResources.getBoolean(name, def);
180 }
181catch (ClassCastException e)
182 {
183// get the possible list184 String[] values = getStringArray(name);
185186// try again with the first187if ((values != null) && (values.length > 0))
188returnnew Boolean(values[0]).booleanValue();
189190// otherwise, just throw the exception191throw e;
192 }
193 }
194195/***196 * The purpose of this method is to get the configuration resource197 * with the given name as a double.198 *199 * @param name The resoource name.200 * @return The value of the named resource as double.201 */202publicstaticdouble getDouble(String name)
203 {
204try205 {
206return TurbineResources.getDouble(name);
207 }
208catch (ClassCastException e)
209 {
210// get the possible list211 String[] values = getStringArray(name);
212213// try again with the first214if ((values != null) && (values.length > 0))
215return Double.parseDouble(values[0]);
216217// otherwise, just throw the exception218throw e;
219 }
220 }
221222/***223 * The purpose of this method is to get the configuration resource224 * with the given name as a double, or a default value.225 *226 * @param name The resource name.227 * @param def The default value of the resource.228 * @return The value of the named resource as a double.229 */230publicstaticdouble getDouble(String name,
231double def)
232 {
233try234 {
235return TurbineResources.getDouble(name, def);
236 }
237catch (ClassCastException e)
238 {
239// get the possible list240 String[] values = getStringArray(name);
241242// try again with the first243if ((values != null) && (values.length > 0))
244return Double.parseDouble(values[0]);
245246// otherwise, just throw the exception247throw e;
248 }
249 }
250251/***252 * The purpose of this method is to get the configuration resource253 * with the given name as a float.254 *255 * @param name The resource name.256 * @return The value of the resource as a float.257 */258publicstaticfloat getFloat(String name)
259 {
260try261 {
262return TurbineResources.getFloat(name);
263 }
264catch (ClassCastException e)
265 {
266// get the possible list267 String[] values = getStringArray(name);
268269// try again with the first270if ((values != null) && (values.length > 0))
271return Float.parseFloat(values[0]);
272273// otherwise, just throw the exception274throw e;
275 }
276 }
277278/***279 * The purpose of this method is to get the configuration resource280 * with the given name as a float, or a default value.281 *282 * @param name The resource name.283 * @param def The default value of the resource.284 * @return The value of the resource as a float.285 */286publicstaticfloat getFloat(String name,
287float def)
288 {
289try290 {
291return TurbineResources.getFloat(name, def);
292 }
293catch (ClassCastException e)
294 {
295// get the possible list296 String[] values = getStringArray(name);
297298// try again with the first299if ((values != null) && (values.length > 0))
300return Float.parseFloat(values[0]);
301302// otherwise, just throw the exception303throw e;
304 }
305 }
306307/***308 * The purpose of this method is to get the configuration resource309 * with the given name as an integer.310 *311 * @param name The resource name.312 * @return The value of the resource as an integer.313 */314publicstaticint getInt(String name)
315 {
316try317 {
318return TurbineResources.getInt(name);
319 }
320catch (ClassCastException e)
321 {
322// get the possible list323 String[] values = getStringArray(name);
324325// try again with the first326if ((values != null) && (values.length > 0))
327return Integer.parseInt(values[0]);
328329// otherwise, just throw the exception330throw e;
331 }
332 }
333334/***335 * The purpose of this method is to get the configuration resource336 * with the given name as an integer, or a default value.337 *338 * @param name The resource name.339 * @param def The default value of the resource.340 * @return The value of the resource as an integer.341 */342publicstaticint getInt(String name,
343int def)
344 {
345try346 {
347return TurbineResources.getInt(name, def);
348 }
349catch (ClassCastException e)
350 {
351// get the possible list352 String[] values = getStringArray(name);
353354// try again with the first355if ((values != null) && (values.length > 0))
356return Integer.parseInt(values[0]);
357358// otherwise, just throw the exception359throw e;
360 }
361 }
362363/***364 * The purpose of this method is to get the configuration resource365 * with the given name as a long.366 *367 * @param name The resource name.368 * @return The value of the resource as a long.369 */370publicstaticlong getLong(String name)
371 {
372try373 {
374return TurbineResources.getLong(name);
375 }
376catch (ClassCastException e)
377 {
378// get the possible list379 String[] values = getStringArray(name);
380381// try again with the first382if ((values != null) && (values.length > 0))
383return Long.parseLong(values[0]);
384385// otherwise, just throw the exception386throw e;
387 }
388 }
389390/***391 * The purpose of this method is to get the configuration resource392 * with the given name as a long, or a default value.393 *394 * @param name The resource name.395 * @param def The default value of the resource.396 * @return The value of the resource as a long.397 */398publicstaticlong getLong(String name,
399long def)
400 {
401try402 {
403return TurbineResources.getLong(name, def);
404 }
405catch (ClassCastException e)
406 {
407// get the possible list408 String[] values = getStringArray(name);
409410// try again with the first411if ((values != null) && (values.length > 0))
412return Long.parseLong(values[0]);
413414// otherwise, just throw the exception415throw e;
416 }
417 }
418419/***420 * The purpose of this method is to get the configuration resource421 * with the given name as a string.422 *423 * @param name The resource name.424 * @return The value of the resource as a string.425 */426publicstatic String getString(String name)
427 {
428// get the possible list429 String[] values = getStringArray(name);
430if ((values != null) && (values.length > 0))
431return values[0];
432433return TurbineResources.getString(name);
434 }
435436/***437 * The purpose of this method is to get the configuration resource438 * with the given name as a string, or a default value.439 *440 * @param name The resource name.441 * @param def The default value of the resource.442 * @return The value of the resource as a string.443 */444publicstatic String getString(String name,
445 String def)
446 {
447// get the possible list448 String[] values = getStringArray(name);
449if ((values != null) && (values.length > 0))
450return values[0];
451452return TurbineResources.getString(name, def);
453 }
454 }
455