Author: pier
Date: Thu Nov  4 15:07:57 2004
New Revision: 56628

Added:
   cocoon/whiteboard/kernel/sources/blocks/saxon/
   cocoon/whiteboard/kernel/sources/blocks/saxon/cocoon.xml
   cocoon/whiteboard/kernel/sources/blocks/saxon/saxonb-8.1.1.jar   (contents, 
props changed)
   cocoon/whiteboard/kernel/sources/extensions/jaxp/
   cocoon/whiteboard/kernel/sources/extensions/jaxp/cocoon.xml
   cocoon/whiteboard/kernel/sources/extensions/jaxp/src/
   cocoon/whiteboard/kernel/sources/extensions/jaxp/src/META-INF/
   cocoon/whiteboard/kernel/sources/extensions/jaxp/src/META-INF/services/
   
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/META-INF/services/javax.xml.parsers.DocumentBuilderFactory
   
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/META-INF/services/javax.xml.parsers.SAXParserFactory
   
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/META-INF/services/javax.xml.transform.TransformerFactory
   cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/
   cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/
   cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/cocoon/
   
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/cocoon/kernel/
   
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/cocoon/kernel/plugins/
   
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/cocoon/kernel/plugins/JaxpBuilderPlugin.java
   
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/cocoon/kernel/plugins/JaxpParserPlugin.java
   
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/cocoon/kernel/plugins/JaxpPlugin.java
   
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/cocoon/kernel/plugins/JaxpTransformerPlugin.java
   cocoon/whiteboard/kernel/sources/interfaces/jaxp/
   cocoon/whiteboard/kernel/sources/interfaces/jaxp/cocoon.xml
   cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/
   cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/
   cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/
   cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/
   
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/
   
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/
   
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/AbstractProvider.java
   
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/DefaultBuilderProvider.java
   
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/DefaultParserProvider.java
   
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/DefaultTransformerProvider.java
   
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/JaxpException.java
   
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/JaxpProvider.java
Modified:
   cocoon/whiteboard/kernel/build.xml
   
cocoon/whiteboard/kernel/sources/blocks/jasper/src/org/apache/cocoon/blocks/jasper/JasperServlet.java
   cocoon/whiteboard/kernel/sources/extensions/logging/cocoon.xml
   
cocoon/whiteboard/kernel/sources/extensions/logging/src/org/apache/cocoon/kernel/plugins/LoggingPlugin.java
   cocoon/whiteboard/kernel/sources/webapp/WEB-INF/configuration.xml
   cocoon/whiteboard/kernel/sources/webapp/WEB-INF/web.xml
   cocoon/whiteboard/kernel/sources/webapp/test.jsp
   cocoon/whiteboard/kernel/sources/webapp/test.kjsp
Log:
Adding JAXP plugin to the kernel:
The JAXP plugin allow each block to be configured with a different
SAXTransformerFactory / DocumentBuilder / SAXParser but each block
can look up and retrieve its own configured instance using the
default JAXP set of factories.
For example in this configuration the block "jasper" which executes
.kjsp files inside the kernel is associated with the "saxon" JAXP
transformer provider. So, everyone else will get the system default,
while "jasper" will get Saxon.
Simple note. I hate JSP too, but for debugging web applications they
are the best tool yet.

Modified: cocoon/whiteboard/kernel/build.xml
==============================================================================
--- cocoon/whiteboard/kernel/build.xml  (original)
+++ cocoon/whiteboard/kernel/build.xml  Thu Nov  4 15:07:57 2004
@@ -121,7 +121,7 @@
    + 
============================================================================ -->
 
   <target name="javadoc" unless="javadoc.uptodate" depends="webapp.prepare">
-    <javadoc destdir="${webapp.docs.dir}/javadoc"
+    <!--javadoc destdir="${webapp.docs.dir}/javadoc"
         author="true"
         version="true"
         use="true"
@@ -142,7 +142,7 @@
           href="http://java.sun.com/j2ee/1.4/docs/api/package-list";
           packagelistLoc="${tools.dir}/package-list/j2ee"
           offline="true"/>
-    </javadoc>
+    </javadoc-->
   </target>
 
   <!-- 
=========================================================================== +
@@ -214,14 +214,17 @@
   <!-- 
========================================================================== -->
   
   <target name="kernel.components">
-    <antcall target="kernel.component"><param name="name" 
value="extensions/logging"/></antcall>
     <antcall target="kernel.component"><param name="name" 
value="interfaces/datasource"/></antcall>
+    <antcall target="kernel.component"><param name="name" 
value="interfaces/jaxp"/></antcall>
     <antcall target="kernel.component"><param name="name" 
value="interfaces/servlet"/></antcall>
+    <antcall target="kernel.component"><param name="name" 
value="extensions/logging"/></antcall>
+    <antcall target="kernel.component"><param name="name" 
value="extensions/jaxp"/></antcall>
     <antcall target="kernel.component"><param name="name" 
value="modules/ant"/></antcall>
     <antcall target="kernel.component"><param name="name" 
value="modules/commons-collections"/></antcall>
     <antcall target="kernel.component"><param name="name" 
value="modules/commons-pool"/></antcall>
     <antcall target="kernel.component"><param name="name" 
value="blocks/commons-dbcp"/></antcall>
     <antcall target="kernel.component"><param name="name" 
value="blocks/jasper"/></antcall>
+    <antcall target="kernel.component"><param name="name" 
value="blocks/saxon"/></antcall>
   </target>
 
   <!-- 
=========================================================================== +

Modified: 
cocoon/whiteboard/kernel/sources/blocks/jasper/src/org/apache/cocoon/blocks/jasper/JasperServlet.java
==============================================================================
--- 
cocoon/whiteboard/kernel/sources/blocks/jasper/src/org/apache/cocoon/blocks/jasper/JasperServlet.java
       (original)
+++ 
cocoon/whiteboard/kernel/sources/blocks/jasper/src/org/apache/cocoon/blocks/jasper/JasperServlet.java
       Thu Nov  4 15:07:57 2004
@@ -24,9 +24,6 @@
 import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 
 import org.apache.cocoon.kernel.Kernel;
 import org.apache.cocoon.kernel.startup.ServletWrapper;

Added: cocoon/whiteboard/kernel/sources/blocks/saxon/cocoon.xml
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/kernel/sources/blocks/saxon/cocoon.xml    Thu Nov  4 
15:07:57 2004
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<block xmlns="http://apache.org/cocoon/kernel/descriptor/1.0";
+    id="http://cocoon.apache.org/kernel/blocks/saxon-b/8.1.1";>
+
+  <implementations>  
+    <implements 
interface="http://cocoon.apache.org/kernel/interfaces/jaxp/1.0"/>
+  </implementations>
+
+  <libraries>
+    <library href="saxonb-8.1.1.jar"/>
+  </libraries>
+
+  <provides 
component="org.apache.cocoon.interfaces.jaxp.DefaultTransformerProvider">
+    <set property="className" value="net.sf.saxon.TransformerFactoryImpl"/>
+  </provides>
+
+</block>

Added: cocoon/whiteboard/kernel/sources/blocks/saxon/saxonb-8.1.1.jar
==============================================================================
Binary file. No diff available.

Added: cocoon/whiteboard/kernel/sources/extensions/jaxp/cocoon.xml
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/kernel/sources/extensions/jaxp/cocoon.xml Thu Nov  4 
15:07:57 2004
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<extension xmlns="http://apache.org/cocoon/kernel/descriptor/1.0";
+    id="http://cocoon.apache.org/kernel/extensions/jaxp/1.0.0";>
+
+  <configuration element="jaxp"/>
+
+  <plugin class="org.apache.cocoon.kernel.plugins.JaxpTransformerPlugin"/>
+  <plugin class="org.apache.cocoon.kernel.plugins.JaxpParserPlugin"/>
+  <plugin class="org.apache.cocoon.kernel.plugins.JaxpBuilderPlugin"/>
+
+</extension>

Added: 
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/META-INF/services/javax.xml.parsers.DocumentBuilderFactory
==============================================================================
--- (empty file)
+++ 
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/META-INF/services/javax.xml.parsers.DocumentBuilderFactory
     Thu Nov  4 15:07:57 2004
@@ -0,0 +1 @@
+org.apache.cocoon.kernel.plugins.JaxpBuilderPlugin$Factory
\ No newline at end of file

Added: 
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/META-INF/services/javax.xml.parsers.SAXParserFactory
==============================================================================
--- (empty file)
+++ 
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/META-INF/services/javax.xml.parsers.SAXParserFactory
   Thu Nov  4 15:07:57 2004
@@ -0,0 +1 @@
+org.apache.cocoon.kernel.plugins.JaxpParserPlugin$Factory
\ No newline at end of file

Added: 
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/META-INF/services/javax.xml.transform.TransformerFactory
==============================================================================
--- (empty file)
+++ 
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/META-INF/services/javax.xml.transform.TransformerFactory
       Thu Nov  4 15:07:57 2004
@@ -0,0 +1 @@
+org.apache.cocoon.kernel.plugins.JaxpTransformerPlugin$Factory
\ No newline at end of file

Added: 
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/cocoon/kernel/plugins/JaxpBuilderPlugin.java
==============================================================================
--- (empty file)
+++ 
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/cocoon/kernel/plugins/JaxpBuilderPlugin.java
        Thu Nov  4 15:07:57 2004
@@ -0,0 +1,148 @@
+/* 
=============================================================================== 
*
+ * Copyright (C) 1999-2004, The Apache Software Foundation.   All rights 
reserved. *
+ *                                                                             
    *
+ * 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.kernel.plugins;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.cocoon.interfaces.jaxp.JaxpException;
+
+/**
+ * <p>TODO.</p> 
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Pier Fumagalli</a>
+ * @author Copyright &copy; 2000-2004 <a href="http://www.apache.org/";>The 
Apache
+ *         Software Foundation</a>. All rights reserved.
+ */
+public class JaxpBuilderPlugin extends JaxpPlugin {
+
+    /** <p>The attribute name of the configuration element.</p> */
+    public static final String ATTRIBUTE = "builder";
+
+    /** <p>The instance of this plugin for the nested JAXP factory.</p> */
+    private static JaxpBuilderPlugin instance = null;
+
+    /**
+     * <p>Create a new [EMAIL PROTECTED] JaxpBuilderPlugin} instance.</p>
+     */
+    public JaxpBuilderPlugin() {
+        super(DocumentBuilderFactory.class, JaxpBuilderPlugin.ATTRIBUTE);
+    }
+
+    /**
+     * <p>Initialize this [EMAIL PROTECTED] JaxpBuilderPlugin} instance.</p>
+     */
+    public void initialize() {
+        /* Check for duplicate initialization */
+        if (JaxpBuilderPlugin.instance != null) {
+            throw new IllegalStateException("Already initialized");
+        } else {
+            JaxpBuilderPlugin.instance = this;
+        }
+    }
+
+    /**
+     * <p>Destroy this [EMAIL PROTECTED] JaxpBuilderPlugin} instance.</p>
+     */
+    public void destroy() {
+        JaxpBuilderPlugin.instance = null;
+    }
+
+    /**
+     * <p>A simple wrapper around the [EMAIL PROTECTED] 
DocumentBuilderFactory} class.</p>
+     */
+    public static final class Factory extends DocumentBuilderFactory {
+        
+        /** <p>The wrapped [EMAIL PROTECTED] DocumentBuilderFactory}.</p> */
+        private DocumentBuilderFactory instance = null;
+        
+        /**
+         * <p>Create a new instance of this [EMAIL PROTECTED] Factory}.</p>
+         */
+        public Factory() {
+            try {
+                JaxpBuilderPlugin plugin = JaxpBuilderPlugin.instance;
+                this.instance = (DocumentBuilderFactory) plugin.newFactory();
+            } catch (JaxpException exception) {
+                throw exception;
+            } catch (Throwable throwable) {
+                String message = "Error accessing kernel-provided transformer";
+                throw new JaxpException(message, throwable);
+            }
+        }
+
+        public DocumentBuilder newDocumentBuilder()
+        throws ParserConfigurationException {
+            return this.instance.newDocumentBuilder();
+        }
+        
+        public void setAttribute(String name, Object value)
+        throws IllegalArgumentException {
+            this.instance.setAttribute(name, value);
+        }
+
+        public Object getAttribute(String name)
+        throws IllegalArgumentException {
+            return this.instance.getAttribute(name);
+        }
+        
+        public void setNamespaceAware(boolean awareness) {
+            this.instance.setNamespaceAware(awareness);
+        }
+
+        public void setValidating(boolean validating) {
+            this.instance.setValidating(validating);
+        }
+
+        public void setIgnoringElementContentWhitespace(boolean whitespace) {
+            this.instance.setIgnoringElementContentWhitespace(whitespace);
+        }
+
+        public void setExpandEntityReferences(boolean expandEntityRef) {
+            this.instance.setExpandEntityReferences(expandEntityRef);
+        }
+
+        public void setIgnoringComments(boolean ignoreComments) {
+            this.instance.setIgnoringComments(ignoreComments);
+        }
+
+        public void setCoalescing(boolean coalescing) {
+            this.instance.setCoalescing(coalescing);
+        }
+
+        public boolean isNamespaceAware() {
+            return this.instance.isNamespaceAware();
+        }
+
+        public boolean isValidating() {
+            return this.instance.isValidating();
+        }
+
+        public boolean isIgnoringElementContentWhitespace() {
+            return this.instance.isIgnoringElementContentWhitespace();
+        }
+
+        public boolean isExpandEntityReferences() {
+            return this.instance.isExpandEntityReferences();
+        }
+
+        public boolean isIgnoringComments() {
+            return this.instance.isIgnoringComments();
+        }
+
+        public boolean isCoalescing() {
+            return this.instance.isCoalescing();
+        }
+    }
+}

Added: 
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/cocoon/kernel/plugins/JaxpParserPlugin.java
==============================================================================
--- (empty file)
+++ 
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/cocoon/kernel/plugins/JaxpParserPlugin.java
 Thu Nov  4 15:07:57 2004
@@ -0,0 +1,121 @@
+/* 
=============================================================================== 
*
+ * Copyright (C) 1999-2004, The Apache Software Foundation.   All rights 
reserved. *
+ *                                                                             
    *
+ * 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.kernel.plugins;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.apache.cocoon.interfaces.jaxp.JaxpException;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+
+/**
+ * <p>TODO.</p> 
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Pier Fumagalli</a>
+ * @author Copyright &copy; 2000-2004 <a href="http://www.apache.org/";>The 
Apache
+ *         Software Foundation</a>. All rights reserved.
+ */
+public class JaxpParserPlugin extends JaxpPlugin {
+
+    /** <p>The attribute name of the configuration element.</p> */
+    public static final String ATTRIBUTE = "parser";
+
+    /** <p>The instance of this plugin for the nested JAXP factory.</p> */
+    private static JaxpParserPlugin instance = null;
+
+    /**
+     * <p>Create a new [EMAIL PROTECTED] JaxpParserPlugin} instance.</p>
+     */
+    public JaxpParserPlugin() {
+        super(SAXParserFactory.class, JaxpParserPlugin.ATTRIBUTE);
+    }
+
+    /**
+     * <p>Initialize this [EMAIL PROTECTED] JaxpParserPlugin} instance.</p>
+     */
+    public void initialize() {
+        /* Check for duplicate initialization */
+        if (JaxpParserPlugin.instance != null) {
+            throw new IllegalStateException("Already initialized");
+        } else {
+            JaxpParserPlugin.instance = this;
+        }
+    }
+
+    /**
+     * <p>Destroy this [EMAIL PROTECTED] JaxpParserPlugin} instance.</p>
+     */
+    public void destroy() {
+        JaxpParserPlugin.instance = null;
+    }
+
+    /**
+     * <p>A simple wrapper around the [EMAIL PROTECTED] SAXParserFactory} 
class.</p>
+     */
+    public static final class Factory extends SAXParserFactory {
+        
+        /** <p>The wrapped [EMAIL PROTECTED] DocumentBuilderFactory}.</p> */
+        private SAXParserFactory instance = null;
+
+        /**
+         * <p>Create a new instance of this [EMAIL PROTECTED] Factory}.</p>
+         */
+        public Factory() {
+            try {
+                JaxpParserPlugin plugin = JaxpParserPlugin.instance;
+                this.instance = (SAXParserFactory) plugin.newFactory();
+            } catch (JaxpException exception) {
+                throw exception;
+            } catch (Throwable throwable) {
+                String message = "Error accessing kernel-provided transformer";
+                throw new JaxpException(message, throwable);
+            }
+        }
+
+        public SAXParser newSAXParser()
+        throws ParserConfigurationException, SAXException {
+            return this.instance.newSAXParser();
+        }
+
+        
+        public void setNamespaceAware(boolean awareness) {
+            this.instance.setNamespaceAware(awareness);
+        }
+
+        public void setValidating(boolean validating) {
+            this.instance.setValidating(validating);
+        }
+
+        public boolean isNamespaceAware() {
+            return this.instance.isNamespaceAware();
+        }
+
+        public boolean isValidating() {
+            return this.instance.isValidating();
+        }
+
+        public void setFeature(String name, boolean value)
+        throws ParserConfigurationException, SAXNotRecognizedException,
+                SAXNotSupportedException {
+            this.instance.setFeature(name, value);
+        }
+
+        public boolean getFeature(String name)
+        throws ParserConfigurationException, SAXNotRecognizedException,
+                SAXNotSupportedException {
+            return this.instance.getFeature(name);
+        }
+    }
+}

Added: 
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/cocoon/kernel/plugins/JaxpPlugin.java
==============================================================================
--- (empty file)
+++ 
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/cocoon/kernel/plugins/JaxpPlugin.java
       Thu Nov  4 15:07:57 2004
@@ -0,0 +1,153 @@
+/* 
=============================================================================== 
*
+ * Copyright (C) 1999-2004, The Apache Software Foundation.   All rights 
reserved. *
+ *                                                                             
    *
+ * 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.kernel.plugins;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cocoon.interfaces.jaxp.JaxpException;
+import org.apache.cocoon.interfaces.jaxp.JaxpProvider;
+import org.apache.cocoon.kernel.configuration.Configuration;
+import org.apache.cocoon.kernel.deployment.Instance;
+
+/**
+ * <p>TODO.</p> 
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Pier Fumagalli</a>
+ * @author Copyright &copy; 2000-2004 <a href="http://www.apache.org/";>The 
Apache
+ *         Software Foundation</a>. All rights reserved.
+ */
+public abstract class JaxpPlugin extends AbstractPlugin {
+    
+    /** <p>The configuration element of JAXP plugins.</p> */
+    public static final String ELEMENT = "jaxp";
+
+    /** <p>A map for all instance names with their required JAXP provider.</p> 
*/
+    private Map mappings = new HashMap();
+    /** <p>The short JAXP factory name (class name only).</p> */
+    private String name = null;
+    /** <p>The attribute of the configuration associated with this.</p> */
+    private String attribute = null;
+    /** <p>The abstract JAXP factory of this plugin.</p> */
+    private Class type = null;
+    /** <p>The [EMAIL PROTECTED] Class} of the default factory.</p> */
+    private Class factory = null;
+
+    /**
+     * <p>Create a new [EMAIL PROTECTED] JaxpPlugin} instance.</p>
+     */
+    protected JaxpPlugin(Class type, String attribute) {
+        super(JaxpPlugin.ELEMENT);
+
+        if (type == null) throw new NullPointerException("Null JAXP factory 
type");
+        if (attribute == null) throw new NullPointerException("Null 
attribute");
+
+        this.name = type.getName();
+        this.attribute = attribute;
+        this.type = type;
+
+        int last = this.name.lastIndexOf('.');
+        if (last > 0) this.name = this.name.substring(last + 1);
+    }
+
+    /**
+     * <p>Configure this [EMAIL PROTECTED] JaxpPlugin} instance finding the 
JVM's original
+     * JAXP factory instance.</p>
+     */
+    public void configure() {
+        /*
+         * Allocate the system JAXP transformer by preventing the current 
thread
+         * access to anyting BUT the system classloader
+         */
+        Thread thread = Thread.currentThread();
+        ClassLoader context = thread.getContextClassLoader();
+        thread.setContextClassLoader(ClassLoader.getSystemClassLoader());
+
+        try {
+            /* Use reflections to invoke the static "newInstance()" method */
+            Method method = this.type.getMethod("newInstance", new Class[0]);
+            Object instance = method.invoke(this.type, new Object[0]);
+            if (instance == null) {
+                String error = this.name + ".newInstance() returned null";
+                throw new JaxpException(error);
+            }
+            
+            /* Check if the returned object instance is compatible with the 
type */
+            if (! this.type.isAssignableFrom(instance.getClass())) {
+                String error = this.name + ".newInstance() returned ";
+                error += "incompatible class " + instance.getClass().getName();
+                throw new JaxpException(error);
+            }
+            
+            /* Save the class of the returned factory */
+            this.factory = instance.getClass();
+
+        } catch (JaxpException exception) {
+            throw exception;
+        } catch (InvocationTargetException exception) {
+            String message = "Exception caught creating default " + this.name;
+            throw new JaxpException(message, exception.getCause());
+        } catch (Throwable throwable) {
+            String message = "Error occurred creating default " + this.name;
+            throw new JaxpException(message, throwable);
+        } finally {
+            thread.setContextClassLoader(context);
+        }
+    }
+
+    /**
+     * <p>Receive notification of a new [EMAIL PROTECTED] Instance}.</p>
+     */
+    public void notify(Instance instance, Configuration configuration) {
+        if (JaxpPlugin.ELEMENT.equals(configuration.name())) {
+            String prov = configuration.getStringAttribute(this.attribute, 
null);
+            if (prov != null) {
+                this.mappings.put(instance.getName(), prov);
+                this.debug(this.name + " for \"" + instance.getName() + "\" "
+                        + "will be provided by \"" + prov + "\"");
+            }
+        }
+    }
+
+    /**
+     * <p>Return the JAXP factory instance associated with the caller.</p>
+     */
+    protected Object newFactory() {
+        /* Retrieve the instance name associated with this call */
+        String caller = Utilities.getCallerName();
+        String provider = (String) this.mappings.get(caller);
+        
+        /* If the instance was not mapped, then simply return the default */
+        if (provider == null) try {
+            this.debug("Returning default " + this.name + " to \"" + caller + 
"\"");
+            return this.factory.newInstance();
+        } catch (Throwable throwable) {
+            String message = "Unable to instantiate default " + this.name;
+            throw new JaxpException(message, throwable);
+        }
+        
+        /* Return the specially configured DocumentBuilder */
+        try {
+            this.debug("Returning " + this.name + " from instance \""
+                    + provider + "\" to instance \"" + caller + "\"");
+            Object instance = this.getKernel().lookup(provider);
+            return ((JaxpProvider) instance).newInstance();
+        } catch (Throwable throwable) {
+            String message = "Unable to access " + this.name + " provided by 
\"";
+            message += provider + "\" configured for block \"" + caller + "\"";
+            throw new JaxpException(message, throwable);
+        }
+    }
+}

Added: 
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/cocoon/kernel/plugins/JaxpTransformerPlugin.java
==============================================================================
--- (empty file)
+++ 
cocoon/whiteboard/kernel/sources/extensions/jaxp/src/org/apache/cocoon/kernel/plugins/JaxpTransformerPlugin.java
    Thu Nov  4 15:07:57 2004
@@ -0,0 +1,174 @@
+/* 
=============================================================================== 
*
+ * Copyright (C) 1999-2004, The Apache Software Foundation.   All rights 
reserved. *
+ *                                                                             
    *
+ * 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.kernel.plugins;
+
+import javax.xml.transform.ErrorListener;
+import javax.xml.transform.Source;
+import javax.xml.transform.Templates;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TemplatesHandler;
+import javax.xml.transform.sax.TransformerHandler;
+
+import org.apache.cocoon.interfaces.jaxp.JaxpException;
+import org.xml.sax.XMLFilter;
+
+/**
+ * <p>TODO.</p> 
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Pier Fumagalli</a>
+ * @author Copyright &copy; 2000-2004 <a href="http://www.apache.org/";>The 
Apache
+ *         Software Foundation</a>. All rights reserved.
+ */
+public class JaxpTransformerPlugin extends JaxpPlugin {
+
+    /** <p>The attribute name of the configuration element.</p> */
+    public static final String ATTRIBUTE = "transformer";
+
+    /** <p>The instance of this plugin for the nested JAXP factory.</p> */
+    private static JaxpTransformerPlugin instance = null;
+
+    /**
+     * <p>Create a new [EMAIL PROTECTED] JaxpTransformerPlugin} instance.</p>
+     */
+    public JaxpTransformerPlugin() {
+        super(SAXTransformerFactory.class, JaxpTransformerPlugin.ATTRIBUTE);
+    }
+
+    /**
+     * <p>Initialize this [EMAIL PROTECTED] JaxpTransformerPlugin} 
instance.</p>
+     */
+    public void initialize() {
+        /* Check for duplicate initialization */
+        if (JaxpTransformerPlugin.instance != null) {
+            throw new IllegalStateException("Already initialized");
+        } else {
+            JaxpTransformerPlugin.instance = this;
+        }
+    }
+
+    /**
+     * <p>Destroy this [EMAIL PROTECTED] JaxpTransformerPlugin} instance.</p>
+     */
+    public void destroy() {
+        JaxpTransformerPlugin.instance = null;
+    }
+
+    /**
+     * <p>A simple wrapper around the [EMAIL PROTECTED] SAXTransformerFactory} 
class.</p>
+     */
+    public static final class Factory extends SAXTransformerFactory {
+        
+        /** <p>The wrapped [EMAIL PROTECTED] SAXTransformerFactory}.</p> */
+        private SAXTransformerFactory instance = null;
+        
+        /**
+         * <p>Create a new instance of this [EMAIL PROTECTED] Factory}.</p>
+         */
+        public Factory() {
+            try {
+                JaxpTransformerPlugin plugin = JaxpTransformerPlugin.instance;
+                this.instance = (SAXTransformerFactory) plugin.newFactory();
+            } catch (JaxpException exception) {
+                throw exception;
+            } catch (Throwable throwable) {
+                String message = "Error accessing kernel-provided transformer";
+                throw new JaxpException(message, throwable);
+            }
+        }
+
+        public TransformerHandler newTransformerHandler(Source arg0)
+        throws TransformerConfigurationException {
+            return this.instance.newTransformerHandler(arg0);
+        }
+
+        public TransformerHandler newTransformerHandler(Templates arg0)
+        throws TransformerConfigurationException {
+            return this.instance.newTransformerHandler(arg0);
+        }
+
+        public TransformerHandler newTransformerHandler()
+        throws TransformerConfigurationException {
+            return this.instance.newTransformerHandler();
+        }
+
+        public TemplatesHandler newTemplatesHandler()
+        throws TransformerConfigurationException {
+            return this.instance.newTemplatesHandler();
+        }
+
+        public XMLFilter newXMLFilter(Source arg0)
+        throws TransformerConfigurationException {
+            return this.instance.newXMLFilter(arg0);
+        }
+
+        public XMLFilter newXMLFilter(Templates arg0)
+        throws TransformerConfigurationException {
+            return this.instance.newXMLFilter(arg0);
+        }
+
+        public Transformer newTransformer(Source arg0)
+        throws TransformerConfigurationException {
+            return this.instance.newTransformer(arg0);
+        }
+
+        public Transformer newTransformer()
+        throws TransformerConfigurationException {
+            return this.instance.newTransformer();
+        }
+
+        public Templates newTemplates(Source arg0)
+        throws TransformerConfigurationException {
+            return this.instance.newTemplates(arg0);
+        }
+
+        public Source getAssociatedStylesheet(Source arg0, String arg1, String 
arg2, String arg3)
+        throws TransformerConfigurationException {
+            return this.instance.getAssociatedStylesheet(arg0, arg1, arg2, 
arg3);
+        }
+
+        public void setURIResolver(URIResolver arg0) {
+            this.instance.setURIResolver(arg0);
+        }
+
+        public URIResolver getURIResolver() {
+            return this.instance.getURIResolver();
+        }
+
+        public boolean getFeature(String arg0) {
+            return this.instance.getFeature(arg0);
+        }
+
+        public void setAttribute(String arg0, Object arg1)
+        throws IllegalArgumentException {
+            this.instance.setAttribute(arg0, arg1);
+        }
+
+        public Object getAttribute(String arg0)
+        throws IllegalArgumentException {
+            return this.instance.getAttribute(arg0);
+        }
+
+        public void setErrorListener(ErrorListener arg0)
+        throws IllegalArgumentException {
+            this.instance.setErrorListener(arg0);
+        }
+
+        public ErrorListener getErrorListener() {
+            return this.instance.getErrorListener();
+        }
+        
+    }
+}

Modified: cocoon/whiteboard/kernel/sources/extensions/logging/cocoon.xml
==============================================================================
--- cocoon/whiteboard/kernel/sources/extensions/logging/cocoon.xml      
(original)
+++ cocoon/whiteboard/kernel/sources/extensions/logging/cocoon.xml      Thu Nov 
 4 15:07:57 2004
@@ -3,9 +3,9 @@
 <extension xmlns="http://apache.org/cocoon/kernel/descriptor/1.0";
     id="http://cocoon.apache.org/kernel/extensions/logging/1.0.0";>
 
-  <plugin
-    class="org.apache.cocoon.kernel.plugins.LoggingPlugin"
-    configuration-element="logging"/>
+  <configuration element="logging"/>
+
+  <plugin class="org.apache.cocoon.kernel.plugins.LoggingPlugin"/>
 
   <libraries>
     <library href="commons-logging-1.0.4.jar"/>

Modified: 
cocoon/whiteboard/kernel/sources/extensions/logging/src/org/apache/cocoon/kernel/plugins/LoggingPlugin.java
==============================================================================
--- 
cocoon/whiteboard/kernel/sources/extensions/logging/src/org/apache/cocoon/kernel/plugins/LoggingPlugin.java
 (original)
+++ 
cocoon/whiteboard/kernel/sources/extensions/logging/src/org/apache/cocoon/kernel/plugins/LoggingPlugin.java
 Thu Nov  4 15:07:57 2004
@@ -29,7 +29,7 @@
 import org.apache.log4j.xml.DOMConfigurator;
 
 /**
- * <p>The [EMAIL PROTECTED] LoggingPlugin} enables the use of Log4J and 
Commons-Logging
+ * <p>The [EMAIL PROTECTED] JaxpTransformerPlugin} enables the use of Log4J 
and Commons-Logging
  * in a kernel-aware way.</p> 
  *
  * @author <a href="mailto:[EMAIL PROTECTED]">Pier Fumagalli</a>
@@ -39,15 +39,19 @@
 public class LoggingPlugin extends AbstractPlugin
 implements LoggerRepository, RepositorySelector {
 
+    /** <p>The configuration element of JAXP plugins.</p> */
+    public static final String ELEMENT = "logging";
+
     /** <p>The original [EMAIL PROTECTED] LoggerRepository} of Log4J.</p> */
     private LoggerRepository repository = null;
     /** <p>The logger originally associated with the kernel.</p> */
     private org.apache.cocoon.kernel.startup.Logger original = null;
 
     /**
-     * <p>Create a new [EMAIL PROTECTED] LoggingPlugin} instance.</p>
+     * <p>Create a new [EMAIL PROTECTED] JaxpTransformerPlugin} instance.</p>
      */
     public LoggingPlugin() {
+        super(LoggingPlugin.ELEMENT);
         this.repository = LogManager.getLoggerRepository();
     }
 

Added: cocoon/whiteboard/kernel/sources/interfaces/jaxp/cocoon.xml
==============================================================================
--- (empty file)
+++ cocoon/whiteboard/kernel/sources/interfaces/jaxp/cocoon.xml Thu Nov  4 
15:07:57 2004
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<interface xmlns="http://apache.org/cocoon/kernel/descriptor/1.0";
+    id="http://cocoon.apache.org/kernel/interfaces/jaxp/1.0";>
+
+  <exposes interface="org.apache.cocoon.interfaces.jaxp.JaxpProvider"/>
+
+</interface>
\ No newline at end of file

Added: 
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/AbstractProvider.java
==============================================================================
--- (empty file)
+++ 
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/AbstractProvider.java
        Thu Nov  4 15:07:57 2004
@@ -0,0 +1,72 @@
+/* 
=============================================================================== 
*
+ * Copyright (C) 1999-2004, The Apache Software Foundation.   All rights 
reserved. *
+ *                                                                             
    *
+ * 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.interfaces.jaxp;
+
+/**
+ * <p>TODO.</p> 
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Pier Fumagalli</a>
+ * @author Copyright &copy; 2000-2004 <a href="http://www.apache.org/";>The 
Apache
+ *         Software Foundation</a>. All rights reserved.
+ */
+public class AbstractProvider implements JaxpProvider {
+
+    /** <p>The [EMAIL PROTECTED] Class} type of the instances to return.</p> */
+    private Class type = null;
+    /** <p>The [EMAIL PROTECTED] Class} of the instances to return.</p> */
+    private Class factory = null;
+
+    /**
+     * <p>Create a new [EMAIL PROTECTED] AbstractProvider} instance.</p>
+     */
+    public AbstractProvider(Class type) {
+        if (type == null) throw new NullPointerException("Null class type");
+        this.type = type;
+    }
+
+    /**
+     * <p>Set the class name of the JAXP factory returned by this instance.</p>
+     */
+    public void setClassName(String factory) {
+        try {
+            Thread thread = Thread.currentThread();
+            ClassLoader loader = thread.getContextClassLoader();
+            this.factory = loader.loadClass(factory);
+            Object instance = this.factory.newInstance();
+            if (this.type.isAssignableFrom(this.factory)) return;
+        } catch (Throwable throwable) {
+            throw new JaxpException("Unable to access \"" + this.type.getName()
+                    + "\" implementation from \"" + factory + "\"", throwable);
+        }
+        String message = "Class \"" + factory + "\" does not represent a ";
+        message += "valid \"" + this.type.getName() + "\"";
+        throw new JaxpException(message);
+    }
+
+    /**
+     * <p>Return a new instance of the configured JAXP factory.</p>
+     */
+    public Object newInstance() {
+        if (this.factory == null) {
+            String message = "No implementation of \"";
+            message +=  this.type.getName() + "\" provided";
+            throw new JaxpException(message);
+        } else try {
+            return this.factory.newInstance();
+        } catch (Throwable throwable) {
+            String message = "Can't instantiate \"" + this.factory.getName() + 
"\"";
+            throw new JaxpException(message, throwable);
+        }
+            
+    }
+}

Added: 
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/DefaultBuilderProvider.java
==============================================================================
--- (empty file)
+++ 
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/DefaultBuilderProvider.java
  Thu Nov  4 15:07:57 2004
@@ -0,0 +1,33 @@
+/* 
=============================================================================== 
*
+ * Copyright (C) 1999-2004, The Apache Software Foundation.   All rights 
reserved. *
+ *                                                                             
    *
+ * 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.interfaces.jaxp;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+/**
+ * <p>The default implementation of the [EMAIL PROTECTED] BuilderProvider} 
interface.</p> 
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Pier Fumagalli</a>
+ * @author Copyright &copy; 2000-2004 <a href="http://www.apache.org/";>The 
Apache
+ *         Software Foundation</a>. All rights reserved.
+ */
+public class DefaultBuilderProvider extends AbstractProvider {
+
+    /**
+     * <p>Create a new [EMAIL PROTECTED] DefaultBuilderProvider} instance.</p>
+     */
+    public DefaultBuilderProvider() {
+        super(DocumentBuilderFactory.class);
+    }
+
+}

Added: 
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/DefaultParserProvider.java
==============================================================================
--- (empty file)
+++ 
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/DefaultParserProvider.java
   Thu Nov  4 15:07:57 2004
@@ -0,0 +1,33 @@
+/* 
=============================================================================== 
*
+ * Copyright (C) 1999-2004, The Apache Software Foundation.   All rights 
reserved. *
+ *                                                                             
    *
+ * 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.interfaces.jaxp;
+
+import javax.xml.parsers.SAXParserFactory;
+
+/**
+ * <p>The default implementation of the [EMAIL PROTECTED] ParserProvider} 
interface.</p> 
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Pier Fumagalli</a>
+ * @author Copyright &copy; 2000-2004 <a href="http://www.apache.org/";>The 
Apache
+ *         Software Foundation</a>. All rights reserved.
+ */
+public class DefaultParserProvider extends AbstractProvider {
+
+    /**
+     * <p>Create a new [EMAIL PROTECTED] DefaultParserProvider} instance.</p>
+     */
+    public DefaultParserProvider() {
+        super(SAXParserFactory.class);
+    }
+
+}

Added: 
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/DefaultTransformerProvider.java
==============================================================================
--- (empty file)
+++ 
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/DefaultTransformerProvider.java
      Thu Nov  4 15:07:57 2004
@@ -0,0 +1,33 @@
+/* 
=============================================================================== 
*
+ * Copyright (C) 1999-2004, The Apache Software Foundation.   All rights 
reserved. *
+ *                                                                             
    *
+ * 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.interfaces.jaxp;
+
+import javax.xml.transform.sax.SAXTransformerFactory;
+
+/**
+ * <p>The default implementation of the [EMAIL PROTECTED] TransformerProvider} 
interface.</p> 
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Pier Fumagalli</a>
+ * @author Copyright &copy; 2000-2004 <a href="http://www.apache.org/";>The 
Apache
+ *         Software Foundation</a>. All rights reserved.
+ */
+public class DefaultTransformerProvider extends AbstractProvider {
+
+    /**
+     * <p>Create a new [EMAIL PROTECTED] DefaultTransformerProvider} 
instance.</p>
+     */
+    public DefaultTransformerProvider() {
+        super(SAXTransformerFactory.class);
+    }
+
+}

Added: 
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/JaxpException.java
==============================================================================
--- (empty file)
+++ 
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/JaxpException.java
   Thu Nov  4 15:07:57 2004
@@ -0,0 +1,38 @@
+/* 
=============================================================================== 
*
+ * Copyright (C) 1999-2004, The Apache Software Foundation.   All rights 
reserved. *
+ *                                                                             
    *
+ * 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.interfaces.jaxp;
+
+/**
+ * <p>TODO.</p> 
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Pier Fumagalli</a>
+ * @author Copyright &copy; 2000-2004 <a href="http://www.apache.org/";>The 
Apache
+ *         Software Foundation</a>. All rights reserved.
+ */
+public class JaxpException extends RuntimeException {
+
+    /**
+     * <p>Create a new [EMAIL PROTECTED] JaxpException} instance.</p>
+     */
+    public JaxpException(String arg0) {
+        super(arg0);
+    }
+
+    /**
+     * <p>Create a new [EMAIL PROTECTED] JaxpException} instance.</p>
+     */
+    public JaxpException(String arg0, Throwable arg1) {
+        super(arg0, arg1);
+    }
+
+}

Added: 
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/JaxpProvider.java
==============================================================================
--- (empty file)
+++ 
cocoon/whiteboard/kernel/sources/interfaces/jaxp/src/org/apache/cocoon/interfaces/jaxp/JaxpProvider.java
    Thu Nov  4 15:07:57 2004
@@ -0,0 +1,29 @@
+/* 
=============================================================================== 
*
+ * Copyright (C) 1999-2004, The Apache Software Foundation.   All rights 
reserved. *
+ *                                                                             
    *
+ * 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.interfaces.jaxp;
+
+/**
+ * <p>A [EMAIL PROTECTED] JaxpProvider} gives access to the several parts of 
the JAXP API.</p> 
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Pier Fumagalli</a>
+ * @author Copyright &copy; 2000-2004 <a href="http://www.apache.org/";>The 
Apache
+ *         Software Foundation</a>. All rights reserved.
+ */
+public interface JaxpProvider {
+
+    /**
+     * <p>Return a new instance of the configured JAXP factory.</p>
+     */
+    public Object newInstance();
+
+}

Modified: cocoon/whiteboard/kernel/sources/webapp/WEB-INF/configuration.xml
==============================================================================
--- cocoon/whiteboard/kernel/sources/webapp/WEB-INF/configuration.xml   
(original)
+++ cocoon/whiteboard/kernel/sources/webapp/WEB-INF/configuration.xml   Thu Nov 
 4 15:07:57 2004
@@ -7,12 +7,14 @@
     <library href="kernel/cocoon-kernel-runtime-0.1.jar"/>
   </classpath>
 
-  <!-- Kernel plugins -->
-  <descriptor href="kernel/extensions/logging/cocoon.xml"/>
-
   <!-- The interface descriptors available to this kernel -->
   <descriptor href="kernel/interfaces/datasource/cocoon.xml"/>
   <descriptor href="kernel/interfaces/servlet/cocoon.xml"/>
+  <descriptor href="kernel/interfaces/jaxp/cocoon.xml"/>
+
+  <!-- The extension descriptors available to this kernel -->
+  <descriptor href="kernel/extensions/logging/cocoon.xml"/>
+  <descriptor href="kernel/extensions/jaxp/cocoon.xml"/>
 
   <!-- The abstract descriptors available to this kernel -->
   <descriptor href="kernel/modules/commons-collections/cocoon.xml"/>
@@ -21,12 +23,17 @@
   <!-- The block descriptors available to this kernel -->
   <descriptor href="kernel/blocks/commons-dbcp/cocoon.xml"/>
   <descriptor href="kernel/blocks/jasper/cocoon.xml"/>
+  <descriptor href="kernel/blocks/saxon/cocoon.xml"/>
 
   <!-- Logging plugin configuration -->
   <logging log4j="log4j.xml"/>
 
   <!-- Configuration for all instances deployed in the kernel -->  
-  <instance name="test"  
block="http://cocoon.apache.org/kernel/blocks/commons-dbcp/1.2.1";>
+  <instance name="saxon" 
block="http://cocoon.apache.org/kernel/blocks/saxon-b/8.1.1";>
+    <set property="className" value="net.sf.saxon.TransformerFactoryImpl"/>
+  </instance>
+
+  <instance name="test" 
block="http://cocoon.apache.org/kernel/blocks/commons-dbcp/1.2.1";>
     <set property="driverClassName" value="oracle.jdbc.OracleDriver"/>
     <set property="url" value="jdbc:oracle:thin:@qbe.local:1521:vnlive"/>
     <set property="username" value="****"/>
@@ -35,6 +42,7 @@
   </instance>
   
   <instance name="jasper"  
block="http://cocoon.apache.org/kernel/blocks/jasper/4.1.30";>
+    <jaxp transformer="saxon"/>
     <set property="kernel" kernel="true"/>
   </instance>
 

Modified: cocoon/whiteboard/kernel/sources/webapp/WEB-INF/web.xml
==============================================================================
--- cocoon/whiteboard/kernel/sources/webapp/WEB-INF/web.xml     (original)
+++ cocoon/whiteboard/kernel/sources/webapp/WEB-INF/web.xml     Thu Nov  4 
15:07:57 2004
@@ -26,14 +26,6 @@
       <param-name>supply-kernel</param-name>
       <param-value>true</param-value>
     </init-param>
-    <init-param>
-      <param-name>logVerbosityLevel</param-name>
-      <param-value>debug</param-value>
-    </init-param>
-    <!--init-param>
-      <param-name>classpath</param-name>
-      
<param-value>/Users/pier/Workspace/ivory/webapps/root/WEB-INF/kernel/blocks/commons-dbcp/commons-dbcp-1.2.1.jar:/Users/pier/Workspace/ivory/webapps/root/WEB-INF/kernel/cocoon-kernel-runtime-0.1.jar:/Users/pier/Workspace/ivory/webapps/root/WEB-INF/kernel/extensions/logging/commons-logging-1.0.4.jar:/Users/pier/Workspace/ivory/webapps/root/WEB-INF/kernel/extensions/logging/local.jar:/Users/pier/Workspace/ivory/webapps/root/WEB-INF/kernel/extensions/logging/log4j-1.2.9.jar:/Users/pier/Workspace/ivory/webapps/root/WEB-INF/kernel/modules/commons-collections/commons-collections-3.1.jar:/Users/pier/Workspace/ivory/webapps/root/WEB-INF/kernel/modules/commons-pool/commons-pool-1.2.jar:/Users/pier/Workspace/ivory/webapps/root/WEB-INF/lib/cocoon-kernel-startup-0.1.jar</param-value>
-    </init-param-->
 
     <load-on-startup>0</load-on-startup>
   </servlet>

Modified: cocoon/whiteboard/kernel/sources/webapp/test.jsp
==============================================================================
--- cocoon/whiteboard/kernel/sources/webapp/test.jsp    (original)
+++ cocoon/whiteboard/kernel/sources/webapp/test.jsp    Thu Nov  4 15:07:57 2004
@@ -1,10 +1,33 @@
 <%@ page session="false" %>
+<%@ page import="javax.xml.parsers.DocumentBuilderFactory" %>
+<%@ page import="javax.xml.parsers.SAXParserFactory" %>
+<%@ page import="javax.xml.transform.sax.SAXTransformerFactory" %>
 
 <html>
   <head>
     <title>Hello world!</title>
   </head>
   <body>
-    <% out.println("Hello world from a normal JSP!"); %>
+    <% 
+      out.println("<h3>Hello world from a normal JSP page!</h3>");
+
+      try {
+        SAXParserFactory p = (SAXParserFactory) SAXParserFactory.newInstance();
+        out.println("The parser is " + p.newSAXParser().getClass().getName() + 
"<br />");
+
+        DocumentBuilderFactory b = (DocumentBuilderFactory) 
DocumentBuilderFactory.newInstance();
+        out.println("The builder is " + 
b.newDocumentBuilder().getClass().getName() + "<br />");
+
+        SAXTransformerFactory t = (SAXTransformerFactory) 
SAXTransformerFactory.newInstance();
+        out.println("The transformer is " + 
t.newTransformer().getClass().getName() + "<br />");
+
+      } catch (Throwable t) {
+        out.println("I am more stupid<pre>");
+        java.io.PrintWriter pw = new java.io.PrintWriter(out);
+        t.printStackTrace(pw);
+        pw.flush();
+        out.println("</pre>");
+      }
+    %>
   </body>
 </html>

Modified: cocoon/whiteboard/kernel/sources/webapp/test.kjsp
==============================================================================
--- cocoon/whiteboard/kernel/sources/webapp/test.kjsp   (original)
+++ cocoon/whiteboard/kernel/sources/webapp/test.kjsp   Thu Nov  4 15:07:57 2004
@@ -1,5 +1,8 @@
 <%@ page session="false" %>
 <%@ page import="org.apache.cocoon.kernel.Kernel" %>
+<%@ page import="javax.xml.parsers.DocumentBuilderFactory" %>
+<%@ page import="javax.xml.parsers.SAXParserFactory" %>
+<%@ page import="javax.xml.transform.sax.SAXTransformerFactory" %>
 
 <html>
   <head>
@@ -7,12 +10,30 @@
   </head>
   <body>
     <% 
-      out.println("Hello world from inside the kernel!<br />");
+      out.println("<h3>Hello world from inside the kernel!</h3>");
       Kernel kernel = (Kernel) request.getAttribute("cocoon-kernel");
       if (kernel == null) {
-        out.println("The Kernel instance has not been supplied.");
+        out.println("The Kernel instance has not been supplied.<br />");
       } else {
-        out.println("The Kernel is " + kernel.getClass().getName());
+        out.println("The Kernel is " + kernel.getClass().getName() + "<br />");
+      }
+
+      try {
+        SAXParserFactory p = (SAXParserFactory) SAXParserFactory.newInstance();
+        out.println("The parser is " + p.newSAXParser().getClass().getName() + 
"<br />");
+
+        DocumentBuilderFactory b = (DocumentBuilderFactory) 
DocumentBuilderFactory.newInstance();
+        out.println("The builder is " + 
b.newDocumentBuilder().getClass().getName() + "<br />");
+
+        SAXTransformerFactory t = (SAXTransformerFactory) 
SAXTransformerFactory.newInstance();
+        out.println("The transformer is " + 
t.newTransformer().getClass().getName() + "<br />");
+
+      } catch (Throwable t) {
+        out.println("I am more stupid<pre>");
+        java.io.PrintWriter pw = new java.io.PrintWriter(out);
+        t.printStackTrace(pw);
+        pw.flush();
+        out.println("</pre>");
       }
     %>
   </body>

Reply via email to