You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2007/12/19 21:27:35 UTC
svn commit: r605687 - in
/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/generation:
FileGenerator.java FileGeneratorBean.java
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 <code>null</code>.
*/
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);
}