You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by da...@apache.org on 2005/11/26 19:57:34 UTC

svn commit: r349135 - in /cocoon/trunk/src: java/org/apache/cocoon/ java/org/apache/cocoon/components/blocks/ java/org/apache/cocoon/core/ test/org/apache/cocoon/test/

Author: danielf
Date: Sat Nov 26 10:57:25 2005
New Revision: 349135

URL: http://svn.apache.org/viewcvs?rev=349135&view=rev
Log:
Starting to integrate the blocks functionality in CoreUtil and later in the CocoonServlet. Added processorClass to settings to make the root processor confgurable.
Started refactoring CoreUtil to get rid of explicit references to Cocoon using Processor instead.
Factored out the processor part of the BlocksManager to the new class BlockDispatcherProcessor.
Updated the tests.

Added:
    cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlockDispatcherProcessor.java   (with props)
Modified:
    cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java
    cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlocksManager.java
    cocoon/trunk/src/java/org/apache/cocoon/core/BaseSettings.java
    cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java
    cocoon/trunk/src/java/org/apache/cocoon/core/MutableSettings.java
    cocoon/trunk/src/test/org/apache/cocoon/test/SitemapTestCase.java

Modified: cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java?rev=349135&r1=349134&r2=349135&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java Sat Nov 26 10:57:25 2005
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon;
 
+import org.apache.avalon.excalibur.logger.LoggerManageable;
 import org.apache.avalon.excalibur.logger.LoggerManager;
 import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.activity.Initializable;
@@ -79,7 +80,8 @@
                    Modifiable,
                    Processor,
                    Contextualizable,
-                   Serviceable {
+                   Serviceable,
+                   LoggerManageable {
 
     // Register the location finder for Avalon configuration objects and exceptions
     // and keep a strong reference to it.

Added: cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlockDispatcherProcessor.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlockDispatcherProcessor.java?rev=349135&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlockDispatcherProcessor.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlockDispatcherProcessor.java Sat Nov 26 10:57:25 2005
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2005 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.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.components.blocks;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.cocoon.Processor;
+import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.environment.internal.EnvironmentHelper;
+
+/**
+ * @version SVN $Id$
+ */
+public class BlockDispatcherProcessor extends AbstractLogEnabled implements Processor {
+
+    private BlocksManager blocksManager;
+
+    /** Processor attributes */
+    private Map processorAttributes = new HashMap();
+   
+    /**
+     * @param blocksManager
+     */
+    public BlockDispatcherProcessor(BlocksManager blocksManager) {
+        this.blocksManager = blocksManager;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#process(org.apache.cocoon.environment.Environment)
+     */
+    public boolean process(Environment environment) throws Exception {
+        String uri = environment.getURI();
+        String oldPrefix = environment.getURIPrefix();
+        String oldURI = uri;
+        // The mount points start with '/' make sure that the URI also
+        // does, so that they are compareable.
+        if (uri.length() == 0 || uri.charAt(0) != '/') {
+            uri = "/" + uri;
+        }
+        Block block = this.blocksManager.getMountedBlock(uri);
+        if (block == null) {
+            return false;
+        } else {
+            // Resolve the URI relative to the mount point
+            String mountPoint = block.getMountPath();
+            uri = uri.substring(mountPoint.length());
+            getLogger().debug("Enter processing in block at " + mountPoint);
+            try {
+                environment.setURI("", uri);
+                // It is important to set the current block each time
+                // a new block is entered, this is used for the block
+                // protocol
+                EnvironmentHelper.enterProcessor(block, null, environment);
+                return block.process(environment);
+            } finally {
+                EnvironmentHelper.leaveProcessor();
+                environment.setURI(oldPrefix, oldURI);
+                getLogger().debug("Leaving processing in block at " + mountPoint);
+            }
+        }
+    }
+
+    /* (non-Javadoc)
+     * Not relevant for the block dispatcher as it don't has an own pipeline
+     * @see org.apache.cocoon.Processor#buildPipeline(org.apache.cocoon.environment.Environment)
+     */
+    public InternalPipelineDescription buildPipeline(Environment environment)
+            throws Exception {
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#getComponentConfigurations()
+     */
+    public Configuration[] getComponentConfigurations() {
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * The block dispatcher is always the root processor in the processing chain
+     * @see org.apache.cocoon.Processor#getRootProcessor()
+     */
+    public Processor getRootProcessor() {
+        return this;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#getSourceResolver()
+     */
+    public SourceResolver getSourceResolver() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#getContext()
+     */
+    public String getContext() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#setAttribute(java.lang.String, java.lang.Object)
+     */
+    public void setAttribute(String name, Object value) {
+        this.processorAttributes.put(name, value);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#getAttribute(java.lang.String)
+     */
+    public Object getAttribute(String name) {
+        return this.processorAttributes.get(name);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#removeAttribute(java.lang.String)
+     */
+    public Object removeAttribute(String name) {
+        return this.processorAttributes.remove(name);
+    }
+
+}

Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlockDispatcherProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlockDispatcherProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlocksManager.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlocksManager.java?rev=349135&r1=349134&r2=349135&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlocksManager.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/blocks/BlocksManager.java Sat Nov 26 10:57:25 2005
@@ -35,9 +35,10 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.Processor;
 import org.apache.cocoon.components.LifecycleHelper;
+import org.apache.cocoon.core.Core;
 import org.apache.cocoon.environment.Environment;
-import org.apache.cocoon.environment.internal.EnvironmentHelper;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
 
@@ -46,18 +47,22 @@
  */
 public class BlocksManager
     extends AbstractLogEnabled
-    implements Configurable, Contextualizable, Disposable, Initializable, Serviceable, ThreadSafe { 
+    implements Configurable, Contextualizable, Disposable, Initializable, Serviceable, ThreadSafe, Processor { 
 
     public static String ROLE = BlocksManager.class.getName();
     private ServiceManager serviceManager;
     private Context context;
 
-    private String wiringFile;
+    private String wiringFile = null;
     private HashMap blocks = new HashMap();
     private TreeMap mountedBlocks = new TreeMap(new InverseLexicographicalOrder());
+    
+    private Core core;
+    private Processor processor;
 
     public void service(ServiceManager manager) throws ServiceException {
         this.serviceManager = manager;
+        this.core = (Core)this.serviceManager.lookup(Core.ROLE);
     }
 
     public void contextualize(Context context) throws ContextException {
@@ -112,6 +117,7 @@
                                   " at " + mountPath);
             }
         }
+        this.createProcessor();
     }
 
     public void dispose() {
@@ -119,73 +125,88 @@
         while (blocksIter.hasNext()) {
             LifecycleHelper.dispose(blocksIter.next());
         }
+        if (this.serviceManager != null) {
+            this.serviceManager.release(this.core);
+            this.core = null;
+            this.serviceManager = null;            
+        }
         this.blocks = null;
         this.mountedBlocks = null;
-        this.serviceManager = null;
     }
 
-    /* 
-       The BlocksManager could be merged with the Cocoon object and be
-       responsible for all processing. In that case it should
-       implement Processor, at the moment it is called from a protocol
-       and delagates to a BlockManager, so there is no point in
-       implementing the whole Processor interface.
-
-       The largest mount point that is a prefix of the URI is
-       chosen. The implementation could be made much more efficient.
-    */
-    public boolean process(Environment environment) throws Exception {
-        String uri = environment.getURI();
-        String oldPrefix = environment.getURIPrefix();
-        String oldURI = uri;
-        // The mount points start with '/' make sure that the URI also
-        // does, so that they are compareable.
-        if (uri.length() == 0 || uri.charAt(0) != '/') {
-            uri = "/" + uri;
-        }
+    private void createProcessor() {
+        this.processor = new BlockDispatcherProcessor(this);
+        ((BlockDispatcherProcessor)this.processor).enableLogging(this.getLogger());
+    }
+    
+    public Block getBlock(String blockId) {
+        return (Block)this.blocks.get(blockId);
+    }
+    
+    /**
+     * The block with the largest mount point that is a prefix of the URI is
+     * chosen. The implementation could be made much more efficient.
+     * @param uri
+     * @return
+     */
+    public Block getMountedBlock(String uri) {
+        Block block = null;
         // All mount points that are before or equal to the URI in
         // lexicographical order. This includes all prefixes.
-        Map possiblePrefixes = mountedBlocks.tailMap(uri);
+        Map possiblePrefixes = this.mountedBlocks.tailMap(uri);
         Iterator possiblePrefixesIt = possiblePrefixes.entrySet().iterator();
-        BlockManager block = null;
-        String mountPoint = null;
         // Find the largest prefix to the uri
         while (possiblePrefixesIt.hasNext()) {
             Map.Entry entry = (Map.Entry) possiblePrefixesIt.next();
-            mountPoint = (String)entry.getKey();
+            String mountPoint = (String)entry.getKey();
             if (uri.startsWith(mountPoint)) {
                 block = (BlockManager)entry.getValue();
                 break;
             }
         }
-        if (block == null) {
-            return false;
-        } else {
-            // Resolve the URI relative to the mount point
-            uri = uri.substring(mountPoint.length());
-            getLogger().debug("Enter processing in block at " + mountPoint);
-            try {
-                environment.setURI("", uri);
-                // It is important to set the current block each time
-                // a new block is entered, this is used for the block
-                // protocol
-                EnvironmentHelper.enterProcessor(block, null, environment);
-                return block.process(environment);
-            } finally {
-                EnvironmentHelper.leaveProcessor();
-                environment.setURI(oldPrefix, oldURI);
-                getLogger().debug("Leaving processing in block at " + mountPoint);
-            }
-        }
-    }
-
-    public Block getBlock(String blockId) {
-	return (Block)this.blocks.get(blockId);
+        return block;
     }
 
     private static class InverseLexicographicalOrder implements Comparator {
         public int compare(Object o1, Object o2) {
             return ((String)o2).compareTo((String)o1);
         }
+    }
+
+    // Processor methods
+    public boolean process(Environment environment) throws Exception {
+        return this.processor.process(environment);
+    }
+
+    public InternalPipelineDescription buildPipeline(Environment environment) throws Exception {
+        return this.processor.buildPipeline(environment);
+    }
+
+    public Configuration[] getComponentConfigurations() {
+        return this.processor.getComponentConfigurations();
+    }
+
+    public Processor getRootProcessor() {
+        return this.processor.getRootProcessor();
+    }
+
+    public org.apache.cocoon.environment.SourceResolver getSourceResolver() {
+        return this.processor.getSourceResolver();
+    }
+
+    public String getContext() {
+        return this.processor.getContext();
+    }
+
+    public void setAttribute(String name, Object value) {
+        this.processor.setAttribute(name, value);
+    }
+
+    public Object getAttribute(String name) {
+        return this.processor.getAttribute(name);
+    }
+
+    public Object removeAttribute(String name) {
+        return this.processor.removeAttribute(name);
     }
 }

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=349135&r1=349134&r2=349135&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/BaseSettings.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/BaseSettings.java Sat Nov 26 10:57:25 2005
@@ -47,6 +47,12 @@
      */
     String KEY_FORCE_PROPERTIES = "system.properties";
 
+    /** This parameter specifies the class for the root processor */
+    String KEY_PROCESSOR_CLASS = "processor";
+    
+    /** The default root processor */
+    String DEFAULT_PROCESSOR_CLASS = "org.apache.cocoon.Cocoon";
+    
     /**
      * This parameter points to the main configuration file for Cocoon.
      * Note that the path is specified in absolute notation but it will be
@@ -162,6 +168,12 @@
      */
     String KEY_PROPERTY_PROVIDER = "property.provider";
 
+    /**
+     * @return Returns the class for the root processor
+     * @see #KEY_PROCESSOR_CLASS
+     */
+    String getProcessorClassName();
+    
     /**
      * @return Returns the configuration.
      * @see #KEY_CONFIGURATION

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=349135&r1=349134&r2=349135&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java Sat Nov 26 10:57:25 2005
@@ -32,6 +32,7 @@
 import java.util.Properties;
 
 import org.apache.avalon.excalibur.logger.Log4JConfLoggerManager;
+import org.apache.avalon.excalibur.logger.LoggerManageable;
 import org.apache.avalon.excalibur.logger.LoggerManager;
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
@@ -46,6 +47,8 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.Cocoon;
 import org.apache.cocoon.Constants;
+import org.apache.cocoon.Modifiable;
+import org.apache.cocoon.Processor;
 import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.components.container.ComponentContext;
 import org.apache.cocoon.configuration.ConfigurationBuilder;
@@ -93,8 +96,8 @@
     /** The logger manager. */
     protected LoggerManager loggerManager;
 
-    /** The Cocoon instance (the root processor). */
-    protected Cocoon cocoon;
+    /** The Root processor instance */
+    protected Processor processor;
 
     /** Is this a per request logger manager */
     protected boolean isPerRequestLoggerManager = false;
@@ -657,41 +660,6 @@
     }
 
     /**
-     * Creates the Cocoon object and handles exception handling.
-     */
-    public synchronized Cocoon createCocoon()
-    throws Exception {
-
-        this.updateEnvironment();
-        this.forceLoad();
-        this.forceProperty();
-
-        try {
-            if (this.log.isInfoEnabled()) {
-                this.log.info("Reloading from: " + this.settings.getConfiguration());
-            }
-            Cocoon c = (Cocoon)ClassUtils.newInstance("org.apache.cocoon.Cocoon");
-            ContainerUtil.enableLogging(c, getCocoonLogger());
-            c.setLoggerManager(this.loggerManager);
-            ContainerUtil.contextualize(c, this.appContext);
-
-            // create the Core object
-            final Core core = this.createCore();
-            this.parentManager = this.getParentServiceManager(core);
-            ContainerUtil.service(c, this.parentManager);
-
-            ContainerUtil.initialize(c);
-            this.settings.setCreationTime(System.currentTimeMillis());
-            this.cocoon = c;
-        } catch (Exception e) {
-            this.log.error("Exception reloading Cocoon.", e);
-            this.disposeCocoon();
-            throw e;
-        }
-        return this.cocoon;
-    }
-
-    /**
      * Create the classloader that inlcudes all the [block]/BLOCK-INF/classes directories. 
      * @throws Exception
      */
@@ -732,7 +700,7 @@
                 resolver.release(classesDir);
             }
         }
-
+    
         // setup the classloader using the current classloader as parent
         ClassLoader parentClassloader = Thread.currentThread().getContextClassLoader();
         URL[] urls = (URL[]) urlList.toArray(new URL[urlList.size()]);        
@@ -742,12 +710,69 @@
     }
 
     /**
+     * Creates the Cocoon object and handles exception handling.
+     */
+    public synchronized Cocoon createCocoon()
+    throws Exception {        
+        this.createProcessor();
+        return (Cocoon)this.processor;
+    }
+
+    /**
      * Gets the current cocoon object.
      * Reload cocoon if configuration changed or we are reloading.
      * Ensure that the correct classloader is set.
      */
     public Cocoon getCocoon(final String pathInfo, final String reloadParam)
     throws Exception {
+        this.getProcessor(pathInfo, reloadParam);
+        return (Cocoon)this.processor;
+    }
+
+    /**
+     * Creates the root processor object and handles exception handling.
+     */
+    public synchronized Processor createProcessor()
+    throws Exception {
+
+        this.updateEnvironment();
+        this.forceLoad();
+        this.forceProperty();
+
+        try {
+            if (this.log.isInfoEnabled()) {
+                this.log.info("Reloading from: " + this.settings.getConfiguration());
+            }
+            Processor p = (Processor)ClassUtils.newInstance(this.settings.getProcessorClassName());
+            ContainerUtil.enableLogging(p, getCocoonLogger());
+            if (p instanceof LoggerManageable) {
+                ((LoggerManageable)p).setLoggerManager(this.loggerManager);
+            }
+            ContainerUtil.contextualize(p, this.appContext);
+
+            // create the Core object
+            final Core core = this.createCore();
+            this.parentManager = this.getParentServiceManager(core);
+            ContainerUtil.service(p, this.parentManager);
+
+            ContainerUtil.initialize(p);
+            this.settings.setCreationTime(System.currentTimeMillis());
+            this.processor = p;
+        } catch (Exception e) {
+            this.log.error("Exception reloading root processor.", e);
+            this.disposeProcessor();
+            throw e;
+        }
+        return this.processor;
+    }
+
+    /**
+     * Gets the current root processor object.
+     * Reload the root processor if configuration changed or we are reloading.
+     * Ensure that the correct classloader is set.
+     */
+    public Processor getProcessor(final String pathInfo, final String reloadParam)
+    throws Exception {
         
         // set the blocks classloader for this thread
         Thread.currentThread().setContextClassLoader(this.classloader);        
@@ -755,8 +780,8 @@
         if (this.settings.isReloadingEnabled("config")) {
             boolean reload = false;
 
-            if (this.cocoon != null) {
-                if (this.cocoon.modifiedSince(this.settings.getCreationTime())) {
+            if (this.processor != null) {
+                if (this.processor instanceof Modifiable && ((Modifiable)this.processor).modifiedSince(this.settings.getCreationTime())) {
                     if (this.log.isInfoEnabled()) {
                         this.log.info("Configuration changed reload attempt");
                     }
@@ -776,22 +801,22 @@
 
             if (reload) {
                 this.init();
-                this.createCocoon();
+                this.createProcessor();
             }
         }
-        return this.cocoon;
+        return this.processor;
     }
 
     /**
-     * Destroy Cocoon
+     * Destroy root processor
      */
-    protected final void disposeCocoon() {
-        if (this.cocoon != null) {
+    protected final void disposeProcessor() {
+        if (this.processor != null) {
             if (this.log.isDebugEnabled()) {
-                this.log.debug("Disposing Cocoon");
+                this.log.debug("Disposing root processor");
             }
-            ContainerUtil.dispose(this.cocoon);
-            this.cocoon = null;
+            ContainerUtil.dispose(this.processor);
+            this.processor = null;
         }
         ContainerUtil.dispose(this.parentManager);
         this.parentManager = null;
@@ -889,10 +914,10 @@
     }
 
     /**
-     * Dispose Cocoon when environment is destroyed
+     * Dispose the root processor when environment is destroyed
      */
     public void destroy() {
-        this.disposeCocoon();
+        this.disposeProcessor();
     }
 
     /**

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=349135&r1=349134&r2=349135&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/MutableSettings.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/MutableSettings.java Sat Nov 26 10:57:25 2005
@@ -50,6 +50,11 @@
     protected Map forceProperties = new HashMap();
 
     /**
+     * This parameter indicates what class to use for the root processor.
+     */
+    protected String processorClassName = DEFAULT_PROCESSOR_CLASS;
+    
+    /**
      * 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.
@@ -243,7 +248,9 @@
                     key = key.substring(KEYPREFIX.length());
                     final String value = current.getValue().toString();
 
-                    if ( key.equals(KEY_CONFIGURATION) ) {
+                    if ( key.equals(KEY_PROCESSOR_CLASS) ) {
+                        this.processorClassName = value;
+                    } else if ( key.equals(KEY_CONFIGURATION) ) {
                         this.configuration = value;
                     } else if ( key.equals(KEY_RELOAD_DELAY) ) {
                         this.configurationReloadDelay = NumberUtils.toLong(value);
@@ -348,6 +355,13 @@
     }
 
     /**
+     * @return Returns the processorClassName.
+     */
+    public String getProcessorClassName() {
+        return this.processorClassName;
+    }
+
+    /**
      * @return Returns the configuration.
      */
     public String getConfiguration() {
@@ -534,7 +548,9 @@
         String value = null;
         if ( key.startsWith(KEYPREFIX) ) {
             final String sKey = key.substring(KEYPREFIX.length());
-            if ( sKey.equals(KEY_CONFIGURATION) ) {
+            if ( sKey.equals(KEY_PROCESSOR_CLASS) ) {
+                value = this.processorClassName;
+            } else if ( sKey.equals(KEY_CONFIGURATION) ) {
                 value = this.configuration;
             } else if ( sKey.equals(KEY_RELOAD_DELAY) ) {
                 value = String.valueOf(this.configurationReloadDelay);
@@ -607,6 +623,7 @@
     public String toString() {
         return "Settings:\n" +
           "Running mode : " + this.getProperty(PROPERTY_RUNNING_MODE, DEFAULT_RUNNING_MODE) + '\n' +
+          KEY_PROCESSOR_CLASS + " : " + this.processorClassName + '\n' +
           KEY_CONFIGURATION + " : " + this.configuration + '\n' +
           KEY_RELOAD_DELAY + " : " + this.configurationReloadDelay + '\n' +
           KEY_RELOADING + " : " + this.reloadingEnabled + '\n' +
@@ -705,6 +722,14 @@
     public void setCacheDirectory(String cacheDirectory) {
         this.checkWriteable();
         this.cacheDirectory = cacheDirectory;
+    }
+
+    /**
+     * @param processorClassName The processorClassName to set.
+     */
+    public void setProcessorClassName(String processorClassName) {
+        this.checkWriteable();
+        this.processorClassName = processorClassName;
     }
 
     /**

Modified: cocoon/trunk/src/test/org/apache/cocoon/test/SitemapTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/test/SitemapTestCase.java?rev=349135&r1=349134&r2=349135&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/test/SitemapTestCase.java (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/test/SitemapTestCase.java Sat Nov 26 10:57:25 2005
@@ -27,6 +27,7 @@
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.cocoon.Cocoon;
+import org.apache.cocoon.Processor;
 import org.apache.cocoon.core.BootstrapEnvironment;
 import org.apache.cocoon.core.CoreUtil;
 import org.apache.cocoon.test.core.TestBootstrapEnvironment;
@@ -48,7 +49,7 @@
 
     private Logger logger;
     private CoreUtil coreUtil;
-    private Cocoon cocoon;
+    private Processor processor;
     private String classDir;
 
     protected void setUp() throws Exception {
@@ -77,7 +78,7 @@
                                          this.logger);
 
         this.coreUtil = new TestCoreUtil(env);
-        this.cocoon = this.coreUtil.createCocoon();
+        this.processor = this.coreUtil.createProcessor();
     }
 
     protected void tearDown() throws Exception {
@@ -91,11 +92,17 @@
     }
     
     protected final Object lookup( final String key ) throws ServiceException {
-        return this.cocoon.getServiceManager().lookup( key );
+        if (this.processor instanceof Cocoon) {
+            return ((Cocoon)this.processor).getServiceManager().lookup( key );
+        } else {
+            throw new ServiceException(key, "The processor have no service manager");
+        }
     }
 
     protected final void release( final Object object ) {
-        this.cocoon.getServiceManager().release( object );
+        if (this.processor instanceof Cocoon) {
+            ((Cocoon)this.processor).getServiceManager().release( object );
+        }
     }
     
     /**
@@ -136,7 +143,7 @@
         byte[] assertiondocument = null;
 
         try {
-            resolver = this.cocoon.getSourceResolver();
+            resolver = this.processor.getSourceResolver();
             assertNotNull("Test lookup of source resolver", resolver);
 
             assertionsource = resolver.resolveURI(source);
@@ -199,7 +206,7 @@
 
     protected byte[] process(String uri) throws Exception {
         MockEnvironment env = getEnvironment(uri);
-        this.cocoon.process(env);
+        this.processor.process(env);
         getLogger().info("Output: " + new String(env.getOutput(), "UTF-8"));
 
         return env.getOutput();