]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Renamed apps.FOInputHandler to apps.FOFileHandler to reduce confusion with the new...
authorGlen Mazza <gmazza@apache.org>
Tue, 12 Aug 2003 21:17:44 +0000 (21:17 +0000)
committerGlen Mazza <gmazza@apache.org>
Tue, 12 Aug 2003 21:17:44 +0000 (21:17 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196792 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/apps/CommandLineOptions.java
src/java/org/apache/fop/apps/Driver.java
src/java/org/apache/fop/apps/FOFileHandler.java [new file with mode: 0644]
src/java/org/apache/fop/apps/FOInputHandler.java [deleted file]
src/java/org/apache/fop/apps/XSLTInputHandler.java
src/java/org/apache/fop/image/XMLImage.java
src/java/org/apache/fop/svg/SVGElementMapping.java
src/java/org/apache/fop/svg/SVGUserAgent.java
src/java/org/apache/fop/tools/TestConverter.java
src/java/org/apache/fop/tools/anttasks/Fop.java

index 264b6dd38752b81ec3e473eff96cacceaa2d5ca5..646ba1022b02ecea31602009a214068b1cb154ec 100644 (file)
@@ -491,7 +491,7 @@ public class CommandLineOptions {
     public InputHandler getInputHandler() throws FOPException {
         switch (inputmode) {
         case FO_INPUT:
-            return new FOInputHandler(fofile);
+            return new FOFileHandler(fofile);
         case XSLT_INPUT:
             return new XSLTInputHandler(xmlfile, xsltfile);
         default:
index 129ab8e8ec9b32e6571785d7426594b477811ec9..e21624c27e397ef8a41fcba18c1ef1e24b737a34 100644 (file)
@@ -648,8 +648,7 @@ public class Driver implements LogEnabled, FOTreeListener {
 
         if (reader == null) {
             if (!(source instanceof DocumentInputSource)) {
-                //TODO: (gm) rename to FOFileHandler or similar
-                reader = org.apache.fop.apps.FOInputHandler.createParser();
+                reader = FOFileHandler.createParser();
             }
         }
 
diff --git a/src/java/org/apache/fop/apps/FOFileHandler.java b/src/java/org/apache/fop/apps/FOFileHandler.java
new file mode 100644 (file)
index 0000000..82de099
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ * $Id$
+ * ============================================================================
+ *                    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
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (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.apps;
+
+// Imported SAX classes
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotSupportedException;
+
+// java
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.File;
+import java.net.URL;
+
+
+/**
+ * Manages input if it is an XSL-FO file.
+ */
+public class FOFileHandler extends InputHandler {
+    
+    private File fofile = null;
+    private URL foURL = null;
+
+    /**
+     * Create a FOFileHandler for a file.
+     * @param fofile the file to read the FO document.
+     */
+    public FOFileHandler(File fofile) {
+        this.fofile = fofile;
+    }
+
+    /**
+     * Create a FOFileHandler for an URL.
+     * @param url the URL to read the FO document.
+     */
+    public FOFileHandler(URL url) {
+        this.foURL = url;
+    }
+
+    
+    /**
+     * @see org.apache.fop.apps.InputHandler#getInputSource()
+     */
+    public InputSource getInputSource () {
+        if (fofile != null) {
+            return super.fileInputSource(fofile);
+        }
+        return super.urlInputSource(foURL);
+    }
+
+    /**
+     * @see org.apache.fop.apps.InputHandler#getParser()
+     */
+    public XMLReader getParser() throws FOPException {
+        return createParser();
+    }
+
+    /**
+     * Creates <code>XMLReader</code> object using default
+     * <code>SAXParserFactory</code>
+     * @return the created <code>XMLReader</code>
+     * @throws FOPException if the parser couldn't be created or configured for proper operation.
+     */
+    protected static XMLReader createParser() throws FOPException {
+        try {
+            SAXParserFactory factory = SAXParserFactory.newInstance();
+            factory.setNamespaceAware(true);
+            factory.setFeature(
+                "http://xml.org/sax/features/namespace-prefixes", true);
+            return factory.newSAXParser().getXMLReader();
+        } catch (SAXNotSupportedException se) {
+            throw new FOPException("Error: You need a parser which allows the"
+                   + " http://xml.org/sax/features/namespace-prefixes"
+                   + " feature to be set to true to support namespaces", se);
+        } catch (SAXException se) {
+            throw new FOPException("Couldn't create XMLReader", se);
+        } catch (ParserConfigurationException pce) {
+            throw new FOPException("Couldn't create XMLReader", pce);
+        }
+    }
+
+    /**
+     * Returns the fully qualified classname of the standard XML parser for FOP
+     * to use.
+     * @return the XML parser classname
+     */
+    public static final String getParserClassName() {
+        try {
+            return createParser().getClass().getName();
+        } catch (FOPException e) {
+            return null;
+        }
+    }
+}
+
diff --git a/src/java/org/apache/fop/apps/FOInputHandler.java b/src/java/org/apache/fop/apps/FOInputHandler.java
deleted file mode 100644 (file)
index f2696f8..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * $Id$
- * ============================================================================
- *                    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
- * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (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.apps;
-
-// Imported SAX classes
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotSupportedException;
-
-// java
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.File;
-import java.net.URL;
-
-
-/**
- * Manages input if it is an XSL-FO file.
- */
-public class FOInputHandler extends InputHandler {
-    
-    private File fofile = null;
-    private URL foURL = null;
-
-    /**
-     * Create a FOInputHandler for a file.
-     * @param fofile the file to read the FO document.
-     */
-    public FOInputHandler(File fofile) {
-        this.fofile = fofile;
-    }
-
-    /**
-     * Create a FOInputHandler for an URL.
-     * @param url the URL to read the FO document.
-     */
-    public FOInputHandler(URL url) {
-        this.foURL = url;
-    }
-
-    
-    /**
-     * @see org.apache.fop.apps.InputHandler#getInputSource()
-     */
-    public InputSource getInputSource () {
-        if (fofile != null) {
-            return super.fileInputSource(fofile);
-        }
-        return super.urlInputSource(foURL);
-    }
-
-    /**
-     * @see org.apache.fop.apps.InputHandler#getParser()
-     */
-    public XMLReader getParser() throws FOPException {
-        return createParser();
-    }
-
-    /**
-     * Creates <code>XMLReader</code> object using default
-     * <code>SAXParserFactory</code>
-     * @return the created <code>XMLReader</code>
-     * @throws FOPException if the parser couldn't be created or configured for proper operation.
-     */
-    protected static XMLReader createParser() throws FOPException {
-        try {
-            SAXParserFactory factory = SAXParserFactory.newInstance();
-            factory.setNamespaceAware(true);
-            factory.setFeature(
-                "http://xml.org/sax/features/namespace-prefixes", true);
-            return factory.newSAXParser().getXMLReader();
-        } catch (SAXNotSupportedException se) {
-            throw new FOPException("Error: You need a parser which allows the"
-                   + " http://xml.org/sax/features/namespace-prefixes"
-                   + " feature to be set to true to support namespaces", se);
-        } catch (SAXException se) {
-            throw new FOPException("Couldn't create XMLReader", se);
-        } catch (ParserConfigurationException pce) {
-            throw new FOPException("Couldn't create XMLReader", pce);
-        }
-    }
-
-    /**
-     * Returns the fully qualified classname of the standard XML parser for FOP
-     * to use.
-     * @return the XML parser classname
-     */
-    public static final String getParserClassName() {
-        try {
-            return createParser().getClass().getName();
-        } catch (FOPException e) {
-            return null;
-        }
-    }
-}
-
index 990e683e850ce69dd557a0b8ba0677d35b28d599..66cd536fa4a51fd0df4a035cbee625271e0327a0 100644 (file)
@@ -170,7 +170,7 @@ public class XSLTInputHandler extends InputHandler {
                     saxTFactory.newXMLFilter(xsltSource);
 
                 // Create an XMLReader.
-                XMLReader parser = FOInputHandler.createParser();
+                XMLReader parser = FOFileHandler.createParser();
                 if (parser == null) {
                     throw new FOPException("Unable to create SAX parser");
                 }
index 8b97a2cc80caacf965f342b11f4b3616b0c1c0eb..50733beb4ac54163418972bba6a3794d767a6ee7 100644 (file)
@@ -54,7 +54,7 @@ package org.apache.fop.image;
 import org.w3c.dom.Document;
 
 // FOP
-import org.apache.fop.apps.FOInputHandler;
+import org.apache.fop.apps.FOFileHandler;
 
 /**
  * This is an implementation for XML-based images such as SVG.
@@ -86,7 +86,7 @@ public class XMLImage extends AbstractFopImage {
      * @return the created SAX parser
      */
     public static String getParserName() {
-        String parserClassName = FOInputHandler.getParserClassName();
+        String parserClassName = FOFileHandler.getParserClassName();
         return parserClassName;
     }
 
index 982737eae8fbb0f2a60779923fa1a6b237a17fc5..3c958527ffbb909663758fe0fcc2350da5542871 100644 (file)
@@ -54,7 +54,7 @@ import java.util.HashMap;
 
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.ElementMapping;
-import org.apache.fop.apps.FOInputHandler;
+import org.apache.fop.apps.FOFileHandler;
 
 import org.apache.batik.util.XMLResourceDescriptor;
 import org.apache.batik.dom.svg.SVGDOMImplementation;
@@ -78,7 +78,7 @@ public class SVGElementMapping extends ElementMapping {
             // normally the user agent value is used
             try {
                 XMLResourceDescriptor.setXMLParserClassName(
-                  FOInputHandler.getParserClassName());
+                  FOFileHandler.getParserClassName());
     
                 foObjs = new HashMap();
                 foObjs.put("svg", new SE());
index 5711df3c0049243599598fd05271b03b4aa71a75..5c5dd481c5b0aeeede769c2ed1ce010df05e06ff 100644 (file)
@@ -158,7 +158,7 @@ public class SVGUserAgent extends UserAgentAdapter {
      * @return the XML parser class name
      */
     public String getXMLParserClassName() {
-        return org.apache.fop.apps.FOInputHandler.getParserClassName();
+        return org.apache.fop.apps.FOFileHandler.getParserClassName();
     }
 
     /**
index bbe5cb70989e0156fcf28903bc8ba1f0729d148f..d7fb0f69725928b1795b550989c752ae3c9f879b 100644 (file)
@@ -51,7 +51,7 @@
 package org.apache.fop.tools;
 
 import org.apache.fop.apps.Driver;
-import org.apache.fop.apps.FOInputHandler;
+import org.apache.fop.apps.FOFileHandler;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.InputHandler;
 import org.apache.fop.apps.XSLTInputHandler;
@@ -278,7 +278,7 @@ public class TestConverter extends AbstractLogEnabled {
 
             InputHandler inputHandler = null;
             if (xsl == null) {
-                inputHandler = new FOInputHandler(xmlFile);
+                inputHandler = new FOFileHandler(xmlFile);
             } else {
                 inputHandler = new XSLTInputHandler(xmlFile,
                                                     new File(baseDir + "/"
index a54d07558249bb5ed7ae85809a29bf2a5d25e96f..db388f46166c9eb49818998ba1d6e2ecbd8e60b0 100644 (file)
@@ -68,7 +68,7 @@ import java.util.List;
 // FOP
 import org.apache.fop.apps.Starter;
 import org.apache.fop.apps.InputHandler;
-import org.apache.fop.apps.FOInputHandler;
+import org.apache.fop.apps.FOFileHandler;
 import org.apache.fop.apps.Driver;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fo.FOUserAgent;
@@ -502,7 +502,7 @@ class FOPTaskStarter extends Starter {
 
     private void render(File foFile, File outFile,
                         int renderer) throws FOPException {
-        InputHandler inputHandler = new FOInputHandler(foFile);
+        InputHandler inputHandler = new FOFileHandler(foFile);
 
         OutputStream out = null;
         try {