diff options
author | William Victor Mote <vmote@apache.org> | 2003-06-17 02:46:56 +0000 |
---|---|---|
committer | William Victor Mote <vmote@apache.org> | 2003-06-17 02:46:56 +0000 |
commit | ba1eaace4686656ae9907f4d7fa005683447aecc (patch) | |
tree | 5ed08fe80e9dbf4e2ba27a394bb27d04b21b2387 /src/java/org/apache/fop/tools | |
parent | f09ec7881f53619870e157ff1ef6efee9c627bd0 (diff) | |
download | xmlgraphics-fop-ba1eaace4686656ae9907f4d7fa005683447aecc.tar.gz xmlgraphics-fop-ba1eaace4686656ae9907f4d7fa005683447aecc.zip |
1. Copy apps.Driver to apps.Session.
2. Fix all references to use Session instead of Driver.
3. Keep contents of "Services" class, but remove the class definition itself so that it can be used by both Driver and Session.
4. Deprecate Driver.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196503 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/tools')
-rw-r--r-- | src/java/org/apache/fop/tools/TestConverter.java | 50 | ||||
-rw-r--r-- | src/java/org/apache/fop/tools/anttasks/Fop.java | 44 |
2 files changed, 47 insertions, 47 deletions
diff --git a/src/java/org/apache/fop/tools/TestConverter.java b/src/java/org/apache/fop/tools/TestConverter.java index 1f8449043..c4fd4f6da 100644 --- a/src/java/org/apache/fop/tools/TestConverter.java +++ b/src/java/org/apache/fop/tools/TestConverter.java @@ -3,34 +3,34 @@ * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ - * + * * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * + * * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: "This product includes software * developed by the Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. - * + * * 4. The names "FOP" and "Apache Software Foundation" must not be used to * endorse or promote products derived from this software without prior * written permission. For written permission, please contact * apache@apache.org. - * + * * 5. Products derived from this software may not be called "Apache", nor may * "Apache" appear in their name, without prior written permission of the * Apache Software Foundation. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -42,15 +42,15 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ============================================================================ - * + * * This software consists of voluntary contributions made by many individuals * on behalf of the Apache Software Foundation and was originally created by * James Tauber <jtauber@jtauber.com>. For more information on the Apache * Software Foundation, please see <http://www.apache.org/>. - */ + */ package org.apache.fop.tools; -import org.apache.fop.apps.Driver; +import org.apache.fop.apps.Session; import org.apache.fop.apps.FOInputHandler; import org.apache.fop.apps.FOPException; import org.apache.fop.apps.InputHandler; @@ -84,10 +84,10 @@ import org.xml.sax.SAXException; * pdf rendering. * * Modified by Mark Lillywhite mark-fop@inomial.com to use the new Driver - * interface. + * (now Session) interface. */ public class TestConverter extends AbstractLogEnabled { - + private boolean failOnly = false; private boolean outputPDF = false; private File destdir; @@ -141,7 +141,7 @@ public class TestConverter extends AbstractLogEnabled { } /** - * Controls whether to process only the tests which are specified as fail + * Controls whether to process only the tests which are specified as fail * in the test results. * @param fail True if only fail tests should be processed */ @@ -266,7 +266,7 @@ public class TestConverter extends AbstractLogEnabled { if (xslNode != null) { xsl = xslNode.getNodeValue(); } - getLogger().debug("converting xml:" + xml + " and xsl:" + getLogger().debug("converting xml:" + xml + " and xsl:" + xsl + " to area tree"); try { @@ -290,33 +290,33 @@ public class TestConverter extends AbstractLogEnabled { XMLReader parser = inputHandler.getParser(); setParserFeatures(parser); - Driver driver = new Driver(); - setupLogger(driver, "fop"); - driver.initialize(); + Session session = new Session(); + setupLogger(session, "fop"); + session.initialize(); FOUserAgent userAgent = new FOUserAgent(); userAgent.setBaseURL(baseURL); - driver.setUserAgent(userAgent); + session.setUserAgent(userAgent); if (outputPDF) { - driver.setRenderer(Driver.RENDER_PDF); + session.setRenderer(Session.RENDER_PDF); } else { - driver.setRenderer(Driver.RENDER_XML); + session.setRenderer(Session.RENDER_XML); } Map rendererOptions = new java.util.HashMap(); rendererOptions.put("fineDetail", new Boolean(false)); rendererOptions.put("consistentOutput", new Boolean(true)); - driver.getRenderer().setOptions(rendererOptions); - driver.getRenderer().setProducer("Testsuite Converter"); + session.getRenderer().setOptions(rendererOptions); + session.getRenderer().setProducer("Testsuite Converter"); String outname = xmlFile.getName(); if (outname.endsWith(".xml")) { outname = outname.substring(0, outname.length() - 4); } - driver.setOutputStream(new java.io.BufferedOutputStream( + session.setOutputStream(new java.io.BufferedOutputStream( new java.io.FileOutputStream(new File(destdir, outname + (outputPDF ? ".pdf" : ".at.xml"))))); getLogger().debug("ddir:" + destdir + " on:" + outname + ".pdf"); - driver.render(parser, inputHandler.getInputSource()); + session.render(parser, inputHandler.getInputSource()); // check difference if (compare != null) { diff --git a/src/java/org/apache/fop/tools/anttasks/Fop.java b/src/java/org/apache/fop/tools/anttasks/Fop.java index a4104de92..5fcb89222 100644 --- a/src/java/org/apache/fop/tools/anttasks/Fop.java +++ b/src/java/org/apache/fop/tools/anttasks/Fop.java @@ -72,7 +72,7 @@ import java.util.List; import org.apache.fop.apps.Starter; import org.apache.fop.apps.InputHandler; import org.apache.fop.apps.FOInputHandler; -import org.apache.fop.apps.Driver; +import org.apache.fop.apps.Session; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FOUserAgent; @@ -307,27 +307,27 @@ class FOPTaskStarter extends Starter { if ((format == null) || format.equalsIgnoreCase("application/pdf") || format.equalsIgnoreCase("pdf")) { - return Driver.RENDER_PDF; + return Session.RENDER_PDF; } else if (format.equalsIgnoreCase("application/postscript") || format.equalsIgnoreCase("ps")) { - return Driver.RENDER_PS; + return Session.RENDER_PS; } else if (format.equalsIgnoreCase("application/vnd.mif") || format.equalsIgnoreCase("mif")) { - return Driver.RENDER_MIF; + return Session.RENDER_MIF; } else if (format.equalsIgnoreCase("application/msword") || format.equalsIgnoreCase("application/rtf") || format.equalsIgnoreCase("rtf")) { - return Driver.RENDER_RTF; + return Session.RENDER_RTF; } else if (format.equalsIgnoreCase("application/vnd.hp-PCL") || format.equalsIgnoreCase("pcl")) { - return Driver.RENDER_PCL; + return Session.RENDER_PCL; } else if (format.equalsIgnoreCase("text/plain") || format.equalsIgnoreCase("txt")) { - return Driver.RENDER_TXT; + return Session.RENDER_TXT; } else if (format.equalsIgnoreCase("text/xml") || format.equalsIgnoreCase("at") || format.equalsIgnoreCase("xml")) { - return Driver.RENDER_XML; + return Session.RENDER_XML; } else { String err = "Couldn't determine renderer to use: " + format; throw new BuildException(err); @@ -336,19 +336,19 @@ class FOPTaskStarter extends Starter { private String determineExtension(int renderer) { switch (renderer) { - case Driver.RENDER_PDF: + case Session.RENDER_PDF: return ".pdf"; - case Driver.RENDER_PS: + case Session.RENDER_PS: return ".ps"; - case Driver.RENDER_MIF: + case Session.RENDER_MIF: return ".mif"; - case Driver.RENDER_RTF: + case Session.RENDER_RTF: return ".rtf"; - case Driver.RENDER_PCL: + case Session.RENDER_PCL: return ".pcl"; - case Driver.RENDER_TXT: + case Session.RENDER_TXT: return ".txt"; - case Driver.RENDER_XML: + case Session.RENDER_XML: return ".xml"; default: String err = "Unknown renderer: " + renderer; @@ -478,16 +478,16 @@ class FOPTaskStarter extends Starter { } try { - Driver driver = new Driver(); - setupLogger(driver); - driver.initialize(); + Session session = new Session(); + setupLogger(session); + session.initialize(); FOUserAgent userAgent = new FOUserAgent(); userAgent.setBaseURL(this.baseURL); userAgent.enableLogging(getLogger()); - driver.setUserAgent(userAgent); - driver.setRenderer(renderer); - driver.setOutputStream(out); - driver.render(parser, inputHandler.getInputSource()); + session.setUserAgent(userAgent); + session.setRenderer(renderer); + session.setOutputStream(out); + session.render(parser, inputHandler.getInputSource()); } catch (Exception ex) { throw new BuildException(ex); } finally { |