cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r177968 - in /cocoon: blocks/unsupported/ojb/trunk/java/org/apache/cocoon/ojb/components/ trunk/src/java/org/apache/cocoon/core/ trunk/src/java/org/apache/cocoon/generation/ trunk/src/test/org/apache/cocoon/core/container/
Date Mon, 23 May 2005 12:57:16 GMT
Author: cziegeler
Date: Mon May 23 05:57:15 2005
New Revision: 177968

URL: http://svn.apache.org/viewcvs?rev=177968&view=rev
Log:
Start with a minimal set of dynamic settings
Quick fix for NPE in OJB

Modified:
    cocoon/blocks/unsupported/ojb/trunk/java/org/apache/cocoon/ojb/components/LoggerImpl.java
    cocoon/trunk/src/java/org/apache/cocoon/core/BaseSettings.java
    cocoon/trunk/src/java/org/apache/cocoon/core/Core.java
    cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java
    cocoon/trunk/src/java/org/apache/cocoon/core/DynamicSettings.java
    cocoon/trunk/src/java/org/apache/cocoon/core/MutableSettings.java
    cocoon/trunk/src/java/org/apache/cocoon/core/Settings.java
    cocoon/trunk/src/java/org/apache/cocoon/generation/StatusGenerator.java
    cocoon/trunk/src/test/org/apache/cocoon/core/container/ContainerTestCase.java

Modified: cocoon/blocks/unsupported/ojb/trunk/java/org/apache/cocoon/ojb/components/LoggerImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/ojb/trunk/java/org/apache/cocoon/ojb/components/LoggerImpl.java?rev=177968&r1=177967&r2=177968&view=diff
==============================================================================
--- cocoon/blocks/unsupported/ojb/trunk/java/org/apache/cocoon/ojb/components/LoggerImpl.java (original)
+++ cocoon/blocks/unsupported/ojb/trunk/java/org/apache/cocoon/ojb/components/LoggerImpl.java Mon May 23 05:57:15 2005
@@ -18,8 +18,10 @@
 import org.apache.avalon.framework.activity.Initializable;
 import org.apache.avalon.framework.component.Component;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.NullLogger;
 import org.apache.avalon.framework.thread.ThreadSafe;
 
+import org.apache.log.Hierarchy;
 import org.apache.ojb.broker.util.configuration.Configuration;
 import org.apache.ojb.broker.util.configuration.ConfigurationException;
 import org.apache.ojb.broker.util.logging.Logger;
@@ -37,8 +39,9 @@
 
     /**
      * Root logger for all OJB loggers
+     * FIXME - we just initialize it with a NullLogger to prevent later NPEs
      */
-    private static org.apache.avalon.framework.logger.Logger LOGGER;
+    private static org.apache.avalon.framework.logger.Logger LOGGER = new NullLogger();
 
     private final String name;
     private transient int level;

Modified: 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=177968&r1=177967&r2=177968&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/BaseSettings.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/BaseSettings.java Mon May 23 05:57:15 2005
@@ -20,13 +20,24 @@
 import java.util.Map;
 
 /**
- * This object holds the global configuration of Cocoon that can't be changed
- * during runtime.
+ * The settings (configuration) for the Cocoon core are described through the {@link BaseSettings}
+ * interface and the {@link DynamicSettings} interface.
+ * Whereas the settings of the {@link BaseSettings} object can't be changed at runtime,
+ * the settings of the {@link DynamicSettings} object are mutable. Use the {@link Core} instance
+ * to update the settings.
  *
  * @version SVN $Id$
  */
 public interface BaseSettings {
 
+    /** Default value for {@link #isManageExceptions()}. */
+    boolean MANAGE_EXCEPTIONS = true;
+
+    /**
+     * Default value for {@link #isInitClassloader()} setting (false)
+     */
+    boolean INIT_CLASSLOADER = false;
+
     /** Name of the property specifying a user properties file */
     String PROPERTY_USER_SETTINGS = "org.apache.cocoon.settings";
 
@@ -99,6 +110,71 @@
     String KEY_PARENT_SERVICE_MANAGER = "parentservicemanager";
 
     /**
+     * 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_ENVIRONMENT_LOGGER = "logging.category.environment";
+
+    /**
+     * 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.category.cocoon";
+
+    /**
+     * 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";
+
+    /**
+     * 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";
+
+    /**
+     * 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";
+
+    /**
      * @return Returns the configuration.
      * @see #KEY_CONFIGURATION
      */
@@ -151,5 +227,59 @@
      * @see #KEY_LOGGING_LOG4J_CONFIGURATION
      */
     String getLog4jConfiguration();
+
+    /**
+     * @return Returns the uploadDirectory.
+     * @see #KEY_UPLOADS_DIRECTORY
+     */
+    String getUploadDirectory();
+
+    /**
+     * @return Returns the workDirectory.
+     * @see #KEY_WORK_DIRECTORY
+     */
+    String getWorkDirectory();
+
+    /**
+     * @return Returns the logger for the environment.
+     * @see #KEY_LOGGING_ENVIRONMENT_LOGGER
+     */
+    String getEnvironmentLogger();
+
+    /**
+     * @return Returns the overrideLogLevel.
+     * @see #KEY_LOGGING_OVERRIDE_LOGLEVEL
+     */
+    String getOverrideLogLevel();
+
+    /**
+     * @return Returns the formEncoding.
+     * @see #KEY_FORM_ENCODING
+     */
+    String getFormEncoding();
+
+    /**
+     * @return Returns the initClassloader.
+     * @see #KEY_INIT_CLASSLOADER
+     */
+    boolean isInitClassloader();
+
+    /**
+     * @return Returns the manageExceptions.
+     * @see #KEY_MANAGE_EXCEPTIONS
+     */
+    boolean isManageExceptions();
+
+    /**
+     * @return Returns the cacheDirectory.
+     * @see #KEY_CACHE_DIRECTORY
+     */
+    String getCacheDirectory();
+
+    /**
+     * @return Returns the cocoonLogger.
+     * @see #KEY_LOGGING_COCOON_LOGGER
+     */
+    String getCocoonLogger();
 
 }

Modified: cocoon/trunk/src/java/org/apache/cocoon/core/Core.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/Core.java?rev=177968&r1=177967&r2=177968&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/Core.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/Core.java Mon May 23 05:57:15 2005
@@ -31,6 +31,7 @@
 import org.apache.cocoon.core.container.ComponentLocatorWrapper;
 import org.apache.cocoon.environment.internal.EnvironmentHelper;
 import org.apache.cocoon.sitemap.ComponentLocator;
+import org.apache.commons.lang.NotImplementedException;
 
 /**
  * This is the core Cocoon component.
@@ -118,6 +119,14 @@
      */
     public Settings getSettings() {
         return this.settings;
+    }
+
+    /**
+     * Update the dynamic settings at runtime.
+     * @param dynSettings
+     */
+    public void update(DynamicSettings dynSettings) {
+        throw new NotImplementedException("The update method is not implemented yet.");
     }
 
     /**

Modified: cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java?rev=177968&r1=177967&r2=177968&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java Mon May 23 05:57:15 2005
@@ -666,7 +666,7 @@
 
             this.cocoon = c;
         } catch (Exception e) {
-            this.log.error("Exception reloading", e);
+            this.log.error("Exception reloading Cocoon.", e);
             this.disposeCocoon();
             throw e;
         }

Modified: 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=177968&r1=177967&r2=177968&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/DynamicSettings.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/DynamicSettings.java Mon May 23 05:57:15 2005
@@ -17,8 +17,11 @@
 
 
 /**
- * This object holds the global configuration of Cocoon. The different settings can
- * be changed during runtime.
+ * The settings (configuration) for the Cocoon core are described through the {@link BaseSettings}
+ * interface and the {@link DynamicSettings} interface.
+ * Whereas the settings of the {@link BaseSettings} object can't be changed at runtime,
+ * the settings of the {@link DynamicSettings} object are mutable. Use the {@link Core} instance
+ * to update the settings.
  *
  * @version SVN $Id$
  */
@@ -36,36 +39,8 @@
     boolean SAVE_UPLOADS_TO_DISK = true;
     int MAX_UPLOAD_SIZE = 10000000; // 10Mb
 
-    /**
-     * Default value for {@link #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_ENVIRONMENT_LOGGER = "logging.category.environment";
-
-    /**
-     * 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.category.cocoon";
 
     /**
      * Allow reinstantiating (reloading) of the cocoon instance. If this is
@@ -82,14 +57,6 @@
     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.
      */
@@ -109,22 +76,6 @@
     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";
@@ -135,25 +86,6 @@
     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";
@@ -182,42 +114,12 @@
     boolean isAutosaveUploads();
 
     /**
-     * @return Returns the cacheDirectory.
-     * @see #KEY_CACHE_DIRECTORY
-     */
-    String getCacheDirectory();
-
-    /**
-     * @return Returns the cocoonLogger.
-     * @see #KEY_LOGGING_COCOON_LOGGER
-     */
-    String getCocoonLogger();
-
-    /**
      * @return Returns the enableUploads.
      * @see #KEY_UPLOADS_ENABLE
      */
     boolean isEnableUploads();
 
     /**
-     * @return Returns the formEncoding.
-     * @see #KEY_FORM_ENCODING
-     */
-    String getFormEncoding();
-
-    /**
-     * @return Returns the initClassloader.
-     * @see #KEY_INIT_CLASSLOADER
-     */
-    boolean isInitClassloader();
-
-    /**
-     * @return Returns the manageExceptions.
-     * @see #KEY_MANAGE_EXCEPTIONS
-     */
-    boolean isManageExceptions();
-
-    /**
      * @return Returns the maxUploadSize.
      * @see #KEY_UPLOADS_MAXSIZE
      */
@@ -236,30 +138,6 @@
     boolean isShowTime();
 
     /**
-     * @return Returns the uploadDirectory.
-     * @see #KEY_UPLOADS_DIRECTORY
-     */
-    String getUploadDirectory();
-
-    /**
-     * @return Returns the workDirectory.
-     * @see #KEY_WORK_DIRECTORY
-     */
-    String getWorkDirectory();
-
-    /**
-     * @return Returns the logger for the environment.
-     * @see #KEY_LOGGING_ENVIRONMENT_LOGGER
-     */
-    String getEnvironmentLogger();
-
-    /**
-     * @return Returns the overrideLogLevel.
-     * @see #KEY_LOGGING_OVERRIDE_LOGLEVEL
-     */
-    String getOverrideLogLevel();
-
-    /**
      * @return Returns the configurationReloadDelay.
      * @see #KEY_CONFIGURATION_RELOAD_DELAY
      */
@@ -270,5 +148,9 @@
      * @see #KEY_LAZY_MODE
      */
     boolean isLazyMode();
+
+    boolean isAllowOverwrite();
+
+    boolean isSilentlyRename();
 
 }

Modified: cocoon/trunk/src/java/org/apache/cocoon/core/MutableSettings.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/MutableSettings.java?rev=177968&r1=177967&r2=177968&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/MutableSettings.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/MutableSettings.java Mon May 23 05:57:15 2005
@@ -15,7 +15,10 @@
  */
 package org.apache.cocoon.core;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
@@ -27,11 +30,205 @@
  *
  * @version SVN $Id$
  */
-public class MutableSettings extends Settings {
+public class MutableSettings implements Settings {
 
     /** Are we still mutable? */
     protected boolean readOnly = false;
 
+    /** Prefix for properties */
+    protected static final String KEYPREFIX = "org.apache.cocoon.";
+
+    /**
+     * The list of properties used to configure Cocoon
+     */
+    protected List properties = new ArrayList();
+
+    /**
+     * 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".
+     */
+    protected boolean initClassloader = INIT_CLASSLOADER;
+
+    /**
+     * This parameter allows to set system properties
+     */
+    protected Map forceProperties = new HashMap();
+
+    /**
+     * 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.
+     */
+    protected String configuration;
+
+    /**
+     * This parameter indicates the configuration file of the LogKit management
+     */
+    protected String loggingConfiguration;
+
+    /**
+     * This parameter indicates the category id of the logger from the LogKit
+     * configuration used by the environment.
+     */
+    protected String environmentLogger;
+
+    /**
+     * 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.
+     */
+    protected String cocoonLogger;
+
+    /**
+     * 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.
+     */
+    protected String bootstrapLogLevel;
+
+    /**
+     * This parameter switches the logging system from LogKit to Log4J for Cocoon.
+     * Log4J has to be configured already.
+     */
+    protected String loggerManagerClassName;
+
+    /**
+     * 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.
+     */
+    protected String log4jConfiguration;
+
+    /**
+     * 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.
+     */
+    protected boolean allowReload = ALLOW_RELOAD;
+
+    /**
+     * 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.
+     */
+    protected List loadClasses = new ArrayList();
+
+    /**
+     * Causes all files in multipart requests to be processed.
+     * Default is false for security reasons.
+     */
+    protected boolean enableUploads = ENABLE_UPLOADS;
+
+    /**
+     * 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.
+     */
+    protected String uploadDirectory;
+
+    /**
+     * 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;
+
+    /**
+     * 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.
+     */
+    protected String overwriteUploads;
+
+    /**
+     * Specify maximum allowed size of the upload. Defaults to 10 Mb.
+     */
+    protected int maxUploadSize = MAX_UPLOAD_SIZE;
+
+    /**
+     * 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.
+     */
+    protected String cacheDirectory;
+
+    /**
+     * 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.
+     */
+    protected String workDirectory;
+
+    /**
+     * 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.
+     */
+    protected List extraClasspaths = new ArrayList();
+
+    /**
+     * 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.
+     */
+    protected String parentServiceManagerClassName;
+
+    /**
+     * Allow adding processing time to the response
+     */
+    protected boolean showTime = SHOW_TIME;
+
+    /**
+     * If true, processing time will be added as an HTML comment
+     */
+    protected boolean hideShowTime = HIDE_SHOW_TIME;
+
+    /**
+     * 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;
+
+    /**
+     * 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;
+
+    /**
+     * 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.
+     */
+    protected String overrideLogLevel;
+
+    /**
+     * Delay between reload checks for the configuration
+     */
+    protected long configurationReloadDelay = 1000;
+
+    /**
+     * Lazy mode for component loading
+     */
+    protected boolean lazyMode = false;
+
     /**
      * Create a new settings object
      */
@@ -113,6 +310,371 @@
             }
             this.properties.add(props);
         }
+    }
+
+    /**
+     * @return Returns the hideShowTime.
+     */
+    public boolean isHideShowTime() {
+        return this.hideShowTime;
+    }
+
+    /**
+     * @return Returns the allowReload.
+     */
+    public boolean isAllowReload() {
+        return this.allowReload;
+    }
+
+    /**
+     * @return Returns the autosaveUploads.
+     */
+    public boolean isAutosaveUploads() {
+        return this.autosaveUploads;
+    }
+
+    /**
+     * @return Returns the cacheDirectory.
+     */
+    public String getCacheDirectory() {
+        return this.cacheDirectory;
+    }
+
+    /**
+     * @return Returns the cocoonLogger.
+     */
+    public String getCocoonLogger() {
+        return this.cocoonLogger;
+    }
+
+    /**
+     * @return Returns the configuration.
+     */
+    public String getConfiguration() {
+        return this.configuration;
+    }
+
+    /**
+     * @return Returns the enableUploads.
+     */
+    public boolean isEnableUploads() {
+        return this.enableUploads;
+    }
+
+    /**
+     * @return Returns the extraClasspaths.
+     */
+    public List getExtraClasspaths() {
+        return this.extraClasspaths;
+    }
+
+    /**
+     * @return Returns the forceProperties.
+     */
+    public Map getForceProperties() {
+        return this.forceProperties;
+    }
+
+    /**
+     * @return Returns the formEncoding.
+     */
+    public String getFormEncoding() {
+        return this.formEncoding;
+    }
+
+    /**
+     * @return Returns the initClassloader.
+     */
+    public boolean isInitClassloader() {
+        return this.initClassloader;
+    }
+
+    /**
+     * @return Returns the loadClasses.
+     */
+    public Iterator getLoadClasses() {
+        return this.loadClasses.iterator();
+    }
+
+    /**
+     * @return Returns the loggerClassName.
+     */
+    public String getLoggerManagerClassName() {
+        return this.loggerManagerClassName;
+    }
+
+    /**
+     * @return Returns the loggingConfiguration.
+     */
+    public String getLoggingConfiguration() {
+        return this.loggingConfiguration;
+    }
+
+    /**
+     * @return Returns the logLevel.
+     */
+    public String getBootstrapLogLevel() {
+        return this.bootstrapLogLevel;
+    }
+
+    /**
+     * @return Returns the manageExceptions.
+     */
+    public boolean isManageExceptions() {
+        return this.manageExceptions;
+    }
+
+    /**
+     * @return Returns the maxUploadSize.
+     */
+    public int getMaxUploadSize() {
+        return this.maxUploadSize;
+    }
+
+    /**
+     * @return Returns the overwriteUploads.
+     */
+    public String getOverwriteUploads() {
+        return this.overwriteUploads;
+    }
+
+    /**
+     * @return Returns the parentServiceManagerClassName.
+     */
+    public String getParentServiceManagerClassName() {
+        return this.parentServiceManagerClassName;
+    }
+
+    /**
+     * @return Returns the showTime.
+     */
+    public boolean isShowTime() {
+        return this.showTime;
+    }
+
+    /**
+     * @return Returns the uploadDirectory.
+     */
+    public String getUploadDirectory() {
+        return this.uploadDirectory;
+    }
+
+    /**
+     * @return Returns the workDirectory.
+     */
+    public String getWorkDirectory() {
+        return this.workDirectory;
+    }
+
+    /**
+     * @return Returns the log4jConfiguration.
+     */
+    public String getLog4jConfiguration() {
+        return this.log4jConfiguration;
+    }
+
+    /**
+     * @return Returns the accessLogger.
+     */
+    public String getEnvironmentLogger() {
+        return this.environmentLogger;
+    }
+
+    /**
+     * @return Returns the overrideLogLevel.
+     */
+    public String getOverrideLogLevel() {
+        return this.overrideLogLevel;
+    }
+
+    public boolean isAllowOverwrite() {
+        if ("deny".equalsIgnoreCase(this.overwriteUploads)) {
+            return false;
+        } else if ("allow".equalsIgnoreCase(this.overwriteUploads)) {
+            return true;
+        } else {
+            // either rename is specified or unsupported value - default to rename.
+            return false;
+        }
+    }
+
+    public boolean isSilentlyRename() {
+        if ("deny".equalsIgnoreCase(this.overwriteUploads)) {
+            return false;
+        } else if ("allow".equalsIgnoreCase(this.overwriteUploads)) {
+            return false; // ignored in this case
+        } else {
+            // either rename is specified or unsupported value - default to rename.
+            return true;
+        }
+    }
+
+    /**
+     * @return Returns the configurationReloadDelay.
+     */
+    public long getConfigurationReloadDelay() {
+        return configurationReloadDelay;
+    }
+
+    /**
+     * @return Returns the lazyMode.
+     */
+    public boolean isLazyMode() {
+        return this.lazyMode;
+    }
+
+    public String getProperty(String name) {
+        return this.getProperty(name, null);
+    }
+
+    public String getProperty(String key, String defaultValue) {
+        if ( key == null ) {
+            return defaultValue;
+        }
+        String value = null;
+        if ( key.startsWith(KEYPREFIX) ) {
+            final String sKey = key.substring(KEYPREFIX.length());
+            if ( sKey.equals(KEY_INIT_CLASSLOADER) ) {
+                value = String.valueOf(this.initClassloader);
+            } else if ( sKey.equals(KEY_CONFIGURATION) ) {
+                value = this.configuration;
+            } else if ( sKey.equals(KEY_CONFIGURATION_RELOAD_DELAY) ) {
+                value = String.valueOf(this.configurationReloadDelay);
+            } else if ( sKey.equals(KEY_LOGGING_CONFIGURATION) ) {
+                value = this.loggingConfiguration;
+            } else if ( sKey.equals(KEY_LOGGING_ENVIRONMENT_LOGGER) ) {
+                value = this.environmentLogger;
+            } else if ( sKey.equals(KEY_LOGGING_COCOON_LOGGER) ) {
+                value = this.cocoonLogger;
+            } else if ( sKey.equals(KEY_LOGGING_BOOTSTRAP_LOGLEVEL) ) {
+                value = this.bootstrapLogLevel;
+            } else if ( sKey.equals(KEY_LOGGING_MANAGER_CLASS) ) {
+                value = this.loggerManagerClassName;
+            } else if ( sKey.equals(KEY_LOGGING_LOG4J_CONFIGURATION) ) {
+                value = this.log4jConfiguration;
+            } else if ( sKey.equals(KEY_ALLOW_RELOAD) ) {
+                value = String.valueOf(this.allowReload);
+            } else if ( sKey.equals(KEY_UPLOADS_ENABLE) ) {
+                value = String.valueOf(this.enableUploads);
+            } else if ( sKey.equals(KEY_UPLOADS_DIRECTORY) ) {
+                value = this.uploadDirectory = value;
+            } else if ( sKey.equals(KEY_UPLOADS_AUTOSAVE) ) {
+                value = String.valueOf(this.autosaveUploads);
+            } else if ( sKey.equals(KEY_UPLOADS_OVERWRITE) ) {
+                value = this.overwriteUploads;
+            } else if ( sKey.equals(KEY_UPLOADS_MAXSIZE) ) {
+                value = String.valueOf(this.maxUploadSize);
+            } else if ( sKey.equals(KEY_CACHE_DIRECTORY) ) {
+                value = this.cacheDirectory;
+            } else if ( sKey.equals(KEY_WORK_DIRECTORY) ) {
+                value = this.workDirectory;
+            } else if ( sKey.equals(KEY_PARENT_SERVICE_MANAGER) ) {
+                value = this.parentServiceManagerClassName;
+            } else if ( sKey.equals(KEY_SHOWTIME) ) {
+                value = String.valueOf(this.showTime);
+            } else if ( sKey.equals(KEY_HIDE_SHOWTIME) ) {
+                value = String.valueOf(this.hideShowTime);
+            } else if ( sKey.equals(KEY_MANAGE_EXCEPTIONS) ) {
+                value = String.valueOf(this.manageExceptions);
+            } else if ( sKey.equals(KEY_FORM_ENCODING) ) {
+                value = this.formEncoding;
+            } else if ( sKey.equals(KEY_LOGGING_OVERRIDE_LOGLEVEL) ) {
+                value = this.overrideLogLevel;
+            } else if ( sKey.equals(KEY_LAZY_MODE) ) {
+                value = String.valueOf(this.lazyMode);
+            } else if ( key.equals(KEY_LOAD_CLASSES) ) {
+                value = this.toString(this.loadClasses);
+            } else if ( key.equals(KEY_EXTRA_CLASSPATHS) ) {
+                this.toString(this.extraClasspaths);
+            } else if ( key.equals(KEY_FORCE_PROPERTIES) ) {
+                this.toString(this.forceProperties);
+            }
+        }
+
+        int i = 0;
+        while ( i < this.properties.size() && value == null ) {
+            final Properties p = (Properties)this.properties.get(i);
+            value = p.getProperty(key);
+            i++;
+        }
+        if ( value == null ) {
+            value = defaultValue;
+        }
+        return value;
+    }
+
+    /**
+     * @see java.lang.Object#toString()
+     */
+    public String toString() {
+        return "Settings:\n"+
+          KEY_CONFIGURATION + " : " + this.configuration + '\n' +
+          KEY_CONFIGURATION_RELOAD_DELAY + " : " + this.configurationReloadDelay + '\n' +
+          KEY_ALLOW_RELOAD + " : " + this.allowReload + '\n' +
+          KEY_INIT_CLASSLOADER + " : " + this.initClassloader + '\n' +
+          KEY_EXTRA_CLASSPATHS + " : " + this.toString(this.extraClasspaths) + '\n' +
+          KEY_LOAD_CLASSES + " : " + this.toString(this.loadClasses) + '\n' +
+          KEY_FORCE_PROPERTIES + " : " + this.toString(this.forceProperties) + '\n' +
+          KEY_LOGGING_CONFIGURATION + " : " + this.loggingConfiguration + '\n' +
+          KEY_LOGGING_ENVIRONMENT_LOGGER + " : " + this.environmentLogger + '\n' +
+          KEY_LOGGING_BOOTSTRAP_LOGLEVEL + " : " + this.bootstrapLogLevel + '\n' +
+          KEY_LOGGING_COCOON_LOGGER + " : " + this.cocoonLogger + '\n' +
+          KEY_LOGGING_LOG4J_CONFIGURATION + " : " + this.log4jConfiguration + '\n' +
+          KEY_LOGGING_MANAGER_CLASS + " : " + this.loggerManagerClassName + '\n' +
+          KEY_LOGGING_OVERRIDE_LOGLEVEL + " : " + this.overrideLogLevel + '\n' +
+          KEY_MANAGE_EXCEPTIONS + " : " + this.manageExceptions + '\n' +
+          KEY_PARENT_SERVICE_MANAGER + " : " + this.parentServiceManagerClassName + '\n' +
+          KEY_UPLOADS_DIRECTORY + " : " + this.uploadDirectory + '\n' +
+          KEY_UPLOADS_AUTOSAVE + " : " + this.autosaveUploads + '\n' +
+          KEY_UPLOADS_ENABLE + " : " + this.enableUploads + '\n' +
+          KEY_UPLOADS_MAXSIZE + " : " + this.maxUploadSize + '\n' +
+          KEY_UPLOADS_OVERWRITE + " : " + this.overwriteUploads + '\n' +
+          KEY_CACHE_DIRECTORY + " : " + this.cacheDirectory + '\n' +
+          KEY_WORK_DIRECTORY + " : " + this.workDirectory + '\n' +
+          KEY_FORM_ENCODING + " : " + this.formEncoding + '\n' +
+          KEY_SHOWTIME + " : " + this.showTime + '\n' +
+          KEY_HIDE_SHOWTIME + " : " + this.hideShowTime + '\n' +
+          KEY_LAZY_MODE + " : " + this.lazyMode + '\n';
+    }
+
+    /**
+     * Helper method to make a string out of a list of objects.
+     */
+    protected String toString(List a) {
+        final StringBuffer buffer = new StringBuffer();
+        final Iterator i = a.iterator();
+        boolean first = true;
+        while ( i.hasNext() ) {
+            if ( first ) {
+                first = false;
+            } else {
+                buffer.append(", ");
+            }
+            buffer.append(i.next());
+        }
+        return buffer.toString();        
+    }
+
+    /**
+     * Helper method to make a string out of a map of objects.
+     */
+    protected String toString(Map a) {
+        final StringBuffer buffer = new StringBuffer("{");
+        final Iterator i = a.entrySet().iterator();
+        boolean first = true;
+        while ( i.hasNext() ) {
+            if ( first ) {
+                first = false;
+            } else {
+                buffer.append(", ");
+            }
+            final Map.Entry current = (Map.Entry)i.next();
+            buffer.append(current.getKey());
+            buffer.append("=");
+            buffer.append(current.getValue());
+        }
+        buffer.append("}");
+        return buffer.toString();        
     }
 
     /**

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=177968&r1=177967&r2=177968&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/Settings.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/Settings.java Mon May 23 05:57:15 2005
@@ -15,584 +15,16 @@
  */
 package org.apache.cocoon.core;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
 
 /**
  * This object holds the global configuration of Cocoon.
  *
  * @version SVN $Id$
  */
-public class Settings implements BaseSettings, DynamicSettings {
+public interface Settings extends BaseSettings, DynamicSettings {
 
-    /** Prefix for properties */
-    protected static final String KEYPREFIX = "org.apache.cocoon.";
+    String getProperty(String name);
 
-    /**
-     * The list of properties used to configure Cocoon
-     */
-    protected List properties = new ArrayList();
-
-    /**
-     * 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".
-     */
-    protected boolean initClassloader = INIT_CLASSLOADER;
-
-    /**
-     * This parameter allows to set system properties
-     */
-    protected Map forceProperties = new HashMap();
-
-    /**
-     * 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.
-     */
-    protected String configuration;
-
-    /**
-     * This parameter indicates the configuration file of the LogKit management
-     */
-    protected String loggingConfiguration;
-
-    /**
-     * This parameter indicates the category id of the logger from the LogKit
-     * configuration used by the environment.
-     */
-    protected String environmentLogger;
-
-    /**
-     * 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.
-     */
-    protected String cocoonLogger;
-
-    /**
-     * 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.
-     */
-    protected String bootstrapLogLevel;
-
-    /**
-     * This parameter switches the logging system from LogKit to Log4J for Cocoon.
-     * Log4J has to be configured already.
-     */
-    protected String loggerManagerClassName;
-
-    /**
-     * 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.
-     */
-    protected String log4jConfiguration;
-
-    /**
-     * 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.
-     */
-    protected boolean allowReload = ALLOW_RELOAD;
-
-    /**
-     * 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.
-     */
-    protected List loadClasses = new ArrayList();
-
-    /**
-     * Causes all files in multipart requests to be processed.
-     * Default is false for security reasons.
-     */
-    protected boolean enableUploads = ENABLE_UPLOADS;
-
-    /**
-     * 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.
-     */
-    protected String uploadDirectory;
-
-    /**
-     * 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;
-
-    /**
-     * 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.
-     */
-    protected String overwriteUploads;
-
-    /**
-     * Specify maximum allowed size of the upload. Defaults to 10 Mb.
-     */
-    protected int maxUploadSize = MAX_UPLOAD_SIZE;
-
-    /**
-     * 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.
-     */
-    protected String cacheDirectory;
-
-    /**
-     * 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.
-     */
-    protected String workDirectory;
-
-    /**
-     * 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.
-     */
-    protected List extraClasspaths = new ArrayList();
-
-    /**
-     * 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.
-     */
-    protected String parentServiceManagerClassName;
-
-    /**
-     * Allow adding processing time to the response
-     */
-    protected boolean showTime = SHOW_TIME;
-
-    /**
-     * If true, processing time will be added as an HTML comment
-     */
-    protected boolean hideShowTime = HIDE_SHOW_TIME;
-
-    /**
-     * 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;
-
-    /**
-     * 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;
-
-    /**
-     * 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.
-     */
-    protected String overrideLogLevel;
-
-    /**
-     * Delay between reload checks for the configuration
-     */
-    protected long configurationReloadDelay = 1000;
-
-    /**
-     * Lazy mode for component loading
-     */
-    protected boolean lazyMode = false;
-
-    /**
-     * Create a new settings object
-     */
-    public Settings() {
-        // nothing to do
-    }
-
-    /**
-     * @return Returns the hideShowTime.
-     */
-    public boolean isHideShowTime() {
-        return this.hideShowTime;
-    }
-
-    /**
-     * @return Returns the allowReload.
-     */
-    public boolean isAllowReload() {
-        return this.allowReload;
-    }
-
-    /**
-     * @return Returns the autosaveUploads.
-     */
-    public boolean isAutosaveUploads() {
-        return this.autosaveUploads;
-    }
-
-    /**
-     * @return Returns the cacheDirectory.
-     */
-    public String getCacheDirectory() {
-        return this.cacheDirectory;
-    }
-
-    /**
-     * @return Returns the cocoonLogger.
-     */
-    public String getCocoonLogger() {
-        return this.cocoonLogger;
-    }
-
-    /**
-     * @return Returns the configuration.
-     */
-    public String getConfiguration() {
-        return this.configuration;
-    }
-
-    /**
-     * @return Returns the enableUploads.
-     */
-    public boolean isEnableUploads() {
-        return this.enableUploads;
-    }
-
-    /**
-     * @return Returns the extraClasspaths.
-     */
-    public List getExtraClasspaths() {
-        return this.extraClasspaths;
-    }
-
-    /**
-     * @return Returns the forceProperties.
-     */
-    public Map getForceProperties() {
-        return this.forceProperties;
-    }
-
-    /**
-     * @return Returns the formEncoding.
-     */
-    public String getFormEncoding() {
-        return this.formEncoding;
-    }
-
-    /**
-     * @return Returns the initClassloader.
-     */
-    public boolean isInitClassloader() {
-        return this.initClassloader;
-    }
-
-    /**
-     * @return Returns the loadClasses.
-     */
-    public Iterator getLoadClasses() {
-        return this.loadClasses.iterator();
-    }
-
-    /**
-     * @return Returns the loggerClassName.
-     */
-    public String getLoggerManagerClassName() {
-        return this.loggerManagerClassName;
-    }
-
-    /**
-     * @return Returns the loggingConfiguration.
-     */
-    public String getLoggingConfiguration() {
-        return this.loggingConfiguration;
-    }
-
-    /**
-     * @return Returns the logLevel.
-     */
-    public String getBootstrapLogLevel() {
-        return this.bootstrapLogLevel;
-    }
-
-    /**
-     * @return Returns the manageExceptions.
-     */
-    public boolean isManageExceptions() {
-        return this.manageExceptions;
-    }
-
-    /**
-     * @return Returns the maxUploadSize.
-     */
-    public int getMaxUploadSize() {
-        return this.maxUploadSize;
-    }
-
-    /**
-     * @return Returns the overwriteUploads.
-     */
-    public String getOverwriteUploads() {
-        return this.overwriteUploads;
-    }
-
-    /**
-     * @return Returns the parentServiceManagerClassName.
-     */
-    public String getParentServiceManagerClassName() {
-        return this.parentServiceManagerClassName;
-    }
-
-    /**
-     * @return Returns the showTime.
-     */
-    public boolean isShowTime() {
-        return this.showTime;
-    }
-
-    /**
-     * @return Returns the uploadDirectory.
-     */
-    public String getUploadDirectory() {
-        return this.uploadDirectory;
-    }
-
-    /**
-     * @return Returns the workDirectory.
-     */
-    public String getWorkDirectory() {
-        return this.workDirectory;
-    }
-
-    /**
-     * @return Returns the log4jConfiguration.
-     */
-    public String getLog4jConfiguration() {
-        return this.log4jConfiguration;
-    }
-
-    /**
-     * @return Returns the accessLogger.
-     */
-    public String getEnvironmentLogger() {
-        return this.environmentLogger;
-    }
-
-    /**
-     * @return Returns the overrideLogLevel.
-     */
-    public String getOverrideLogLevel() {
-        return this.overrideLogLevel;
-    }
-
-    public boolean isAllowOverwrite() {
-        if ("deny".equalsIgnoreCase(this.overwriteUploads)) {
-            return false;
-        } else if ("allow".equalsIgnoreCase(this.overwriteUploads)) {
-            return true;
-        } else {
-            // either rename is specified or unsupported value - default to rename.
-            return false;
-        }
-    }
-
-    public boolean isSilentlyRename() {
-        if ("deny".equalsIgnoreCase(this.overwriteUploads)) {
-            return false;
-        } else if ("allow".equalsIgnoreCase(this.overwriteUploads)) {
-            return false; // ignored in this case
-        } else {
-            // either rename is specified or unsupported value - default to rename.
-            return true;
-        }
-    }
-
-    /**
-     * @return Returns the configurationReloadDelay.
-     */
-    public long getConfigurationReloadDelay() {
-        return configurationReloadDelay;
-    }
-
-    /**
-     * @return Returns the lazyMode.
-     */
-    public boolean isLazyMode() {
-        return this.lazyMode;
-    }
-
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString() {
-        return "Settings:\n"+
-          KEY_CONFIGURATION + " : " + this.configuration + '\n' +
-          KEY_CONFIGURATION_RELOAD_DELAY + " : " + this.configurationReloadDelay + '\n' +
-          KEY_ALLOW_RELOAD + " : " + this.allowReload + '\n' +
-          KEY_INIT_CLASSLOADER + " : " + this.initClassloader + '\n' +
-          KEY_EXTRA_CLASSPATHS + " : " + this.toString(this.extraClasspaths) + '\n' +
-          KEY_LOAD_CLASSES + " : " + this.toString(this.loadClasses) + '\n' +
-          KEY_FORCE_PROPERTIES + " : " + this.toString(this.forceProperties) + '\n' +
-          KEY_LOGGING_CONFIGURATION + " : " + this.loggingConfiguration + '\n' +
-          KEY_LOGGING_ENVIRONMENT_LOGGER + " : " + this.environmentLogger + '\n' +
-          KEY_LOGGING_BOOTSTRAP_LOGLEVEL + " : " + this.bootstrapLogLevel + '\n' +
-          KEY_LOGGING_COCOON_LOGGER + " : " + this.cocoonLogger + '\n' +
-          KEY_LOGGING_LOG4J_CONFIGURATION + " : " + this.log4jConfiguration + '\n' +
-          KEY_LOGGING_MANAGER_CLASS + " : " + this.loggerManagerClassName + '\n' +
-          KEY_LOGGING_OVERRIDE_LOGLEVEL + " : " + this.overrideLogLevel + '\n' +
-          KEY_MANAGE_EXCEPTIONS + " : " + this.manageExceptions + '\n' +
-          KEY_PARENT_SERVICE_MANAGER + " : " + this.parentServiceManagerClassName + '\n' +
-          KEY_UPLOADS_DIRECTORY + " : " + this.uploadDirectory + '\n' +
-          KEY_UPLOADS_AUTOSAVE + " : " + this.autosaveUploads + '\n' +
-          KEY_UPLOADS_ENABLE + " : " + this.enableUploads + '\n' +
-          KEY_UPLOADS_MAXSIZE + " : " + this.maxUploadSize + '\n' +
-          KEY_UPLOADS_OVERWRITE + " : " + this.overwriteUploads + '\n' +
-          KEY_CACHE_DIRECTORY + " : " + this.cacheDirectory + '\n' +
-          KEY_WORK_DIRECTORY + " : " + this.workDirectory + '\n' +
-          KEY_FORM_ENCODING + " : " + this.formEncoding + '\n' +
-          KEY_SHOWTIME + " : " + this.showTime + '\n' +
-          KEY_HIDE_SHOWTIME + " : " + this.hideShowTime + '\n' +
-          KEY_LAZY_MODE + " : " + this.lazyMode + '\n';
-    }
-
-    /**
-     * Helper method to make a string out of a list of objects.
-     */
-    protected String toString(List a) {
-        final StringBuffer buffer = new StringBuffer();
-        final Iterator i = a.iterator();
-        boolean first = true;
-        while ( i.hasNext() ) {
-            if ( first ) {
-                first = false;
-            } else {
-                buffer.append(", ");
-            }
-            buffer.append(i.next());
-        }
-        return buffer.toString();        
-    }
-
-    /**
-     * Helper method to make a string out of a map of objects.
-     */
-    protected String toString(Map a) {
-        final StringBuffer buffer = new StringBuffer("{");
-        final Iterator i = a.entrySet().iterator();
-        boolean first = true;
-        while ( i.hasNext() ) {
-            if ( first ) {
-                first = false;
-            } else {
-                buffer.append(", ");
-            }
-            final Map.Entry current = (Map.Entry)i.next();
-            buffer.append(current.getKey());
-            buffer.append("=");
-            buffer.append(current.getValue());
-        }
-        buffer.append("}");
-        return buffer.toString();        
-    }
-
-    public String getProperty(String name) {
-        return this.getProperty(name, null);
-    }
-
-    public String getProperty(String key, String defaultValue) {
-        if ( key == null ) {
-            return defaultValue;
-        }
-        String value = null;
-        if ( key.startsWith(KEYPREFIX) ) {
-            final String sKey = key.substring(KEYPREFIX.length());
-            if ( sKey.equals(KEY_INIT_CLASSLOADER) ) {
-                value = String.valueOf(this.initClassloader);
-            } else if ( sKey.equals(KEY_CONFIGURATION) ) {
-                value = this.configuration;
-            } else if ( sKey.equals(KEY_CONFIGURATION_RELOAD_DELAY) ) {
-                value = String.valueOf(this.configurationReloadDelay);
-            } else if ( sKey.equals(KEY_LOGGING_CONFIGURATION) ) {
-                value = this.loggingConfiguration;
-            } else if ( sKey.equals(KEY_LOGGING_ENVIRONMENT_LOGGER) ) {
-                value = this.environmentLogger;
-            } else if ( sKey.equals(KEY_LOGGING_COCOON_LOGGER) ) {
-                value = this.cocoonLogger;
-            } else if ( sKey.equals(KEY_LOGGING_BOOTSTRAP_LOGLEVEL) ) {
-                value = this.bootstrapLogLevel;
-            } else if ( sKey.equals(KEY_LOGGING_MANAGER_CLASS) ) {
-                value = this.loggerManagerClassName;
-            } else if ( sKey.equals(KEY_LOGGING_LOG4J_CONFIGURATION) ) {
-                value = this.log4jConfiguration;
-            } else if ( sKey.equals(KEY_ALLOW_RELOAD) ) {
-                value = String.valueOf(this.allowReload);
-            } else if ( sKey.equals(KEY_UPLOADS_ENABLE) ) {
-                value = String.valueOf(this.enableUploads);
-            } else if ( sKey.equals(KEY_UPLOADS_DIRECTORY) ) {
-                value = this.uploadDirectory = value;
-            } else if ( sKey.equals(KEY_UPLOADS_AUTOSAVE) ) {
-                value = String.valueOf(this.autosaveUploads);
-            } else if ( sKey.equals(KEY_UPLOADS_OVERWRITE) ) {
-                value = this.overwriteUploads;
-            } else if ( sKey.equals(KEY_UPLOADS_MAXSIZE) ) {
-                value = String.valueOf(this.maxUploadSize);
-            } else if ( sKey.equals(KEY_CACHE_DIRECTORY) ) {
-                value = this.cacheDirectory;
-            } else if ( sKey.equals(KEY_WORK_DIRECTORY) ) {
-                value = this.workDirectory;
-            } else if ( sKey.equals(KEY_PARENT_SERVICE_MANAGER) ) {
-                value = this.parentServiceManagerClassName;
-            } else if ( sKey.equals(KEY_SHOWTIME) ) {
-                value = String.valueOf(this.showTime);
-            } else if ( sKey.equals(KEY_HIDE_SHOWTIME) ) {
-                value = String.valueOf(this.hideShowTime);
-            } else if ( sKey.equals(KEY_MANAGE_EXCEPTIONS) ) {
-                value = String.valueOf(this.manageExceptions);
-            } else if ( sKey.equals(KEY_FORM_ENCODING) ) {
-                value = this.formEncoding;
-            } else if ( sKey.equals(KEY_LOGGING_OVERRIDE_LOGLEVEL) ) {
-                value = this.overrideLogLevel;
-            } else if ( sKey.equals(KEY_LAZY_MODE) ) {
-                value = String.valueOf(this.lazyMode);
-            } else if ( key.equals(KEY_LOAD_CLASSES) ) {
-                value = this.toString(this.loadClasses);
-            } else if ( key.equals(KEY_EXTRA_CLASSPATHS) ) {
-                this.toString(this.extraClasspaths);
-            } else if ( key.equals(KEY_FORCE_PROPERTIES) ) {
-                this.toString(this.forceProperties);
-            }
-        }
-
-        int i = 0;
-        while ( i < this.properties.size() && value == null ) {
-            final Properties p = (Properties)this.properties.get(i);
-            value = p.getProperty(key);
-            i++;
-        }
-        if ( value == null ) {
-            value = defaultValue;
-        }
-        return value;
-    }
+    String getProperty(String key, String defaultValue);
 
 }

Modified: cocoon/trunk/src/java/org/apache/cocoon/generation/StatusGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/generation/StatusGenerator.java?rev=177968&r1=177967&r2=177968&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/generation/StatusGenerator.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/generation/StatusGenerator.java Mon May 23 05:57:15 2005
@@ -401,26 +401,26 @@
         this.addValue(Settings.KEY_LOGGING_LOG4J_CONFIGURATION, s.getLog4jConfiguration());
         this.addValue(Settings.KEY_LOGGING_MANAGER_CLASS, s.getLoggerManagerClassName());
         this.addValue(Settings.KEY_PARENT_SERVICE_MANAGER, s.getParentServiceManagerClassName());
+        this.addValue(Settings.KEY_LOGGING_COCOON_LOGGER, s.getCocoonLogger());
+        this.addValue(Settings.KEY_INIT_CLASSLOADER, s.isInitClassloader());
+        this.addValue(Settings.KEY_LOGGING_ENVIRONMENT_LOGGER, s.getEnvironmentLogger());
+        this.addValue(Settings.KEY_LOGGING_OVERRIDE_LOGLEVEL, s.getOverrideLogLevel());
+        this.addValue(Settings.KEY_MANAGE_EXCEPTIONS, s.isManageExceptions());
+        this.addValue(Settings.KEY_UPLOADS_DIRECTORY, s.getUploadDirectory());
+        this.addValue(Settings.KEY_CACHE_DIRECTORY, s.getCacheDirectory());
+        this.addValue(Settings.KEY_WORK_DIRECTORY, s.getWorkDirectory());
+        this.addValue(Settings.KEY_FORM_ENCODING, s.getFormEncoding());
         
         this.endGroup();
 
         this.startGroup("Dynamic Settings");
 
         this.addValue(Settings.KEY_CONFIGURATION_RELOAD_DELAY, s.getConfigurationReloadDelay());
-        this.addValue(Settings.KEY_LOGGING_COCOON_LOGGER, s.getCocoonLogger());
         this.addValue(Settings.KEY_ALLOW_RELOAD, s.isAllowReload());
-        this.addValue(Settings.KEY_INIT_CLASSLOADER, s.isInitClassloader());
-        this.addValue(Settings.KEY_LOGGING_ENVIRONMENT_LOGGER, s.getEnvironmentLogger());
-        this.addValue(Settings.KEY_LOGGING_OVERRIDE_LOGLEVEL, s.getOverrideLogLevel());
-        this.addValue(Settings.KEY_MANAGE_EXCEPTIONS, s.isManageExceptions());
-        this.addValue(Settings.KEY_UPLOADS_DIRECTORY, s.getUploadDirectory());
         this.addValue(Settings.KEY_UPLOADS_AUTOSAVE, s.isAutosaveUploads());
         this.addValue(Settings.KEY_UPLOADS_ENABLE, s.isEnableUploads());
         this.addValue(Settings.KEY_UPLOADS_MAXSIZE, s.getMaxUploadSize());
         this.addValue(Settings.KEY_UPLOADS_OVERWRITE, s.isAllowOverwrite());
-        this.addValue(Settings.KEY_CACHE_DIRECTORY, s.getCacheDirectory());
-        this.addValue(Settings.KEY_WORK_DIRECTORY, s.getWorkDirectory());
-        this.addValue(Settings.KEY_FORM_ENCODING, s.getFormEncoding());
         this.addValue(Settings.KEY_SHOWTIME, s.isShowTime());
         this.addValue(Settings.KEY_HIDE_SHOWTIME, s.isHideShowTime());
         this.addValue(Settings.KEY_LAZY_MODE, s.isLazyMode());

Modified: cocoon/trunk/src/test/org/apache/cocoon/core/container/ContainerTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/core/container/ContainerTestCase.java?rev=177968&r1=177967&r2=177968&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/core/container/ContainerTestCase.java (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/core/container/ContainerTestCase.java Mon May 23 05:57:15 2005
@@ -38,7 +38,7 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.core.Core;
 import org.apache.cocoon.core.CoreUtil;
-import org.apache.cocoon.core.Settings;
+import org.apache.cocoon.core.MutableSettings;
 import org.apache.cocoon.util.log.DeprecationLogger;
 
 /**
@@ -300,7 +300,7 @@
         roleManager.configure( confRM );
 
         // Set up root manager for Core
-        Core core = new Core(new Settings(), this.context);
+        Core core = new Core(new MutableSettings(), this.context);
         ((DefaultContext)this.context).put(Core.ROLE, core);
         CoreUtil.RootServiceManager rsm = new CoreUtil.RootServiceManager(null, core);
  



Mime
View raw message