Author: cziegeler
Date: Fri Apr 22 04:41:51 2005
New Revision: 164222

URL: http://svn.apache.org/viewcvs?rev=164222&view=rev
Log:
Minor cleanups

Modified:
    
cocoon/blocks/unsupported/databases/trunk/java/org/apache/cocoon/acting/AbstractDatabaseAction.java
    cocoon/trunk/src/java/org/apache/cocoon/Constants.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/generation/FileGeneratorFactory.java
    cocoon/trunk/src/java/org/apache/cocoon/util/HashMap.java
    cocoon/trunk/src/java/org/apache/cocoon/xml/dom/DOMStreamer.java

Modified: 
cocoon/blocks/unsupported/databases/trunk/java/org/apache/cocoon/acting/AbstractDatabaseAction.java
URL: 
http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/java/org/apache/cocoon/acting/AbstractDatabaseAction.java?rev=164222&r1=164221&r2=164222&view=diff
==============================================================================
--- 
cocoon/blocks/unsupported/databases/trunk/java/org/apache/cocoon/acting/AbstractDatabaseAction.java
 (original)
+++ 
cocoon/blocks/unsupported/databases/trunk/java/org/apache/cocoon/acting/AbstractDatabaseAction.java
 Fri Apr 22 04:41:51 2005
@@ -33,7 +33,6 @@
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.avalon.excalibur.datasource.DataSourceComponent;
@@ -46,6 +45,7 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.ServiceSelector;
 import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.util.HashMap;
 import org.apache.cocoon.util.ImageProperties;
 import org.apache.cocoon.util.ImageUtils;
 

Modified: cocoon/trunk/src/java/org/apache/cocoon/Constants.java
URL: 
http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/Constants.java?rev=164222&r1=164221&r2=164222&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/Constants.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/Constants.java Fri Apr 22 04:41:51 
2005
@@ -117,9 +117,6 @@
      */
     public static final String LINK_VIEW = "links";
 
-    /** Don't know exactly what this is for (and it is not used in the code 
base) */
-    public static final String LINK_CRAWLING_ROLE = "static";
-
     /**
      * Key of the Map of index translation table.
      * <p>Presence of this Map in the ObjectModel indicates to the Sitemap 
that link

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=164222&r1=164221&r2=164222&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/Core.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/Core.java Fri Apr 22 04:41:51 
2005
@@ -112,6 +112,9 @@
         return ContextHelper.getObjectModel(this.context);
     }
 
+    /**
+     * Return the work directory.
+     */
     public File getWorkDirectory() {
         try {
             return (File)this.context.get(Constants.CONTEXT_WORK_DIR);
@@ -120,6 +123,9 @@
         }        
     }
 
+    /**
+     * Return the upload directory.
+     */
     public File getUploadDirectory() {
         try {
             return (File)this.context.get(Constants.CONTEXT_UPLOAD_DIR);
@@ -128,6 +134,9 @@
         }        
     }
 
+    /**
+     * Return the cache directory.
+     */
     public File getCacheDirectory() {
         try {
             return (File)this.context.get(Constants.CONTEXT_CACHE_DIR);

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=164222&r1=164221&r2=164222&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java Fri Apr 22 
04:41:51 2005
@@ -72,14 +72,14 @@
     /** Parameter map for the context protocol */
     protected static final Map CONTEXT_PARAMETERS = 
Collections.singletonMap("force-traversable", Boolean.TRUE);
 
-    /** The callback to the real environment */
+    /** The callback to the real environment. */
     protected final BootstrapEnvironment env;
 
-    /** "legacy" support: create an avalon context */
+    /** "legacy" support: create an avalon context. */
     protected final DefaultContext appContext = new DefaultContext();
-    
-    /** The settings */
-    protected final Settings settings;
+
+    /** The settings. */
+    protected Settings settings;
 
     /** The parent service manager. */
     protected ServiceManager parentManager;
@@ -92,16 +92,18 @@
 
     /** The Cocoon instance (the root processor). */
     protected Cocoon cocoon;
-    
-    /**
-     * The time the cocoon instance was created
-     */
+
+    /** The time the cocoon instance was created. */
     protected long creationTime;
 
-    public CoreUtil(BootstrapEnvironment environment) 
+    public CoreUtil(BootstrapEnvironment environment)
     throws Exception {
         this.env = environment;
+        this.init();
+    }
 
+    protected void init()
+    throws Exception {
         // create settings
         this.settings = this.createSettings();
 
@@ -117,14 +119,14 @@
 
         // add root url
         try {
-            appContext.put(ContextHelper.CONTEXT_ROOT_URL, 
-                           new URL(this.env.getContextURL()));            
+            appContext.put(ContextHelper.CONTEXT_ROOT_URL,
+                           new URL(this.env.getContextURL()));        
         } catch (MalformedURLException ignore) {
             // we simply ignore this
         }
 
         // add environment context
-        this.appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, 
+        this.appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT,
                             this.env.getEnvironmentContext());
 
         // now add environment specific information
@@ -249,11 +251,12 @@
 
         // create parent service manager
         this.parentManager = this.getParentServiceManager(core);
-        
+
         // settings can't be changed anymore
         settings.makeReadOnly();
-        
-        // put the core into the context
+
+        // put the core into the context - this is for internal use only
+        // The Cocoon container fetches the Core object using the context.
         this.appContext.put(Core.ROLE, core);
     }
 
@@ -266,6 +269,11 @@
         }
     }
 
+    /**
+     * Create a new core instance.
+     * This method can be overwritten in sub classes.
+     * @return A new core object.
+     */
     protected Core createCore() {
         final Core c = new Core(this.settings, this.appContext);
         return c;
@@ -310,15 +318,15 @@
     }
 
     /**
-     * Get the settings for Cocoon
-     * @param env This provides access to various parts of the used 
environment.
+     * Get the settings for Cocoon.
+     * @return A new Settings object
      */
     protected Settings createSettings() {
         // create an empty settings objects
         final Settings s = new Settings();
 
         String additionalPropertyFile = 
System.getProperty(Settings.PROPERTY_USER_SETTINGS);
-        
+
         // read cocoon-settings.properties - if available
         InputStream propsIS = env.getInputStream("cocoon-settings.properties");
         if ( propsIS != null ) {
@@ -336,7 +344,7 @@
         }
         // fill from the environment configuration, like web.xml etc.
         env.configure(s);
-        
+
         // read additional properties file
         if ( additionalPropertyFile != null ) {
             env.log("Reading user settings from '" + additionalPropertyFile + 
"'");
@@ -559,7 +567,7 @@
 
     public static final class RootServiceManager 
     implements ServiceManager, Disposable {
-        
+
         protected final ServiceManager parent;
         protected final Core cocoon;
 
@@ -658,8 +666,8 @@
     }
 
     /**
-     * Gets the current cocoon object.  Reload cocoon if configuration
-     * changed or we are reloading.
+     * Gets the current cocoon object.  
+     * Reload cocoon if configuration changed or we are reloading.
      */
     public Cocoon getCocoon(final String pathInfo, final String reloadParam)
     throws Exception {
@@ -686,7 +694,7 @@
             }
 
             if (reload) {
-                this.initLogger();
+                this.init();
                 this.createCocoon();
             }
         }
@@ -696,7 +704,7 @@
     /**
      * Destroy Cocoon
      */
-    public final void disposeCocoon() {
+    protected final void disposeCocoon() {
         if (this.cocoon != null) {
             if (this.log.isDebugEnabled()) {
                 this.log.debug("Disposing Cocoon");
@@ -790,7 +798,7 @@
     }
 
     /**
-     * Dispose Cocoon when servlet is destroyed
+     * Dispose Cocoon when environment is destroyed
      */
     public void destroy() {
         if (this.settings.isInitClassloader()) {
@@ -852,6 +860,5 @@
         }
         return "";
     }
-
 
 }

Modified: 
cocoon/trunk/src/java/org/apache/cocoon/generation/FileGeneratorFactory.java
URL: 
http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/generation/FileGeneratorFactory.java?rev=164222&r1=164221&r2=164222&view=diff
==============================================================================
--- 
cocoon/trunk/src/java/org/apache/cocoon/generation/FileGeneratorFactory.java 
(original)
+++ 
cocoon/trunk/src/java/org/apache/cocoon/generation/FileGeneratorFactory.java 
Fri Apr 22 04:41:51 2005
@@ -59,7 +59,7 @@
                                   implements GeneratorFactory, Serviceable {
 
     /** The service manager */
-    private ServiceManager manager;
+    protected ServiceManager manager;
 
     public void service(ServiceManager manager) throws ServiceException {
         this.manager = manager;

Modified: cocoon/trunk/src/java/org/apache/cocoon/util/HashMap.java
URL: 
http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/util/HashMap.java?rev=164222&r1=164221&r2=164222&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/util/HashMap.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/util/HashMap.java Fri Apr 22 
04:41:51 2005
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 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.
@@ -18,30 +18,31 @@
 import java.util.Map;
 
 /**
- * Extended Version of [EMAIL PROTECTED] java.util.HashMap}.
+ * Extended Version of [EMAIL PROTECTED] java.util.HashMap} that provides an 
extended
+ * get method accpeting a default value. The default value is returned if
+ * the map does not contain a value for the provided key.
  *
  * @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a>
- * @version CVS $Id: HashMap.java,v 1.2 2004/03/05 13:03:00 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public class HashMap extends java.util.HashMap {
 
     public HashMap () {
-    super();
+        super();
     }
 
     public HashMap ( int initialCapacity ) {
-    super(initialCapacity);
+        super(initialCapacity);
     }
 
     public HashMap ( int initialCapacity, float loadFactor ) {
-    super(initialCapacity, loadFactor);
+        super(initialCapacity, loadFactor);
     }
 
     public HashMap ( Map t) {
-    super(t);
+        super(t);
     }
 
-
     /**
      * Get method extended by default object to be returned when key
      * is not found.
@@ -50,12 +51,11 @@
      * @param _default default value to return if key is not found
      * @return value that is associated with key
      */
-    public Object get ( Object key, Object _default ) {
-    if (this.containsKey(key)) {
-        return this.get(key);
-    } else {
+    public Object get( Object key, Object _default ) {
+        if (this.containsKey(key)) {
+            return this.get(key);
+        }
         return _default;
-    }
     }
 
 }

Modified: cocoon/trunk/src/java/org/apache/cocoon/xml/dom/DOMStreamer.java
URL: 
http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/xml/dom/DOMStreamer.java?rev=164222&r1=164221&r2=164222&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/xml/dom/DOMStreamer.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/xml/dom/DOMStreamer.java Fri Apr 22 
04:41:51 2005
@@ -67,7 +67,7 @@
 public class DOMStreamer implements XMLProducer, Recyclable {
 
     /** The transformer factory shared by all instances (only used by 
DefaultDOMStreamer) */
-    private static final TransformerFactory FACTORY = 
TransformerFactory.newInstance();
+    protected static final TransformerFactory FACTORY = 
TransformerFactory.newInstance();
 
     /** Default value for normalizeNamespaces. */
     private static final boolean DEFAULT_NORMALIZE_NAMESPACES = true;


Reply via email to