cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r408067 - in /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor: ConcreteTreeProcessor.java TreeBuilder.java TreeProcessor.java sitemap/SitemapLanguage.java
Date Sat, 20 May 2006 18:25:08 GMT
Author: cziegeler
Date: Sat May 20 11:25:08 2006
New Revision: 408067

URL: http://svn.apache.org/viewvc?rev=408067&view=rev
Log:
Start readding per sitemap classpath

Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeBuilder.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java?rev=408067&r1=408066&r2=408067&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
Sat May 20 11:25:08 2006
@@ -102,6 +102,9 @@
     /** Bean Factory for this sitemap. */
     protected BeanFactory beanFactory;
 
+    /** Classloader for this sitemap. */
+    protected ClassLoader classLoader;
+
     /**
      * Builds a concrete processig, given the wrapping processor
      */
@@ -116,6 +119,7 @@
 
     /** Set the processor data, result of the treebuilder job */
     public void setProcessorData(BeanFactory beanFactory,
+                                 ClassLoader classLoader,
                                  ProcessingNode rootNode,
                                  List disposableNodes,
                                  List enterSitemapEventListeners,
@@ -123,7 +127,7 @@
         if (this.rootNode != null) {
             throw new IllegalStateException("setProcessorData() can only be called once");
         }
-
+        this.classLoader = classLoader;
         this.beanFactory = beanFactory;
         this.manager = (ServiceManager)this.beanFactory.getBean(ProcessingUtil.SERVICE_MANAGER_ROLE);
         this.rootNode = rootNode;
@@ -303,6 +307,8 @@
             requestCount++;
         }
 
+        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(this.classLoader);
         try {
             final EnterSitemapEvent enterEvent = new EnterSitemapEvent(this, environment);
             this.enteredSitemap(enterEvent);
@@ -360,6 +366,7 @@
                 // Marked for disposal and no more concurrent requests.
                 dispose();
             }
+            Thread.currentThread().setContextClassLoader(oldClassLoader);
         }
     }
 

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeBuilder.java?rev=408067&r1=408066&r2=408067&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeBuilder.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeBuilder.java
Sat May 20 11:25:08 2006
@@ -33,6 +33,8 @@
 
     ConcreteTreeProcessor getProcessor();
 
+    ClassLoader getClassLoader();
+
     void setProcessor(ConcreteTreeProcessor processor);
 
     /**

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java?rev=408067&r1=408066&r2=408067&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
Sat May 20 11:25:08 2006
@@ -412,6 +412,7 @@
                 this.beanFactory = treeBuilder.getBeanFactory();
                 newProcessor.setProcessorData(
                         this.beanFactory,
+                        treeBuilder.getClassLoader(),
                         root,
                         treeBuilder.getDisposableNodes(),
                         treeBuilder.getEnterSitemapEventListeners(),

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java?rev=408067&r1=408066&r2=408067&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
Sat May 20 11:25:08 2006
@@ -185,6 +185,9 @@
     /** Nodes registered using registerNode() */
     private Map registeredNodes = new HashMap();
 
+    /** Class Loader for this sitemap. */
+    private ClassLoader itsClassLoader = this.getClass().getClassLoader();
+
     /**
      * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
      */
@@ -246,6 +249,13 @@
     }
 
     /**
+     * @see org.apache.cocoon.components.treeprocessor.TreeBuilder#getClassLoader()
+     */
+    public ClassLoader getClassLoader() {
+        return this.itsClassLoader;
+    }
+
+    /**
      * @see org.apache.cocoon.components.treeprocessor.TreeBuilder#getEnterSitemapEventListeners()
      */
     public List getEnterSitemapEventListeners() {
@@ -363,11 +373,15 @@
             }
         }
         // Context and manager and classloader for the sitemap we build
+        
         final Context itsContext = createContext(tree);
 
         // TODO Get factory from spring
         final BeanFactoryFactoryImpl factory = new BeanFactoryFactoryImpl();
         factory.setBeanFactory(this.beanFactory);
+
+        // TODO Create class loader (and filter classpath configuration from componentConfig!)
+        // this.itsClassLoader = factory.createClassLoader(itsContext, componentConfig.getChild("classpath",
false));
 
         // check for sitemap local properties
         Settings settings = (Settings)factory.getCurrentBeanFactory(itsContext).getBean(ProcessingUtil.SETTINGS_ROLE);



Mime
View raw message