On Thu, 3 May 2001, Carsten Ziegeler wrote:
> Hi,
>
> I am not quiet sure if this was a good idea as there were several
> discussions about this point in the past. (One link to this:
> http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=96942815402258&w=2)
>
> And I do not see a reason why it is easier to write custom serializers
> if there is a setup method.
Thanks Carsten pointing us there. I haven't seen it.
Dims, why should a serializer have access to the objectModel? It's only
concern is to serialize the SAX events to the output stream. Can you
explain us your intentions?
Giacomo
>
> Carsten
>
> > dims@apache.org wrote:
> >
> > dims 01/05/03 07:09:45
> >
> > Modified: src/org/apache/cocoon/components/pipeline Tag: xml-cocoon2
> > AbstractStreamPipeline.java
> > CachingStreamPipeline.java
> > src/org/apache/cocoon/serialization Tag: xml-cocoon2
> > AbstractSerializer.java LinkSerializer.java
> > SVGSerializer.java Serializer.java
> > Log:
> > Added setup() for serializers also. Need access to the objectModel when
> > people start writing custom serializers.
> >
> > Revision Changes Path
> > No revision
> >
> >
> > No revision
> >
> >
> > 1.1.2.8 +7 -1
> > xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/Abstrac
> > tStreamPipeline.java
> >
> > Index: AbstractStreamPipeline.java
> > ===================================================================
> > RCS file:
> > /home/cvs/xml-cocoon/src/org/apache/cocoon/components/pipeline/Att
> > ic/AbstractStreamPipeline.java,v
> > retrieving revision 1.1.2.7
> > retrieving revision 1.1.2.8
> > diff -u -r1.1.2.7 -r1.1.2.8
> > --- AbstractStreamPipeline.java 2001/04/30 14:17:12 1.1.2.7
> > +++ AbstractStreamPipeline.java 2001/05/03 14:09:16 1.1.2.8
> > @@ -35,7 +35,7 @@
> > * resource
> > * </UL>
> > * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
> > - * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/04/30 14:17:12 $
> > + * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/05/03 14:09:16 $
> > */
> > public abstract class AbstractStreamPipeline extends
> > AbstractLoggable implements StreamPipeline, Disposable {
> > protected EventPipeline eventPipeline;
> > @@ -122,6 +122,12 @@
> > } else {
> > if ( !checkPipeline() ) {
> > throw new ProcessingException("Attempted to
> > process incomplete pipeline.");
> > + }
> > +
> > + try {
> > + this.serializer.setup((EntityResolver)
> > environment,environment.getObjectModel(),serializerSource,serializ
> > erParam);
> > + } catch ( Exception e ) {
> > + throw new ProcessingException("Error in
> > serializer setup",e);
> > }
> >
> > setupPipeline(environment);
> >
> >
> >
> > 1.1.2.10 +8 -2
> > xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/Caching
> > StreamPipeline.java
> >
> > Index: CachingStreamPipeline.java
> > ===================================================================
> > RCS file:
> > /home/cvs/xml-cocoon/src/org/apache/cocoon/components/pipeline/Att
> > ic/CachingStreamPipeline.java,v
> > retrieving revision 1.1.2.9
> > retrieving revision 1.1.2.10
> > diff -u -r1.1.2.9 -r1.1.2.10
> > --- CachingStreamPipeline.java 2001/05/03 11:33:08 1.1.2.9
> > +++ CachingStreamPipeline.java 2001/05/03 14:09:19 1.1.2.10
> > @@ -44,14 +44,14 @@
> > * </ul>
> > *
> > * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
> > - * @version CVS $Revision: 1.1.2.9 $ $Date: 2001/05/03 11:33:08 $
> > + * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/05/03 14:09:19 $
> > */
> > public final class CachingStreamPipeline extends
> > AbstractStreamPipeline {
> >
> > /** The role name of the serializer */
> > private String serializerRole;
> >
> > - /** The role name of the serializer */
> > + /** The role name of the reader */
> > private String readerRole;
> >
> > /** The cache for the responses */
> > @@ -234,6 +234,12 @@
> > } else {
> > if ( !this.checkPipeline() ) {
> > throw new ProcessingException("Attempted to
> > process incomplete pipeline.");
> > + }
> > +
> > + try {
> > + this.serializer.setup((EntityResolver)
> > environment,environment.getObjectModel(),serializerSource,serializ
> > erParam);
> > + } catch ( Exception e ) {
> > + throw new ProcessingException("Error in
> > serializer setup",e);
> > }
> >
> > try {
> >
> >
> >
> > No revision
> >
> >
> > No revision
> >
> >
> > 1.1.2.16 +15 -2
> > xml-cocoon/src/org/apache/cocoon/serialization/Attic/AbstractSeria
> > lizer.java
> >
> > Index: AbstractSerializer.java
> > ===================================================================
> > RCS file:
> > /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/Abs
> > tractSerializer.java,v
> > retrieving revision 1.1.2.15
> > retrieving revision 1.1.2.16
> > diff -u -r1.1.2.15 -r1.1.2.16
> > --- AbstractSerializer.java 2001/04/30 14:17:37 1.1.2.15
> > +++ AbstractSerializer.java 2001/05/03 14:09:28 1.1.2.16
> > @@ -9,15 +9,21 @@
> > package org.apache.cocoon.serialization;
> >
> > import java.io.BufferedOutputStream;
> > +import java.io.IOException;
> > import java.io.OutputStream;
> > -import org.apache.cocoon.xml.AbstractXMLPipe;
> > +import java.util.Map;
> > import org.apache.avalon.excalibur.pool.Recyclable;
> > +import org.apache.avalon.framework.parameters.Parameters;
> > +import org.apache.cocoon.xml.AbstractXMLPipe;
> > +import org.apache.cocoon.ProcessingException;
> > +import org.xml.sax.EntityResolver;
> > +import org.xml.sax.SAXException;
> >
> > /**
> > * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo
> > Fumagalli</a>
> > * (Apache Software Foundation, Exoffice Technologies)
> > * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
> > - * @version CVS $Revision: 1.1.2.15 $ $Date: 2001/04/30 14:17:37 $
> > + * @version CVS $Revision: 1.1.2.16 $ $Date: 2001/05/03 14:09:28 $
> > */
> >
> > public abstract class AbstractSerializer extends
> > AbstractXMLPipe implements Serializer, Recyclable {
> > @@ -26,6 +32,13 @@
> > * The <code>OutputStream</code> used by this serializer.
> > */
> > protected OutputStream output;
> > +
> > + /**
> > + * Set the <code>EntityResolver</code> the object model
> > <code>Map</code>,
> > + * the source and sitemap <code>Parameters</code> used to
> > process the request.
> > + */
> > + public void setup(EntityResolver resolver, Map
> > objectModel, String src, Parameters par)
> > + throws ProcessingException, SAXException, IOException {}
> >
> > /**
> > * Set the <code>OutputStream</code> where the XML should
> > be serialized.
> >
> >
> >
> > 1.1.2.11 +12 -1
> > xml-cocoon/src/org/apache/cocoon/serialization/Attic/LinkSerializer.java
> >
> > Index: LinkSerializer.java
> > ===================================================================
> > RCS file:
> > /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/Lin
> > kSerializer.java,v
> > retrieving revision 1.1.2.10
> > retrieving revision 1.1.2.11
> > diff -u -r1.1.2.10 -r1.1.2.11
> > --- LinkSerializer.java 2001/04/30 14:17:38 1.1.2.10
> > +++ LinkSerializer.java 2001/05/03 14:09:33 1.1.2.11
> > @@ -11,21 +11,32 @@
> > import java.io.IOException;
> > import java.io.OutputStream;
> > import java.io.PrintStream;
> > +import java.util.Map;
> > import org.apache.cocoon.Constants;
> > +import org.apache.cocoon.ProcessingException;
> > import org.apache.cocoon.xml.xlink.ExtendedXLinkPipe;
> > import org.apache.avalon.excalibur.pool.Poolable;
> > +import org.apache.avalon.framework.parameters.Parameters;
> > import org.xml.sax.Attributes;
> > +import org.xml.sax.EntityResolver;
> > import org.xml.sax.SAXException;
> >
> > /**
> > * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
> > - * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/04/30 14:17:38 $
> > + * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/05/03 14:09:33 $
> > */
> >
> > public class LinkSerializer extends ExtendedXLinkPipe
> > implements Serializer, Poolable {
> >
> > private PrintStream out;
> >
> > + /**
> > + * Set the <code>EntityResolver</code> the object model
> > <code>Map</code>,
> > + * the source and sitemap <code>Parameters</code> used to
> > process the request.
> > + */
> > + public void setup(EntityResolver resolver, Map
> > objectModel, String src, Parameters par)
> > + throws ProcessingException, SAXException, IOException {}
> > +
> > /**
> > * Set the <code>OutputStream</code> where the requested
> > resource should
> > * be serialized.
> >
> >
> >
> > 1.1.2.37 +13 -1
> > xml-cocoon/src/org/apache/cocoon/serialization/Attic/SVGSerializer.java
> >
> > Index: SVGSerializer.java
> > ===================================================================
> > RCS file:
> > /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/SVG
> > Serializer.java,v
> > retrieving revision 1.1.2.36
> > retrieving revision 1.1.2.37
> > diff -u -r1.1.2.36 -r1.1.2.37
> > --- SVGSerializer.java 2001/04/30 14:17:38 1.1.2.36
> > +++ SVGSerializer.java 2001/05/03 14:09:35 1.1.2.37
> > @@ -10,13 +10,16 @@
> >
> > import java.awt.Color;
> > import java.io.BufferedOutputStream;
> > +import java.io.IOException;
> > import java.io.OutputStream;
> > import java.lang.reflect.Field;
> > +import java.util.Map;
> > import org.apache.avalon.framework.component.ComponentManager;
> > import org.apache.avalon.framework.component.Composable;
> > import org.apache.avalon.framework.configuration.Configurable;
> > import org.apache.avalon.framework.configuration.Configuration;
> > import
> > org.apache.avalon.framework.configuration.ConfigurationException;
> > +import org.apache.avalon.framework.parameters.Parameters;
> > import org.apache.batik.transcoder.Transcoder;
> > import org.apache.batik.transcoder.TranscoderInput;
> > import org.apache.batik.transcoder.TranscoderOutput;
> > @@ -27,6 +30,7 @@
> > import
> > org.apache.cocoon.components.transcoder.ExtendableTranscoderFactory;
> > import org.apache.cocoon.components.transcoder.TranscoderFactory;
> > import org.apache.cocoon.environment.Environment;
> > +import org.apache.cocoon.ProcessingException;
> > import org.apache.cocoon.util.ClassUtils;
> > import org.apache.cocoon.xml.XMLConsumer;
> > import org.apache.cocoon.xml.dom.SVGBuilder;
> > @@ -34,6 +38,7 @@
> > import org.apache.log.Logger;
> > import org.w3c.dom.Document;
> > import org.xml.sax.ContentHandler;
> > +import org.xml.sax.EntityResolver;
> > import org.xml.sax.SAXException;
> > import org.xml.sax.ext.LexicalHandler;
> >
> > @@ -42,7 +47,7 @@
> > *
> > * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
> > * @author <a href="mailto:rossb@apache.org">Ross Burton</a>
> > - * @version CVS $Revision: 1.1.2.36 $ $Date: 2001/04/30 14:17:38 $
> > + * @version CVS $Revision: 1.1.2.37 $ $Date: 2001/05/03 14:09:35 $
> > */
> > public class SVGSerializer extends SVGBuilder
> > implements Composable, Serializer, Configurable,
> > Poolable, Cacheable {
> > @@ -65,6 +70,13 @@
> > Transcoder transcoder = null;
> > /** The Transcoder Factory to use */
> > TranscoderFactory factory =
> > ExtendableTranscoderFactory.getTranscoderFactoryImplementation();
> > +
> > + /**
> > + * Set the <code>EntityResolver</code> the object model
> > <code>Map</code>,
> > + * the source and sitemap <code>Parameters</code> used to
> > process the request.
> > + */
> > + public void setup(EntityResolver resolver, Map
> > objectModel, String src, Parameters par)
> > + throws ProcessingException, SAXException, IOException {}
> >
> > /**
> > * Set the <code>OutputStream</code> where the XML should
> > be serialized.
> >
> >
> >
> > 1.1.2.5 +3 -2
> > xml-cocoon/src/org/apache/cocoon/serialization/Attic/Serializer.java
> >
> > Index: Serializer.java
> > ===================================================================
> > RCS file:
> > /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/Ser
> > ializer.java,v
> > retrieving revision 1.1.2.4
> > retrieving revision 1.1.2.5
> > diff -u -r1.1.2.4 -r1.1.2.5
> > --- Serializer.java 2000/08/04 21:12:02 1.1.2.4
> > +++ Serializer.java 2001/05/03 14:09:37 1.1.2.5
> > @@ -7,6 +7,7 @@
> >
> > ******************************************************************
> > ***********/
> > package org.apache.cocoon.serialization;
> >
> > +import org.apache.cocoon.sitemap.SitemapModelComponent;
> > import org.apache.cocoon.sitemap.SitemapOutputComponent;
> > import org.apache.cocoon.xml.XMLConsumer;
> >
> > @@ -14,7 +15,7 @@
> > *
> > * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo
> > Fumagalli</a>
> > * (Apache Software Foundation, Exoffice Technologies)
> > - * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/08/04 21:12:02 $
> > + * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/05/03 14:09:37 $
> > */
> > -public interface Serializer extends XMLConsumer,
> > SitemapOutputComponent {
> > +public interface Serializer extends XMLConsumer,
> > SitemapOutputComponent, SitemapModelComponent {
> > }
> >
> >
> >
> >
> > ----------------------------------------------------------------------
> > In case of troubles, e-mail: webmaster@xml.apache.org
> > To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-cvs-help@xml.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
|