dims 01/08/14 07:44:33
Modified: . build.xml
xdocs jars.xml pdf-serializer.xml uc2.xml
Added: src/org/apache/cocoon/components/renderer
ExtendableRendererFactory.java RendererFactory.java
src/org/apache/cocoon/serialization FOPSerializer.java
Removed: src/org/apache/cocoon/serialization
AbstractFOPSerializer.java PCLSerializer.java
PDFSerializer.java PSSerializer.java
Log:
- Add RendererFactory/ExtendableRendererFactory for FOP on the same lines as SVG's
TranscoderFactory/ExtendableTranscoderFactory
- Get rid of PCL/PDF/PS Serializers, use the factory to instantiate the Renderer's.
- Rename AbstractFOPSerializer back to FOPSerializer.
- Support for adding more Renderers dynamically from Config.
John, Colin,
Please take a look.
Thanks,
dims
Revision Changes Path
1.50 +7 -10 xml-cocoon2/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/build.xml,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- build.xml 2001/08/14 12:45:26 1.49
+++ build.xml 2001/08/14 14:44:33 1.50
@@ -113,11 +113,11 @@
Serializers
- fo2pdf serializer : Requires the FOP package (included in the dist)
- <map:serializer name="fo2pdf"
src="org.apache.cocoon.serialization.PDFSerializer" mime-type="application/pdf"/>
+ <map:serializer name="fo2pdf"
src="org.apache.cocoon.serialization.FOPSerializer" mime-type="application/pdf"/>
- fo2ps serializer : Requires the FOP package (included in the dist)
- <map:serializer name="fo2ps"
src="org.apache.cocoon.serialization.PSSerializer" mime-type="application/ps"/>
+ <map:serializer name="fo2ps"
src="org.apache.cocoon.serialization.FOPSerializer"
mime-type="application/postscript"/>
- fo2pcl serializer : Requires the FOP package (included in the dist)
- <map:serializer name="fo2pdf"
src="org.apache.cocoon.serialization.PCLSerializer"
mime-type="application/vnd.hp-PCL"/>
+ <map:serializer name="fo2pcl"
src="org.apache.cocoon.serialization.FOPSerializer"
mime-type="application/vnd.hp-PCL"/>
Happy hacking from the Apache Cocoon 2 Dev Team :)
@@ -401,10 +401,7 @@
<exclude name="**/Javascript*" unless="rhino.present"/>
<exclude name="**/Jstyle*" unless="jstyle.present"/>
<exclude name="**/FOP*" unless="fop.present"/>
- <exclude name="**/serialization/AbstractFOP*" unless="fop.present"/>
- <exclude name="**/serialization/PDF*" unless="fop.present"/>
- <exclude name="**/serialization/PCL*" unless="fop.present"/>
- <exclude name="**/serialization/PS*" unless="fop.present"/>
+ <exclude name="**/renderer/*" unless="fop.present"/>
<exclude name="**/Php*" unless="php.present"/>
<exclude name="**/HTMLGenerator.java" unless="tidy.present"/>
<exclude name="**/J2eeDataSource.java" unless="j2ee.present"/>
@@ -574,19 +571,19 @@
<!-- =================================================================== -->
<target name="prepare-webapp-fop" depends="copy-webapp" if="fop.present">
<java classname="st">
- <arg line="-i ${build.war}/sitemap.xmap -o ${build.war}/sitemap.xmap -m
application/pdf -a serializers fo2pdf
org.apache.cocoon.serialization.PDFSerializer"/>
+ <arg line="-i ${build.war}/sitemap.xmap -o ${build.war}/sitemap.xmap -m
application/pdf -a serializers fo2pdf
org.apache.cocoon.serialization.FOPSerializer"/>
<classpath>
<pathelement location="${bin.dir}"/>
</classpath>
</java>
<java classname="st">
- <arg line="-i ${build.war}/sitemap.xmap -o ${build.war}/sitemap.xmap -m
application/ps -a serializers fo2ps
org.apache.cocoon.serialization.PSSerializer"/>
+ <arg line="-i ${build.war}/sitemap.xmap -o ${build.war}/sitemap.xmap -m
application/postscript -a serializers fo2ps
org.apache.cocoon.serialization.FOPSerializer"/>
<classpath>
<pathelement location="${bin.dir}"/>
</classpath>
</java>
<java classname="st">
- <arg line="-i ${build.war}/sitemap.xmap -o ${build.war}/sitemap.xmap -m
'application/vnd.hp-PCL' -a serializers fo2pcl
org.apache.cocoon.serialization.PCLSerializer"/>
+ <arg line="-i ${build.war}/sitemap.xmap -o ${build.war}/sitemap.xmap -m
'application/vnd.hp-PCL' -a serializers fo2pcl
org.apache.cocoon.serialization.FOPSerializer"/>
<classpath>
<pathelement location="${bin.dir}"/>
</classpath>
1.1
xml-cocoon2/src/org/apache/cocoon/components/renderer/ExtendableRendererFactory.java
Index: ExtendableRendererFactory.java
===================================================================
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************/
package org.apache.cocoon.components.renderer;
import java.util.HashMap;
import java.util.Map;
import org.apache.fop.render.Renderer;
import org.apache.fop.render.ps.PSRenderer;
import org.apache.fop.render.pdf.PDFRenderer;
import org.apache.fop.render.pcl.PCLRenderer;
/**
* An extendable FOP Renderer factory.
* When given a MIME type, find a Renderer which supports that MIME
* type. This factory is extendable as new <code>Renderer</code>s can
* be added at runtime.
* @author Davanum Srinivas
* @version $Revision: 1.1 $, $Date: 2001/08/14 14:44:33 $
*/
public class ExtendableRendererFactory implements RendererFactory {
protected static Map renderers = new HashMap();
protected final static RendererFactory singleton = new ExtendableRendererFactory();
private ExtendableRendererFactory() {
// Add the default renderers which come with Apache FOP.
addRenderer("application/pdf", PDFRenderer.class);
addRenderer("application/postscript", PSRenderer.class);
addRenderer("application/vnd.hp-PCL", PCLRenderer.class);
}
/**
* Get a reference to this Renderer Factory.
*/
public final static RendererFactory getRendererFactoryImplementation() {
return singleton;
}
/**
* Create a renderer for a specified MIME type.
* @param mimeType The MIME type of the destination format
* @return A suitable renderer, or <code>null</code> if one cannot be found
*/
public Renderer createRenderer(String mimeType) {
Class rendererClass = (Class)renderers.get(mimeType);
if (rendererClass == null) {
return null;
} else {
try {
return (Renderer)rendererClass.newInstance();
} catch (Exception ex) {
return null;
}
}
}
/**
* Add a mapping from the specified MIME type to a renderer.
* Note: The renderer must have a no-argument constructor.
* @param mimeType The MIME type of the Renderer
* @param rendererClass The <code>Class</code> object for the Renderer.
*/
public void addRenderer(String mimeType, Class rendererClass) {
renderers.put(mimeType, rendererClass);
}
/**
* Remove the mapping from a specified MIME type.
* @param mimeType The MIME type to remove from the mapping.
*/
public void removeRenderer(String mimeType) {
renderers.remove(mimeType);
}
}
1.1
xml-cocoon2/src/org/apache/cocoon/components/renderer/RendererFactory.java
Index: RendererFactory.java
===================================================================
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************/
package org.apache.cocoon.components.renderer;
import org.apache.fop.render.Renderer;
/**
* Apache FOP Renderer factory.
* When given a MIME type, find a Renderer which supports that MIME type.
* @author Davanum Srinivas
* @version $Revision: 1.1 $, $Date: 2001/08/14 14:44:33 $
*/
public interface RendererFactory {
/**
* Create a transcoder for a specified MIME type.
* @param mimeType The MIME type of the destination format
* @return A suitable renderer, or <code>null> if one cannot be found
*/
Renderer createRenderer(String mimeType) ;
}
1.4 +106 -77
xml-cocoon2/src/org/apache/cocoon/serialization/FOPSerializer.java
1.11 +1 -1 xml-cocoon2/xdocs/jars.xml
Index: jars.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/xdocs/jars.xml,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- jars.xml 2001/08/14 12:45:26 1.10
+++ jars.xml 2001/08/14 14:44:33 1.11
@@ -108,7 +108,7 @@
conforming to the XSL candidate release and then turns it into a PDF
document or allows you to preview it directly on screen.</td>
<td>No</td>
- <td>PDFSerializer serializer ("fo2pdf")</td>
+ <td>FOPSerializer serializer ("fo2pdf")</td>
<td>Hello World - PDF, Static content - formatting objects</td>
<td/>
</tr>
1.7 +3 -3 xml-cocoon2/xdocs/pdf-serializer.xml
Index: pdf-serializer.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/xdocs/pdf-serializer.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- pdf-serializer.xml 2001/08/14 12:45:26 1.6
+++ pdf-serializer.xml 2001/08/14 14:44:33 1.7
@@ -21,7 +21,7 @@
the distribution includes this package already.</p>
<ul>
<li>Name : fo2pdf</li>
- <li>Class: org.apache.cocoon.serialization.PDFSerializer</li>
+ <li>Class: org.apache.cocoon.serialization.FOPSerializer</li>
<li>Cacheable: yes.</li>
</ul>
</s1>
@@ -130,11 +130,11 @@
located. Find the line in your sitemap which looks
like:</p>
<source><![CDATA[
-<map:serializer name="fo2pdf" src="org.apache.cocoon.serialization.PDFSerializer"
mime-type="application/pdf"/>
+<map:serializer name="fo2pdf" src="org.apache.cocoon.serialization.FOPSerializer"
mime-type="application/pdf"/>
]]></source>
<p>and replace it with...</p>
<source><![CDATA[
-<map:serializer name="fo2pdf" src="org.apache.cocoon.serialization.PDFSerializer"
mime-type="application/pdf">
+<map:serializer name="fo2pdf" src="org.apache.cocoon.serialization.FOPSerializer"
mime-type="application/pdf">
<user-config src="D:/fop-fonts/config.xml"/>
</map:serializer>
]]></source>
1.8 +1 -1 xml-cocoon2/xdocs/uc2.xml
Index: uc2.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/xdocs/uc2.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- uc2.xml 2001/08/14 12:45:26 1.7
+++ uc2.xml 2001/08/14 14:44:33 1.8
@@ -414,7 +414,7 @@
src="org.apache.cocoon.serialization.HTMLSerializer"/>
<map:serializer name="fo2pdf"
mime-type="application/pdf"
- src="org.apache.cocoon.serialization.PDFSerializer"/>
+ src="org.apache.cocoon.serialization.FOPSerializer"/>
<map:serializer name="vrml"
mime-type="model/vrml"
src="org.apache.cocoon.serialization.TextSerializer"/>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]