Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 51355 invoked from network); 19 Dec 2007 20:28:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Dec 2007 20:28:03 -0000 Received: (qmail 88770 invoked by uid 500); 19 Dec 2007 20:27:52 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 88722 invoked by uid 500); 19 Dec 2007 20:27:52 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 88711 invoked by uid 99); 19 Dec 2007 20:27:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Dec 2007 12:27:52 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Dec 2007 20:27:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 4D6301A9832; Wed, 19 Dec 2007 12:27:38 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r605687 - in /cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/generation: FileGenerator.java FileGeneratorBean.java Date: Wed, 19 Dec 2007 20:27:35 -0000 To: cvs@cocoon.apache.org From: vgritsenko@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071219202738.4D6301A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: vgritsenko Date: Wed Dec 19 12:27:35 2007 New Revision: 605687 URL: http://svn.apache.org/viewvc?rev=605687&view=rev Log: FileGeneratorBean was not working with XMLizable source Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/generation/FileGenerator.java cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/generation/FileGeneratorBean.java Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/generation/FileGenerator.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/generation/FileGenerator.java?rev=605687&r1=605686&r2=605687&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/generation/FileGenerator.java (original) +++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/generation/FileGenerator.java Wed Dec 19 12:27:35 2007 @@ -57,7 +57,8 @@ /** The SAX Parser. */ protected SAXParser parser; - public void setParser(SAXParser parser) { + + public void setParser(SAXParser parser) { this.parser = parser; } @@ -66,12 +67,12 @@ * All instance variables are set to null. */ public void recycle() { - if (null != this.inputSource) { + if (this.inputSource != null) { super.resolver.release(this.inputSource); this.inputSource = null; } - if (null != this.parser) { - this.manager.release(this.parser); + if (this.parser != null) { + super.manager.release(this.parser); this.parser = null; } super.recycle(); @@ -84,18 +85,22 @@ public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) throws ProcessingException, SAXException, IOException { super.setup(resolver, objectModel, src, par); + try { // Lookup parser in Avalon contexts - if (null == this.parser) + if (this.parser == null) { this.parser = (SAXParser) this.manager.lookup(SAXParser.class.getName()); + } } catch (ServiceException e) { throw new ProcessingException("Exception when getting parser.", e); } + try { this.inputSource = super.resolver.resolveURI(src); } catch (SourceException se) { throw SourceUtil.handle("Error during resolving of '" + src + "'.", se); } + if (getLogger().isDebugEnabled()) { getLogger().debug("Source " + super.source + " resolved to " + this.inputSource.getURI()); @@ -128,7 +133,7 @@ public void generate() throws IOException, SAXException, ProcessingException { try { - SourceUtil.parse(this.parser, this.inputSource, super.xmlConsumer); + SourceUtil.parse(this.parser, this.inputSource, super.xmlConsumer); } catch (SAXException e) { SourceUtil.handleSAXException(this.inputSource.getURI(), e); } Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/generation/FileGeneratorBean.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/generation/FileGeneratorBean.java?rev=605687&r1=605686&r2=605687&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/generation/FileGeneratorBean.java (original) +++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/generation/FileGeneratorBean.java Wed Dec 19 12:27:35 2007 @@ -84,16 +84,18 @@ * Setup the file generator. * Try to get the last modification date of the source for caching. * - * @see org.apache.cocoon.sitemap.SitemapModelComponent#setup(org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters) + * @see org.apache.cocoon.sitemap.SitemapModelComponent#setup(SourceResolver, Map, String, Parameters) */ public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) throws ProcessingException, SAXException, IOException { this.resolver = resolver; + try { this.inputSource = this.resolver.resolveURI(src); } catch (SourceException se) { throw SourceUtil.handle("Error during resolving of '" + src + "'.", se); } + if (getLogger().isDebugEnabled()) { getLogger().debug("Source " + src + " resolved to " + this.inputSource.getURI()); @@ -121,7 +123,7 @@ } /** - * @see org.apache.cocoon.xml.XMLProducer#setConsumer(org.apache.cocoon.xml.XMLConsumer) + * @see org.apache.cocoon.xml.XMLProducer#setConsumer(XMLConsumer) */ public void setConsumer(XMLConsumer consumer) { this.consumer = consumer; @@ -133,7 +135,7 @@ public void generate() throws IOException, SAXException, ProcessingException { try { - this.parser.parse(SourceUtil.getInputSource(this.inputSource), this.consumer); + SourceUtil.parse(this.parser, this.inputSource, this.consumer); } catch (SAXException e) { SourceUtil.handleSAXException(this.inputSource.getURI(), e); }