From 440ec1d3a5601f93e8798acd8a6325c39a19ddd9 Mon Sep 17 00:00:00 2001 From: fotis Date: Tue, 27 Feb 2001 11:41:53 +0000 Subject: [PATCH] restitutes jdk 1.1 compatiblity (Art Welch) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194094 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/apps/CommandLineOptions.java | 75 ++++++++++++------- 1 file changed, 49 insertions(+), 26 deletions(-) diff --git a/src/org/apache/fop/apps/CommandLineOptions.java b/src/org/apache/fop/apps/CommandLineOptions.java index b5575ca3a..939fc2c64 100644 --- a/src/org/apache/fop/apps/CommandLineOptions.java +++ b/src/org/apache/fop/apps/CommandLineOptions.java @@ -1,6 +1,6 @@ -/* +/* * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. - * For details on use and redistribution please refer to the + * For details on use and redistribution please refer to the * LICENSE file included with these sources." */ @@ -69,16 +69,16 @@ public class CommandLineOptions { } /** - * parses the commandline arguments - */ + * parses the commandline arguments + */ private void parseOptions (String args[]) { for (int i = 0; i < args.length; i++) { if (args[i].equals("-d") || args[i].equals("--full-error-dump")) { errorDump = new Boolean(true); } else if (args[i].equals("-x") || args[i].equals("--dump-config")) { - dumpConfiguration = new Boolean(true); + dumpConfiguration = new Boolean(true); } else if (args[i].equals("-q") || args[i].equals("--quiet")) { - quiet = new Boolean(true); + quiet = new Boolean(true); } else if (args[i].equals("-c")) { if ((i + 1 == args.length) || (args[i + 1].charAt(0) == '-')) { @@ -278,14 +278,14 @@ public class CommandLineOptions { } /** - * - **/ + * + **/ public InputHandler getInputHandler () { switch (inputmode) { case FO_INPUT: return new FOInputHandler(fofile); case XSLT_INPUT: - return new XSLTInputHandler(xmlfile,xsltfile); + return new XSLTInputHandler(xmlfile, xsltfile); default: return new FOInputHandler(fofile); } @@ -297,11 +297,34 @@ public class CommandLineOptions { case PDF_OUTPUT: return new CommandLineStarter(this); case AWT_OUTPUT: - return new AWTStarter(this); + try { + return((Starter) Class.forName( + "org.apache.fop.apps.AWTStarter"). + getConstructor( + new Class[]{CommandLineOptions.class}). + newInstance(new Object[]{this})); + } catch (Exception e) { + MessageHandler.errorln( + "ERROR: AWTStarter could not be loaded. " + + e.toString()); + return(null); + } case MIF_OUTPUT: return new CommandLineStarter(this); case PRINT_OUTPUT: - return new PrintStarter(this); + try { + return((Starter) Class.forName( + "org.apache.fop.apps.PrintStarter"). + getConstructor( + new Class[]{CommandLineOptions.class}). + newInstance(new Object[]{this})); + } catch (Exception e) { + MessageHandler.errorln( + "ERROR: PrintStarter could not be loaded. " + + e.toString()); + return(null); + } + default: return new CommandLineStarter(this); } @@ -343,18 +366,18 @@ public class CommandLineOptions { return quiet; } - public Boolean dumpConfiguration() { - return dumpConfiguration; - } + public Boolean dumpConfiguration() { + return dumpConfiguration; + } public Boolean isDebugMode() { return errorDump; } - + /** - * return either the fofile or the xmlfile - */ + * return either the fofile or the xmlfile + */ public File getInputFile() { switch (inputmode) { case FO_INPUT: @@ -368,8 +391,8 @@ public class CommandLineOptions { /** - * shows the commandline syntax including a summary of all available options and some examples - */ + * shows the commandline syntax including a summary of all available options and some examples + */ public static void printUsage() { MessageHandler.logln( "\nUSAGE\nFop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-print] \n" + @@ -399,8 +422,8 @@ public class CommandLineOptions { } /** - * shows the options for print output - */ + * shows the options for print output + */ public void printUsagePrintOutput() { MessageHandler.errorln( "USAGE: -print [-Dstart=i] [-Dend=i] [-Dcopies=i] [-Deven=true|false] " + @@ -411,8 +434,8 @@ public class CommandLineOptions { /** - * debug mode. outputs all commandline settings - */ + * debug mode. outputs all commandline settings + */ private void debug () { System.out.print("Input mode: "); switch (inputmode) { @@ -493,9 +516,9 @@ public class CommandLineOptions { //debug: create class and output all settings public static void main (String args[]) { /* - for (int i = 0; i < args.length; i++) { - MessageHandler.logln(">"+args[i]+"<"); - }*/ + for (int i = 0; i < args.length; i++) { + MessageHandler.logln(">"+args[i]+"<"); + }*/ CommandLineOptions options = new CommandLineOptions (args); //options.debug(); -- 2.39.5