cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r126226 - in cocoon/trunk/src/core/java/org/apache/cocoon: components/source/impl configuration core/container core/source
Date Sun, 23 Jan 2005 17:44:24 GMT
Author: cziegeler
Date: Sun Jan 23 09:44:23 2005
New Revision: 126226

URL: http://svn.apache.org/viewcvs?view=rev&rev=126226
Log:
Minor bug fixes
Modified:
   cocoon/trunk/src/core/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java
   cocoon/trunk/src/core/java/org/apache/cocoon/components/source/impl/TraversableContextSource.java
   cocoon/trunk/src/core/java/org/apache/cocoon/configuration/Settings.java
   cocoon/trunk/src/core/java/org/apache/cocoon/core/container/ComponentEnvironment.java
   cocoon/trunk/src/core/java/org/apache/cocoon/core/source/SimpleSourceResolver.java

Modified: cocoon/trunk/src/core/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java?view=diff&rev=126226&p1=cocoon/trunk/src/core/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java&r1=126225&p2=cocoon/trunk/src/core/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java&r2=126226
==============================================================================
--- cocoon/trunk/src/core/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java
(original)
+++ cocoon/trunk/src/core/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java
Sun Jan 23 09:44:23 2005
@@ -106,6 +106,7 @@
 
             // Remove the protocol and the first '/'
             final int pos = location.indexOf(":/");
+            final String scheme = location.substring(0, pos);
             final String path = location.substring(pos+1);
             
             // fix for #24093, we don't give access to files outside the context:
@@ -131,7 +132,7 @@
                      && !(source instanceof TraversableSource) ) {
                     final Set children = this.servletContext.getResourcePaths(path + '/');
                     if ( children != null ) {
-                        source = new TraversableContextSource(source, children, this, path);
+                        source = new TraversableContextSource(source, children, this, path,
scheme);
                     }
                 }
                 return source;                

Modified: cocoon/trunk/src/core/java/org/apache/cocoon/components/source/impl/TraversableContextSource.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/components/source/impl/TraversableContextSource.java?view=diff&rev=126226&p1=cocoon/trunk/src/core/java/org/apache/cocoon/components/source/impl/TraversableContextSource.java&r1=126225&p2=cocoon/trunk/src/core/java/org/apache/cocoon/components/source/impl/TraversableContextSource.java&r2=126226
==============================================================================
--- cocoon/trunk/src/core/java/org/apache/cocoon/components/source/impl/TraversableContextSource.java
(original)
+++ cocoon/trunk/src/core/java/org/apache/cocoon/components/source/impl/TraversableContextSource.java
Sun Jan 23 09:44:23 2005
@@ -39,15 +39,18 @@
     final protected Set children;
     final protected ContextSourceFactory factory;
     final protected String path;
+    final protected String scheme;
     
     public TraversableContextSource(Source source, 
                                     Set children, 
                                     ContextSourceFactory factory,
-                                    String path) {
+                                    String path,
+                                    String scheme) {
         this.wrappedSource = source;
         this.children = children;
         this.factory = factory;
         this.path = path;
+        this.scheme = scheme;
     }
 
     /* (non-Javadoc)
@@ -90,7 +93,7 @@
      * @see org.apache.excalibur.source.Source#getScheme()
      */
     public String getScheme() {
-        return this.wrappedSource.getScheme();
+        return this.scheme;
     }
     
     /* (non-Javadoc)

Modified: cocoon/trunk/src/core/java/org/apache/cocoon/configuration/Settings.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/configuration/Settings.java?view=diff&rev=126226&p1=cocoon/trunk/src/core/java/org/apache/cocoon/configuration/Settings.java&r1=126225&p2=cocoon/trunk/src/core/java/org/apache/cocoon/configuration/Settings.java&r2=126226
==============================================================================
--- cocoon/trunk/src/core/java/org/apache/cocoon/configuration/Settings.java	(original)
+++ cocoon/trunk/src/core/java/org/apache/cocoon/configuration/Settings.java	Sun Jan 23 09:44:23
2005
@@ -55,7 +55,6 @@
     public static final boolean SHOW_TIME = false;
     public static final boolean HIDE_SHOW_TIME = false;
     public static final boolean MANAGE_EXCEPTIONS = true;
-    public static final String FORM_ENCODING = "";
 
     /**
      * This parameter tells Cocoon to set the thread's context classloader to
@@ -280,7 +279,7 @@
                     } else if ( key.equals("uploads.overwrite") ) {
                         this.overwriteUploads = value;
                     } else if ( key.equals("uploads.maxsize") ) {
-                        this.maxUploadSize = NumberUtils.stringToInt(value);
+                        this.maxUploadSize = NumberUtils.toInt(value);
                     } else if ( key.equals("cache.directory") ) {
                         this.cacheDirectory = value;
                     } else if ( key.equals("work.directory") ) {

Modified: cocoon/trunk/src/core/java/org/apache/cocoon/core/container/ComponentEnvironment.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/core/container/ComponentEnvironment.java?view=diff&rev=126226&p1=cocoon/trunk/src/core/java/org/apache/cocoon/core/container/ComponentEnvironment.java&r1=126225&p2=cocoon/trunk/src/core/java/org/apache/cocoon/core/container/ComponentEnvironment.java&r2=126226
==============================================================================
--- cocoon/trunk/src/core/java/org/apache/cocoon/core/container/ComponentEnvironment.java
(original)
+++ cocoon/trunk/src/core/java/org/apache/cocoon/core/container/ComponentEnvironment.java
Sun Jan 23 09:44:23 2005
@@ -16,16 +16,21 @@
  */
 package org.apache.cocoon.core.container;
 
+import java.io.InputStream;
+
 import org.apache.avalon.excalibur.logger.LoggerManager;
+import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.cocoon.components.ComponentInfo;
+import org.apache.cocoon.configuration.ConfigurationBuilder;
 
 /**
  * The component enviromnent contains all objects necessary to create
  * a new component; it's just a "container" of objects.
  *
- * @version CVS $Id:  123716 2004-12-30 14:16:00Z vgritsenko $
+ * @version SVN $Id:  123716 2004-12-30 14:16:00Z vgritsenko $
  */
 public class ComponentEnvironment {
 
@@ -57,5 +62,20 @@
 
     public Class loadClass(String name) throws ClassNotFoundException {
         return this.classLoader.loadClass(name);
+    }
+    
+    public ComponentInfo loadComponentInfo(String name) 
+    throws Exception {
+        final StringBuffer bu = new StringBuffer(name);
+        bu.append(".xconf");
+        ComponentInfo ci = null;
+        final InputStream is = this.classLoader.getResourceAsStream(bu.toString());
+        if ( is != null ) {
+            final ConfigurationBuilder cb = new ConfigurationBuilder();
+            final Configuration conf = cb.build(is);
+            ci = new ComponentInfo();
+            ci.fill(conf);
+        }
+        return ci;
     }
 }

Modified: cocoon/trunk/src/core/java/org/apache/cocoon/core/source/SimpleSourceResolver.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/core/java/org/apache/cocoon/core/source/SimpleSourceResolver.java?view=diff&rev=126226&p1=cocoon/trunk/src/core/java/org/apache/cocoon/core/source/SimpleSourceResolver.java&r1=126225&p2=cocoon/trunk/src/core/java/org/apache/cocoon/core/source/SimpleSourceResolver.java&r2=126226
==============================================================================
--- cocoon/trunk/src/core/java/org/apache/cocoon/core/source/SimpleSourceResolver.java	(original)
+++ cocoon/trunk/src/core/java/org/apache/cocoon/core/source/SimpleSourceResolver.java	Sun
Jan 23 09:44:23 2005
@@ -140,8 +140,15 @@
      * @see org.apache.excalibur.source.SourceResolver#release(org.apache.excalibur.source.Source)
      */
     public void release(Source source) {
-        // Don't care. The factories we use here don't need that
-        // TODO - We should check this!!!
+        if ( source != null ) {
+            if ( "context".equals(source.getScheme()) ) {
+                this.contextFactory.release(source);
+            } else if ( "resource".equals(source.getScheme()) ) {
+                this.resourceFactory.release(source);
+            } else {
+                this.urlFactory.release(source);
+            }
+        }
     }
     
     public static final class SimpleServiceManager implements ServiceManager {

Mime
View raw message