cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r158919 - in cocoon/trunk/src: core/java/org/apache/cocoon/components/ core/java/org/apache/cocoon/core/ core/java/org/apache/cocoon/environment/ core/java/org/apache/cocoon/util/log/ java/org/apache/cocoon/components/ java/org/apache/cocoon/components/container/ java/org/apache/cocoon/environment/ java/org/apache/cocoon/servlet/ java/org/apache/cocoon/util/log/
Date Thu, 24 Mar 2005 14:25:46 GMT
Author: cziegeler
Date: Thu Mar 24 06:25:43 2005
New Revision: 158919

URL: http://svn.apache.org/viewcvs?view=rev&rev=158919
Log:
Move some classes to the core so we can make objects available through the core

Added:
    cocoon/trunk/src/core/java/org/apache/cocoon/components/ContextHelper.java
      - copied unchanged from r158892, cocoon/trunk/src/java/org/apache/cocoon/components/ContextHelper.java
    cocoon/trunk/src/core/java/org/apache/cocoon/environment/Cookie.java
      - copied, changed from r158892, cocoon/trunk/src/java/org/apache/cocoon/environment/Cookie.java
    cocoon/trunk/src/core/java/org/apache/cocoon/environment/ObjectModelHelper.java
      - copied unchanged from r158892, cocoon/trunk/src/java/org/apache/cocoon/environment/ObjectModelHelper.java
    cocoon/trunk/src/core/java/org/apache/cocoon/environment/Request.java
      - copied unchanged from r158892, cocoon/trunk/src/java/org/apache/cocoon/environment/Request.java
    cocoon/trunk/src/core/java/org/apache/cocoon/environment/Response.java
      - copied, changed from r158892, cocoon/trunk/src/java/org/apache/cocoon/environment/Response.java
    cocoon/trunk/src/core/java/org/apache/cocoon/environment/Session.java
      - copied, changed from r158892, cocoon/trunk/src/java/org/apache/cocoon/environment/Session.java
    cocoon/trunk/src/core/java/org/apache/cocoon/util/log/Log4JConfigurator.java
      - copied, changed from r158892, cocoon/trunk/src/java/org/apache/cocoon/util/log/Log4JConfigurator.java
    cocoon/trunk/src/core/java/org/apache/cocoon/util/log/LoggingHelper.java
      - copied, changed from r158892, cocoon/trunk/src/java/org/apache/cocoon/components/container/LoggingHelper.java
Removed:
    cocoon/trunk/src/java/org/apache/cocoon/components/ContextHelper.java
    cocoon/trunk/src/java/org/apache/cocoon/components/container/LoggingHelper.java
    cocoon/trunk/src/java/org/apache/cocoon/environment/Cookie.java
    cocoon/trunk/src/java/org/apache/cocoon/environment/ObjectModelHelper.java
    cocoon/trunk/src/java/org/apache/cocoon/environment/Request.java
    cocoon/trunk/src/java/org/apache/cocoon/environment/Response.java
    cocoon/trunk/src/java/org/apache/cocoon/environment/Session.java
    cocoon/trunk/src/java/org/apache/cocoon/util/log/Log4JConfigurator.java
Modified:
    cocoon/trunk/src/core/java/org/apache/cocoon/core/Core.java
    cocoon/trunk/src/core/java/org/apache/cocoon/core/CoreUtil.java
    cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java

Modified: cocoon/trunk/src/core/java/org/apache/cocoon/core/Core.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/core/Core.java?view=diff&r1=158918&r2=158919
==============================================================================
--- cocoon/trunk/src/core/java/org/apache/cocoon/core/Core.java (original)
+++ cocoon/trunk/src/core/java/org/apache/cocoon/core/Core.java Thu Mar 24 06:25:43 2005
@@ -23,6 +23,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 
 import org.apache.avalon.framework.CascadingRuntimeException;
@@ -31,6 +32,7 @@
 import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.context.DefaultContext;
 import org.apache.cocoon.Constants;
+import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.configuration.Settings;
 import org.apache.log.LogTarget;
 
@@ -134,6 +136,14 @@
         }
     }
     
+    /**
+     * Return the current object model
+     * @return The object model.
+     */
+    public Map getCurrentObjectModel() {
+        return ContextHelper.getObjectModel(this.context);
+    }
+
     public File getWorkDirectory() {
         try {
             return (File)this.context.get(Constants.CONTEXT_WORK_DIR);

Modified: cocoon/trunk/src/core/java/org/apache/cocoon/core/CoreUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/core/CoreUtil.java?view=diff&r1=158918&r2=158919
==============================================================================
--- cocoon/trunk/src/core/java/org/apache/cocoon/core/CoreUtil.java (original)
+++ cocoon/trunk/src/core/java/org/apache/cocoon/core/CoreUtil.java Thu Mar 24 06:25:43 2005
@@ -19,6 +19,7 @@
 import java.io.File;
 import java.lang.reflect.Constructor;
 import java.net.MalformedURLException;
+import java.net.URL;
 
 import org.apache.avalon.excalibur.logger.LoggerManager;
 import org.apache.avalon.framework.container.ContainerUtil;
@@ -27,8 +28,10 @@
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.Constants;
+import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.configuration.Settings;
 import org.apache.cocoon.util.ClassUtils;
+import org.apache.cocoon.util.log.LoggingHelper;
 
 /**
  *
@@ -139,12 +142,11 @@
             }
         }
 
-        //try {
-            // TODO - ContextHelper is not in core :(
-            //appContext.put(ContextHelper.CONTEXT_ROOT_URL, new URL(contextURL));      
     
-        //} catch (MalformedURLException ignore) {
+        try {
+            appContext.put(ContextHelper.CONTEXT_ROOT_URL, new URL(contextURL));        
   
+        } catch (MalformedURLException ignore) {
             // we simply ignore this
-        //}
+        }
 
         // Init logger
         initLogger();
@@ -289,10 +291,10 @@
         }
         this.env.configureLoggingContext(subcontext);
 
-        // FIXME - we can move the logginghelper code into this class
-        //LoggingHelper lh = new LoggingHelper(this.settings, this.env.getDefaultLogTarget(),
subcontext);
-        //this.loggerManager = lh.getLoggerManager();
-        //this.log = lh.getLogger();
+        // FIXME - we can move the logging helper into this class
+        LoggingHelper loggingHelper = new LoggingHelper(this.settings, this.env.getDefaultLogTarget(),
subcontext);
+        this.loggerManager = loggingHelper.getLoggerManager();
+        this.log = loggingHelper.getLogger();
     }
 
     public static final class RootServiceManager implements ServiceManager {

Copied: cocoon/trunk/src/core/java/org/apache/cocoon/environment/Cookie.java (from r158892,
cocoon/trunk/src/java/org/apache/cocoon/environment/Cookie.java)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/environment/Cookie.java?view=diff&rev=158919&p1=cocoon/trunk/src/java/org/apache/cocoon/environment/Cookie.java&r1=158892&p2=cocoon/trunk/src/core/java/org/apache/cocoon/environment/Cookie.java&r2=158919
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/environment/Cookie.java (original)
+++ cocoon/trunk/src/core/java/org/apache/cocoon/environment/Cookie.java Thu Mar 24 06:25:43
2005
@@ -51,7 +51,7 @@
  *
  *
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: Cookie.java,v 1.4 2004/03/05 13:02:54 bdelacretaz Exp $
+ * @version CVS $Id$
  *
  */
 

Copied: cocoon/trunk/src/core/java/org/apache/cocoon/environment/Response.java (from r158892,
cocoon/trunk/src/java/org/apache/cocoon/environment/Response.java)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/environment/Response.java?view=diff&rev=158919&p1=cocoon/trunk/src/java/org/apache/cocoon/environment/Response.java&r1=158892&p2=cocoon/trunk/src/core/java/org/apache/cocoon/environment/Response.java&r2=158919
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/environment/Response.java (original)
+++ cocoon/trunk/src/core/java/org/apache/cocoon/environment/Response.java Thu Mar 24 06:25:43
2005
@@ -22,7 +22,7 @@
  *
  * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: Response.java,v 1.3 2004/03/05 13:02:54 bdelacretaz Exp $
+ * @version CVS $Id$
  *
  */
 

Copied: cocoon/trunk/src/core/java/org/apache/cocoon/environment/Session.java (from r158892,
cocoon/trunk/src/java/org/apache/cocoon/environment/Session.java)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/environment/Session.java?view=diff&rev=158919&p1=cocoon/trunk/src/java/org/apache/cocoon/environment/Session.java&r1=158892&p2=cocoon/trunk/src/core/java/org/apache/cocoon/environment/Session.java&r2=158919
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/environment/Session.java (original)
+++ cocoon/trunk/src/core/java/org/apache/cocoon/environment/Session.java Thu Mar 24 06:25:43
2005
@@ -42,7 +42,7 @@
  * will not be directly visible in another.
  *
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: Session.java,v 1.3 2004/03/05 13:02:54 bdelacretaz Exp $
+ * @version CVS $Id$
  *
  */
 

Copied: cocoon/trunk/src/core/java/org/apache/cocoon/util/log/Log4JConfigurator.java (from
r158892, cocoon/trunk/src/java/org/apache/cocoon/util/log/Log4JConfigurator.java)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/util/log/Log4JConfigurator.java?view=diff&rev=158919&p1=cocoon/trunk/src/java/org/apache/cocoon/util/log/Log4JConfigurator.java&r1=158892&p2=cocoon/trunk/src/core/java/org/apache/cocoon/util/log/Log4JConfigurator.java&r2=158919
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/util/log/Log4JConfigurator.java (original)
+++ cocoon/trunk/src/core/java/org/apache/cocoon/util/log/Log4JConfigurator.java Thu Mar 24
06:25:43 2005
@@ -67,46 +67,44 @@
                 // no more variables
                 if(i==0) { // this is a simple string
                     return val;
-                } else { // add the tail string which contails no variables and return the
result.
-                    sbuf.append(val.substring(i, val.length()));
-                    return sbuf.toString();
                 }
-            } else {
-                sbuf.append(val.substring(i, j));
-                k = val.indexOf(DELIM_STOP, j);
-                if(k == -1) {
-                    throw new IllegalArgumentException('"'+val+
-                             "\" has no closing brace. Opening brace at position " + j
-                             + '.');
-                } else {
-                    j += DELIM_START_LEN;
-                    String key = val.substring(j, k);
-                    // first try in System properties
-                    String replacement = this.getSystemProperty(key);
-                    // then try props parameter
-                    if (replacement == null && this.context != null) {
-                        try {
-                            Object o = this.context.get(key);
-                            if ( o != null ) {
-                                replacement = o.toString();
-                            }
-                        } catch (ContextException ce) {
-                            LogLog.debug("Was not allowed to read context property \""+key+"\".");
                           
-                        }
-                    }
-    
-                    if (replacement != null) {
-                        // Do variable substitution on the replacement string
-                        // such that we can solve "Hello ${x2}" as "Hello p1" 
-                        // the where the properties are
-                        // x1=p1
-                        // x2=${x1}
-                        String recursiveReplacement = substVars(replacement);
-                        sbuf.append(recursiveReplacement);
+                // add the tail string which contails no variables and return the result.
+                sbuf.append(val.substring(i, val.length()));
+                return sbuf.toString();
+            }
+            sbuf.append(val.substring(i, j));
+            k = val.indexOf(DELIM_STOP, j);
+            if(k == -1) {
+                throw new IllegalArgumentException('"'+val+
+                         "\" has no closing brace. Opening brace at position " + j
+                         + '.');
+            }
+            j += DELIM_START_LEN;
+            String key = val.substring(j, k);
+            // first try in System properties
+            String replacement = this.getSystemProperty(key);
+            // then try props parameter
+            if (replacement == null && this.context != null) {
+                try {
+                    Object o = this.context.get(key);
+                    if ( o != null ) {
+                        replacement = o.toString();
                     }
-                    i = k + DELIM_STOP_LEN;
+                } catch (ContextException ce) {
+                    LogLog.debug("Was not allowed to read context property \""+key+"\".");
                           
                 }
             }
+
+            if (replacement != null) {
+                // Do variable substitution on the replacement string
+                // such that we can solve "Hello ${x2}" as "Hello p1" 
+                // the where the properties are
+                // x1=p1
+                // x2=${x1}
+                String recursiveReplacement = substVars(replacement);
+                sbuf.append(recursiveReplacement);
+            }
+            i = k + DELIM_STOP_LEN;
         }
     }
     

Copied: cocoon/trunk/src/core/java/org/apache/cocoon/util/log/LoggingHelper.java (from r158892,
cocoon/trunk/src/java/org/apache/cocoon/components/container/LoggingHelper.java)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/util/log/LoggingHelper.java?view=diff&rev=158919&p1=cocoon/trunk/src/java/org/apache/cocoon/components/container/LoggingHelper.java&r1=158892&p2=cocoon/trunk/src/core/java/org/apache/cocoon/util/log/LoggingHelper.java&r2=158919
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/container/LoggingHelper.java (original)
+++ cocoon/trunk/src/core/java/org/apache/cocoon/util/log/LoggingHelper.java Thu Mar 24 06:25:43
2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.cocoon.components.container;
+package org.apache.cocoon.util.log;
 
 import java.io.IOException;
 import java.util.Collections;
@@ -38,7 +38,6 @@
 import org.apache.cocoon.configuration.Settings;
 import org.apache.cocoon.core.source.SimpleSourceResolver;
 import org.apache.cocoon.matching.helpers.WildcardHelper;
-import org.apache.cocoon.util.log.Log4JConfigurator;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.TraversableSource;
 import org.apache.log.ErrorHandler;

Modified: cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java?view=diff&r1=158918&r2=158919
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java Thu Mar 24 06:25:43
2005
@@ -53,7 +53,6 @@
 import org.apache.cocoon.Constants;
 import org.apache.cocoon.ResourceNotFoundException;
 import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.components.container.LoggingHelper;
 import org.apache.cocoon.components.notification.DefaultNotifyingBuilder;
 import org.apache.cocoon.components.notification.Notifier;
 import org.apache.cocoon.components.notification.Notifying;
@@ -69,6 +68,7 @@
 import org.apache.cocoon.util.IOUtils;
 import org.apache.cocoon.util.StringUtils;
 import org.apache.cocoon.util.log.CocoonLogFormatter;
+import org.apache.cocoon.util.log.LoggingHelper;
 import org.apache.commons.lang.SystemUtils;
 import org.apache.log.ContextMap;
 import org.apache.log.LogTarget;



Mime
View raw message