[FOray-commit] SF.net SVN: foray: [9729] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-06-08 23:02:34
|
Revision: 9729
http://svn.sourceforge.net/foray/?rev=9729&view=rev
Author: victormote
Date: 2007-06-08 16:02:26 -0700 (Fri, 08 Jun 2007)
Log Message:
-----------
Remove a Batik dependency by leveraging the new GraphicServer capabilities.
Modified Paths:
--------------
trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java
trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java
trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java
trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java
trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java
trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java
trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java
trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java
trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java
trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java
Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2007-06-08 22:39:14 UTC (rev 9728)
+++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineStarter.java 2007-06-08 23:02:26 UTC (rev 9729)
@@ -115,7 +115,7 @@
final FileOutputStream outputStream = getFileOutputStream();
final OutputTarget outputTarget = OutputTargetFactory.makeOutputTarget(
outputType, outputOptions, outputStream,
- session.getLogger());
+ session.getLogger(), session.getGraphicServer());
/*
* Instantiate and configure the FOrayTarget(s). Multiple targets can
Modified: trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java 2007-06-08 22:39:14 UTC (rev 9728)
+++ trunk/foray/foray-app/src/java/org/foray/app/OutputTargetFactory.java 2007-06-08 23:02:26 UTC (rev 9729)
@@ -39,6 +39,7 @@
import org.foray.render.txt.TXTRenderer;
import org.foray.render.xml.XMLRenderer;
+import org.axsl.graphicR.GraphicServer;
import org.axsl.output.OutputTarget;
import org.axsl.pdfW.PDFDocument;
@@ -77,13 +78,16 @@
* @param outputStream The output stream to which the target will be
* written.
* @param logger The logger.
+ * @param graphicServer The GraphicServer to be used for output targets that
+ * create a graphic (like the SVG Renderer).
* @return The newly-created OutputTarget instance.
* @throws FOrayException For errors creating the target.
*/
public static OutputTarget makeOutputTarget(
final OutputTargetType rendererType,
final OutputConfig outputOptions, final OutputStream outputStream,
- final Log logger) throws FOrayException {
+ final Log logger, final GraphicServer graphicServer)
+ throws FOrayException {
OutputTarget renderer = null;
switch (rendererType) {
case AWT: {
@@ -115,7 +119,7 @@
break;
}
case SVG: {
- renderer = new SVGRenderer(logger, outputOptions);
+ renderer = new SVGRenderer(logger, outputOptions, graphicServer);
break;
}
default: {
Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2007-06-08 22:39:14 UTC (rev 9728)
+++ trunk/foray/foray-app/src/java/org/foray/app/ant/FOrayAntTaskStarter.java 2007-06-08 23:02:26 UTC (rev 9729)
@@ -313,7 +313,7 @@
final OutputTarget outputTarget =
OutputTargetFactory.makeOutputTarget(
this.task.getRendererType(), this.outputConfig, out,
- session.getLogger());
+ session.getLogger(), session.getGraphicServer());
new FOrayTarget(document, outputTarget, null, out);
session.process();
Modified: trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2007-06-08 22:39:14 UTC (rev 9728)
+++ trunk/foray/foray-app/src/java/org/foray/app/test/TestConverter.java 2007-06-08 23:02:26 UTC (rev 9729)
@@ -341,7 +341,8 @@
renderOptions.parseOption("consistentOutput", "true",
SessionConfig.PRECEDENCE_DEFAULT);
final OutputTarget renderer = OutputTargetFactory.makeOutputTarget(
- rendererType, renderOptions, bos, session.getLogger());
+ rendererType, renderOptions, bos, session.getLogger(),
+ session.getGraphicServer());
new FOrayTarget(document, renderer, null, bos);
Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2007-06-08 22:39:14 UTC (rev 9728)
+++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoFO2PDF.java 2007-06-08 23:02:26 UTC (rev 9729)
@@ -73,7 +73,8 @@
//Setup Renderer
final OutputStream out = new FileOutputStream(pdf);
final OutputTarget renderer = OutputTargetFactory.makeOutputTarget(
- OutputTargetType.PDF, null, out, session.getLogger());
+ OutputTargetType.PDF, null, out, session.getLogger(),
+ session.getGraphicServer());
//Setup FOrayTarget
new FOrayTarget(document, renderer, null, out);
Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java 2007-06-08 22:39:14 UTC (rev 9728)
+++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoObj2PDF.java 2007-06-08 23:02:26 UTC (rev 9729)
@@ -90,7 +90,8 @@
//Setup Renderer
final OutputStream out = new FileOutputStream(pdf);
final OutputTarget renderer = OutputTargetFactory.makeOutputTarget(
- OutputTargetType.PDF, null, out, session.getLogger());
+ OutputTargetType.PDF, null, out, session.getLogger(),
+ session.getGraphicServer());
//Setup FOrayTarget
new FOrayTarget(document, renderer, null, out);
Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java 2007-06-08 22:39:14 UTC (rev 9728)
+++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoXML2PDF.java 2007-06-08 23:02:26 UTC (rev 9729)
@@ -90,7 +90,8 @@
//Setup Renderer
final OutputStream out = new FileOutputStream(pdf);
final OutputTarget renderer = OutputTargetFactory.makeOutputTarget(
- OutputTargetType.PDF, null, out, session.getLogger());
+ OutputTargetType.PDF, null, out, session.getLogger(),
+ session.getGraphicServer());
//Setup FOrayTarget
new FOrayTarget(document, renderer, null, out);
Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2007-06-08 22:39:14 UTC (rev 9728)
+++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/AbstractDemoServlet.java 2007-06-08 23:02:26 UTC (rev 9729)
@@ -194,7 +194,7 @@
final ByteArrayOutputStream output = new ByteArrayOutputStream();
final OutputTarget renderer = OutputTargetFactory.makeOutputTarget(
OutputTargetType.PDF, null, output,
- session.getLogger());
+ session.getLogger(), session.getGraphicServer());
// Setup FOrayTarget
new FOrayTarget(document, renderer, null, output);
@@ -240,7 +240,7 @@
final ByteArrayOutputStream output = new ByteArrayOutputStream();
final OutputTarget renderer = OutputTargetFactory.makeOutputTarget(
OutputTargetType.PDF, null, output,
- session.getLogger());
+ session.getLogger(), session.getGraphicServer());
// Setup FOrayTarget
new FOrayTarget(document, renderer, null, output);
Modified: trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java 2007-06-08 22:39:14 UTC (rev 9728)
+++ trunk/foray/foray-app/src/java/org/foray/demo/servlet/DemoServlet.java 2007-06-08 23:02:26 UTC (rev 9729)
@@ -139,7 +139,7 @@
final ByteArrayOutputStream output = new ByteArrayOutputStream();
final OutputTarget renderer = OutputTargetFactory.makeOutputTarget(
OutputTargetType.PDF, null, output,
- document.getLogger());
+ document.getLogger(), document.getGraphicServer());
// Setup FOrayTarget
final FOrayTarget target = new FOrayTarget(document, renderer, null,
Modified: trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java 2007-06-08 22:39:14 UTC (rev 9728)
+++ trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java 2007-06-08 23:02:26 UTC (rev 9729)
@@ -47,6 +47,7 @@
import org.axsl.fontR.FontConsumer;
import org.axsl.graphicR.Graphic;
import org.axsl.graphicR.GraphicException;
+import org.axsl.graphicR.GraphicServer;
import org.axsl.graphicR.SVGGraphic;
import org.apache.batik.dom.svg.SVGDOMImplementation;
@@ -56,7 +57,6 @@
import org.apache.batik.transcoder.svg2svg.SVGTranscoder;
import org.apache.commons.logging.Log;
-import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -105,12 +105,19 @@
/** The current page number. */
private int pageNumber = 0;
+ /** The Graphic Server to use for creation and handling of the SVG
+ * document.*/
+ private GraphicServer graphicServer;
+
/**
* Constructor.
* @param logger The logger.
* @param renderConfig The configuration for this renderer.
+ * @param graphicServer The Graphic Server to use for creation and handling
+ * of the SVG document.
*/
- public SVGRenderer(final Log logger, final OutputConfig renderConfig) {
+ public SVGRenderer(final Log logger, final OutputConfig renderConfig,
+ final GraphicServer graphicServer) {
super(logger, renderConfig);
}
@@ -610,9 +617,11 @@
* {@inheritDoc}
*/
public void startOutput() throws IOException {
- final DOMImplementation impl =
- SVGDOMImplementation.getDOMImplementation();
- this.svgDocument = impl.createDocument(SVGRenderer.SVG_NS, "svg", null);
+ try {
+ this.svgDocument = this.graphicServer.makeSvgDocument();
+ } catch (final GraphicException e) {
+ throw new IOException(e.getMessage());
+ }
final ProcessingInstruction pi =
this.svgDocument.createProcessingInstruction(
"xml",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|