cziegeler 2003/03/06 06:59:34
Modified: src/java/org/apache/cocoon/transformation Tag: cocoon_2_0_3_branch XIncludeTransformer.java CIncludeTransformer.java SQLTransformer.java src/java/org/apache/cocoon/components/xscript Tag: cocoon_2_0_3_branch XScriptObject.java src/scratchpad/src/org/apache/cocoon/generation Tag: cocoon_2_0_3_branch XPathDirectoryGenerator.java src/java/org/apache/cocoon/generation Tag: cocoon_2_0_3_branch JspGenerator.java VelocityGenerator.java PhpGenerator.java StreamGenerator.java ScriptGenerator.java HTMLGenerator.java src/java/org/apache/cocoon/components/source Tag: cocoon_2_0_3_branch AbstractStreamSource.java src/java/org/apache/cocoon/components/search Tag: cocoon_2_0_3_branch SimpleLuceneXMLIndexerImpl.java lib Tag: cocoon_2_0_3_branch jars.xml src/java/org/apache/cocoon/sitemap Tag: cocoon_2_0_3_branch SitemapManager.java src/java/org/apache/cocoon Tag: cocoon_2_0_3_branch Cocoon.java src/java/org/apache/cocoon/components/resolver Tag: cocoon_2_0_3_branch ResolverImpl.java src/java/org/apache/cocoon/components/deli Tag: cocoon_2_0_3_branch DeliImpl.java src/documentation/xdocs/userdocs/transformers Tag: cocoon_2_0_3_branch cinclude-transformer.xml src/java/org/apache/cocoon/i18n Tag: cocoon_2_0_3_branch XMLResourceBundle.java Added: lib/core Tag: cocoon_2_0_3_branch excalibur-xmlutil-20030306.jar Removed: lib/core Tag: cocoon_2_0_3_branch excalibur-xmlutil-20020820.jar Log: Updating to latest excalibur xmlutil version PR: Obtained from: Submitted by: Reviewed by: CVS: ---------------------------------------------------------------------- CVS: PR: CVS: If this change addresses a PR in the problem report tracking CVS: database, then enter the PR number(s) here. CVS: Obtained from: CVS: If this change has been taken from another system, such as NCSA, CVS: then name the system in this line, otherwise delete it. CVS: Submitted by: CVS: If this code has been contributed to Apache by someone else; i.e., CVS: they sent us a patch or a new module, then include their name/email CVS: address here. If this is your work then delete this line. CVS: Reviewed by: CVS: If we are doing pre-commit code reviews and someone else has CVS: reviewed your changes, include their name(s) here. CVS: If you have not had it reviewed then delete this line. Revision Changes Path No revision No revision 1.11.2.3 +12 -8 xml-cocoon2/src/java/org/apache/cocoon/transformation/XIncludeTransformer.java Index: XIncludeTransformer.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/XIncludeTransformer.java,v retrieving revision 1.11.2.2 retrieving revision 1.11.2.3 diff -u -r1.11.2.2 -r1.11.2.3 --- XIncludeTransformer.java 7 Feb 2003 06:59:23 -0000 1.11.2.2 +++ XIncludeTransformer.java 6 Mar 2003 14:59:29 -0000 1.11.2.3 @@ -50,7 +50,6 @@ */ package org.apache.cocoon.transformation; -import org.apache.avalon.excalibur.xml.Parser; import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.component.ComponentException; @@ -58,11 +57,13 @@ import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.parameters.Parameters; import org.apache.cocoon.ProcessingException; -import org.apache.avalon.excalibur.xml.xpath.XPathProcessor; import org.apache.cocoon.environment.Source; import org.apache.cocoon.environment.SourceResolver; import org.apache.cocoon.xml.IncludeXMLConsumer; import org.apache.cocoon.xml.dom.DOMStreamer; +import org.apache.excalibur.xml.dom.DOMParser; +import org.apache.excalibur.xml.sax.SAXParser; +import org.apache.excalibur.xml.xpath.XPathProcessor; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.Attributes; @@ -289,16 +290,17 @@ } } else if (parse.equals("xml")) { getLogger().debug("Parse type is XML"); - Parser parser = null; + Object parser = null; try { - parser = (Parser)manager.lookup(Parser.ROLE); InputSource input = url.getInputSource(); if (suffix.startsWith("xpointer(") && suffix.endsWith(")")) { + DOMParser domparser = (DOMParser)manager.lookup(DOMParser.ROLE); + parser = domparser; String xpath = suffix.substring(9,suffix.length()-1); getLogger().debug("XPath is "+xpath); - Document document = parser.parseDocument(input); + Document document = domparser.parseDocument(input); NodeList list = processor.selectNodeList(document,xpath); DOMStreamer streamer = new DOMStreamer(super.contentHandler,super.lexicalHandler); int length = list.getLength(); @@ -306,8 +308,10 @@ streamer.stream(list.item(i)); } } else { + SAXParser saxparser = (SAXParser)manager.lookup(SAXParser.ROLE); + parser = saxparser; IncludeXMLConsumer xinclude_handler = new IncludeXMLConsumer(super.contentHandler,super.lexicalHandler); - parser.parse(input, xinclude_handler); + saxparser.parse(input, xinclude_handler); } } catch(SAXException e) { getLogger().error("Error in processXIncludeElement", e); @@ -325,7 +329,7 @@ getLogger().error("Error in processXIncludeElement", e); throw new SAXException(e); } finally { - this.manager.release(parser); + this.manager.release((Component)parser); } } } finally { 1.6.2.3 +2 -2 xml-cocoon2/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java Index: CIncludeTransformer.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java,v retrieving revision 1.6.2.2 retrieving revision 1.6.2.3 diff -u -r1.6.2.2 -r1.6.2.3 --- CIncludeTransformer.java 7 Feb 2003 06:59:23 -0000 1.6.2.2 +++ CIncludeTransformer.java 6 Mar 2003 14:59:29 -0000 1.6.2.3 @@ -50,7 +50,6 @@ */ package org.apache.cocoon.transformation; -import org.apache.avalon.excalibur.xml.xpath.XPathProcessor; import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.parameters.Parameters; @@ -63,6 +62,7 @@ import org.apache.cocoon.xml.XMLUtils; import org.apache.excalibur.source.SourceException; import org.apache.excalibur.source.SourceParameters; +import org.apache.excalibur.xml.xpath.XPathProcessor; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; 1.10.2.7 +5 -5 xml-cocoon2/src/java/org/apache/cocoon/transformation/Attic/SQLTransformer.java Index: SQLTransformer.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/Attic/SQLTransformer.java,v retrieving revision 1.10.2.6 retrieving revision 1.10.2.7 diff -u -r1.10.2.6 -r1.10.2.7 --- SQLTransformer.java 7 Feb 2003 06:59:24 -0000 1.10.2.6 +++ SQLTransformer.java 6 Mar 2003 14:59:29 -0000 1.10.2.7 @@ -51,7 +51,6 @@ package org.apache.cocoon.transformation; import org.apache.avalon.excalibur.datasource.DataSourceComponent; -import org.apache.avalon.excalibur.xml.Parser; import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.component.*; import org.apache.avalon.framework.configuration.Configurable; @@ -64,6 +63,7 @@ import org.apache.cocoon.environment.SourceResolver; import org.apache.cocoon.util.Tokenizer; import org.apache.cocoon.xml.IncludeXMLConsumer; +import org.apache.excalibur.xml.sax.SAXParser; import org.apache.log.Logger; import org.xml.sax.Attributes; import org.xml.sax.InputSource; @@ -181,7 +181,7 @@ protected XMLSerializer compiler; protected XMLDeserializer interpreter; - protected Parser parser; + protected SAXParser parser; /** * Constructor @@ -217,7 +217,7 @@ this.queries.clear(); this.outUri = null; this.outPrefix = null; - this.manager.release(this.parser); + this.manager.release((Component)this.parser); this.parser = null; this.manager.release(this.compiler); this.compiler = null; @@ -1190,7 +1190,7 @@ if (value.length() > 0 && value.charAt(0) == '<') { try { if (transformer.parser != null) { - transformer.parser = (Parser)manager.lookup(Parser.ROLE); + transformer.parser = (SAXParser)manager.lookup(SAXParser.ROLE); } if (transformer.compiler != null) { compiler = (XMLSerializer)manager.lookup(XMLSerializer.ROLE); No revision No revision 1.1.2.1 +0 -0 xml-cocoon2/lib/core/excalibur-xmlutil-20030306.jar <<Binary file>> No revision No revision 1.7.2.5 +6 -6 xml-cocoon2/src/java/org/apache/cocoon/components/xscript/XScriptObject.java Index: XScriptObject.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/xscript/XScriptObject.java,v retrieving revision 1.7.2.4 retrieving revision 1.7.2.5 diff -u -r1.7.2.4 -r1.7.2.5 --- XScriptObject.java 7 Feb 2003 07:19:18 -0000 1.7.2.4 +++ XScriptObject.java 6 Mar 2003 14:59:30 -0000 1.7.2.5 @@ -50,17 +50,17 @@ */ package org.apache.cocoon.components.xscript; +import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.parameters.Parameters; -import org.apache.avalon.excalibur.xml.Parser; - import org.apache.cocoon.ProcessingException; import org.apache.cocoon.components.xslt.XSLTProcessor; import org.apache.cocoon.environment.Source; import org.apache.cocoon.xml.EmbeddedXMLPipe; +import org.apache.excalibur.xml.sax.SAXParser; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; @@ -151,9 +151,9 @@ /* The Source interface methods. */ public void toSAX(ContentHandler handler) throws SAXException { - Parser parser = null; + SAXParser parser = null; try { - parser = (Parser) componentManager.lookup(Parser.ROLE); + parser = (SAXParser) componentManager.lookup(SAXParser.ROLE); InputSource source = getInputSource(); parser.parse(source, handler); } catch (SAXException e) { @@ -162,7 +162,7 @@ throw new SAXException(e); } finally { if (parser != null) { - componentManager.release(parser); + componentManager.release((Component)parser); } } } No revision No revision 1.4.2.3 +2 -2 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/XPathDirectoryGenerator.java Index: XPathDirectoryGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/XPathDirectoryGenerator.java,v retrieving revision 1.4.2.2 retrieving revision 1.4.2.3 diff -u -r1.4.2.2 -r1.4.2.3 --- XPathDirectoryGenerator.java 27 Feb 2003 14:49:59 -0000 1.4.2.2 +++ XPathDirectoryGenerator.java 6 Mar 2003 14:59:30 -0000 1.4.2.3 @@ -54,13 +54,13 @@ import java.io.IOException; import java.util.Map; -import org.apache.avalon.excalibur.xml.xpath.XPathProcessor; import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.parameters.Parameters; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.components.parser.Parser; import org.apache.cocoon.environment.SourceResolver; import org.apache.cocoon.xml.dom.DOMStreamer; +import org.apache.excalibur.xml.xpath.XPathProcessor; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; No revision No revision 1.6.2.4 +6 -5 xml-cocoon2/src/java/org/apache/cocoon/generation/Attic/JspGenerator.java Index: JspGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/Attic/JspGenerator.java,v retrieving revision 1.6.2.3 retrieving revision 1.6.2.4 diff -u -r1.6.2.3 -r1.6.2.4 --- JspGenerator.java 7 Feb 2003 07:21:22 -0000 1.6.2.3 +++ JspGenerator.java 6 Mar 2003 14:59:31 -0000 1.6.2.4 @@ -58,13 +58,14 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.avalon.excalibur.xml.Parser; +import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.components.jsp.JSPEngine; import org.apache.cocoon.environment.http.HttpEnvironment; +import org.apache.excalibur.xml.sax.SAXParser; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -100,7 +101,7 @@ } JSPEngine engine = null; - Parser parser = null; + SAXParser parser = null; try { // FIXME (KP): Should we exclude not supported protocols, say 'context'? String url = this.source; @@ -125,7 +126,7 @@ input.setEncoding("utf-8"); // pipe the results into the parser - parser = (Parser)this.manager.lookup(Parser.ROLE); + parser = (SAXParser)this.manager.lookup(SAXParser.ROLE); parser.parse(input, this.xmlConsumer); } catch (ServletException e) { getLogger().debug("ServletException in JspGenerator.generate()", e); @@ -144,7 +145,7 @@ getLogger().debug("Exception in JspGenerator.generate()", e); throw new ProcessingException("Exception JspGenerator.generate()",e); } finally { - this.manager.release(parser); + this.manager.release((Component)parser); this.manager.release(engine); } } 1.8.2.3 +6 -5 xml-cocoon2/src/java/org/apache/cocoon/generation/Attic/VelocityGenerator.java Index: VelocityGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/Attic/VelocityGenerator.java,v retrieving revision 1.8.2.2 retrieving revision 1.8.2.3 diff -u -r1.8.2.2 -r1.8.2.3 --- VelocityGenerator.java 7 Feb 2003 07:21:22 -0000 1.8.2.2 +++ VelocityGenerator.java 6 Mar 2003 14:59:31 -0000 1.8.2.3 @@ -60,8 +60,8 @@ import java.util.List; import java.util.Map; -import org.apache.avalon.excalibur.xml.Parser; import org.apache.avalon.framework.activity.Initializable; +import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; @@ -76,6 +76,7 @@ import org.apache.cocoon.environment.Source; import org.apache.cocoon.environment.SourceResolver; import org.apache.commons.collections.ExtendedProperties; +import org.apache.excalibur.xml.sax.SAXParser; import org.apache.log.Logger; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; @@ -510,9 +511,9 @@ throw new IllegalStateException("generate called on sitemap component before setup."); } - Parser parser = null; + SAXParser parser = null; try { - parser = (Parser)this.manager.lookup(Parser.ROLE); + parser = (SAXParser)this.manager.lookup(SAXParser.ROLE); if (getLogger().isDebugEnabled()) { getLogger().debug("Processing File: " + super.source); } @@ -539,7 +540,7 @@ getLogger().error("Could not get parser", e); throw new ProcessingException("Exception in VelocityGenerator.generate()", e); } finally { - this.manager.release(parser); + this.manager.release((Component)parser); } } 1.6.2.4 +6 -5 xml-cocoon2/src/java/org/apache/cocoon/generation/Attic/PhpGenerator.java Index: PhpGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/Attic/PhpGenerator.java,v retrieving revision 1.6.2.3 retrieving revision 1.6.2.4 diff -u -r1.6.2.3 -r1.6.2.4 --- PhpGenerator.java 7 Feb 2003 07:21:22 -0000 1.6.2.3 +++ PhpGenerator.java 6 Mar 2003 14:59:31 -0000 1.6.2.4 @@ -62,11 +62,12 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.avalon.excalibur.xml.Parser; import org.apache.avalon.framework.CascadingRuntimeException; +import org.apache.avalon.framework.component.Component; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.environment.Source; import org.apache.cocoon.environment.http.HttpEnvironment; +import org.apache.excalibur.xml.sax.SAXParser; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -169,7 +170,7 @@ // ensure that we are serving a file... Source inputSource = null; - Parser parser = null; + SAXParser parser = null; try { inputSource = this.resolver.resolve(this.source); String systemId = inputSource.getSystemId(); @@ -189,7 +190,7 @@ new Thread(php).start(); // pipe the results into the parser - parser = (Parser)this.manager.lookup(Parser.ROLE); + parser = (SAXParser)this.manager.lookup(SAXParser.ROLE); parser.parse(new InputSource(input), this.xmlConsumer); // clean up @@ -202,7 +203,7 @@ throw new IOException(e.toString()); } finally { if (inputSource != null) inputSource.recycle(); - this.manager.release(parser); + this.manager.release((Component)parser); } } } 1.8.2.5 +6 -5 xml-cocoon2/src/java/org/apache/cocoon/generation/StreamGenerator.java Index: StreamGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/StreamGenerator.java,v retrieving revision 1.8.2.4 retrieving revision 1.8.2.5 diff -u -r1.8.2.4 -r1.8.2.5 --- StreamGenerator.java 7 Feb 2003 07:21:23 -0000 1.8.2.4 +++ StreamGenerator.java 6 Mar 2003 14:59:31 -0000 1.8.2.5 @@ -55,11 +55,12 @@ import javax.servlet.http.HttpServletRequest; -import org.apache.avalon.excalibur.xml.Parser; +import org.apache.avalon.framework.component.Component; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.ResourceNotFoundException; import org.apache.cocoon.environment.http.HttpEnvironment; import org.apache.cocoon.util.PostInputStream; +import org.apache.excalibur.xml.sax.SAXParser; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -114,7 +115,7 @@ */ public void generate() throws IOException, SAXException, ProcessingException { - Parser parser = null; + SAXParser parser = null; String parameter = parameters.getParameter(StreamGenerator.FORM_NAME, null); int len = 0; String contentType = null; @@ -150,7 +151,7 @@ { this.inputSource.setEncoding(charset); } - parser = (Parser)this.manager.lookup(Parser.ROLE); + parser = (SAXParser)this.manager.lookup(SAXParser.ROLE); parser.parse(this.inputSource, super.xmlConsumer); } catch (IOException e) { getLogger().error("StreamGenerator.generate()", e); @@ -162,7 +163,7 @@ getLogger().error("Could not get parser", e); throw new ProcessingException("Exception in StreamGenerator.generate()", e); } finally { - this.manager.release(parser); + this.manager.release((Component)parser); } } 1.8.2.4 +6 -5 xml-cocoon2/src/java/org/apache/cocoon/generation/Attic/ScriptGenerator.java Index: ScriptGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/Attic/ScriptGenerator.java,v retrieving revision 1.8.2.3 retrieving revision 1.8.2.4 diff -u -r1.8.2.3 -r1.8.2.4 --- ScriptGenerator.java 7 Feb 2003 07:21:23 -0000 1.8.2.3 +++ ScriptGenerator.java 6 Mar 2003 14:59:31 -0000 1.8.2.4 @@ -58,13 +58,14 @@ import com.ibm.bsf.BSFManager; import com.ibm.bsf.util.IOUtils; -import org.apache.avalon.excalibur.xml.Parser; +import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.ResourceNotFoundException; import org.apache.cocoon.environment.Source; +import org.apache.excalibur.xml.sax.SAXParser; import org.xml.sax.InputSource; /** @@ -149,7 +150,7 @@ } public void generate() throws ProcessingException { - Parser parser = null; + SAXParser parser = null; try { // Figure out what file to open and do so getLogger().debug("processing file [" + super.source + "]"); @@ -201,7 +202,7 @@ InputSource xmlInput = new InputSource(new StringReader(output.toString())); - parser = (Parser)(this.manager.lookup(Parser.ROLE)); + parser = (SAXParser)(this.manager.lookup(SAXParser.ROLE)); parser.parse(xmlInput, this.xmlConsumer); } catch (ProcessingException e) { throw e; @@ -215,7 +216,7 @@ throw new ProcessingException( "Exception in ScriptGenerator.generate()", e); } finally { - this.manager.release(parser); + this.manager.release((Component)parser); } } } 1.14.2.5 +2 -2 xml-cocoon2/src/java/org/apache/cocoon/generation/Attic/HTMLGenerator.java Index: HTMLGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/Attic/HTMLGenerator.java,v retrieving revision 1.14.2.4 retrieving revision 1.14.2.5 diff -u -r1.14.2.4 -r1.14.2.5 --- HTMLGenerator.java 7 Feb 2003 07:21:23 -0000 1.14.2.4 +++ HTMLGenerator.java 6 Mar 2003 14:59:31 -0000 1.14.2.5 @@ -63,7 +63,6 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXResult; -import org.apache.avalon.excalibur.xml.xpath.XPathProcessor; import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.component.ComponentException; @@ -86,6 +85,7 @@ import org.apache.cocoon.util.HashUtil; import org.apache.cocoon.xml.XMLUtils; import org.apache.cocoon.xml.dom.DOMStreamer; +import org.apache.excalibur.xml.xpath.XPathProcessor; import org.w3c.dom.NodeList; import org.w3c.tidy.Tidy; import org.xml.sax.SAXException; No revision No revision 1.2.2.4 +6 -5 xml-cocoon2/src/java/org/apache/cocoon/components/source/Attic/AbstractStreamSource.java Index: AbstractStreamSource.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/Attic/AbstractStreamSource.java,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- AbstractStreamSource.java 31 Jan 2003 12:46:33 -0000 1.2.2.3 +++ AbstractStreamSource.java 6 Mar 2003 14:59:31 -0000 1.2.2.4 @@ -67,12 +67,13 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import org.apache.avalon.excalibur.xml.Parser; +import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.logger.AbstractLoggable; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.environment.ModifiableSource; import org.apache.cocoon.util.ClassUtils; +import org.apache.excalibur.xml.sax.SAXParser; import org.w3c.dom.Document; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; @@ -189,9 +190,9 @@ * @throws SAXException if failed to parse source document. */ public void toSAX(ContentHandler handler) throws SAXException, ProcessingException { - Parser parser = null; + SAXParser parser = null; try { - parser = (Parser)this.manager.lookup(Parser.ROLE); + parser = (SAXParser)this.manager.lookup(SAXParser.ROLE); parser.parse( this.getInputSource(), handler); } catch (SAXException e) { @@ -204,7 +205,7 @@ throw new ProcessingException("Exception during processing of " + this.getSystemId(), e); } finally { - if (parser != null) this.manager.release(parser); + if (parser != null) this.manager.release((Component)parser); } } No revision No revision 1.9.2.5 +6 -5 xml-cocoon2/src/java/org/apache/cocoon/components/search/Attic/SimpleLuceneXMLIndexerImpl.java Index: SimpleLuceneXMLIndexerImpl.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/search/Attic/SimpleLuceneXMLIndexerImpl.java,v retrieving revision 1.9.2.4 retrieving revision 1.9.2.5 diff -u -r1.9.2.4 -r1.9.2.5 --- SimpleLuceneXMLIndexerImpl.java 7 Feb 2003 07:19:22 -0000 1.9.2.4 +++ SimpleLuceneXMLIndexerImpl.java 6 Mar 2003 14:59:32 -0000 1.9.2.5 @@ -59,7 +59,7 @@ import java.util.Iterator; import java.util.List; -import org.apache.avalon.excalibur.xml.Parser; +import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.component.Composable; @@ -69,6 +69,7 @@ import org.apache.avalon.framework.logger.AbstractLoggable; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.ProcessingException; +import org.apache.excalibur.xml.sax.SAXParser; import org.apache.lucene.document.DateField; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -222,14 +223,14 @@ InputStream is = null; InputSource in = null; - Parser parser = null; + SAXParser parser = null; try { is = contentURLConnection.getInputStream(); in = new InputSource(is); // get an XML parser - parser = (Parser) this.manager.lookup(Parser.ROLE); + parser = (SAXParser) this.manager.lookup(SAXParser.ROLE); //reader.setErrorHandler(new CocoonErrorHandler()); parser.parse(in, luceneIndexContentHandler); // @@ -243,7 +244,7 @@ throw new ProcessingException("Cannot lookup xml parser!", ce); } finally { if (parser != null) { - this.manager.release(parser); + this.manager.release((Component)parser); } } } No revision No revision 1.11.2.22 +1 -1 xml-cocoon2/lib/jars.xml Index: jars.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/lib/jars.xml,v retrieving revision 1.11.2.21 retrieving revision 1.11.2.22 diff -u -r1.11.2.21 -r1.11.2.22 --- jars.xml 27 Feb 2003 14:09:37 -0000 1.11.2.21 +++ jars.xml 6 Mar 2003 14:59:32 -0000 1.11.2.22 @@ -148,7 +148,7 @@ <description>Part of jakarta-avalon, it is a set of classes and patterns that support high level server development.</description> <used-by>Cocoon</used-by> - <lib>core/excalibur-xmlutil-20020820.jar</lib> + <lib>core/excalibur-xmlutil-20020306.jar</lib> <homepage>http://jakarta.apache.org/avalon/excalibur/</homepage> </file> <file> No revision No revision 1.10.2.5 +6 -5 xml-cocoon2/src/java/org/apache/cocoon/sitemap/Attic/SitemapManager.java Index: SitemapManager.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/sitemap/Attic/SitemapManager.java,v retrieving revision 1.10.2.4 retrieving revision 1.10.2.5 diff -u -r1.10.2.4 -r1.10.2.5 --- SitemapManager.java 7 Feb 2003 07:22:50 -0000 1.10.2.4 +++ SitemapManager.java 6 Mar 2003 14:59:32 -0000 1.10.2.5 @@ -53,7 +53,7 @@ import java.io.InputStream; import org.apache.avalon.excalibur.component.DefaultRoleManager; -import org.apache.avalon.excalibur.xml.Parser; +import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; @@ -63,6 +63,7 @@ import org.apache.cocoon.components.pipeline.StreamPipeline; import org.apache.cocoon.environment.Environment; import org.apache.cocoon.util.ClassUtils; +import org.apache.excalibur.xml.sax.SAXParser; import org.xml.sax.InputSource; /** @@ -97,10 +98,10 @@ } // Read sitemap roles - Parser p = null; + SAXParser p = null; Configuration rolesConfig; try { - p = (Parser)this.manager.lookup(Parser.ROLE); + p = (SAXParser)this.manager.lookup(SAXParser.ROLE); SAXConfigurationHandler b = new SAXConfigurationHandler(); InputStream inputStream = ClassUtils.getResource("org/apache/cocoon/sitemap/sitemap.roles").openStream(); InputSource is = new InputSource(inputStream); @@ -111,7 +112,7 @@ getLogger().error("Could not configure Cocoon environment", e); throw new ConfigurationException("Error trying to load configurations", e); } finally { - this.manager.release(p); + this.manager.release((Component)p); } DefaultRoleManager sitemapRoleManager = new DefaultRoleManager(); No revision No revision 1.22.2.11 +20 -19 xml-cocoon2/src/java/org/apache/cocoon/Cocoon.java Index: Cocoon.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/Cocoon.java,v retrieving revision 1.22.2.10 retrieving revision 1.22.2.11 diff -u -r1.22.2.10 -r1.22.2.11 --- Cocoon.java 28 Feb 2003 00:29:11 -0000 1.22.2.10 +++ Cocoon.java 6 Mar 2003 14:59:33 -0000 1.22.2.11 @@ -50,7 +50,14 @@ */ package org.apache.cocoon; -import org.apache.avalon.excalibur.xml.Parser; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Enumeration; +import java.util.Map; + import org.apache.avalon.excalibur.component.DefaultRoleManager; import org.apache.avalon.excalibur.component.ExcaliburComponentManager; import org.apache.avalon.excalibur.logger.LogKitManageable; @@ -84,16 +91,10 @@ import org.apache.cocoon.environment.Session; import org.apache.cocoon.sitemap.SitemapManager; import org.apache.cocoon.util.ClassUtils; +import org.apache.excalibur.xml.impl.XercesParser; +import org.apache.excalibur.xml.sax.SAXParser; import org.xml.sax.InputSource; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Enumeration; -import java.util.Map; - /** * The Cocoon Object is the main Kernel for the entire Cocoon system. * @@ -234,7 +235,7 @@ if ( !Constants.DEFAULT_PARSER.equals( parser ) ) { this.getLogger().warn("Deprecated property " +Constants.DEPRECATED_PARSER_PROPERTY+ " is used. Please use "+Constants.PARSER_PROPERTY+" instead."); if ( "org.apache.cocoon.components.parser.XercesParser".equals(parser) ) { - parser = "org.apache.avalon.excalibur.xml.XercesParser"; + parser = XercesParser.class.getName(); } else { this.getLogger().warn("Unknown value for deprecated property: " + Constants.DEPRECATED_PARSER_PROPERTY + ", value: " + parser + @@ -252,7 +253,7 @@ startupManager.setLogKitManager(this.logKitManager); try { - startupManager.addComponent(Parser.ROLE, ClassUtils.loadClass(parser), new org.apache.avalon.framework.configuration.DefaultConfiguration("", "empty")); + startupManager.addComponent(SAXParser.ROLE, ClassUtils.loadClass(parser), new org.apache.avalon.framework.configuration.DefaultConfiguration("", "empty")); } catch (Exception e) { getLogger().error("Could not load parser, Cocoon object not created.", e); throw new ConfigurationException("Could not load parser " + parser, e); @@ -317,12 +318,12 @@ * @exception ContextException if an error occurs */ public Configuration configure(ExcaliburComponentManager startupManager) throws ConfigurationException, ContextException { - Parser p = null; + SAXParser p = null; Configuration roleConfig = null; try { this.configurationFile.refresh(); - p = (Parser)startupManager.lookup(Parser.ROLE); + p = (SAXParser)startupManager.lookup(SAXParser.ROLE); SAXConfigurationHandler b = new SAXConfigurationHandler(); InputStream inputStream = ClassUtils.getResource("org/apache/cocoon/cocoon.roles").openStream(); InputSource is = new InputSource(inputStream); @@ -333,7 +334,7 @@ getLogger().error("Could not configure Cocoon environment", e); throw new ConfigurationException("Error trying to load configurations", e); } finally { - if (p != null) startupManager.release(p); + if (p != null) startupManager.release((Component)p); } DefaultRoleManager drm = new DefaultRoleManager(); @@ -342,7 +343,7 @@ roleConfig = null; try { - p = (Parser)startupManager.lookup(Parser.ROLE); + p = (SAXParser)startupManager.lookup(SAXParser.ROLE); SAXConfigurationHandler b = new SAXConfigurationHandler(); InputSource is = this.configurationFile.getInputSource(); p.parse(is, b); @@ -351,7 +352,7 @@ getLogger().error("Could not configure Cocoon environment", e); throw new ConfigurationException("Error trying to load configurations",e); } finally { - if (p != null) startupManager.release(p); + if (p != null) startupManager.release((Component)p); } Configuration conf = this.configuration; @@ -371,7 +372,7 @@ String userRoles = conf.getAttribute("user-roles", ""); if (!"".equals(userRoles)) { try { - p = (Parser)startupManager.lookup(Parser.ROLE); + p = (SAXParser)startupManager.lookup(SAXParser.ROLE); SAXConfigurationHandler b = new SAXConfigurationHandler(); org.apache.cocoon.environment.Context context = (org.apache.cocoon.environment.Context) this.context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT); @@ -384,7 +385,7 @@ getLogger().error("Could not configure Cocoon environment with user roles file", e); throw new ConfigurationException("Error trying to load user-roles configuration", e); } finally { - startupManager.release(p); + startupManager.release((Component)p); } DefaultRoleManager urm = new DefaultRoleManager(drm); No revision No revision 1.9.2.8 +2 -2 xml-cocoon2/src/java/org/apache/cocoon/components/resolver/ResolverImpl.java Index: ResolverImpl.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/resolver/ResolverImpl.java,v retrieving revision 1.9.2.7 retrieving revision 1.9.2.8 diff -u -r1.9.2.7 -r1.9.2.8 --- ResolverImpl.java 27 Feb 2003 14:50:03 -0000 1.9.2.7 +++ ResolverImpl.java 6 Mar 2003 14:59:33 -0000 1.9.2.8 @@ -52,7 +52,6 @@ import java.io.IOException; -import org.apache.avalon.excalibur.xml.EntityResolver; import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; @@ -66,6 +65,7 @@ import org.apache.avalon.framework.parameters.Parameters; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.Constants; +import org.apache.excalibur.xml.EntityResolver; import org.apache.xml.resolver.CatalogManager; import org.apache.xml.resolver.tools.CatalogResolver; import org.xml.sax.InputSource; No revision No revision 1.17.2.4 +4 -4 xml-cocoon2/src/java/org/apache/cocoon/components/deli/Attic/DeliImpl.java Index: DeliImpl.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/deli/Attic/DeliImpl.java,v retrieving revision 1.17.2.3 retrieving revision 1.17.2.4 diff -u -r1.17.2.3 -r1.17.2.4 --- DeliImpl.java 27 Feb 2003 14:18:19 -0000 1.17.2.3 +++ DeliImpl.java 6 Mar 2003 14:59:33 -0000 1.17.2.4 @@ -74,7 +74,6 @@ import com.hp.hpl.deli.ProfileAttribute; import com.hp.hpl.deli.Workspace; -import org.apache.avalon.excalibur.xml.Parser; import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.activity.Initializable; import org.apache.avalon.framework.component.Component; @@ -90,6 +89,7 @@ import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.Constants; import org.apache.cocoon.environment.Request; +import org.apache.excalibur.xml.dom.DOMParser; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Text; @@ -129,7 +129,7 @@ protected ComponentManager manager = null; /** Parser used to construct the DOM tree to import the profile to a stylesheet */ - protected Parser parser; + protected DOMParser parser; /** A context, used to retrieve the path to the configuration file */ protected CocoonServletContext servletContext; @@ -146,7 +146,7 @@ throws ComponentException { this.manager = manager; try { - this.parser = (Parser)this.manager.lookup(Parser.ROLE); + this.parser = (DOMParser)this.manager.lookup(DOMParser.ROLE); } catch (ComponentException e) { getLogger().error("DELI Exception while creating parser: ", e); throw e; No revision No revision 1.1.2.2 +161 -18 xml-cocoon2/src/documentation/xdocs/userdocs/transformers/cinclude-transformer.xml Index: cinclude-transformer.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/src/documentation/xdocs/userdocs/transformers/cinclude-transformer.xml,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- cinclude-transformer.xml 18 Oct 2002 18:17:52 -0000 1.1.2.1 +++ cinclude-transformer.xml 6 Mar 2003 14:59:33 -0000 1.1.2.2 @@ -15,10 +15,12 @@ <body> <s1 title="CInclude Transformer"> <p>This transformer includes XML in the current stream and acts therefore - is a kind of (dynamic) content aggregation. Two forms, one verbose + as a kind of (dynamic) content aggregation. Two forms, one verbose and flexible approach, and a simple approach are supported by the transformer. We will first discuss the simple approach and - the more flexible is mentioned in the next chapter.</p> + the more flexible is mentioned in the next chapter. In addition + the cinclude transformer provides a caching mechanism (for the + simple include form).</p> <p> This transformer triggers for the element <code>include</code> in the namespace "http://apache.org/cocoon/include/1.0". @@ -33,22 +35,6 @@ <li>Class: org.apache.cocoon.transformation.CIncludeTransformer</li> <li>Cacheable: no.</li> </ul> - <ul> - <li>Name : cinclude</li> - <li>Class: org.apache.cocoon.transformation.CachingCIncludeTransformer</li> - <li>Cacheable: yes.</li> - </ul> - <p> - There are two versions of CIncludeTransformer available: - </p> - <ul> - <li>A non caching version - <code>org.apache.cocoon.transformation.CIncludeTransformer</code> - </li> - <li>A caching version - <code>org.apache.cocoon.transformation.CachingCIncludeTransformer</code> - </li> - </ul> <p> A simple example might help to use the CIncludeTransfomer effectivly: </p> @@ -200,5 +186,162 @@ <p>The format of the parameters is the same as for the connection configuration.</p> </s1> + <s1 title="Caching"> + <p>This transformer includes XML in the current stream and acts therefore + as a kind of (dynamic) content aggregation. However, the included content + might be very big or either it might take a lot of time to fetch + the content. If, in those cases, your content does not change too + frequently, you can turn on caching for these contents.</p> + <p> + To turn on caching, this transformer triggers for the element <code>cached-include</code> + in the namespace "http://apache.org/cocoon/include/1.0/caching". + The <code>src</code> attribute contains the url which points to + an xml resource that is included instead of the element. + It is possible to mix the <code>cached-include</code> and the <code>include</code> + element, so only parts are cached and others are not. + </p> + <p> + A simple example might help to use the caching effectivly: + </p> + <p> + First define your pipeline to use the CIncludeTransformer with + caching turned on; you turn on caching by setting the <code>expires</code> + parameter to a value greater than 0. The exact meaning of this + parameter is explained below. + </p> +<source><![CDATA[ +<map:match pattern="cinc/simple-cinc"> + <map:generate src="cinc/simple-cinc.xml"/> + <map:transform type="cinclude"> + <map:parameter name="expires" value="600"/> + </map:transform> + <map:transform src="stylesheets/page/simple-page2html.xsl"/> + <map:serialize/> +</map:match> +]]></source> + + <p> + In this example-pipeline it is assumed that simple-cinc.xml contains + the <code>cached-include</code> element. Beside defining the element + it uses the namespache URI "http://apache.org/cocoon/include/1.0". + This helps the transformer to find the tag to get replaced by + the xml content referenced via the src attribute. + The simple-cinc.xml may look like this: + </p> +<source><![CDATA[ +<?xml version="1.0" encoding="UTF-8"?> +<page + xmlns:cinclude="http://apache.org/cocoon/include/1.0"> + <title>Hello</title> + <content> + <para>This is my first Cocoon page!</para> + <cinclude:cached-include src="http://server/document1.xml"/> + <cinclude:cached-include src="http://server/document2.xml"/> + </content> +</page> +]]></source> + + <p> + Now finally we have everything put together the xml content after the + CIncludeTransformer processing will look like this: + </p> +<source><![CDATA[ +<?xml version="1.0" encoding="UTF-8"?> +<page + xmlns:cinclude="http://apache.org/cocoon/include/1.0"> + <title>Hello</title> + <content> + <para>This is my first Cocoon page!</para> + <document1> + CONTENT OF document 1 + </document1> + <document2> + CONTENT OF document 2 + </document2> + </content> +</page> +]]></source> + <p>So, of course even with caching turned on, this transformer acts like the + usual cinclude transformer. But as you can see from the example above, you + can define an expires value. The fetched content is cached for the duration of + this value; in the example above the content is cached for 10 minutes. So, if + during the next 10 minutes after the first time this pipeline was processed, + someone else requests this pipeline, the content is not fetched again from a + distant server (or whereever the content is stored). It is directly delivered + from the cache. When the 10 minutes have expired, the next time the pipeline + is requested, the content is fetched again and stored in the cache for the + next 10 minutes.</p> + <p>You can fine tune the behaviour of the transformer with several parameters.</p> + <p>The <code>expires</code> parameter defines the expiration date of the + content in seconds from the time the pipeline is requested.</p> + <p>Usually the content is cached in the common store, but you + can also define a writeable/modifiable source with the "source" parameter, + e.g. "file:/c:/temp". Then the cached content is written into this + directory.</p> + <p>With the optional <code>purge</code> set to <code>true</code> + the cache is purged which means the cached content is regarded as + invalid nevertheless if it has expired or not.</p> + <p>With the optional parameter <code>parallel</code> the various + included contents are processed (included) in parallel rather than + in a series.</p> + <p>With the optional parameter <code>preemptive</code> set to <code>true</code> + a pre-emptive caching is activated. When a resource is requested with + pre-emptive caching, this transformer always attempts to get the + content from the cache. If the content is not in the cache, it is + of course retrieved from the original source and cached. + If the cached resource has expired, it is still provided. The cache + is updated by a background task. This task has to be started + beforehand.</p> + <p> + Complete Example: + </p> +<source><![CDATA[ +<map:match pattern="cinc/simple-cinc"> + <map:generate src="cinc/simple-cinc.xml"/> + <map:transform type="cinclude"> + <map:parameter name="expires" value="600"/> + <map:parameter name="purge" value="false"/> + <map:parameter name="parallel" value="true"/> + <map:parameter name="preemptive" value="false"/> + <map:parameter name="source" value="file:/c:/temp"/> + </map:transform> + <map:transform src="stylesheets/page/simple-page2html.xsl"/> + <map:serialize/> +</map:match> +]]></source> + </s1> + <s1 title="Configuration"> +<p>Besides the usual transformer configuration, this transformer requires some components. +You have to add the following lines to the cocoon.xconf:</p> +<source><![CDATA[ + <component class="org.apache.cocoon.transformation.helpers.DefaultIncludeCacheManager" + role="org.apache.cocoon.transformation.helpers.IncludeCacheManager" + logger="test"> + <!-- Specify this only if you use preemptive-caching --> + <parameter name="preemptive-loader-url" value="http://localhost:8080/cocoon/loader"/> + </component> +]]></source> + <p>If you want to use preemptive caching, you have to specify a URI inside Cocoon that contains + the preemptive-loader action. This pipeline is automatically called, when + preemptive loading is actived and requried. It loads the content in the background.</p> + <p>First you have to define the action:</p> +<source><![CDATA[ +... +<map:components> +... + <map:actions> + ... + <map:action name="preemptive" + src="org.apache.cocoon.transformation.helpers.PreemptiveLoaderAction"/> + ... +]]></source> + <p>Then you must define a pipeline containing the action. This is the pipeline that + has to be configured in the cocoon.xconf:</p> +<source><![CDATA[ + <map:match pattern="loader"> + <map:act type="preemptive"></map:act> + </map:match> +]]></source> +</s1> </body> </document> No revision No revision 1.7.2.4 +2 -2 xml-cocoon2/src/java/org/apache/cocoon/i18n/XMLResourceBundle.java Index: XMLResourceBundle.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/i18n/XMLResourceBundle.java,v retrieving revision 1.7.2.3 retrieving revision 1.7.2.4 diff -u -r1.7.2.3 -r1.7.2.4 --- XMLResourceBundle.java 7 Feb 2003 07:21:37 -0000 1.7.2.3 +++ XMLResourceBundle.java 6 Mar 2003 14:59:33 -0000 1.7.2.4 @@ -56,7 +56,7 @@ import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.logger.Loggable; -import org.apache.avalon.excalibur.xml.xpath.XPathProcessor; +import org.apache.excalibur.xml.xpath.XPathProcessor; import org.apache.log.Logger; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap;