cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dani...@apache.org
Subject svn commit: r370295 - in /cocoon/trunk: cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/ cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/ cocoon-core/src/main/java/org/apache/cocoon/core/
Date Wed, 18 Jan 2006 22:46:26 GMT
Author: danielf
Date: Wed Jan 18 14:46:13 2006
New Revision: 370295

URL: http://svn.apache.org/viewcvs?rev=370295&view=rev
Log:
Refactored the CoreUtil so that the setup of Settings and Context are separated. Also removed the more flexible configuration method options as it to centralized for the blocks architecture. Made the BlockManager less Avalonish in its setup.

Modified:
    cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockContext.java
    cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockManager.java
    cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlocksManager.java
    cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/CoreUtil.java
    cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/LoggerUtil.java
    cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/Core.java

Modified: cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockContext.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockContext.java?rev=370295&r1=370294&r2=370295&view=diff
==============================================================================
--- cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockContext.java (original)
+++ cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockContext.java Wed Jan 18 14:46:13 2006
@@ -43,8 +43,7 @@
     private BlockWiring wiring;
     private Block block;
     
-    public BlockContext(ServletContext parentContext, BlockWiring wiring, Block block)
-    throws ServletException, MalformedURLException {
+    public BlockContext(ServletContext parentContext, BlockWiring wiring, Block block) {
         super(parentContext);
         this.wiring = wiring;
         this.block = block;

Modified: cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockManager.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockManager.java?rev=370295&r1=370294&r2=370295&view=diff
==============================================================================
--- cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockManager.java (original)
+++ cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockManager.java Wed Jan 18 14:46:13 2006
@@ -16,7 +16,6 @@
 package org.apache.cocoon.blocks;
 
 import java.io.IOException;
-import java.net.URL;
 
 import javax.servlet.Servlet;
 import javax.servlet.ServletConfig;
@@ -25,27 +24,22 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.activity.Initializable;
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
 import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.logger.LogEnabled;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.Constants;
 import org.apache.cocoon.blocks.util.CoreUtil;
 import org.apache.cocoon.blocks.util.ServletConfigurationWrapper;
-import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.components.LifecycleHelper;
 import org.apache.cocoon.components.container.CocoonServiceManager;
-import org.apache.cocoon.components.container.ComponentContext;
+import org.apache.cocoon.core.Core;
+import org.apache.cocoon.core.Settings;
 import org.apache.cocoon.core.container.CoreServiceManager;
-import org.apache.cocoon.environment.http.HttpContext;
+import org.apache.cocoon.core.container.SingleComponentServiceManager;
 import org.apache.cocoon.util.ClassUtils;
 
 /**
@@ -53,12 +47,11 @@
  */
 public class BlockManager
     extends HttpServlet
-    implements Block, Configurable, Contextualizable, Disposable, Initializable, LogEnabled { 
+    implements Block, Configurable, LogEnabled { 
 
     public static String ROLE = BlockManager.class.getName();
 
     private Logger logger;
-    private Context context;
     private Configuration config;
     private ServiceManager serviceManager;
 
@@ -72,47 +65,64 @@
         this.logger = logger;
     }
 
-    public void contextualize(Context context) throws ContextException {
-        this.context = context;
-    }
-
     public void configure(Configuration config)
         throws ConfigurationException {
         this.config = config;
     }
 
-    public void initialize() throws Exception {
+    protected final Logger getLogger() {
+        return this.logger;
+    }
+
+    // FIXME The InterBlockServiceManager need access to the BlocksManager,
+    // it should preferably just need to access something more component
+    // handling specific.
+    public void setBlocks(Blocks blocks) {
+        this.blocks = blocks;
+    }
+
+    public void init(ServletConfig servletConfig) throws ServletException {
+        super.init(servletConfig);
         this.blockWiring = new BlockWiring();
         this.blockWiring.setServletContext(this.getServletContext());
-        LifecycleHelper.setupComponent(this.blockWiring,
-                                       this.getLogger(),
-                                       null,
-                                       null,
-                                       this.config);    
+        try {
+            LifecycleHelper.setupComponent(this.blockWiring,
+                                           this.getLogger(),
+                                           null,
+                                           null,
+                                           this.config);
+        } catch (Exception e) {
+            throw new ServletException(e);
+        }    
 
         getLogger().debug("Initializing new Block Manager: " + this.blockWiring.getId());
 
         this.blockContext =
             new BlockContext(this.getServletContext(), this.blockWiring, this);
         this.contextURL = CoreUtil.getContextURL(this.blockContext, BlockConstants.BLOCK_CONF);
-        Context newContext = this.getAvalonContext();
-        String confLocation = this.contextURL + "::";
-
         ServletConfig blockServletConfig =
             new ServletConfigurationWrapper(this.getServletConfig(), this.blockContext);
-        if (this.blockWiring.isCore()) {
-            this.getLogger().debug("Block with core=true");
-            CoreUtil coreUtil = new CoreUtil(blockServletConfig, BlockConstants.BLOCK_CONF);
-            this.serviceManager = coreUtil.getServiceManager();
-       } else {
-            // Create a service manager for getting components from other blocks
-            ServiceManager topServiceManager = new InterBlockServiceManager(this.blockWiring, this.blocks);
-            ((InterBlockServiceManager)topServiceManager).enableLogging(this.getLogger());
 
-            this.serviceManager =
-                this.createLocalSourceResolverSM(newContext, topServiceManager, confLocation);
+        Settings settings = CoreUtil.createSettings(blockServletConfig);
+        Context newContext =
+            CoreUtil.createContext(blockServletConfig, settings, BlockConstants.BLOCK_CONF); 
+        Core core = new Core(settings, newContext);
+        String confLocation = this.contextURL + "::";
+
+        // Create a service manager for getting components from other blocks
+        ServiceManager topServiceManager = new InterBlockServiceManager(this.blockWiring, this.blocks);
+        ((InterBlockServiceManager)topServiceManager).enableLogging(this.getLogger());
+
+        this.serviceManager = new SingleComponentServiceManager(topServiceManager, core, Core.ROLE);
+        if (!this.blockWiring.isCore()) {
+            this.getLogger().debug("Non core Block");
+            try {
+                this.serviceManager =
+                    this.createLocalSourceResolverSM(newContext, this.serviceManager , confLocation);
+            } catch (Exception e) {
+                throw new ServletException(e);
+            }
         }
-        // FIXME this.settings = (Settings) this.serviceManager.lookup(Core.ROLE);
         
         // Create a service manager with the exposed components of the block
         if (this.blockWiring.getComponentConfiguration() != null) {
@@ -120,53 +130,81 @@
                 new DefaultConfiguration("components", confLocation);
             componentConf.addAll(this.blockWiring.getComponentConfiguration());
             this.serviceManager = new CocoonServiceManager(this.serviceManager);
-            LifecycleHelper.setupComponent(this.serviceManager,
-                    this.getLogger(),
-                    newContext,
-                    null,
-                    componentConf);
+            try {
+                LifecycleHelper.setupComponent(this.serviceManager,
+                        this.getLogger(),
+                        newContext,
+                        null,
+                        componentConf);
+            } catch (Exception e) {
+                throw new ServletException(e);
+            }
         }
 
         // Create a servlet for the block
         if (this.blockWiring.hasServlet()) {
             String servletClass = this.blockWiring.getServletClass();
-            this.blockServlet = (Servlet) ClassUtils.newInstance(servletClass);
-            LifecycleHelper.setupComponent(this.blockServlet,
-                    this.getLogger(),
-                    newContext,
-                    this.serviceManager,
-                    this.blockWiring.getServletConfiguration());
+            try {
+                this.blockServlet = (Servlet) ClassUtils.newInstance(servletClass);
+                LifecycleHelper.setupComponent(this.blockServlet,
+                        this.getLogger(),
+                        newContext,
+                        this.serviceManager,
+                        this.blockWiring.getServletConfiguration());
+            } catch (Exception e) {
+                throw new ServletException(e);
+            }
             this.blockServlet.init(blockServletConfig);            
         }
     }
 
-    public void dispose() {
+    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+        // Request to the own block
+        try {
+            // It is important to set the current block context each time
+            // a new block is entered, this is used for the block
+            // protocol
+            BlockCallStack.enterBlock(this.blockContext);
+            this.blockServlet.service(request, response);
+        } finally {
+            BlockCallStack.leaveBlock();
+        }
     }
-    
-    protected final Logger getLogger() {
-        return this.logger;
+
+    public String getServletInfo() {
+        return "BlockManager";
     }
 
+    public void destroy() {
+        super.destroy();
+    }
+    
     /**
-     * @throws Exception
+     * The exported components of the block. Return null if the block doesn't export components.
+     * 
+     * @return a ServiceManager containing the blocks exported components
      */
-    protected Context getAvalonContext() throws Exception {
-        ComponentContext newContext = new ComponentContext(this.context);
-        // A block is supposed to be an isolated unit so it should not have
-        // any direct access to the global root context
-        newContext.put(ContextHelper.CONTEXT_ROOT_URL, new URL(this.contextURL));
-        newContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, new HttpContext(this.blockContext));
-        newContext.makeReadOnly();
-        
-        return newContext;
+    public ServiceManager getServiceManager() {
+        // Check that the block have a local service manager
+        if (this.blockWiring.getComponentConfiguration() != null) {
+            return this.serviceManager;
+        } else {
+            return null;
+        }
+    }
+
+    public Servlet getBlockServlet() {
+        return this.blockServlet;
     }
 
     /**
      * @param newContext
      * @param confLocation
+     * @throws Exception 
      * @throws Exception
      */
-    protected ServiceManager createLocalSourceResolverSM(Context newContext, ServiceManager parentServiceManager, String confLocation) throws Exception {
+    protected ServiceManager createLocalSourceResolverSM(Context newContext,
+            ServiceManager parentServiceManager, String confLocation) throws Exception {
         // The source resolver must be defined in this service
         // manager, otherwise the root path will be the one from the
         // parent manager, we add a resolver to get it right. If the
@@ -192,60 +230,5 @@
                 null,
                 sourceManagerConf);
         return sourceResolverSM;
-    }
-
-    // Block methods
-
-    // The blocks manager should not be available within a block so I
-    // didn't want to make it part of the parent manager. But this is
-    // a little bit clumsy. Question is what components, if any, the
-    // blocks should have in common.
-    public void setBlocks(Blocks blocks) {
-        this.blocks = blocks;
-    }
-
-    /**
-     * The exported components of the block. Return null if the block doesn't export components.
-     * 
-     * @return a ServiceManager containing the blocks exported components
-     */
-    public ServiceManager getServiceManager() {
-        // Check that the block have a local service manager
-        if (this.blockWiring.getComponentConfiguration() != null) {
-            return this.serviceManager;
-        } else {
-            return null;
-        }
-    }
-    
-    // Servlet methods
-
-        public void init(ServletConfig servletConfig) throws ServletException {
-            super.init(servletConfig);
-    }
-
-        protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-            // Request to the own block
-            try {
-                // It is important to set the current block context each time
-                // a new block is entered, this is used for the block
-                // protocol
-                BlockCallStack.enterBlock(this.blockContext);
-                this.blockServlet.service(request, response);
-            } finally {
-                BlockCallStack.leaveBlock();
-            }
-        }
-
-        public String getServletInfo() {
-                return "BlockManager";
-        }
-
-        public void destroy() {
-            super.destroy();
-    }
-    
-    public Servlet getBlockServlet() {
-        return this.blockServlet;
     }
 }

Modified: cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlocksManager.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlocksManager.java?rev=370295&r1=370294&r2=370295&view=diff
==============================================================================
--- cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlocksManager.java (original)
+++ cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlocksManager.java Wed Jan 18 14:46:13 2006
@@ -20,6 +20,7 @@
 import java.util.Iterator;
 
 import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
@@ -29,18 +30,14 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
-import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.cocoon.Modifiable;
 import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.blocks.util.CoreUtil;
 import org.apache.cocoon.blocks.util.LoggerUtil;
 import org.apache.cocoon.blocks.util.ServletConfigurationWrapper;
 import org.apache.cocoon.components.LifecycleHelper;
 import org.apache.cocoon.components.source.SourceUtil;
 import org.apache.cocoon.components.source.impl.DelayedRefreshSourceWrapper;
-import org.apache.cocoon.core.Core;
-import org.apache.cocoon.core.Settings;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.impl.URLSource;
 import org.xml.sax.InputSource;
@@ -56,7 +53,6 @@
         Modifiable { 
 
     public static String ROLE = BlocksManager.class.getName();
-    private Context context;
     private BlocksContext blocksContext;
 
     private Source wiringFile;
@@ -68,11 +64,8 @@
         super.init(servletConfig);
         this.blocksContext = new BlocksContext(this.getServletContext(), this);
         
-        CoreUtil coreUtil = new CoreUtil(this.getServletConfig(), BlockConstants.WIRING);
-        Core core = coreUtil.getCore();
-        Settings settings = coreUtil.getSettings();
-        this.context = core.getContext();
-        LoggerUtil loggerUtil = new LoggerUtil(this.getServletConfig(), this.context, settings);
+        LoggerUtil loggerUtil =
+            new LoggerUtil(this.getServletConfig(), BlockConstants.WIRING);
         this.logger = loggerUtil.getCocoonLogger();
         this.getLogger().debug("Initializing the Blocks Manager");
         
@@ -117,17 +110,17 @@
                     " id=" + id +
                     " location=" + location);
             BlockManager blockManager = new BlockManager();
-            blockManager.init(blocksConfig);
             blockManager.setBlocks(this);
             try {
                 LifecycleHelper.setupComponent(blockManager,
                         this.getLogger(),
-                        this.context,
+                        null,
                         null,
                         blockConf);
             } catch (Exception e) {
                 throw new ServletException(e);
             }
+            blockManager.init(blocksConfig);
             this.blocks.put(id, blockManager);
             String mountPath = blockConf.getChild("mount").getAttribute("path", null);
             if (mountPath != null) {
@@ -138,9 +131,9 @@
     }
     
     public void destroy() {
-        Iterator blocksIter = this.blocks.entrySet().iterator();
+        Iterator blocksIter = this.blocks.values().iterator();
         while (blocksIter.hasNext()) {
-            LifecycleHelper.dispose(blocksIter.next());
+            ((Servlet)blocksIter.next()).destroy();
         }
         this.blocks = null;
         this.mountedBlocks = null;

Modified: cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/CoreUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/CoreUtil.java?rev=370295&r1=370294&r2=370295&view=diff
==============================================================================
--- cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/CoreUtil.java (original)
+++ cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/CoreUtil.java Wed Jan 18 14:46:13 2006
@@ -17,60 +17,32 @@
 package org.apache.cocoon.blocks.util;
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Constructor;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
 
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.context.ContextException;
 import org.apache.avalon.framework.context.DefaultContext;
-import org.apache.avalon.framework.logger.Logger;
-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.components.container.ComponentContext;
 import org.apache.cocoon.core.Core;
-import org.apache.cocoon.core.CoreFatalException;
-import org.apache.cocoon.core.CoreInitializationException;
 import org.apache.cocoon.core.MutableSettings;
-import org.apache.cocoon.core.PropertyProvider;
 import org.apache.cocoon.core.Settings;
-import org.apache.cocoon.core.container.SingleComponentServiceManager;
-import org.apache.cocoon.core.source.SimpleSourceResolver;
 import org.apache.cocoon.environment.Context;
 import org.apache.cocoon.environment.http.HttpContext;
 import org.apache.cocoon.servlet.SettingsHelper;
-import org.apache.cocoon.util.ClassUtils;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.excalibur.source.TraversableSource;
 
 /**
- * This is an utility class to create a new Cocoon instance.
- * 
- * TODO - Remove dependencies to LogKit and Log4J
+ * This is an utility class to create Settings, Context and Core.
  * 
  * @version $Id$
  * @since 2.2
  */
 public class CoreUtil {
 
-    /** Parameter map for the context protocol */
-    private static final Map CONTEXT_PARAMETERS = Collections.singletonMap(
-            "force-traversable", Boolean.TRUE);
-
     /**
      * Application <code>Context</code> Key for the servlet configuration
      * 
@@ -78,59 +50,188 @@
      */
     public static final String CONTEXT_SERVLET_CONFIG = "servlet-config";
 
-    private ServletConfig config;
-
-    private ServletContext servletContext;
-
-    /** "legacy" support: create an avalon context. */
-    private final DefaultContext appContext = new ComponentContext();
-
-    private Context environmentContext;
-
-    /** The settings. */
-    private MutableSettings settings;
-
-    /** The parent service manager. */
-    private ServiceManager parentManager;
-
-    /** The root logger. */
-    private Logger log;
-
-    private ClassLoader classloader;
-
-    private File contextForWriting = null;
-
-    private String contextURL;
-
-    public CoreUtil(ServletConfig config) throws ServletException {
-        this(config, "/WEB-INF/web.xml");
-    }
-
-    /**
-     * Setup a new instance.
-     * 
-     * @param config
-     * @param knownFile
-     *            path to a file that is supposed to be present in the servlet
-     *            context and that is used for calculating the context URI
-     * @throws ServletException
-     */
-    public CoreUtil(ServletConfig config, String knownFile)
-            throws ServletException {
-        this.config = config;
-        this.servletContext = this.config.getServletContext();
-        this.servletContext.log("Initializing Apache Cocoon "
-                + Constants.VERSION);
-
-        this.contextURL = CoreUtil
-                .getContextURL(this.servletContext, knownFile);
-        String writeableContextPath = CoreUtil
-                .getWritableContextPath(this.servletContext);
-        if (writeableContextPath != null) {
-            this.contextForWriting = new File(writeableContextPath);
-        }
-        this.environmentContext = new HttpContext(config.getServletContext());
-        this.init();
+    public static MutableSettings createSettings(ServletConfig servletConfig) throws ServletException {
+            // create settings
+            ServletContext servletContext1 = servletConfig.getServletContext();
+            
+            // create an empty settings objects
+            final MutableSettings s = new MutableSettings();
+            
+            // fill from the environment configuration, like web.xml etc.
+            // fill from the servlet parameters
+            SettingsHelper.fill(s, servletConfig);
+            if (s.getWorkDirectory() == null) {
+                final File workDir1 = (File) servletContext1.getAttribute("javax.servlet.context.tempdir");
+                s.setWorkDirectory(workDir1.getAbsolutePath());
+            }
+            if (s.getLoggingConfiguration() == null) {
+                s.setLoggingConfiguration("/WEB-INF/logkit.xconf");
+            }
+            MutableSettings settings = s;
+            ServletContext servletContext = servletConfig.getServletContext();
+    
+            File contextForWriting = null;
+            String writeableContextPath = CoreUtil.getWritableContextPath(servletContext);
+            if (writeableContextPath != null) {
+                contextForWriting = new File(writeableContextPath);
+    }
+    
+            // first init the work-directory for the logger.
+            // this is required if we are running inside a war file!
+            final String workDirParam = settings.getWorkDirectory();
+            File workDir;
+            if (workDirParam != null) {
+                if (contextForWriting == null) {
+                    // No context path : consider work-directory as absolute
+                    workDir = new File(workDirParam);
+                } else {
+                    // Context path exists : is work-directory absolute ?
+                    File workDirParamFile = new File(workDirParam);
+                    if (workDirParamFile.isAbsolute()) {
+                        // Yes : keep it as is
+                        workDir = workDirParamFile;
+                    } else {
+                        // No : consider it relative to context path
+                        workDir = new File(contextForWriting, workDirParam);
+                    }
+                }
+            } else {
+                workDir = new File("cocoon-files");
+            }
+            workDir.mkdirs();
+            settings.setWorkDirectory(workDir.getAbsolutePath());
+    
+            // Output some debug info
+            servletContext.log("Writeable Context: " + contextForWriting);
+            if (workDirParam != null) {
+                servletContext.log("Using work-directory " + workDir);
+            } else {
+                servletContext.log("Using default work-directory " + workDir);
+            }
+    
+            final String uploadDirParam = settings.getUploadDirectory();
+            File uploadDir;
+            if (uploadDirParam != null) {
+                if (contextForWriting == null) {
+                    uploadDir = new File(uploadDirParam);
+                } else {
+                    // Context path exists : is upload-directory absolute ?
+                    File uploadDirParamFile = new File(uploadDirParam);
+                    if (uploadDirParamFile.isAbsolute()) {
+                        // Yes : keep it as is
+                        uploadDir = uploadDirParamFile;
+                    } else {
+                        // No : consider it relative to context path
+                        uploadDir = new File(contextForWriting, uploadDirParam);
+                    }
+                }
+                servletContext.log("Using upload-directory " + uploadDir);
+            } else {
+                uploadDir = new File(workDir, "upload-dir" + File.separator);
+                servletContext.log("Using default upload-directory " + uploadDir);
+            }
+            uploadDir.mkdirs();
+            settings.setUploadDirectory(uploadDir.getAbsolutePath());
+    
+            String cacheDirParam = settings.getCacheDirectory();
+            File cacheDir;
+            if (cacheDirParam != null) {
+                if (contextForWriting == null) {
+                    cacheDir = new File(cacheDirParam);
+                } else {
+                    // Context path exists : is cache-directory absolute ?
+                    File cacheDirParamFile = new File(cacheDirParam);
+                    if (cacheDirParamFile.isAbsolute()) {
+                        // Yes : keep it as is
+                        cacheDir = cacheDirParamFile;
+                    } else {
+                        // No : consider it relative to context path
+                        cacheDir = new File(contextForWriting, cacheDirParam);
+                    }
+                }
+                servletContext.log("Using cache-directory " + cacheDir);
+            } else {
+                cacheDir = new File(workDir, "cache-dir" + File.separator);
+                File parent = cacheDir.getParentFile();
+                if (parent != null) {
+                    parent.mkdirs();
+                }
+                servletContext.log("cache-directory was not set - defaulting to " + cacheDir);
+            }
+            cacheDir.mkdirs();
+            settings.setCacheDirectory(cacheDir.getAbsolutePath());
+            
+            /*
+             * Doesn't work when the CoreUtil is called on both the BlocksManager
+             * and the BlockManager level (which will be fixed later) furthermore
+             * the configuration file path configuration isn't necessary as we have
+             * default positions for the files.
+             * 
+            String configFileName = settings.getConfiguration();
+            final String usedFileName;
+    
+            if (configFileName == null) {
+                servletContext.log("Servlet initialization argument 'configurations' not specified, attempting to use '/WEB-INF/cocoon.xconf'");
+                usedFileName = "/WEB-INF/cocoon.xconf";
+            } else {
+                usedFileName = configFileName;
+            }
+    
+            servletContext.log("Using configuration file: " + usedFileName);
+    
+            URL result;
+            try {
+                // test if this is a qualified url
+                if (usedFileName.indexOf(':') == -1) {
+                    result = servletContext.getResource(usedFileName);
+                } else {
+                    result = new URL(usedFileName);
+                }
+            } catch (Exception mue) {
+                String msg = "Init parameter 'configurations' is invalid : " + usedFileName;
+                servletContext.log(msg, mue);
+                throw new ServletException(msg, mue);
+            }
+    
+            if (result == null) {
+                File resultFile = new File(usedFileName);
+                if (resultFile.isFile()) {
+                    try {
+                        result = resultFile.getCanonicalFile().toURL();
+                    } catch (Exception e) {
+                        String msg = "Init parameter 'configurations' is invalid : "
+                                + usedFileName;
+                        servletContext.log(msg, e);
+                        throw new ServletException(msg, e);
+                    }
+                }
+            }
+    
+            if (result == null) {
+                String msg = "Init parameter 'configurations' doesn't name an existing resource : "
+                        + usedFileName;
+                servletContext.log(msg);
+                throw new ServletException(msg);
+            }
+    
+            // update configuration
+            final URL u = result;
+            settings.setConfiguration(u.toExternalForm());
+            */
+            
+            // settings can't be changed anymore
+            settings.makeReadOnly();
+            
+            return settings;
+        }
+
+    public static DefaultContext createContext(ServletConfig servletConfig,
+            Settings settings, String knownFile) throws ServletException {
+        DefaultContext appContext = new ComponentContext();
+        CoreUtil.addSourceResolverContext(appContext, servletConfig, knownFile);
+        CoreUtil.addSettingsContext(appContext, settings);
+        CoreUtil.addCoreContext(appContext, new Core(settings, appContext));
+        return appContext;
     }
 
     public static String getWritableContextPath(ServletContext servletContext) {
@@ -141,8 +242,8 @@
      * @param servletContext
      * @throws ServletException
      */
-    public static String getContextURL(ServletContext servletContext,
-            String knownFile) throws ServletException {
+    public static String getContextURL(ServletContext servletContext, String knownFile)
+    throws ServletException {
         String path = CoreUtil.getWritableContextPath(servletContext);
         String contextURL;
         if (path == null) {
@@ -182,524 +283,58 @@
         }
         return contextURL;
     }
-
-    private void init() throws ServletException {
-        // first let's set up the appContext with some values to make
-        // the simple source resolver work
+    
+    /*
+     * set up the appContext with some values to make
+     * the simple source resolver work
+     */
+    private static void addSourceResolverContext(DefaultContext appContext,
+            ServletConfig servletConfig,
+            String knownFile) throws ServletException {
+        
+        ServletContext servletContext = servletConfig.getServletContext();
+        String contextURL = CoreUtil.getContextURL(servletContext, knownFile);
+        servletContext.log("Context URL: " + contextURL);
 
         // add root url
         try {
-            appContext.put(ContextHelper.CONTEXT_ROOT_URL, new URL(
-                    this.contextURL));
+            appContext.put(ContextHelper.CONTEXT_ROOT_URL, new URL(contextURL));
         } catch (MalformedURLException ignore) {
             // we simply ignore this
         }
 
+        Context environmentContext = new HttpContext(servletConfig.getServletContext());
         // add environment context
-        this.appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT,
-                this.environmentContext);
+        appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, environmentContext);
 
         // now add environment specific information
-        this.appContext.put(CONTEXT_SERVLET_CONFIG, this.config);
-
-        // create settings
-        this.settings = this.createSettings();
-
-        // first init the work-directory for the logger.
-        // this is required if we are running inside a war file!
-        final String workDirParam = this.settings.getWorkDirectory();
-        File workDir;
-        if (workDirParam != null) {
-            if (this.contextForWriting == null) {
-                // No context path : consider work-directory as absolute
-                workDir = new File(workDirParam);
-            } else {
-                // Context path exists : is work-directory absolute ?
-                File workDirParamFile = new File(workDirParam);
-                if (workDirParamFile.isAbsolute()) {
-                    // Yes : keep it as is
-                    workDir = workDirParamFile;
-                } else {
-                    // No : consider it relative to context path
-                    workDir = new File(this.contextForWriting, workDirParam);
-                }
-            }
-        } else {
-            workDir = new File("cocoon-files");
-        }
-        workDir.mkdirs();
-        this.appContext.put(Constants.CONTEXT_WORK_DIR, workDir);
-        this.settings.setWorkDirectory(workDir.getAbsolutePath());
-
-        // Output some debug info
-        this.servletContext.log("Context URL: " + this.contextURL);
-        this.servletContext.log("Writeable Context: " + this.contextForWriting);
-        if (workDirParam != null) {
-            this.servletContext.log("Using work-directory " + workDir);
-        } else {
-            this.servletContext.log("Using default work-directory " + workDir);
-        }
-
-        final String uploadDirParam = this.settings.getUploadDirectory();
-        File uploadDir;
-        if (uploadDirParam != null) {
-            if (this.contextForWriting == null) {
-                uploadDir = new File(uploadDirParam);
-            } else {
-                // Context path exists : is upload-directory absolute ?
-                File uploadDirParamFile = new File(uploadDirParam);
-                if (uploadDirParamFile.isAbsolute()) {
-                    // Yes : keep it as is
-                    uploadDir = uploadDirParamFile;
-                } else {
-                    // No : consider it relative to context path
-                    uploadDir = new File(this.contextForWriting, uploadDirParam);
-                }
-            }
-            this.servletContext.log("Using upload-directory " + uploadDir);
-        } else {
-            uploadDir = new File(workDir, "upload-dir" + File.separator);
-            this.servletContext.log("Using default upload-directory "
-                    + uploadDir);
-        }
-        uploadDir.mkdirs();
-        appContext.put(Constants.CONTEXT_UPLOAD_DIR, uploadDir);
-        this.settings.setUploadDirectory(uploadDir.getAbsolutePath());
-
-        String cacheDirParam = this.settings.getCacheDirectory();
-        File cacheDir;
-        if (cacheDirParam != null) {
-            if (this.contextForWriting == null) {
-                cacheDir = new File(cacheDirParam);
-            } else {
-                // Context path exists : is cache-directory absolute ?
-                File cacheDirParamFile = new File(cacheDirParam);
-                if (cacheDirParamFile.isAbsolute()) {
-                    // Yes : keep it as is
-                    cacheDir = cacheDirParamFile;
-                } else {
-                    // No : consider it relative to context path
-                    cacheDir = new File(this.contextForWriting, cacheDirParam);
-                }
-            }
-            this.servletContext.log("Using cache-directory " + cacheDir);
-        } else {
-            cacheDir = new File(workDir, "cache-dir" + File.separator);
-            File parent = cacheDir.getParentFile();
-            if (parent != null) {
-                parent.mkdirs();
-            }
-            this.servletContext
-                    .log("cache-directory was not set - defaulting to "
-                            + cacheDir);
-        }
-        cacheDir.mkdirs();
-        appContext.put(Constants.CONTEXT_CACHE_DIR, cacheDir);
-        this.settings.setCacheDirectory(cacheDir.getAbsolutePath());
-        
-        /*
-         * Doesn't work when the CoreUtil is called on both the BlocksManager
-         * and the BlockManager level (which will be fixed later) furthermore
-         * the configuration file path configuration isn't necessary as we have
-         * default positions for the files.
-         * 
-        String configFileName = this.settings.getConfiguration();
-        final String usedFileName;
-
-        if (configFileName == null) {
-            this.servletContext
-                    .log("Servlet initialization argument 'configurations' not specified, attempting to use '/WEB-INF/cocoon.xconf'");
-            usedFileName = "/WEB-INF/cocoon.xconf";
-        } else {
-            usedFileName = configFileName;
-        }
+        appContext.put(CONTEXT_SERVLET_CONFIG, servletConfig);        
+    }
 
-        this.servletContext.log("Using configuration file: " + usedFileName);
+    private static void addSettingsContext(DefaultContext appContext, Settings settings) {
+        appContext.put(Constants.CONTEXT_WORK_DIR, settings.getWorkDirectory());
 
-        URL result;
-        try {
-            // test if this is a qualified url
-            if (usedFileName.indexOf(':') == -1) {
-                result = this.config.getServletContext().getResource(
-                        usedFileName);
-            } else {
-                result = new URL(usedFileName);
-            }
-        } catch (Exception mue) {
-            String msg = "Init parameter 'configurations' is invalid : "
-                    + usedFileName;
-            this.servletContext.log(msg, mue);
-            throw new ServletException(msg, mue);
-        }
+        appContext.put(Constants.CONTEXT_UPLOAD_DIR, settings.getUploadDirectory());
 
-        if (result == null) {
-            File resultFile = new File(usedFileName);
-            if (resultFile.isFile()) {
-                try {
-                    result = resultFile.getCanonicalFile().toURL();
-                } catch (Exception e) {
-                    String msg = "Init parameter 'configurations' is invalid : "
-                            + usedFileName;
-                    this.servletContext.log(msg, e);
-                    throw new ServletException(msg, e);
-                }
-            }
-        }
+        appContext.put(Constants.CONTEXT_CACHE_DIR, settings.getCacheDirectory());
 
-        if (result == null) {
-            String msg = "Init parameter 'configurations' doesn't name an existing resource : "
-                    + usedFileName;
-            this.servletContext.log(msg);
-            throw new ServletException(msg);
-        }
+        //appContext.put(Constants.CONTEXT_CONFIG_URL, settings.getConfiguration());
 
-        // update configuration
-        final URL u = result;
-        this.settings.setConfiguration(u.toExternalForm());
-        this.appContext.put(Constants.CONTEXT_CONFIG_URL, u);
-        */
-        
         // set encoding
-        this.appContext.put(Constants.CONTEXT_DEFAULT_ENCODING, settings
-                .getFormEncoding());
+        appContext.put(Constants.CONTEXT_DEFAULT_ENCODING, settings.getFormEncoding());
 
         // set class loader
-        this.appContext.put(Constants.CONTEXT_CLASS_LOADER, this.classloader);
-
-        // create the Core object
-        final Core core = this.createCore();
-
-        // create parent service manager
-        this.parentManager = this.getParentServiceManager(core);
-
-        // settings can't be changed anymore
-        settings.makeReadOnly();
-
-        // 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);
+        appContext.put(Constants.CONTEXT_CLASS_LOADER, null);
 
         // FIXME - for now we just set an empty string as this information is
         // looked up
         // by other components
-        this.appContext.put(Constants.CONTEXT_CLASSPATH, "");
+        appContext.put(Constants.CONTEXT_CLASSPATH, "");        
     }
 
-    public Core getCore() {
-        try {
-            return (Core) this.parentManager.lookup(Core.ROLE);
-        } catch (ServiceException neverIgnore) {
-            // this should never happen!
-            throw new CoreFatalException(
-                    "Fatal exception: no Cocoon core available.", neverIgnore);
-        }
-    }
-
-    /**
-     * Create a new core instance. This method can be overwritten in sub
-     * classes.
-     * 
-     * @return A new core object.
-     */
-    private Core createCore() {
-        final Core c = new Core(this.settings, this.appContext);
-        return c;
-    }
-
-    /**
-     * Return the settings object.
-     */
-    public Settings getSettings() {
-        return this.settings;
-    }
-
-    public ServiceManager getServiceManager() {
-        return this.parentManager;
-    }
-
-    /**
-     * Instatiates the parent service manager, as specified in the
-     * parent-service-manager init parameter.
-     * 
-     * If none is specified, the method returns <code>null</code>.
-     * 
-     * @return the parent service manager, or <code>null</code>.
-     */
-    private ServiceManager getParentServiceManager(Core core) {
-        String parentServiceManagerClass = this.settings
-                .getParentServiceManagerClassName();
-        String parentServiceManagerInitParam = null;
-        if (parentServiceManagerClass != null) {
-            int dividerPos = parentServiceManagerClass.indexOf('/');
-            if (dividerPos != -1) {
-                parentServiceManagerInitParam = parentServiceManagerInitParam
-                        .substring(dividerPos + 1);
-                parentServiceManagerClass = parentServiceManagerClass
-                        .substring(0, dividerPos);
-            }
-        }
-
-        ServiceManager parentServiceManager = null;
-        if (parentServiceManagerClass != null) {
-            try {
-                Class pcm = ClassUtils.loadClass(parentServiceManagerClass);
-                Constructor pcmc = pcm
-                        .getConstructor(new Class[] { String.class });
-                parentServiceManager = (ServiceManager) pcmc
-                        .newInstance(new Object[] { parentServiceManagerInitParam });
-
-                ContainerUtil.enableLogging(parentServiceManager, this.log);
-                ContainerUtil.contextualize(parentServiceManager,
-                        this.appContext);
-                ContainerUtil.initialize(parentServiceManager);
-            } catch (Exception e) {
-                if (this.log.isErrorEnabled()) {
-                    this.log
-                            .error(
-                                    "Could not initialize parent component manager.",
-                                    e);
-                }
-            }
-        }
-        return new SingleComponentServiceManager(parentServiceManager, core,
-                Core.ROLE);
-    }
-
-    /**
-     * Get the settings for Cocoon. This method reads several property files and
-     * merges the result. If there is more than one definition for a property,
-     * the last one wins. The property files are read in the following order: 1)
-     * context://WEB-INF/properties/*.properties Default values for the core and
-     * each block - the order in which the files are read is not guaranteed. 2)
-     * context://WEB-INF/properties/[RUNNING_MODE]/*.properties Default values
-     * for the running mode - the order in which the files are read is not
-     * guaranteed. 3) Property providers (ToBeDocumented) 4) The environment
-     * (CLI, Servlet etc.) adds own properties (e.g. from web.xml) 5) Additional
-     * property file specified by the "org.apache.cocoon.settings" system
-     * property or if the property is not found, the file
-     * ".cocoon/settings.properties" is tried to be read from the user
-     * directory. 6) System properties
-     * 
-     * @return A new Settings object
-     */
-    private MutableSettings createSettings() {
-        // get the running mode
-        final String mode = System.getProperty(Settings.PROPERTY_RUNNING_MODE,
-                Settings.DEFAULT_RUNNING_MODE);
-        this.config.getServletContext().log("Running in mode: " + mode);
-
-        // create an empty settings objects
-        final MutableSettings s = new MutableSettings();
-
-        // we need our own resolver
-        final SourceResolver resolver = this
-                .createSourceResolver(new LoggerWrapper(this.config
-                        .getServletContext()));
-
-        // now read all properties from the properties directory
-        this.readProperties("context://WEB-INF/properties", s, resolver);
-        // read all properties from the mode dependent directory
-        this
-                .readProperties("context://WEB-INF/properties/" + mode, s,
-                        resolver);
-
-        // Next look for custom property providers
-        Iterator i = s.getPropertyProviders().iterator();
-        while (i.hasNext()) {
-            final String className = (String) i.next();
-            try {
-                PropertyProvider provider = (PropertyProvider) ClassUtils
-                        .newInstance(className);
-                s.fill(provider.getProperties());
-            } catch (Exception ignore) {
-                this.config.getServletContext().log(
-                        "Unable to get property provider for class "
-                                + className, ignore);
-                this.config.getServletContext().log(
-                        "Continuing initialization.");
-            }
-        }
-        // fill from the environment configuration, like web.xml etc.
-        // fill from the servlet parameters
-        SettingsHelper.fill(s, this.config);
-        if (s.getWorkDirectory() == null) {
-            final File workDir = (File) this.config.getServletContext()
-                    .getAttribute("javax.servlet.context.tempdir");
-            s.setWorkDirectory(workDir.getAbsolutePath());
-        }
-        if (s.getLoggingConfiguration() == null) {
-            s.setLoggingConfiguration("/WEB-INF/logkit.xconf");
-        }
-
-        // read additional properties file
-        String additionalPropertyFile = s.getProperty(
-                Settings.PROPERTY_USER_SETTINGS, System
-                        .getProperty(Settings.PROPERTY_USER_SETTINGS));
-        // if there is no property defining the addition file, we try it in the
-        // home directory
-        if (additionalPropertyFile == null) {
-            additionalPropertyFile = System.getProperty("user.home")
-                    + File.separator + ".cocoon/settings.properties";
-            final File testFile = new File(additionalPropertyFile);
-            if (!testFile.exists()) {
-                additionalPropertyFile = null;
-            }
-        }
-        if (additionalPropertyFile != null) {
-            this.config.getServletContext().log(
-                    "Reading user settings from '" + additionalPropertyFile
-                            + "'");
-            final Properties p = new Properties();
-            try {
-                FileInputStream fis = new FileInputStream(
-                        additionalPropertyFile);
-                p.load(fis);
-                fis.close();
-            } catch (IOException ignore) {
-                this.config.getServletContext().log(
-                        "Unable to read '" + additionalPropertyFile + "'.",
-                        ignore);
-                this.config.getServletContext().log(
-                        "Continuing initialization.");
-            }
-        }
-        // now overwrite with system properties
-        s.fill(System.getProperties());
-
-        return s;
-    }
-
-    /**
-     * Read all property files from the given directory and apply them to the
-     * settings.
-     */
-    private void readProperties(String directoryName, MutableSettings s,
-            SourceResolver resolver) {
-        Source directory = null;
-        try {
-            directory = resolver.resolveURI(directoryName, null,
-                    CONTEXT_PARAMETERS);
-            if (directory.exists() && directory instanceof TraversableSource) {
-                final Iterator c = ((TraversableSource) directory)
-                        .getChildren().iterator();
-                while (c.hasNext()) {
-                    final Source src = (Source) c.next();
-                    if (src.getURI().endsWith(".properties")) {
-                        final InputStream propsIS = src.getInputStream();
-                        this.config.getServletContext()
-                                .log(
-                                        "Reading settings from '"
-                                                + src.getURI() + "'.");
-                        final Properties p = new Properties();
-                        p.load(propsIS);
-                        propsIS.close();
-                        s.fill(p);
-                    }
-                }
-            }
-        } catch (IOException ignore) {
-            this.config.getServletContext().log(
-                    "Unable to read from directory 'WEB-INF/properties'.",
-                    ignore);
-            this.config.getServletContext().log("Continuing initialization.");
-        } finally {
-            resolver.release(directory);
-        }
-    }
-
-    /**
-     * Create a simple source resolver.
-     */
-    private SourceResolver createSourceResolver(Logger logger) {
-        // Create our own resolver
-        final SimpleSourceResolver resolver = new SimpleSourceResolver();
-        resolver.enableLogging(logger);
-        try {
-            resolver.contextualize(this.appContext);
-        } catch (ContextException ce) {
-            throw new CoreInitializationException(
-                    "Cannot setup source resolver.", ce);
-        }
-        return resolver;
-    }
-
-    private static final class LoggerWrapper implements Logger {
-        private final ServletContext context;
-
-        public LoggerWrapper(ServletContext context) {
-            this.context = context;
-        }
-
-        private void text(String arg0, Throwable arg1) {
-            if (arg1 != null) {
-                this.context.log(arg0, arg1);
-            } else {
-                this.context.log(arg0);
-            }
-        }
-
-        public void debug(String arg0, Throwable arg1) {
-            // we ignore debug
-        }
-
-        public void debug(String arg0) {
-            // we ignore debug
-        }
-
-        public void error(String arg0, Throwable arg1) {
-            this.text(arg0, arg1);
-        }
-
-        public void error(String arg0) {
-            this.text(arg0, null);
-        }
-
-        public void fatalError(String arg0, Throwable arg1) {
-            this.text(arg0, arg1);
-        }
-
-        public void fatalError(String arg0) {
-            this.text(arg0, null);
-        }
-
-        public Logger getChildLogger(String arg0) {
-            return this;
-        }
-
-        public void info(String arg0, Throwable arg1) {
-            // we ignore info
-        }
-
-        public void info(String arg0) {
-            // we ignore info
-        }
-
-        public boolean isDebugEnabled() {
-            return false;
-        }
-
-        public boolean isErrorEnabled() {
-            return true;
-        }
-
-        public boolean isFatalErrorEnabled() {
-            return true;
-        }
-
-        public boolean isInfoEnabled() {
-            return false;
-        }
-
-        public boolean isWarnEnabled() {
-            return false;
-        }
-
-        public void warn(String arg0, Throwable arg1) {
-            // we ignore warn
-        }
-
-        public void warn(String arg0) {
-            // we ignore warn
-        }
+    private static void addCoreContext(DefaultContext appContext, Core core) {
+        // put the core into the context - this is for internal use only
+        // The Cocoon container fetches the Core object using the context.
+        appContext.put(Core.ROLE, core);
     }
 }

Modified: cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/LoggerUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/LoggerUtil.java?rev=370295&r1=370294&r2=370295&view=diff
==============================================================================
--- cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/LoggerUtil.java (original)
+++ cocoon/trunk/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/LoggerUtil.java Wed Jan 18 14:46:13 2006
@@ -22,6 +22,8 @@
 import java.util.Iterator;
 import java.util.Map;
 import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+
 import org.apache.avalon.excalibur.logger.Log4JConfLoggerManager;
 import org.apache.avalon.excalibur.logger.LoggerManager;
 import org.apache.avalon.excalibur.logger.ServletLogger;
@@ -83,12 +85,12 @@
      * Setup a new instance.
      * 
      * @param config
+     * @throws ServletException 
      */
-    public LoggerUtil(ServletConfig config, Context appContext,
-            Settings settings) {
+    public LoggerUtil(ServletConfig config, String knownFile) throws ServletException {
         this.config = config;
-        this.appContext = appContext;
-        this.settings = settings;
+        this.settings = CoreUtil.createSettings(config);
+        this.appContext = CoreUtil.createContext(this.config, this.settings, knownFile);
         // Init logger
         this.initLogger();
     }

Modified: cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/Core.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/Core.java?rev=370295&r1=370294&r2=370295&view=diff
==============================================================================
--- cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/Core.java (original)
+++ cocoon/trunk/cocoon-core/src/main/java/org/apache/cocoon/core/Core.java Wed Jan 18 14:46:13 2006
@@ -145,9 +145,11 @@
     }
 
     /**
+     * Should not be used will be removed soon
      * Return the Avalon context.
      * @return The Avalon context.
      */
+    // FIXME
     public Context getContext() {
         return this.context;
     }



Mime
View raw message