Author: cziegeler
Date: Fri May 6 04:56:03 2005
New Revision: 168593
URL: http://svn.apache.org/viewcvs?rev=168593&view=rev
Log:
Separate Settings into static and dynamic ones
Added:
cocoon/trunk/src/java/org/apache/cocoon/core/BaseSettings.java (with
props)
cocoon/trunk/src/java/org/apache/cocoon/core/DynamicSettings.java (with
props)
Modified:
cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/CocoonPortlet.java
cocoon/trunk/src/java/org/apache/cocoon/core/Settings.java
Modified:
cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/CocoonPortlet.java
URL:
http://svn.apache.org/viewcvs/cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/CocoonPortlet.java?rev=168593&r1=168592&r2=168593&view=diff
==============================================================================
---
cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/CocoonPortlet.java
(original)
+++
cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/CocoonPortlet.java
Fri May 6 04:56:03 2005
@@ -42,7 +42,6 @@
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
-import javax.servlet.ServletException;
import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.logger.Logger;
Added: cocoon/trunk/src/java/org/apache/cocoon/core/BaseSettings.java
URL:
http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/BaseSettings.java?rev=168593&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/BaseSettings.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/BaseSettings.java Fri May 6
04:56:03 2005
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.core;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * This object holds the global configuration of Cocoon that can't be changed
+ * during runtime.
+ *
+ * @version SVN $Id$
+ */
+public interface BaseSettings {
+
+ /** Name of the property specifying a user properties file */
+ String PROPERTY_USER_SETTINGS = "org.apache.cocoon.settings";
+
+ /**
+ * This parameter allows to set system properties
+ */
+ /** FIXME - implement the support for this key: */
+ String KEY_FORCE_PROPERTIES = "system.properties";
+
+ /**
+ * This parameter points to the main configuration file for Cocoon.
+ * Note that the path is specified in absolute notation but it will be
+ * resolved relative to the application context path.
+ */
+ String KEY_CONFIGURATION = "configuration";
+
+ /**
+ * This parameter indicates the configuration file of the LogKit management
+ */
+ String KEY_LOGGING_CONFIGURATION = "logging.configuration";
+
+ /**
+ * This parameter indicates the log level to use throughout startup of the
+ * system. As soon as the logkit.xconf the setting of the logkit.xconf
+ * configuration is used instead! Only for startup and if the logkit.xconf
is
+ * not readable/available this log level is of importance.
+ */
+ String KEY_LOGGING_BOOTSTRAP_LOGLEVEL = "logging.bootstrap.loglevel";
+
+ /**
+ * This parameter switches the logging system from LogKit to Log4J for
Cocoon.
+ * Log4J has to be configured already.
+ */
+ String KEY_LOGGING_MANAGER_CLASS = "logging.manager.class";
+
+ /**
+ * If you want to configure log4j using Cocoon, then you can define
+ * an XML configuration file here. You can use the usual log4j property
+ * substituation mechanism, e.g. ${context-root} is replaced by the
+ * context root of this web application etc.
+ * You can configure the log4j configuration even if you use LogKit
+ * for Cocoon logging. You can use this to configure third party code
+ * for example.
+ */
+ String KEY_LOGGING_LOG4J_CONFIGURATION = "logging.log4j.configuration";
+
+ /**
+ * This parameter is used to list classes that should be loaded at
+ * initialization time of the servlet. For example, JDBC Drivers used need
to
+ * be named here. Additional entries may be inserted here during build
+ * depending on your build properties.
+ */
+ /** FIXME: Implement support for this: */
+ String KEY_LOAD_CLASSES = "classloader.load.classes";
+
+ /**
+ * This parameter allows to specify additional directories or jars
+ * which Cocoon should put into it's own classpath.
+ * Note that absolute pathes are taken as such but relative pathes
+ * are rooted at the context root of the Cocoon servlet.
+ */
+ /** FIXME: Implement support for this: */
+ String KEY_EXTRA_CLASSPATHS = "extra.classpaths";
+
+ /**
+ * This parameter allows you to select the parent service manager.
+ * The class will be instantiated via the constructor that takes a single
+ * String as a parameter. That String will be equal to the text after the
'/'.
+ *
+ * Cocoon honors the LogEnabled, Initializable and Disposable interfaces
for
+ * this class, if it implements them.
+ */
+ String KEY_PARENT_SERVICE_MANAGER = "parentservicemanager";
+
+ /**
+ * @return Returns the configuration.
+ */
+ String getConfiguration();
+
+ /**
+ * @return Returns the extraClasspaths.
+ */
+ List getExtraClasspaths();
+
+ /**
+ * @return Returns the forceProperties.
+ */
+ Map getForceProperties();
+
+ /**
+ * @return Returns the loadClasses.
+ */
+ Iterator getLoadClasses();
+
+ /**
+ * @return Returns the loggerClassName.
+ */
+ String getLoggerClassName();
+
+ /**
+ * @return Returns the loggingConfiguration.
+ */
+ String getLoggingConfiguration();
+
+ /**
+ * @return Returns the logLevel.
+ */
+ String getBootstrapLogLevel();
+
+ /**
+ * @return Returns the parentServiceManagerClassName.
+ */
+ String getParentServiceManagerClassName();
+
+ /**
+ * @return Returns the log4jConfiguration.
+ */
+ String getLog4jConfiguration();
+
+}
Propchange: cocoon/trunk/src/java/org/apache/cocoon/core/BaseSettings.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/src/java/org/apache/cocoon/core/BaseSettings.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: cocoon/trunk/src/java/org/apache/cocoon/core/DynamicSettings.java
URL:
http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/DynamicSettings.java?rev=168593&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/DynamicSettings.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/DynamicSettings.java Fri May
6 04:56:03 2005
@@ -0,0 +1,261 @@
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.core;
+
+
+/**
+ * This object holds the global configuration of Cocoon. The different
settings can
+ * be changed during runtime.
+ *
+ * @version SVN $Id$
+ */
+public interface DynamicSettings {
+
+ /**
+ * Default value for [EMAIL PROTECTED] #isAllowReload()} parameter (false)
+ */
+ boolean ALLOW_RELOAD = false;
+
+ /**
+ * Default value for [EMAIL PROTECTED] #isEnableUploads()} parameter
(false)
+ */
+ boolean ENABLE_UPLOADS = false;
+ boolean SAVE_UPLOADS_TO_DISK = true;
+ int MAX_UPLOAD_SIZE = 10000000; // 10Mb
+
+ /**
+ * Default value for [EMAIL PROTECTED] #isInitClassloader()} setting
(false)
+ */
+ boolean INIT_CLASSLOADER = false;
+
+ boolean SHOW_TIME = false;
+ boolean HIDE_SHOW_TIME = false;
+ boolean MANAGE_EXCEPTIONS = true;
+
+ /**
+ * This parameter tells Cocoon to set the thread's context classloader to
+ * its own classloader. If you experience strange classloader issues,
+ * try setting this parameter to "true".
+ */
+ String KEY_INIT_CLASSLOADER = "classloader.init";
+
+ /**
+ * This parameter indicates the category id of the logger from the LogKit
+ * configuration used by the environment.
+ */
+ String KEY_LOGGING_ACCESS_LOGGER = "logging.logger.access.category";
+
+ /**
+ * This parameter indicates the category id of the logger from the LogKit
+ * management configuration for the Cocoon engine.
+ * This logger is used for all components described in the cocoon.xconf
+ * and sitemap.xmap file not having specified a logger with the
+ * logger="..." attribute in the component configuration file.
+ */
+ String KEY_LOGGING_COCOON_LOGGER = "logging.logger.cocoon.category";
+
+ /**
+ * Allow reinstantiating (reloading) of the cocoon instance. If this is
+ * set to "yes" or "true", a new cocoon instance can be created using
+ * the request parameter "cocoon-reload". It also enables that Cocoon is
+ * reloaded when cocoon.xconf changes. Default is no for security reasons.
+ */
+ String KEY_ALLOW_RELOAD = "allow.reload";
+
+ /**
+ * Causes all files in multipart requests to be processed.
+ * Default is false for security reasons.
+ */
+ String KEY_UPLOADS_ENABLE = "uploads.enable";
+
+ /**
+ * This parameter allows to specify where Cocoon should put uploaded files.
+ * The path specified can be either absolute or relative to the context
+ * path of the servlet. On windows platform, absolute directory must start
+ * with volume: C:\Path\To\Upload\Directory.
+ */
+ String KEY_UPLOADS_DIRECTORY = "uploads.directory";
+
+ /**
+ * Causes all files in multipart requests to be saved to upload-dir.
+ * Default is true for security reasons.
+ */
+ String KEY_UPLOADS_AUTOSAVE = "uploads.autosave";
+
+ /**
+ * Specify handling of name conflicts when saving uploaded files to disk.
+ * Acceptable values are deny, allow, rename (default). Files are renamed
+ * x_filename where x is an integer value incremented to make the new
+ * filename unique.
+ */
+ String KEY_UPLOADS_OVERWRITE = "uploads.overwrite";
+
+ /**
+ * Specify maximum allowed size of the upload. Defaults to 10 Mb.
+ */
+ String KEY_UPLOADS_MAXSIZE = "uploads.maxsize";
+
+ /**
+ * This parameter allows to specify where Cocoon should create its page
+ * and other objects cache. The path specified can be either absolute or
+ * relative to the context path of the servlet. On windows platform,
+ * absolute directory must start with volume: C:\Path\To\Cache\Directory.
+ */
+ String KEY_CACHE_DIRECTORY = "cache.directory";
+
+ /**
+ * This parameter allows to specify where Cocoon should put it's
+ * working files. The path specified is either absolute or relative
+ * to the context path of the Cocoon servlet. On windows platform,
+ * absolute directory must start with volume: C:\Path\To\Work\Directory.
+ */
+ String KEY_WORK_DIRECTORY = "work.directory";
+
+ /**
+ * Allow adding processing time to the response
+ */
+ String KEY_SHOWTIME = "showtime";
+
+ /**
+ * If true, processing time will be added as an HTML comment
+ */
+ String KEY_HIDE_SHOWTIME = "hideshowtime";
+
+ /**
+ * If true or not set, this class will try to catch and handle all Cocoon
exceptions.
+ * If false, it will rethrow them to the servlet container.
+ */
+ String KEY_MANAGE_EXCEPTIONS = "manageexceptions";
+
+ /**
+ * Set form encoding. This will be the character set used to decode request
+ * parameters. If not set the ISO-8859-1 encoding will be assumed.
+ */
+ String KEY_FORM_ENCODING = "formencoding";
+
+ /**
+ * If this value is specified, it will be interpreted as a log level and
+ * all logging categories will be set to this level regardless of their
+ * definition in the logging configuration.
+ */
+ String KEY_LOGGING_OVERRIDE_LOGLEVEL = "override.loglevel";
+
+ /**
+ * Delay between reload checks for the configuration
+ */
+ String KEY_CONFIGURATION_RELOAD_DELAY = "configuration.reloaddelay";
+
+ /**
+ * Lazy mode for component loading
+ */
+ String KEY_LAZY_MODE = "core.LazyMode";
+
+ /**
+ * @return Returns the hideShowTime.
+ */
+ boolean isHideShowTime();
+
+ /**
+ * @return Returns the allowReload.
+ */
+ boolean isAllowReload();
+
+ /**
+ * @return Returns the autosaveUploads.
+ */
+ boolean isAutosaveUploads();
+
+ /**
+ * @return Returns the cacheDirectory.
+ */
+ String getCacheDirectory();
+
+ /**
+ * @return Returns the cocoonLogger.
+ */
+ String getCocoonLogger();
+
+ /**
+ * @return Returns the enableUploads.
+ */
+ boolean isEnableUploads();
+
+ /**
+ * @return Returns the formEncoding.
+ */
+ String getFormEncoding();
+
+ /**
+ * @return Returns the initClassloader.
+ */
+ boolean isInitClassloader();
+
+ /**
+ * @return Returns the logLevel.
+ */
+ String getBootstrapLogLevel();
+
+ /**
+ * @return Returns the manageExceptions.
+ */
+ boolean isManageExceptions();
+
+ /**
+ * @return Returns the maxUploadSize.
+ */
+ int getMaxUploadSize();
+
+ /**
+ * @return Returns the overwriteUploads.
+ */
+ String getOverwriteUploads();
+
+ /**
+ * @return Returns the showTime.
+ */
+ boolean isShowTime();
+
+ /**
+ * @return Returns the uploadDirectory.
+ */
+ String getUploadDirectory();
+
+ /**
+ * @return Returns the workDirectory.
+ */
+ String getWorkDirectory();
+
+ /**
+ * @return Returns the accessLogger.
+ */
+ String getAccessLogger();
+
+ /**
+ * @return Returns the overrideLogLevel.
+ */
+ String getOverrideLogLevel();
+
+ /**
+ * @return Returns the configurationReloadDelay.
+ */
+ long getConfigurationReloadDelay();
+
+ /**
+ * @return Returns the lazyMode.
+ */
+ boolean isLazyMode();
+
+}
Propchange: cocoon/trunk/src/java/org/apache/cocoon/core/DynamicSettings.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/src/java/org/apache/cocoon/core/DynamicSettings.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: cocoon/trunk/src/java/org/apache/cocoon/core/Settings.java
URL:
http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/Settings.java?rev=168593&r1=168592&r2=168593&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/Settings.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/Settings.java Fri May 6
04:56:03 2005
@@ -30,37 +30,13 @@
*
* @version SVN $Id$
*/
-public class Settings {
+public class Settings implements BaseSettings, DynamicSettings{
protected boolean readOnly = false;
/** Prefix for properties */
protected static final String KEYPREFIX = "org.apache.cocoon.";
- /** Name of the property specifying a user properties file */
- public static final String PROPERTY_USER_SETTINGS =
"org.apache.cocoon.settings";
-
- /**
- * Default value for [EMAIL PROTECTED] #isAllowReload()} parameter (false)
- */
- public static final boolean ALLOW_RELOAD = false;
-
- /**
- * Default value for [EMAIL PROTECTED] #isEnableUploads()} parameter
(false)
- */
- public static final boolean ENABLE_UPLOADS = false;
- public static final boolean SAVE_UPLOADS_TO_DISK = true;
- public static final int MAX_UPLOAD_SIZE = 10000000; // 10Mb
-
- /**
- * Default value for [EMAIL PROTECTED] #isInitClassloader()} setting
(false)
- */
- public static final boolean INIT_CLASSLOADER = false;
-
- public static final boolean SHOW_TIME = false;
- public static final boolean HIDE_SHOW_TIME = false;
- public static final boolean MANAGE_EXCEPTIONS = true;
-
/**
* The list of properties used to configure Cocoon
*/
@@ -72,14 +48,11 @@
* try setting this parameter to "true".
*/
protected boolean initClassloader = INIT_CLASSLOADER;
- public static final String KEY_INIT_CLASSLOADER = "classloader.init";
/**
* This parameter allows to set system properties
*/
protected Map forceProperties = new HashMap();
- /** FIXME - implement the support for this key: */
- public static final String KEY_FORCE_PROPERTIES = "system.properties";
/**
* This parameter points to the main configuration file for Cocoon.
@@ -87,20 +60,17 @@
* resolved relative to the application context path.
*/
protected String configuration;
- public static final String KEY_CONFIGURATION = "configuration";
/**
* This parameter indicates the configuration file of the LogKit management
*/
protected String loggingConfiguration;
- public static final String KEY_LOGGING_CONFIGURATION =
"logging.configuration";
/**
* This parameter indicates the category id of the logger from the LogKit
* configuration used by the environment.
*/
protected String accessLogger;
- public static final String KEY_LOGGING_ACCESS_LOGGER =
"logging.logger.access.category";
/**
* This parameter indicates the category id of the logger from the LogKit
@@ -110,7 +80,6 @@
* logger="..." attribute in the component configuration file.
*/
protected String cocoonLogger;
- public static final String KEY_LOGGING_COCOON_LOGGER =
"logging.logger.cocoon.category";
/**
* This parameter indicates the log level to use throughout startup of the
@@ -119,14 +88,12 @@
* not readable/available this log level is of importance.
*/
protected String bootstrapLogLevel;
- public static final String KEY_LOGGING_BOOTSTRAP_LOGLEVEL =
"logging.bootstrap.loglevel";
/**
* This parameter switches the logging system from LogKit to Log4J for
Cocoon.
* Log4J has to be configured already.
*/
protected String loggerClassName;
- public static final String KEY_LOGGING_MANAGER_CLASS =
"logging.manager.class";
/**
* If you want to configure log4j using Cocoon, then you can define
@@ -138,7 +105,6 @@
* for example.
*/
protected String log4jConfiguration;
- public static final String KEY_LOGGING_LOG4J_CONFIGURATION =
"logging.log4j.configuration";
/**
* Allow reinstantiating (reloading) of the cocoon instance. If this is
@@ -147,7 +113,6 @@
* reloaded when cocoon.xconf changes. Default is no for security reasons.
*/
protected boolean allowReload = ALLOW_RELOAD;
- public static final String KEY_ALLOW_RELOAD = "allow.reload";
/**
* This parameter is used to list classes that should be loaded at
@@ -156,15 +121,12 @@
* depending on your build properties.
*/
protected List loadClasses = new ArrayList();
- /** FIXME: Implement support for this: */
- public static final String KEY_LOAD_CLASSES = "classloader.load.classes";
/**
* Causes all files in multipart requests to be processed.
* Default is false for security reasons.
*/
protected boolean enableUploads = ENABLE_UPLOADS;
- public static final String KEY_UPLOADS_ENABLE = "uploads.enable";
/**
* This parameter allows to specify where Cocoon should put uploaded files.
@@ -173,14 +135,12 @@
* with volume: C:\Path\To\Upload\Directory.
*/
protected String uploadDirectory;
- public static final String KEY_UPLOADS_DIRECTORY = "uploads.directory";
/**
* Causes all files in multipart requests to be saved to upload-dir.
* Default is true for security reasons.
*/
protected boolean autosaveUploads = SAVE_UPLOADS_TO_DISK;
- public static final String KEY_UPLOADS_AUTOSAVE = "uploads.autosave";
/**
* Specify handling of name conflicts when saving uploaded files to disk.
@@ -189,13 +149,11 @@
* filename unique.
*/
protected String overwriteUploads;
- public static final String KEY_UPLOADS_OVERWRITE = "uploads.overwrite";
/**
* Specify maximum allowed size of the upload. Defaults to 10 Mb.
*/
protected int maxUploadSize = MAX_UPLOAD_SIZE;
- public static final String KEY_UPLOADS_MAXSIZE = "uploads.maxsize";
/**
* This parameter allows to specify where Cocoon should create its page
@@ -204,7 +162,6 @@
* absolute directory must start with volume: C:\Path\To\Cache\Directory.
*/
protected String cacheDirectory;
- public static final String KEY_CACHE_DIRECTORY = "cache.directory";
/**
* This parameter allows to specify where Cocoon should put it's
@@ -213,7 +170,6 @@
* absolute directory must start with volume: C:\Path\To\Work\Directory.
*/
protected String workDirectory;
- public static final String KEY_WORK_DIRECTORY = "work.directory";
/**
* This parameter allows to specify additional directories or jars
@@ -222,8 +178,6 @@
* are rooted at the context root of the Cocoon servlet.
*/
protected List extraClasspaths = new ArrayList();
- /** FIXME: Implement support for this: */
- public static final String KEY_EXTRA_CLASSPATHS = "extra.classpaths";
/**
* This parameter allows you to select the parent service manager.
@@ -234,33 +188,28 @@
* this class, if it implements them.
*/
protected String parentServiceManagerClassName;
- public static final String KEY_PARENT_SERVICE_MANAGER =
"parentservicemanager";
/**
* Allow adding processing time to the response
*/
protected boolean showTime = SHOW_TIME;
- public static final String KEY_SHOWTIME = "showtime";
/**
* If true, processing time will be added as an HTML comment
*/
protected boolean hideShowTime = HIDE_SHOW_TIME;
- public static final String KEY_HIDE_SHOWTIME = "hideshowtime";
/**
* If true or not set, this class will try to catch and handle all Cocoon
exceptions.
* If false, it will rethrow them to the servlet container.
*/
protected boolean manageExceptions = MANAGE_EXCEPTIONS;
- public static final String KEY_MANAGE_EXCEPTIONS = "manageexceptions";
/**
* Set form encoding. This will be the character set used to decode request
* parameters. If not set the ISO-8859-1 encoding will be assumed.
*/
protected String formEncoding;
- public static final String KEY_FORM_ENCODING = "formencoding";
/**
* If this value is specified, it will be interpreted as a log level and
@@ -268,19 +217,16 @@
* definition in the logging configuration.
*/
protected String overrideLogLevel;
- public static final String KEY_LOGGING_OVERRIDE_LOGLEVEL =
"override.loglevel";
/**
* Delay between reload checks for the configuration
*/
protected long configurationReloadDelay = 1000;
- public static final String KEY_CONFIGURATION_RELOAD_DELAY =
"configuration.reloaddelay";
/**
* Lazy mode for component loading
*/
protected boolean lazyMode = false;
- public static final String KEY_LAZY_MODE = "core.LazyMode";
/**
* Create a new settings object