You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jb...@apache.org on 2006/10/03 09:50:11 UTC

svn commit: r452332 - in /cocoon/trunk/blocks: cocoon-core-sample/cocoon-core-main-sample/src/main/resources/COB-INF/hello-world/style/xsl/ cocoon-fop/ cocoon-fop/cocoon-fop-ng-impl/ cocoon-fop/cocoon-fop-ng-impl/src/ cocoon-fop/cocoon-fop-ng-impl/src/...

Author: jbq
Date: Tue Oct  3 00:50:10 2006
New Revision: 452332

URL: http://svn.apache.org/viewvc?view=rev&rev=452332
Log:
<action dev="JBQ" type="add" due-to="Lars Trieloff" due-to-email="lars@trieloff.net" fixes-bug="COCOON-1924">
  Adding support for FOP 0.92beta and later, written by Jeremias Märki (FOP Developer) and Lars Trieloff during
  the Hackathon.  It uses the new FOP API which simplifies the Serializer code greatly and allows using Cocoon's
  source resolver.
</action>

Added:
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/
      - copied from r452023, cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/pom.xml
      - copied, changed from r452331, cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/pom.xml
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/
      - copied from r452331, cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/src/
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/java/org/apache/cocoon/blocks/
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/java/org/apache/cocoon/blocks/fop/
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/java/org/apache/cocoon/blocks/fop/FOPNGSerializer.java   (with props)
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/status.xml
      - copied, changed from r452331, cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/status.xml
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/
      - copied from r452023, cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/pom.xml
      - copied, changed from r452331, cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/pom.xml
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/
      - copied from r452331, cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/src/
Removed:
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/java/org/apache/cocoon/components/
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/java/org/apache/cocoon/serialization/FOPSerializer.java
Modified:
    cocoon/trunk/blocks/cocoon-core-sample/cocoon-core-main-sample/src/main/resources/COB-INF/hello-world/style/xsl/page2fo.xsl
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/resources/META-INF/legacy/sitemap-additions/cocoon-fop.xmap
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/main/resources/COB-INF/fop.xsamples
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/main/resources/COB-INF/misc/samples.xml
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/main/resources/COB-INF/sitemap.xmap
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/pom.xml
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/src/main/resources/COB-INF/sitemap.xmap
    cocoon/trunk/blocks/cocoon-fop/pom.xml

Modified: cocoon/trunk/blocks/cocoon-core-sample/cocoon-core-main-sample/src/main/resources/COB-INF/hello-world/style/xsl/page2fo.xsl
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-core-sample/cocoon-core-main-sample/src/main/resources/COB-INF/hello-world/style/xsl/page2fo.xsl?view=diff&rev=452332&r1=452331&r2=452332
==============================================================================
--- cocoon/trunk/blocks/cocoon-core-sample/cocoon-core-main-sample/src/main/resources/COB-INF/hello-world/style/xsl/page2fo.xsl (original)
+++ cocoon/trunk/blocks/cocoon-core-sample/cocoon-core-main-sample/src/main/resources/COB-INF/hello-world/style/xsl/page2fo.xsl Tue Oct  3 00:50:10 2006
@@ -33,8 +33,8 @@
                   margin-bottom="2cm" 
                   margin-left="2.5cm" 
                   margin-right="2.5cm">
-       <fo:region-before extent="3cm"/>
        <fo:region-body margin-top="3cm"/>
+       <fo:region-before extent="3cm"/>
        <fo:region-after extent="1.5cm"/>
      </fo:simple-page-master>
 

Copied: cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/pom.xml (from r452331, cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/pom.xml)
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/pom.xml?view=diff&rev=452332&p1=cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/pom.xml&r1=452331&p2=cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/pom.xml&r2=452332
==============================================================================
--- cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/pom.xml (original)
+++ cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/pom.xml Tue Oct  3 00:50:10 2006
@@ -28,10 +28,10 @@
     <artifactId>cocoon-fop</artifactId>
     <version>1-SNAPSHOT</version>
   </parent>
-  <artifactId>cocoon-fop-impl</artifactId>
+  <artifactId>cocoon-fop-ng-impl</artifactId>
   <version>1.0.0-SNAPSHOT</version>
   <packaging>jar</packaging>
-  <name>FOP Block Implementation</name>
+  <name>FOP 0.92 Block Implementation</name>
   <dependencies>
     <dependency>
       <groupId>org.apache.cocoon</groupId>
@@ -39,17 +39,13 @@
       <version>2.2.0-M2-SNAPSHOT</version>
     </dependency>
     <dependency>
-      <groupId>fop</groupId>
+      <groupId>org.apache.xmlgraphics</groupId>
       <artifactId>fop</artifactId>
-      <version>0.20.5</version>
+      <version>0.92beta</version>
       <exclusions>
         <exclusion>
-          <groupId>avalon-framework</groupId>
-          <artifactId>avalon-framework</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>batik</groupId>
-          <artifactId>batik-1.5-fop</artifactId>
+          <groupId>org.apache.avalon.framework</groupId>
+          <artifactId>avalon-framework-impl</artifactId>
         </exclusion>
         <exclusion>
           <groupId>xalan</groupId>
@@ -65,6 +61,12 @@
       <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-batik-impl</artifactId>
       <version>1.0.0-SNAPSHOT</version>
+      <exclusions>
+        <exclusion>
+          <groupId>fop</groupId>
+          <artifactId>fop</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
   </dependencies>
 </project>

Added: cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/java/org/apache/cocoon/blocks/fop/FOPNGSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/java/org/apache/cocoon/blocks/fop/FOPNGSerializer.java?view=auto&rev=452332
==============================================================================
--- cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/java/org/apache/cocoon/blocks/fop/FOPNGSerializer.java (added)
+++ cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/java/org/apache/cocoon/blocks/fop/FOPNGSerializer.java Tue Oct  3 00:50:10 2006
@@ -0,0 +1,313 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.blocks.fop;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.avalon.framework.activity.Disposable;
+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.configuration.SAXConfigurationHandler;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.cocoon.caching.CacheableProcessingComponent;
+import org.apache.cocoon.components.source.SourceUtil;
+import org.apache.cocoon.serialization.AbstractSerializer;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceException;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.excalibur.source.SourceValidity;
+import org.apache.excalibur.source.impl.validity.NOPValidity;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
+import org.xml.sax.InputSource;
+
+/**
+ * @version $Id$
+ */
+public class FOPNGSerializer extends AbstractSerializer implements
+  Configurable, CacheableProcessingComponent, Serviceable, URIResolver, Disposable {
+
+	protected SourceResolver resolver;
+
+    /**
+     * Factory to create fop objects
+     */
+    protected FopFactory fopfactory = FopFactory.newInstance();
+    /**
+     * The FOP instance.
+     */
+    protected Fop fop;
+
+    /**
+     * The current <code>mime-type</code>.
+     */
+    protected String mimetype;
+
+    /**
+     * Should we set the content length ?
+     */
+    protected boolean setContentLength = true;
+
+    /**
+     * It is used to make sure that default Options loaded only once.
+     */
+    private static boolean configured = false;
+
+    /**
+     * Manager to get URLFactory from.
+     */
+    protected ServiceManager manager;
+	private Map rendererOptions;
+
+    /**
+     * Set the component manager for this serializer.
+     */
+    public void service(ServiceManager manager) throws ServiceException {
+        this.manager = manager;
+        this.resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
+    }
+/*
+    public void dispose() {
+        this.manager.release(this.resolver);
+    }
+*/
+    /**
+     * Set the configurations for this serializer.
+     */
+    public void configure(Configuration conf) throws ConfigurationException {
+    	//should the content length be set
+        this.setContentLength = conf.getChild("set-content-length").getValueAsBoolean(true);
+
+        String configUrl = conf.getChild("user-config").getValue(null);
+
+        
+        if (configUrl != null) {
+            Source configSource = null;
+            SourceResolver resolver = null;
+            try {
+                resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
+                configSource = resolver.resolveURI(configUrl);
+                if (getLogger().isDebugEnabled()) {
+                    getLogger().debug("Loading configuration from " + configSource.getURI());
+                }
+                SAXConfigurationHandler configHandler = new SAXConfigurationHandler();
+                SourceUtil.toSAX(configSource, configHandler);
+                fopfactory.setUserConfig(configHandler.getConfiguration());
+            } catch (Exception e) {
+                getLogger().warn("Cannot load configuration from " + configUrl);
+                throw new ConfigurationException("Cannot load configuration from " + configUrl, e);
+            } finally {
+                if (resolver != null) {
+                    resolver.release(configSource);
+                    manager.release(resolver);
+                }
+            }
+        }
+        
+        fopfactory.setURIResolver(this);
+
+        // Get the mime type.
+        this.mimetype = conf.getAttribute("mime-type");
+
+        Configuration confRenderer = conf.getChild("renderer-config");
+        if (confRenderer != null) {
+            Configuration[] parameters = confRenderer.getChildren("parameter");
+            if (parameters.length > 0) {
+                rendererOptions = new HashMap();
+				for (int i = 0; i < parameters.length; i++) {
+                    String name = parameters[i].getAttribute("name");
+                    String value = parameters[i].getAttribute("value");
+                
+                    if (getLogger().isDebugEnabled()) {
+                    	getLogger().debug("renderer " + String.valueOf(name) + " = " + String.valueOf(value));
+                    }
+                }
+			}
+        }
+    }
+
+    /**
+     * Return the MIME type.
+     */
+    public String getMimeType() {
+        return mimetype;
+    }
+
+    /**
+     * Create the FOP driver
+     * Set the <code>OutputStream</code> where the XML should be serialized.
+     * @throws IOException 
+     */
+    public void setOutputStream(OutputStream out) throws IOException {
+        
+        // Give the source resolver to Batik which is used by FOP
+        //SourceProtocolHandler.setup(this.resolver);
+
+    	FOUserAgent userAgent = fopfactory.newFOUserAgent();
+    	if (this.rendererOptions != null) {
+    		userAgent.getRendererOptions().putAll(this.rendererOptions);
+    	}
+    	try {
+			this.fop = fopfactory.newFop(getMimeType(), userAgent, out);
+			setContentHandler(this.fop.getDefaultHandler());
+		} catch (FOPException e) {
+			getLogger().error("FOP setup failed", e);
+			throw new IOException("Unable to setup fop: " + e.getLocalizedMessage());
+		}
+    }
+
+    /**
+     * Generate the unique key.
+     * This key must be unique inside the space of this component.
+     * This method must be invoked before the generateValidity() method.
+     *
+     * @return The generated key or <code>0</code> if the component
+     *              is currently not cacheable.
+     */
+    public Serializable getKey() {
+        return "1";
+    }
+
+    /**
+     * Generate the validity object.
+     * Before this method can be invoked the generateKey() method
+     * must be invoked.
+     *
+     * @return The generated validity object or <code>null</code> if the
+     *         component is currently not cacheable.
+     */
+    public SourceValidity getValidity() {
+        return NOPValidity.SHARED_INSTANCE;
+    }
+
+    /**
+     * Recycle serializer by removing references
+     */
+    public void recycle() {
+        super.recycle();
+        this.fop = null;
+    }
+
+    /**
+     * Test if the component wants to set the content length
+     */
+    public boolean shouldSetContentLength() {
+        return this.setContentLength;
+    }
+    
+    //From URIResolver, copied from TraxProcessor
+	public javax.xml.transform.Source resolve(String href, String base) throws TransformerException {
+		if (getLogger().isDebugEnabled()) {
+            getLogger().debug("resolve(href = " + href + ", base = " + base + "); resolver = " + resolver);
+        }
+
+        Source source = null;
+        try {
+            if (base == null || href.indexOf(":") > 1) {
+                // Null base - href must be an absolute URL
+                source = resolver.resolveURI(href);
+            } else if (href.length() == 0) {
+                // Empty href resolves to base
+                source = resolver.resolveURI(base);
+            } else {
+                // is the base a file or a real m_url
+                if (!base.startsWith("file:")) {
+                    int lastPathElementPos = base.lastIndexOf('/');
+                    if (lastPathElementPos == -1) {
+                        // this should never occur as the base should
+                        // always be protocol:/....
+                        return null; // we can't resolve this
+                    } else {
+                        source = resolver.resolveURI(base.substring(0, lastPathElementPos) + "/" + href);
+                    }
+                } else {
+                    File parent = new File(base.substring(5));
+                    File parent2 = new File(parent.getParentFile(), href);
+                    source = resolver.resolveURI(parent2.toURL().toExternalForm());
+                }
+            }
+
+            InputSource is = getInputSource(source);
+
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("source = " + source + ", system id = " + source.getURI());
+            }
+
+            return new StreamSource(is.getByteStream(), is.getSystemId());
+        } catch (SourceException e) {
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Failed to resolve " + href + "(base = " + base + "), return null", e);
+            }
+
+            // CZ: To obtain the same behaviour as when the resource is
+            // transformed by the XSLT Transformer we should return null here.
+            return null;
+        } catch (java.net.MalformedURLException mue) {
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Failed to resolve " + href + "(base = " + base + "), return null", mue);
+            }
+
+            return null;
+        } catch (IOException ioe) {
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Failed to resolve " + href + "(base = " + base + "), return null", ioe);
+            }
+
+            return null;
+        } finally {
+            resolver.release(source);
+        }
+	}
+	
+    /**
+     * Return a new <code>InputSource</code> object that uses the
+     * <code>InputStream</code> and the system ID of the <code>Source</code>
+     * object.
+     * 
+     * @throws IOException
+     *             if I/O error occured.
+     */
+    private static InputSource getInputSource(final Source source) throws IOException, SourceException {
+        final InputSource newObject = new InputSource(source.getInputStream());
+        newObject.setSystemId(source.getURI());
+        return newObject;
+    }
+	
+	public void dispose() {
+		if (null!=manager) {
+			this.manager.release(this.resolver);
+			this.manager = null;
+		}
+		this.resolver = null;
+		
+	}
+
+}

Propchange: cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/java/org/apache/cocoon/blocks/fop/FOPNGSerializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/java/org/apache/cocoon/blocks/fop/FOPNGSerializer.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/resources/META-INF/legacy/sitemap-additions/cocoon-fop.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/resources/META-INF/legacy/sitemap-additions/cocoon-fop.xmap?view=diff&rev=452332&r1=452331&r2=452332
==============================================================================
--- cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/resources/META-INF/legacy/sitemap-additions/cocoon-fop.xmap (original)
+++ cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/src/main/resources/META-INF/legacy/sitemap-additions/cocoon-fop.xmap Tue Oct  3 00:50:10 2006
@@ -21,7 +21,7 @@
     +-->
 <map:components xmlns:map="http://apache.org/cocoon/sitemap/1.0">
   <map:serializers>
-    <map:serializer name="fo2pdf" logger="sitemap.serializer.fo2pdf" src="org.apache.cocoon.serialization.FOPSerializer" mime-type="application/pdf">
+    <map:serializer name="fo2pdf" logger="sitemap.serializer.fo2pdf" src="org.apache.cocoon.blocks.fop.FOPNGSerializer" mime-type="application/pdf">
       <!-- This element specifies URL to FOP user configuration file.
            It can be absolute file URL or relative to the servlet context.
            Examples:
@@ -36,8 +36,18 @@
       -->
     </map:serializer>
 
-    <map:serializer logger="sitemap.serializer.fo2ps" name="fo2ps" src="org.apache.cocoon.serialization.FOPSerializer" mime-type="application/postscript"/>
+    <map:serializer logger="sitemap.serializer.fo2ps" name="fo2ps" src="org.apache.cocoon.blocks.fop.FOPNGSerializer" mime-type="application/postscript"/>
 
-    <map:serializer logger="sitemap.serializer.fo2pcl" name="fo2pcl" src="org.apache.cocoon.serialization.FOPSerializer" mime-type="vnd.hp-PCL"/>
+    <map:serializer logger="sitemap.serializer.fo2pcl" name="fo2pcl" src="org.apache.cocoon.blocks.fop.FOPNGSerializer" mime-type="application/x-pcl"/>
+    
+    <map:serializer logger="sitemap.serializer.fo2text" name="fo2text" src="org.apache.cocoon.blocks.fop.FOPNGSerializer" mime-type="text/plain"/>
+    
+    <map:serializer logger="sitemap.serializer.fo2rtf" name="fo2rtf" src="org.apache.cocoon.blocks.fop.FOPNGSerializer" mime-type="application/rtf"/>
+    
+    <map:serializer logger="sitemap.serializer.fo2png" name="fo2png" src="org.apache.cocoon.blocks.fop.FOPNGSerializer" mime-type="image/png"/>
+    
+    <map:serializer logger="sitemap.serializer.fo2tiff" name="fo2tiff" src="org.apache.cocoon.blocks.fop.FOPNGSerializer" mime-type="image/tiff"/>
+    
+    <map:serializer logger="sitemap.serializer.fo2afp" name="fo2afp" src="org.apache.cocoon.blocks.fop.FOPNGSerializer" mime-type="application/x-afp"/>
   </map:serializers>
 </map:components>

Copied: cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/status.xml (from r452331, cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/status.xml)
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/status.xml?view=diff&rev=452332&p1=cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/status.xml&r1=452331&p2=cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/status.xml&r2=452332
==============================================================================
--- cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/status.xml (original)
+++ cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-impl/status.xml Tue Oct  3 00:50:10 2006
@@ -15,59 +15,16 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<!DOCTYPE status [
-<!ELEMENT status (developers, todo, changes)>
-<!ELEMENT developers (person+)>
-<!ELEMENT person EMPTY>
-<!ATTLIST person
-  name CDATA #REQUIRED
-  email CDATA #REQUIRED
-  id CDATA #REQUIRED
->
-<!ELEMENT todo (actions+)>
-<!ELEMENT actions (action+)>
-<!ATTLIST actions
-  priority (high | medium | low) #REQUIRED
->
-<!ELEMENT changes (release+)>
-<!ELEMENT release (action+)>
-<!ATTLIST release
-  version CDATA #REQUIRED
-  date CDATA #REQUIRED
->
-<!ELEMENT action (#PCDATA | link | br | code | ul | strong)*>
-<!ATTLIST action
-  context (build | code | docs) #IMPLIED
-  assigned-to CDATA #IMPLIED
-  dev CDATA #IMPLIED
-  type (add | fix | remove | update) #IMPLIED
-  fixes-bug CDATA #IMPLIED
-  due-to CDATA #IMPLIED
-  due-to-email CDATA #IMPLIED
->
-<!ELEMENT code (#PCDATA)>
-<!ELEMENT br EMPTY>
-<!ELEMENT strong (#PCDATA)>
-<!ELEMENT link (#PCDATA)>
-<!ATTLIST link
-  href CDATA #REQUIRED
->
-<!ELEMENT ul (li)+>
-<!ELEMENT li (#PCDATA | link | br | code | ul)*>
-<!ENTITY eacute           "&#x000E9;">
-<!ENTITY ouml             "&#x000F6;">
-<!ENTITY uuml             "&#x000FC;">
-<!ENTITY ccedil           "&#x000E7;">
-]>
-
 <!-- SVN $Id$ -->
 
 <status>
- <!-- The following list contains the changes since the latest 2.1.x version. -->
- <changes>
-  <release version="@version@" date="@date@">
-  </release>
- </changes>
-
+  <changes>
+    <release version="@version@" date="@date@">
+      <action dev="JBQ" type="add" due-to="Lars Trieloff" due-to-email="lars@trieloff.net" fixes-bug="COCOON-1924">
+        Adding support for FOP 0.92beta and later, written by Jeremias Märki (FOP Developer) and Lars Trieloff during
+        the Hackathon.  It uses the new FOP API which simplifies the Serializer code greatly and allows using Cocoon's
+        source resolver.
+      </action>
+    </release>
+  </changes>
 </status>
-

Copied: cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/pom.xml (from r452331, cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/pom.xml)
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/pom.xml?view=diff&rev=452332&p1=cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/pom.xml&r1=452331&p2=cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/pom.xml&r2=452332
==============================================================================
--- cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/pom.xml (original)
+++ cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/pom.xml Tue Oct  3 00:50:10 2006
@@ -21,25 +21,28 @@
     | @version $Id$
     |
     +-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.cocoon</groupId>
-        <artifactId>cocoon-fop</artifactId>
-        <version>1-SNAPSHOT</version>
-    </parent>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
     <groupId>org.apache.cocoon</groupId>
-    <artifactId>cocoon-fop-sample</artifactId>
-    <version>1.0.0-SNAPSHOT</version>
-    <packaging>jar</packaging>
-    <name>FOP Block Samples</name>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.cocoon</groupId>
-            <artifactId>cocoon-fop-impl</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-    </dependencies>
+    <artifactId>cocoon-fop</artifactId>
+    <version>1-SNAPSHOT</version>
+  </parent>
+  <groupId>org.apache.cocoon</groupId>
+  <artifactId>cocoon-fop-ng-sample</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>FOP 0.92 Block Samples</name>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-fop-ng-impl</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-core-main-sample</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
 </project>

Modified: cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/main/resources/COB-INF/fop.xsamples
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/main/resources/COB-INF/fop.xsamples?view=diff&rev=452332&r1=452331&r2=452332
==============================================================================
--- cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/main/resources/COB-INF/fop.xsamples (original)
+++ cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/main/resources/COB-INF/fop.xsamples Tue Oct  3 00:50:10 2006
@@ -16,11 +16,12 @@
   limitations under the License.
 -->
 
-<xsamples xpath="/samples" unless="group[@name='FOP']">
+<xsamples xpath="/samples" unless="group[@name='FONGP']">
 
-  <group name="FOP">
-    <sample name="FOP Block" href="fop/">
-      Examples of PDF document generation using FOP.
+
+  <group name="FOPNG">
+    <sample name="FOP NG Block" href="fop/">
+      Examples of PDF and other file format document generation using FOP 0.92beta and later.
     </sample>
   </group>
 

Modified: cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/main/resources/COB-INF/misc/samples.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/main/resources/COB-INF/misc/samples.xml?view=diff&rev=452332&r1=452331&r2=452332
==============================================================================
--- cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/main/resources/COB-INF/misc/samples.xml (original)
+++ cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/main/resources/COB-INF/misc/samples.xml Tue Oct  3 00:50:10 2006
@@ -33,18 +33,28 @@
         <sample name="Hello, PS world!" href="hello.ps">
             The well-known hello.xml document rendered as PS.
         </sample>
+        <sample name="Hello, PNG world!" href="hello.png">
+            The well-known hello.xml document rendered as PNG.
+        </sample>
+    </group>
+    <group name="FOP example with embedded image">
         <sample name="minimal XSL-FO document" href="misc/minimal.fo.xml">
             Source document used by FOP in the next example.
         </sample>
         <sample name="minimal PDF output" href="misc/minimal.pdf">
             PDF version of the above document
         </sample>
+    </group>
+    <group name="FOP example with embedded SVG">
         <sample name="SVG test XSL-FO document" href="misc/svgtest.fo.xml">
             Source document for testing embedded SVG in FOP. Should enforce
             possible problems with our FOP and our Batik if they are incompatible.
         </sample>
         <sample name="SVG test PDF output" href="misc/svgtest.pdf">
             PDF version of the above document.
+        </sample>
+        <sample name="SVG test PNG output" href="misc/svgtest.png">
+            PNG version of the above document.
         </sample>
     </group>
 

Modified: cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/main/resources/COB-INF/sitemap.xmap?view=diff&rev=452332&r1=452331&r2=452332
==============================================================================
--- cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/main/resources/COB-INF/sitemap.xmap (original)
+++ cocoon/trunk/blocks/cocoon-fop/cocoon-fop-ng-sample/src/main/resources/COB-INF/sitemap.xmap Tue Oct  3 00:50:10 2006
@@ -40,6 +40,13 @@
     </map:view>
   </map:views>
 
+  <map:resources>
+    <map:resource name="hello">
+      <map:generate src="context://blocks/cocoon-core-main-sample/hello-world/content/hello.xml"/>
+      <map:transform src="context://blocks/cocoon-core-main-sample/hello-world/style/xsl/page2fo.xsl"/>
+    </map:resource>
+  </map:resources>
+
 <!-- =========================== Pipelines ================================= -->
 
   <map:pipelines>
@@ -59,17 +66,28 @@
 
       <!-- hello world -->
       <map:match pattern="hello.pdf">
-        <map:generate src="context://blocks/cocoon-core-samples-main-sample/hello-world/content/hello.xml"/>
-        <map:transform src="context://blocks/cocoon-core-samples-main-sample/hello-world/style/xsl/page2fo.xsl"/>
+        <map:call resource="hello"/>
         <map:serialize type="fo2pdf"/>
       </map:match>
 
+      <!--
+        This one does not work, gives a java.util.EmptyStackException
+
+        map:match pattern="hello.rtf">
+        <map:call resource="hello"/>
+        <map:serialize type="fo2rtf"/>
+      </map:match-->
+
       <map:match pattern="hello.ps">
-        <map:generate src="context://blocks/cocoon-core-samples-main-sample/hello-world/content/hello.xml"/>
-        <map:transform src="context://blocks/cocoon-core-samples-main-sample/hello-world/style/xsl/page2fo.xsl"/>
+        <map:call resource="hello"/>
         <map:serialize type="fo2ps"/>
       </map:match>
 
+      <map:match pattern="hello.png">
+        <map:call resource="hello"/>
+        <map:serialize type="fo2png"/>
+      </map:match>
+
       <!-- xsl-fo document access -->
       <map:match pattern="**/*.fo.xml">
         <map:generate src="{1}/{2}.fo.xml"/>
@@ -87,6 +105,11 @@
       <map:match pattern="**/*.pdf">
         <map:generate src="cocoon:/{1}/{2}.fo.xml"/>
         <map:serialize type="fo2pdf"/>
+      </map:match>
+
+      <map:match pattern="**/*.png">
+        <map:generate src="cocoon:/{1}/{2}.fo.xml"/>
+        <map:serialize type="fo2png"/>
       </map:match>
 
       <!-- reuse the XSP caching example for our caching test

Modified: cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/pom.xml?view=diff&rev=452332&r1=452331&r2=452332
==============================================================================
--- cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/pom.xml (original)
+++ cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/pom.xml Tue Oct  3 00:50:10 2006
@@ -41,5 +41,10 @@
             <artifactId>cocoon-fop-impl</artifactId>
             <version>1.0.0-SNAPSHOT</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.cocoon</groupId>
+            <artifactId>cocoon-core-main-sample</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 </project>

Modified: cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/src/main/resources/COB-INF/sitemap.xmap?view=diff&rev=452332&r1=452331&r2=452332
==============================================================================
--- cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/src/main/resources/COB-INF/sitemap.xmap (original)
+++ cocoon/trunk/blocks/cocoon-fop/cocoon-fop-sample/src/main/resources/COB-INF/sitemap.xmap Tue Oct  3 00:50:10 2006
@@ -59,14 +59,14 @@
 
       <!-- hello world -->
       <map:match pattern="hello.pdf">
-        <map:generate src="context://blocks/cocoon-core-samples-main-sample/hello-world/content/hello.xml"/>
-        <map:transform src="context://blocks/cocoon-core-samples-main-sample/hello-world/style/xsl/page2fo.xsl"/>
+        <map:generate src="context://blocks/cocoon-core-main-sample/hello-world/content/hello.xml"/>
+        <map:transform src="context://blocks/cocoon-core-main-sample/hello-world/style/xsl/page2fo.xsl"/>
         <map:serialize type="fo2pdf"/>
       </map:match>
 
       <map:match pattern="hello.ps">
-        <map:generate src="context://blocks/cocoon-core-samples-main-sample/hello-world/content/hello.xml"/>
-        <map:transform src="context://blocks/cocoon-core-samples-main-sample/hello-world/style/xsl/page2fo.xsl"/>
+        <map:generate src="context://blocks/cocoon-core-main-sample/hello-world/content/hello.xml"/>
+        <map:transform src="context://blocks/cocoon-core-main-sample/hello-world/style/xsl/page2fo.xsl"/>
         <map:serialize type="fo2ps"/>
       </map:match>
 

Modified: cocoon/trunk/blocks/cocoon-fop/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-fop/pom.xml?view=diff&rev=452332&r1=452331&r2=452332
==============================================================================
--- cocoon/trunk/blocks/cocoon-fop/pom.xml (original)
+++ cocoon/trunk/blocks/cocoon-fop/pom.xml Tue Oct  3 00:50:10 2006
@@ -37,5 +37,7 @@
   <modules>
     <module>cocoon-fop-sample</module>
     <module>cocoon-fop-impl</module>
+    <module>cocoon-fop-ng-sample</module>
+    <module>cocoon-fop-ng-impl</module>
   </modules>
 </project>