cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/serialization FOPSerializer.java
Date Wed, 19 Sep 2001 09:40:21 GMT
cziegeler    01/09/19 02:40:21

  Modified:    src/org/apache/cocoon/serialization Tag: cocoon_20_branch
                        FOPSerializer.java
  Log:
  Create a new renderer object for each invocation otherwise the pdf output is screwed up
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.1.1.2.4 +21 -5     xml-cocoon2/src/org/apache/cocoon/serialization/FOPSerializer.java
  
  Index: FOPSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/serialization/FOPSerializer.java,v
  retrieving revision 1.1.1.1.2.3
  retrieving revision 1.1.1.1.2.4
  diff -u -r1.1.1.1.2.3 -r1.1.1.1.2.4
  --- FOPSerializer.java	2001/09/05 22:18:14	1.1.1.1.2.3
  +++ FOPSerializer.java	2001/09/19 09:40:21	1.1.1.1.2.4
  @@ -44,19 +44,24 @@
       /** 
         * The current <code>Renderer</code>.  
         */
  -    Renderer renderer = null;
  +    protected Renderer renderer;
   
       /** 
         * The Renderer Factory to use 
         */
  -    RendererFactory factory = ExtendableRendererFactory.getRendererFactoryImplementation();
  +    protected static RendererFactory factory = ExtendableRendererFactory.getRendererFactoryImplementation();
   
       /** 
         * The current <code>mime-type</code>. 
         */
  -    private String mimetype = null;
  +    protected String mimetype;
   
       /**
  +     * The renderer name if configured
  +     */
  +    protected String rendererName;
  +
  +    /**
         * Set the configurations for this serializer.
         */
       public void configure(Configuration conf) 
  @@ -106,7 +111,7 @@
           for (int i = 0; i < parameters.length; i++) {
               String name = parameters[i].getAttribute("name");
               if ("renderer".equals(name)) {
  -                String rendererName = parameters[i].getAttribute("value");
  +                this.rendererName = parameters[i].getAttribute("value");
                   try {
                       this.renderer = (Renderer)ClassUtils.newInstance(rendererName);
                   } catch (Exception ex) {
  @@ -142,8 +147,18 @@
   
           if(driver instanceof Loggable) {
               driver.setLogger(getLogger().getChildLogger("fop"));
  +        }
  +        if (this.rendererName == null) {
  +            this.renderer = factory.createRenderer(mimetype);
  +        } else {
  +            try {
  +                this.renderer = (Renderer)ClassUtils.newInstance(rendererName);
  +            } catch (Exception ex) {
  +                getLogger().error("Cannot load  class " + rendererName, ex);
  +                throw new RuntimeException("Cannot load class " + rendererName);
  +            }
           }
  -        driver.setRenderer(renderer);
  +        driver.setRenderer(this.renderer);
           driver.setOutputStream(out);
           setContentHandler(driver.getContentHandler());
       }
  @@ -179,6 +194,7 @@
           super.recycle();
           options = null;
           driver = null;
  +        this.renderer = null;
       }
   
       /**
  
  
  

----------------------------------------------------------------------
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


Mime
View raw message