cvs commit: xml-fop/src/java/org/apache/fop/apps FOPOptions.java

2004-03-08 Thread pbwest
pbwest  2004/03/08 14:57:57

  Modified:src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design
FOPOptions.java
  Log:
  Use local reference to Fop.logger to set level.
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.1.2.4   +2 -3  xml-fop/src/java/org/apache/fop/apps/Attic/FOPOptions.java
  
  Index: FOPOptions.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Attic/FOPOptions.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- FOPOptions.java   8 Mar 2004 22:49:05 -   1.1.2.3
  +++ FOPOptions.java   8 Mar 2004 22:57:57 -   1.1.2.4
  @@ -355,8 +355,7 @@
   // quiet mode - this is the last setting, so there is no way to
   // supress the logging of messages during options processing
   if (configuration.isTrue("quiet")) {
  -Fop.setLoggingLevel(Level.OFF);
  -//log.setLevel(Level.OFF);
  +log.setLevel(Level.OFF);
   }
   
   }
  
  
  

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



cvs commit: xml-fop/src/java/org/apache/fop/apps FOPOptions.java

2004-03-08 Thread pbwest
pbwest  2004/03/08 14:49:06

  Modified:src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design
FOPOptions.java
  Log:
  Moved getConfResourceFile to ...configuration.ConfigurationResource.
  Use local reference to Fop.logger.
  Modify usage of logger to reduce verbosity.
  Modify usage of OptionBuilder to stop complaints from Eclipse.
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.1.2.3   +170 -212  xml-fop/src/java/org/apache/fop/apps/Attic/FOPOptions.java
  
  Index: FOPOptions.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Attic/FOPOptions.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- FOPOptions.java   6 Mar 2004 06:16:56 -   1.1.2.2
  +++ FOPOptions.java   8 Mar 2004 22:49:05 -   1.1.2.3
  @@ -1,8 +1,6 @@
   /*
  - * $Id$
  - * 
*
  - * Copyright 1999-2003 The Apache Software Foundation.
  + * Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
  @@ -16,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
  - *  
  + * $Id$
*/
   
   package org.apache.fop.apps;
  @@ -45,6 +43,7 @@
   import org.apache.commons.cli.Options;
   import org.apache.commons.cli.ParseException;
   import org.apache.commons.cli.PosixParser;
  +import org.apache.fop.configuration.ConfigurationResource;
   import org.apache.fop.configuration.Configuration;
   import org.apache.fop.configuration.ConfigurationReader;
   
  @@ -116,7 +115,7 @@
   
   private java.util.HashMap rendererOptions;
   
  -private Logger log;
  +private Logger log = Logger.getLogger(Fop.fopPackage);
   
   private Vector xsltParams = null;
   
  @@ -345,7 +344,7 @@
   } catch (Exception e) {}
   }
   if (debug) {
  -Fop.logger.config("base directory: " + baseDir);
  +log.config("base directory: " + baseDir);
   }
   
   if (dumpConfig) {
  @@ -356,7 +355,8 @@
   // quiet mode - this is the last setting, so there is no way to
   // supress the logging of messages during options processing
   if (configuration.isTrue("quiet")) {
  -Fop.logger.setLevel(Level.OFF);
  +Fop.setLoggingLevel(Level.OFF);
  +//log.setLevel(Level.OFF);
   }
   
   }
  @@ -385,44 +385,6 @@
   }
   
   /**
  - * Convenience class for common functionality required by the config
  - * files.
  - * @param fname the configuration file name.
  - * @param classob the requesting class
  - * @return an InputStream generated through a call to
  - * getResourceAsStream on the context ClassLoader
  - * or the ClassLoader for the conf class provided as an argument.
  - */
  -public InputStream getConfResourceFile(String fname, Class classob)
  -throws FOPException
  -{
  -InputStream configfile = null;
  -
  -// Try to use Context Class Loader to load the properties file.
  -try {
  -java.lang.reflect.Method getCCL =
  -Thread.class.getMethod("getContextClassLoader", new Class[0]);
  -if (getCCL != null) {
  -ClassLoader contextClassLoader =
  -(ClassLoader)getCCL.invoke(Thread.currentThread(),
  -new Object[0]);
  -configfile = contextClassLoader.getResourceAsStream("conf/"
  -+ fname);
  -}
  -} catch (Exception e) {}
  -
  -// the entry /conf/config.xml refers to a directory conf
  -// which is a sibling of org
  -if (configfile == null)
  -configfile = classob.getResourceAsStream("/conf/" + fname);
  -if (configfile == null) {
  -throw new FOPException(
  -"can't find configuration file " + fname);
  -}
  -return configfile;
  -}
  -
  -/**
* Loads configuration file from a system standard place.
* The context class loader and the ConfigurationReader
* class loader are asked in turn to getResourceAsStream
  @@ -433,11 +395,11 @@
*/
   public void loadConfiguration(String fname)
   throws FOPException {
  -InputStream configfile =
  -getConfResourceFile(fname, ConfigurationReader.class);
  +InputStream configfile = ConfigurationResource.getResourceFile(
  +"conf/" + fname, ConfigurationReader.class);
   
   if (debug) {
  -Fop.logger.config(
  +log.config(

cvs commit: xml-fop/src/java/org/apache/fop/apps FOPOptions.java

2004-03-05 Thread pbwest
pbwest  2004/03/05 22:16:56

  Modified:src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design
FOPOptions.java
  Log:
  Used OptionBuilder for all args
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.1.2.2   +7 -3  xml-fop/src/java/org/apache/fop/apps/Attic/FOPOptions.java
  
  Index: FOPOptions.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Attic/FOPOptions.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- FOPOptions.java   6 Mar 2004 05:53:16 -   1.1.2.1
  +++ FOPOptions.java   6 Mar 2004 06:16:56 -   1.1.2.2
  @@ -519,8 +519,12 @@
   // Add verbosity to options
   options.addOptionGroup(verbosity);
   // Add the dump-config option directly
  -options.addOption(new Option(
  -"x", "dump-config", NO_ARG, "Dump configuration settings"));
  +options.addOption(
  +OptionBuilder
  +.withArgName("dump config")
  +.withLongOpt("dump-config")
  +.withDescription("Dump configuration settings")
  +.create("x"));
   // Add the config-file option directly
   options.addOption(
   OptionBuilder
  
  
  

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



cvs commit: xml-fop/src/java/org/apache/fop/apps FOPOptions.java FOFileHandler.java XSLTInputHandler.java Driver.java InputHandler.java Fop.java Options.java FOInputHandler.java

2004-03-05 Thread pbwest
pbwest  2004/03/05 21:53:16

  Modified:src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design
Driver.java InputHandler.java Fop.java
  Added:   src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design
FOPOptions.java FOFileHandler.java
XSLTInputHandler.java
  Removed: src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design
Options.java FOInputHandler.java
  Log:
  Aligned Alt-Design apps more with HEAD.
  Made Configuration instance.
  Echoed HEAD in using of InputHandler, FOFileHandler and XSLTInputHandler
  Used org.apache.commons.cli.Options for CLI processing.
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.9.2.11  +42 -26xml-fop/src/java/org/apache/fop/apps/Driver.java
  
  Index: Driver.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Driver.java,v
  retrieving revision 1.9.2.10
  retrieving revision 1.9.2.11
  diff -u -r1.9.2.10 -r1.9.2.11
  --- Driver.java   19 Feb 2004 03:11:57 -  1.9.2.10
  +++ Driver.java   6 Mar 2004 05:53:16 -   1.9.2.11
  @@ -42,8 +42,34 @@
*/
   
   public class Driver {
  +
  +/** private constant to indicate renderer was not defined.  */
  +private static final int NOT_SET = 0;
  +/** Render to PDF. OutputStream must be set */
  +public static final int RENDER_PDF = 1;
  +/** Render to a GUI window. No OutputStream neccessary */
  +public static final int RENDER_AWT = 2;
  +/** Render to MIF. OutputStream must be set */
  +public static final int RENDER_MIF = 3;
  +/** Render to XML. OutputStream must be set */
  +public static final int RENDER_XML = 4;
  +/** Render to PRINT. No OutputStream neccessary */
  +public static final int RENDER_PRINT = 5;
  +/** Render to PCL. OutputStream must be set */
  +public static final int RENDER_PCL = 6;
  +/** Render to Postscript. OutputStream must be set */
  +public static final int RENDER_PS = 7;
  +/** Render to Text. OutputStream must be set */
  +public static final int RENDER_TXT = 8;
  +/** Render to SVG. OutputStream must be set */
  +public static final int RENDER_SVG = 9;
  +/** Render to RTF. OutputStream must be set */
  +public static final int RENDER_RTF = 10;
  +
   /** If true, full error stacks are reported */
  -private static boolean _errorDump = false;
  +private boolean _errorDump = false;
  +private Configuration configuration = null;
  +private FOPOptions options = null;
   
   private InputHandler inputHandler;
   private XMLReader parser;
  @@ -67,9 +93,18 @@
* Error handling, version and logging initialization.
*/
   public Driver() {
  -_errorDump =
  -Configuration.getBooleanValue("debugMode").booleanValue();
   String version = Version.getVersion();
  +configuration = new Configuration();
  +options = new FOPOptions(configuration);
  +_errorDump = configuration.isTrue("debugMode");
  +Fop.logger.config(version);
  +}
  +
  +public Driver(String[] args, Configuration config, FOPOptions options) {
  +String version = Version.getVersion();
  +configuration = config;
  +this.options = options;
  +_errorDump = configuration.isTrue("debugMode");
   Fop.logger.config(version);
   }
   
  @@ -103,7 +138,7 @@
* @throws FOPException
*/
   public void run () throws FOPException {
  -setInputHandler(Options.getInputHandler());
  +setInputHandler(options.getInputHandler());
   parser = inputHandler.getParser();
   saxSource = inputHandler.getInputSource();
   // Setting of namespace-prefixes feature no longer required
  @@ -140,26 +175,7 @@
   }
   
   /**
  - * Gets the parser Class name.
  - * 
  - * @return a String with the value of the property
  - * org.xml.sax.parser or the default value
  - * org.apache.xerces.parsers.SAXParser.
  - */
  -public static final String getParserClassName() {
  -String parserClassName = null;
  -try {
  -parserClassName = System.getProperty("org.xml.sax.parser");
  -} catch (SecurityException se) {}
  -
  -if (parserClassName == null) {
  -parserClassName = "org.apache.xerces.parsers.SAXParser";
  -}
  -return parserClassName;
  -}
  -
  -/**
  - * Sets the InputHandler for XML imput as specified in Options.
  + * Sets the InputHandler for XML imput as specified in FOPOptions.
* @param inputHandler the InputHandler
*/
   public void setInputHandler(InputHandler inputHandler) {
  @@ -180,7 +196,7 @@
* Prints stack trace of an exception