gmazza      2003/07/29 15:08:54

  Modified:    src/java/org/apache/fop/apps CommandLineOptions.java
                        Fop.java
  Log:
  1.) Moved the business logic for determining which starter to create from 
apps.CommandLineOptions to apps.Fop; CLO is now Starter-free.
  
  2.) Made the input and output type constants in CLO public, to make the 
CLO.getOutputMode() and CLO.getInputMode() accessor functions meaningful.  (Should 
probably make uniform with the very similar constants in the Driver class in the 
future.)
  
  Revision  Changes    Path
  1.9       +13 -37    xml-fop/src/java/org/apache/fop/apps/CommandLineOptions.java
  
  Index: CommandLineOptions.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/CommandLineOptions.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- CommandLineOptions.java   27 Jul 2003 20:16:03 -0000      1.8
  +++ CommandLineOptions.java   29 Jul 2003 22:08:54 -0000      1.9
  @@ -64,31 +64,31 @@
   public class CommandLineOptions {
   
       /* input / output not set */
  -    private static final int NOT_SET = 0;
  +    public static final int NOT_SET = 0;
       /* input: fo file */
  -    private static final int FO_INPUT = 1;
  +    public static final int FO_INPUT = 1;
       /* input: xml+xsl file */
  -    private static final int XSLT_INPUT = 2;
  +    public static final int XSLT_INPUT = 2;
       /* output: pdf file */
  -    private static final int PDF_OUTPUT = 1;
  +    public static final int PDF_OUTPUT = 1;
       /* output: screen using swing */
  -    private static final int AWT_OUTPUT = 2;
  +    public static final int AWT_OUTPUT = 2;
       /* output: mif file */
  -    private static final int MIF_OUTPUT = 3;
  +    public static final int MIF_OUTPUT = 3;
       /* output: sent swing rendered file to printer */
  -    private static final int PRINT_OUTPUT = 4;
  +    public static final int PRINT_OUTPUT = 4;
       /* output: pcl file */
  -    private static final int PCL_OUTPUT = 5;
  +    public static final int PCL_OUTPUT = 5;
       /* output: postscript file */
  -    private static final int PS_OUTPUT = 6;
  +    public static final int PS_OUTPUT = 6;
       /* output: text file */
  -    private static final int TXT_OUTPUT = 7;
  +    public static final int TXT_OUTPUT = 7;
       /* output: svg file */
  -    private static final int SVG_OUTPUT = 8;
  +    public static final int SVG_OUTPUT = 8;
       /* output: XML area tree */
  -    private static final int AREA_OUTPUT = 9;
  +    public static final int AREA_OUTPUT = 9;
       /* output: RTF file */
  -    private static final int RTF_OUTPUT = 10;
  +    public static final int RTF_OUTPUT = 10;
   
       /* show configuration information */
       private Boolean dumpConfiguration = Boolean.FALSE;
  @@ -506,30 +506,6 @@
        */
       public java.util.HashMap getRendererOptions() {
           return rendererOptions;
  -    }
  -
  -    /**
  -     * Get the starter for the process.
  -     * @return the starter.
  -     * @throws FOPException In case of failure while getting the starter
  -     */
  -    public Starter getStarter() throws FOPException {
  -        Starter starter = null;
  -        switch (outputmode) {
  -        case AWT_OUTPUT:
  -            try {
  -                starter = new AWTStarter(this);
  -            } catch (FOPException e) {
  -                throw e;
  -            } catch (Exception e) {
  -                throw new FOPException("AWTStarter could not be loaded.", e);
  -            }
  -            break;
  -        default:
  -            starter = new CommandLineStarter(this);
  -        }
  -        starter.enableLogging(log);
  -        return starter;
       }
   
       /**
  
  
  
  1.2       +9 -1      xml-fop/src/java/org/apache/fop/apps/Fop.java
  
  Index: Fop.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Fop.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Fop.java  11 Mar 2003 13:05:28 -0000      1.1
  +++ Fop.java  29 Jul 2003 22:08:54 -0000      1.2
  @@ -50,6 +50,8 @@
    */ 
   package org.apache.fop.apps;
   
  +import org.apache.avalon.framework.logger.ConsoleLogger;
  +
   /**
    * The main application class for the FOP command line interface (CLI).
    */
  @@ -61,10 +63,16 @@
        */
       public static void main(String[] args) {
           CommandLineOptions options = null;
  +        Starter starter = null;
   
           try {
               options = new CommandLineOptions(args);
  -            Starter starter = options.getStarter();
  +            if (options.getOutputMode() == CommandLineOptions.AWT_OUTPUT) {
  +                starter = new AWTStarter(options);
  +            } else {
  +                starter = new CommandLineStarter(options);
  +            }
  +            starter.enableLogging(new ConsoleLogger(ConsoleLogger.LEVEL_INFO));
               starter.run();
           } catch (FOPException e) {
               if (e.getMessage() == null) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to