cziegeler 2003/02/07 05:15:15 Modified: src/java/org/apache/cocoon/serialization Tag: cocoon_2_0_3_branch XMLSerializer.java TextSerializer.java Serializer.java AbstractSerializer.java HTMLSerializer.java ZipArchiveSerializer.java LinkSerializer.java AbstractTextSerializer.java src/java/org/apache/cocoon/sitemap Tag: cocoon_2_0_3_branch SitemapOutputComponent.java Added: src/java/org/apache/cocoon Tag: cocoon_2_0_3_branch CascadingIOException.java Log: Synchronizing serializers Revision Changes Path No revision No revision 1.2.2.1 +0 -0 xml-cocoon2/src/java/org/apache/cocoon/CascadingIOException.java Index: CascadingIOException.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/CascadingIOException.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 No revision No revision 1.5.2.4 +15 -21 xml-cocoon2/src/java/org/apache/cocoon/serialization/XMLSerializer.java Index: XMLSerializer.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/serialization/XMLSerializer.java,v retrieving revision 1.5.2.3 retrieving revision 1.5.2.4 diff -u -r1.5.2.3 -r1.5.2.4 --- XMLSerializer.java 7 Feb 2003 07:22:38 -0000 1.5.2.3 +++ XMLSerializer.java 7 Feb 2003 13:15:14 -0000 1.5.2.4 @@ -50,13 +50,15 @@ */ package org.apache.cocoon.serialization; -import org.apache.avalon.framework.CascadingRuntimeException; - import javax.xml.transform.OutputKeys; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; + import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.cocoon.CascadingIOException; + +import java.io.IOException; import java.io.OutputStream; /** @@ -66,11 +68,6 @@ public class XMLSerializer extends AbstractTextSerializer { - private TransformerHandler handler; - - public XMLSerializer() { - } - /** * Set the configurations for this serializer. */ @@ -80,25 +77,22 @@ this.format.put(OutputKeys.METHOD,"xml"); } - public void setOutputStream(OutputStream out) { + /** + * Set the {@link OutputStream} where the requested resource should + * be serialized. + */ + public void setOutputStream(OutputStream out) throws IOException { + super.setOutputStream(out); try { - super.setOutputStream(out); - this.handler = getTransformerFactory().newTransformerHandler(); - handler.getTransformer().setOutputProperties(format); + TransformerHandler handler = this.getTransformerFactory().newTransformerHandler(); + handler.getTransformer().setOutputProperties(this.format); handler.setResult(new StreamResult(this.output)); this.setContentHandler(handler); this.setLexicalHandler(handler); } catch (Exception e) { - getLogger().error("XMLSerializer.setOutputStream()", e); - throw new CascadingRuntimeException("XMLSerializer.setOutputStream()", e); + final String message = "Cannot set XMLSerializer outputstream"; + throw new CascadingIOException(message, e); } } - /** - * Recycle the serializer. GC instance variables - */ - public void recycle() { - super.recycle(); - this.handler = null; - } } 1.5.2.4 +15 -23 xml-cocoon2/src/java/org/apache/cocoon/serialization/TextSerializer.java Index: TextSerializer.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/serialization/TextSerializer.java,v retrieving revision 1.5.2.3 retrieving revision 1.5.2.4 diff -u -r1.5.2.3 -r1.5.2.4 --- TextSerializer.java 7 Feb 2003 07:22:38 -0000 1.5.2.3 +++ TextSerializer.java 7 Feb 2003 13:15:14 -0000 1.5.2.4 @@ -50,15 +50,16 @@ */ package org.apache.cocoon.serialization; -import org.apache.avalon.framework.CascadingRuntimeException; - +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.cocoon.CascadingIOException; import javax.xml.transform.OutputKeys; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; +import java.io.IOException; import java.io.OutputStream; + /** * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> * @version CVS $Id$ @@ -66,11 +67,6 @@ public class TextSerializer extends AbstractTextSerializer { - private TransformerHandler handler; - - public TextSerializer() { - } - /** * Set the configurations for this serializer. */ @@ -80,26 +76,22 @@ this.format.put(OutputKeys.METHOD,"text"); } - public void setOutputStream(OutputStream out) { + /** + * Set the {@link OutputStream} where the requested resource should + * be serialized. + */ + public void setOutputStream(OutputStream out) throws IOException { + super.setOutputStream(out); try { - super.setOutputStream(out); - handler = getTransformerFactory().newTransformerHandler(); + TransformerHandler handler = this.getTransformerFactory().newTransformerHandler(); handler.getTransformer().setOutputProperties(format); handler.setResult(new StreamResult(this.output)); this.setContentHandler(handler); this.setLexicalHandler(handler); } catch (Exception e) { - getLogger().error("TextSerializer.setOutputStream()", e); - throw new CascadingRuntimeException("TextSerializer.setOutputStream()", e); + final String message = "Cannot set TextSerializer outputstream"; + throw new CascadingIOException(message, e); } - } - - /** - * Recyce the serializer. GC instance variables - */ - public void recycle() { - super.recycle(); - this.handler = null; } } 1.4.2.2 +2 -2 xml-cocoon2/src/java/org/apache/cocoon/serialization/Serializer.java Index: Serializer.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/serialization/Serializer.java,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -u -r1.4.2.1 -r1.4.2.2 --- Serializer.java 7 Feb 2003 07:22:38 -0000 1.4.2.1 +++ Serializer.java 7 Feb 2003 13:15:14 -0000 1.4.2.2 @@ -61,5 +61,5 @@ */ public interface Serializer extends XMLConsumer, SitemapOutputComponent { - String ROLE = "org.apache.cocoon.serialization.Serializer"; + String ROLE = Serializer.class.getName(); } 1.5.2.2 +6 -4 xml-cocoon2/src/java/org/apache/cocoon/serialization/AbstractSerializer.java Index: AbstractSerializer.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/serialization/AbstractSerializer.java,v retrieving revision 1.5.2.1 retrieving revision 1.5.2.2 diff -u -r1.5.2.1 -r1.5.2.2 --- AbstractSerializer.java 7 Feb 2003 07:22:38 -0000 1.5.2.1 +++ AbstractSerializer.java 7 Feb 2003 13:15:14 -0000 1.5.2.2 @@ -51,7 +51,7 @@ package org.apache.cocoon.serialization; import org.apache.cocoon.xml.AbstractXMLPipe; - +import java.io.IOException; import java.io.OutputStream; /** @@ -70,9 +70,11 @@ protected OutputStream output; /** - * Set the <code>OutputStream</code> where the XML should be serialized. + * Set the {@link OutputStream} where the requested resource should + * be serialized. */ - public void setOutputStream(OutputStream out) { + public void setOutputStream(OutputStream out) + throws IOException { this.output = out; } 1.5.2.4 +14 -22 xml-cocoon2/src/java/org/apache/cocoon/serialization/HTMLSerializer.java Index: HTMLSerializer.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/serialization/HTMLSerializer.java,v retrieving revision 1.5.2.3 retrieving revision 1.5.2.4 diff -u -r1.5.2.3 -r1.5.2.4 --- HTMLSerializer.java 7 Feb 2003 07:22:38 -0000 1.5.2.3 +++ HTMLSerializer.java 7 Feb 2003 13:15:14 -0000 1.5.2.4 @@ -50,13 +50,13 @@ */ package org.apache.cocoon.serialization; -import org.apache.avalon.framework.CascadingRuntimeException; - +import org.apache.avalon.framework.configuration.Configuration; +import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.cocoon.CascadingIOException; import javax.xml.transform.OutputKeys; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; +import java.io.IOException; import java.io.OutputStream; /** @@ -66,11 +66,6 @@ public class HTMLSerializer extends AbstractTextSerializer { - private TransformerHandler handler; - - public HTMLSerializer() { - } - /** * Set the configurations for this serializer. */ @@ -80,25 +75,22 @@ this.format.put(OutputKeys.METHOD,"html"); } - public void setOutputStream(OutputStream out) { + /** + * Set the {@link OutputStream} where the requested resource should + * be serialized. + */ + public void setOutputStream(OutputStream out) + throws IOException { + super.setOutputStream(out); try { - super.setOutputStream(out); - handler = getTransformerFactory().newTransformerHandler(); + TransformerHandler handler = this.getTransformerFactory().newTransformerHandler(); handler.getTransformer().setOutputProperties(this.format); handler.setResult(new StreamResult(this.output)); this.setContentHandler(handler); this.setLexicalHandler(handler); } catch (Exception e) { - getLogger().error("HTMLSerializer.setOutputStream()", e); - throw new CascadingRuntimeException("HTMLSerializer.setOutputStream()", e); + throw new CascadingIOException(e.toString(), e); } } - /** - * Recyce the serializer. GC instance variables - */ - public void recycle() { - super.recycle(); - this.handler = null; - } } 1.1.2.5 +8 -8 xml-cocoon2/src/java/org/apache/cocoon/serialization/ZipArchiveSerializer.java Index: ZipArchiveSerializer.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/serialization/ZipArchiveSerializer.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- ZipArchiveSerializer.java 7 Feb 2003 07:22:38 -0000 1.1.2.4 +++ ZipArchiveSerializer.java 7 Feb 2003 13:15:14 -0000 1.1.2.5 @@ -51,13 +51,6 @@ package org.apache.cocoon.serialization; -import java.io.FilterOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Enumeration; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.component.ComponentSelector; @@ -68,6 +61,13 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.NamespaceSupport; + +import java.io.FilterOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Enumeration; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; /** * A serializer that builds Zip archives by aggregating several sources. 1.6.2.2 +12 -4 xml-cocoon2/src/java/org/apache/cocoon/serialization/LinkSerializer.java Index: LinkSerializer.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/serialization/LinkSerializer.java,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -u -r1.6.2.1 -r1.6.2.2 --- LinkSerializer.java 7 Feb 2003 07:22:38 -0000 1.6.2.1 +++ LinkSerializer.java 7 Feb 2003 13:15:14 -0000 1.6.2.2 @@ -50,7 +50,6 @@ */ package org.apache.cocoon.serialization; -import org.apache.avalon.excalibur.pool.Poolable; import org.apache.cocoon.Constants; import org.apache.cocoon.xml.xlink.ExtendedXLinkPipe; import org.xml.sax.Attributes; @@ -65,12 +64,14 @@ * @version CVS $Id$ */ -public class LinkSerializer extends ExtendedXLinkPipe implements Serializer, Poolable { +public class LinkSerializer + extends ExtendedXLinkPipe + implements Serializer { private PrintStream out; /** - * Set the <code>OutputStream</code> where the requested resource should + * Set the {@link OutputStream} where the requested resource should * be serialized. */ public void setOutputStream(OutputStream out) throws IOException { @@ -120,4 +121,11 @@ return false; } + /** + * Recyclable + */ + public void recycle() { + super.recycle(); + this.out = null; + } } 1.9.2.5 +5 -3 xml-cocoon2/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java Index: AbstractTextSerializer.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java,v retrieving revision 1.9.2.4 retrieving revision 1.9.2.5 diff -u -r1.9.2.4 -r1.9.2.5 --- AbstractTextSerializer.java 7 Feb 2003 07:22:38 -0000 1.9.2.4 +++ AbstractTextSerializer.java 7 Feb 2003 13:15:14 -0000 1.9.2.5 @@ -173,9 +173,11 @@ } /** - * Set the <code>OutputStream</code> where the XML should be serialized. + * Set the {@link OutputStream} where the requested resource should + * be serialized. */ - public void setOutputStream(OutputStream out) { + public void setOutputStream(OutputStream out) + throws IOException { /* * Add a level of buffering to the output stream. Xalan serializes * every character individually. In conjunction with chunked No revision No revision 1.4.2.2 +3 -2 xml-cocoon2/src/java/org/apache/cocoon/sitemap/SitemapOutputComponent.java Index: SitemapOutputComponent.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/sitemap/SitemapOutputComponent.java,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -u -r1.4.2.1 -r1.4.2.2 --- SitemapOutputComponent.java 7 Feb 2003 07:22:50 -0000 1.4.2.1 +++ SitemapOutputComponent.java 7 Feb 2003 13:15:15 -0000 1.4.2.2 @@ -62,8 +62,9 @@ * @version CVS $Id$ */ public interface SitemapOutputComponent extends Component { + /** - * Set the <code>OutputStream</code> where the requested resource should + * Set the {@link OutputStream} where the requested resource should * be serialized. */ void setOutputStream(OutputStream out) throws IOException;
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]