cvs commit: xml-fop/src/java/org/apache/fop/apps Driver.java Fop.java Document.java FOUserAgent.java FOPOptions.java

2004-03-13 Thread pbwest
pbwest  2004/03/13 00:44:23

  Modified:src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design
Driver.java Fop.java Document.java
  Removed: src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design
FOUserAgent.java FOPOptions.java
  Log:
  Reconstructed FOPOptions as:
   SystemOptions
   UserOptions extends SystemOptions
   CLI_Options extends UserOptions
  Moved all configuration-related classes into org.apache.fop.configuration
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.9.2.14  +6 -4  xml-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.13
  retrieving revision 1.9.2.14
  diff -u -r1.9.2.13 -r1.9.2.14
  --- Driver.java   10 Mar 2004 06:24:29 -  1.9.2.13
  +++ Driver.java   13 Mar 2004 08:44:23 -  1.9.2.14
  @@ -28,6 +28,8 @@
   import org.xml.sax.XMLReader;
   
   import org.apache.fop.configuration.Configuration;
  +import org.apache.fop.configuration.FOUserAgent;
  +import org.apache.fop.configuration.SystemOptions;
   import org.apache.fop.fo.FOTree;
   import org.apache.fop.layout.AreaTree;
   import org.apache.fop.render.Renderer;
  @@ -74,7 +76,7 @@
   /** If true, full error stacks are reported */
   private boolean _errorDump = false;
   private Configuration configuration = null;
  -private FOPOptions options = null;
  +private SystemOptions options = null;
   private FOUserAgent userAgent = null;
   
   private InputHandler inputHandler;
  @@ -107,13 +109,13 @@
   public Driver() {
   String version = Version.getVersion();
   configuration = new Configuration();
  -options = new FOPOptions(configuration);
  +options = new SystemOptions(configuration);
   userAgent = new FOUserAgent();
   _errorDump = configuration.isTrue(debugMode);
   logger.config(version);
   }
   
  -public Driver(Configuration config, FOPOptions options) {
  +public Driver(Configuration config, SystemOptions options) {
   String version = Version.getVersion();
   configuration = config;
   this.options = options;
  
  
  
  1.1.2.12  +10 -8 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.2.11
  retrieving revision 1.1.2.12
  diff -u -r1.1.2.11 -r1.1.2.12
  --- Fop.java  10 Mar 2004 06:24:29 -  1.1.2.11
  +++ Fop.java  13 Mar 2004 08:44:23 -  1.1.2.12
  @@ -25,8 +25,10 @@
   import java.io.InputStream;
   import java.util.Enumeration;
   import java.util.Properties;
  +import java.util.logging.Level;
   import java.util.logging.Logger;
   
  +import org.apache.fop.configuration.*;
   import org.apache.fop.configuration.ConfigurationResource;
   import org.apache.fop.configuration.Configuration;
   
  @@ -44,12 +46,12 @@
*/
   public static final String fopPackage = org.apache.fop;
   
  -private static Logger logger;
  +private Logger logger;
   
  -public Configuration configuration = new Configuration();
  +public Configuration configuration = null;
   
   public static void main(String[] args) {
  -Fop fopInstance = new Fop();
  +Fop fopInstance = new Fop(args);
   fopInstance.run();
   }
   
  @@ -106,9 +108,9 @@
   // Now that the Fop system properties have been added, set up logger
   logger = Logger.getLogger(fopPackage);
   // Then restrict to WARNING
  +logger.setLevel(Level.WARNING);
   Driver driver;
  -Configuration configuration;
  -FOPOptions options = null;
  +SystemOptions options = null;
   Boolean bool = null;
   
   runtime = Runtime.getRuntime();
  @@ -119,9 +121,9 @@
   try {
   configuration = new Configuration();
   if (args == null) {
  -options = new FOPOptions(configuration);
  +options = new UserOptions(configuration);
   } else {
  -options = new FOPOptions(configuration, args);
  +options = new CLI_Options(configuration, args);
   }
   driver = new Driver(configuration, options);
   driver.run();
  
  
  
  1.11.2.2  +2 -2  xml-fop/src/java/org/apache/fop/apps/Document.java
  
  Index: Document.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Document.java,v
  retrieving revision 1.11.2.1
  retrieving revision 1.11.2.2
  diff -u -r1.11.2.1 -r1.11.2.2
  --- 

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

2004-03-08 Thread pbwest
pbwest  2004/03/08 14:51:12

  Modified:src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design
Driver.java
  Log:
  Use local reference to Fop.logger.
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.9.2.12  +6 -3  xml-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.11
  retrieving revision 1.9.2.12
  diff -u -r1.9.2.11 -r1.9.2.12
  --- Driver.java   6 Mar 2004 05:53:16 -   1.9.2.11
  +++ Driver.java   8 Mar 2004 22:51:12 -   1.9.2.12
  @@ -21,6 +21,8 @@
   
   package org.apache.fop.apps;
   
  +import java.util.logging.Logger;
  +
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
   import org.xml.sax.XMLReader;
  @@ -66,6 +68,7 @@
   /** Render to RTF. OutputStream must be set */
   public static final int RENDER_RTF = 10;
   
  +protected Logger logger = Logger.getLogger(Fop.fopPackage);
   /** If true, full error stacks are reported */
   private boolean _errorDump = false;
   private Configuration configuration = null;
  @@ -97,7 +100,7 @@
   configuration = new Configuration();
   options = new FOPOptions(configuration);
   _errorDump = configuration.isTrue(debugMode);
  -Fop.logger.config(version);
  +logger.config(version);
   }
   
   public Driver(String[] args, Configuration config, FOPOptions options) {
  @@ -105,7 +108,7 @@
   configuration = config;
   this.options = options;
   _errorDump = configuration.isTrue(debugMode);
  -Fop.logger.config(version);
  +logger.config(version);
   }
   
   /**
  
  
  

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



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

2004-01-14 Thread pbwest
pbwest  2004/01/14 06:13:17

  Modified:src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design
Driver.java
  Log:
  Name change: SyncedFoXmlEventsBuffer to SyncedXmlEventsBuffer
  Exception handling modified for 1.4 exception chaining
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.9.2.5   +4 -9  xml-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.4
  retrieving revision 1.9.2.5
  diff -u -r1.9.2.4 -r1.9.2.5
  --- Driver.java   5 Jan 2004 02:24:04 -   1.9.2.4
  +++ Driver.java   14 Jan 2004 14:13:17 -  1.9.2.5
  @@ -63,7 +63,7 @@
   import org.apache.fop.messaging.MessageHandler;
   import org.apache.fop.version.Version;
   import org.apache.fop.xml.FoXMLSerialHandler;
  -import org.apache.fop.xml.SyncedFoXmlEventsBuffer;
  +import org.apache.fop.xml.SyncedXmlEventsBuffer;
   
   /**
* Sets up and runs serialized component threads.
  @@ -81,7 +81,7 @@
   private InputSource source;
   
   private FoXMLSerialHandler xmlhandler;
  -private SyncedFoXmlEventsBuffer xmlevents;
  +private SyncedXmlEventsBuffer xmlevents;
   private FOTree foTree;
   private AreaTree areaTree = new AreaTree();
   
  @@ -106,7 +106,7 @@
* Sets up the environment and start processing threads.
* The primary elements of the environment include:br
* the input source, the parser, the
  - * [EMAIL PROTECTED] org.apache.fop.xml.SyncedFoXmlEventsBuffer 
SyncedFoXmlEventsBuffer}
  + * [EMAIL PROTECTED] org.apache.fop.xml.SyncedXmlEventsBuffer 
SyncedXmlEventsBuffer}
* (codexmlevents/code), the
* [EMAIL PROTECTED] org.apache.fop.xml.FoXMLSerialHandler FoXMLSerialHandler}
* (codexmlhandler/code) and the
  @@ -138,7 +138,7 @@
   // Setting of namespace-prefixes feature no longer required
   //setParserFeatures(parser);
   
  -xmlevents = new SyncedFoXmlEventsBuffer();
  +xmlevents = new SyncedXmlEventsBuffer();
   xmlhandler = new FoXMLSerialHandler(xmlevents, parser, source);
   foTree = new FOTree(xmlevents);
   
  @@ -213,11 +213,6 @@
   e.printStackTrace();
   if (((SAXException)e).getException() != null) {
   ((SAXException)e).getException().printStackTrace();
  -}
  -} else if (e instanceof FOPException) {
  -e.printStackTrace();
  -if (((FOPException)e).getException() != null) {
  -((FOPException)e).getException().printStackTrace();
   }
   } else {
   e.printStackTrace();
  
  
  

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



cvs commit: xml-fop/src/java/org/apache/fop/apps Driver.java InputHandler.java package.html FOPException.java CommandLineStarter.java Fop.java FOInputHandler.java

2004-01-14 Thread pbwest
pbwest  2004/01/14 06:17:20

  Modified:src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design
Driver.java InputHandler.java package.html
FOPException.java CommandLineStarter.java Fop.java
FOInputHandler.java
  Log:
  Changed to ASCII -kkv from -ko
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.9.2.6   +0 -0  xml-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.5
  retrieving revision 1.9.2.6
  diff -u -r1.9.2.5 -r1.9.2.6
  
  
  
  1.4.2.2   +0 -0  xml-fop/src/java/org/apache/fop/apps/InputHandler.java
  
  Index: InputHandler.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/InputHandler.java,v
  retrieving revision 1.4.2.1
  retrieving revision 1.4.2.2
  diff -u -r1.4.2.1 -r1.4.2.2
  
  
  
  1.1.2.2   +0 -0  xml-fop/src/java/org/apache/fop/apps/package.html
  
  Index: package.html
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/package.html,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  
  
  
  1.2.2.5   +0 -0  xml-fop/src/java/org/apache/fop/apps/FOPException.java
  
  Index: FOPException.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/FOPException.java,v
  retrieving revision 1.2.2.4
  retrieving revision 1.2.2.5
  diff -u -r1.2.2.4 -r1.2.2.5
  
  
  
  1.3.2.4   +0 -0  
xml-fop/src/java/org/apache/fop/apps/Attic/CommandLineStarter.java
  
  Index: CommandLineStarter.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/apps/Attic/CommandLineStarter.java,v
  retrieving revision 1.3.2.3
  retrieving revision 1.3.2.4
  diff -u -r1.3.2.3 -r1.3.2.4
  
  
  
  1.1.2.3   +0 -0  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.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  
  
  
  1.4.2.2   +0 -0  xml-fop/src/java/org/apache/fop/apps/Attic/FOInputHandler.java
  
  Index: FOInputHandler.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Attic/FOInputHandler.java,v
  retrieving revision 1.4.2.1
  retrieving revision 1.4.2.2
  diff -u -r1.4.2.1 -r1.4.2.2
  
  
  

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



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

2004-01-04 Thread pbwest
pbwest  2004/01/04 18:24:05

  Modified:src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design
Driver.java
  Log:
  Removed unused setParserFeatures.
  Removed redundant throws exception clause.
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.9.2.4   +5 -5  xml-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.3
  retrieving revision 1.9.2.4
  diff -u -r1.9.2.3 -r1.9.2.4
  --- Driver.java   28 Dec 2003 04:16:00 -  1.9.2.3
  +++ Driver.java   5 Jan 2004 02:24:04 -   1.9.2.4
  @@ -95,7 +95,7 @@
   /**
* Error handling, version and logging initialization.
*/
  -public Driver() throws FOPException {
  +public Driver() {
   _errorDump =
   Configuration.getBooleanValue(debugMode).booleanValue();
   String version = Version.getVersion();
  @@ -135,7 +135,8 @@
   setInputHandler(Options.getInputHandler());
   parser = inputHandler.getParser();
   source = inputHandler.getInputSource();
  -setParserFeatures(parser);
  +// Setting of namespace-prefixes feature no longer required
  +//setParserFeatures(parser);
   
   xmlevents = new SyncedFoXmlEventsBuffer();
   xmlhandler = new FoXMLSerialHandler(xmlevents, parser, source);
  @@ -197,11 +198,10 @@
* @param parser the XMLReader used to parse the input
* @throws FOPException
*/
  +/*
   public void setParserFeatures(XMLReader parser) throws FOPException {
  -/*
  - Setting of namespaces-prefixes feature removed.
  -*/
   }
  +*/
   
   /**
* Prints stack trace of an exception
  
  
  

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



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

2003-12-27 Thread pbwest
pbwest  2003/12/27 20:16:00

  Modified:src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design
Driver.java
  Log:
  Removed setting of namespace-prefixes feature from SAX
  parser.
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.9.2.3   +3 -8  xml-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.2
  retrieving revision 1.9.2.3
  diff -u -r1.9.2.2 -r1.9.2.3
  --- Driver.java   11 Jul 2003 04:03:47 -  1.9.2.2
  +++ Driver.java   28 Dec 2003 04:16:00 -  1.9.2.3
  @@ -198,14 +198,9 @@
* @throws FOPException
*/
   public void setParserFeatures(XMLReader parser) throws FOPException {
  -try {
  -parser.setFeature(http://xml.org/sax/features/namespace-prefixes;,
  -  true);
  -} catch (SAXException e) {
  -throw new FOPException(
  -Error in setting up parser feature namespace-prefixes\n
  -   + You need a parser which supports SAX version 2, e);
  -}
  +/*
  + Setting of namespaces-prefixes feature removed.
  +*/
   }
   
   /**
  
  
  

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



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

2003-11-08 Thread jeremias
jeremias2003/11/08 06:00:03

  Modified:src/java/org/apache/fop/apps Driver.java
  Log:
  Fix Document construction in getContentHandler() (it was done too late)
  
  Revision  ChangesPath
  1.46  +14 -14xml-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.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- Driver.java   7 Nov 2003 21:49:02 -   1.45
  +++ Driver.java   8 Nov 2003 14:00:02 -   1.46
  @@ -524,6 +524,19 @@
  validateOutputStream();
   }
   
  +/** Document creation is hard-wired for now, but needs to be made
  + accessible through the API and/or configuration */
  +if (currentDocument == null) {
  +currentDocument = new Document(this);
  +}
  +/** LayoutStrategy is hard-wired for now, but needs to be made
  +accessible through the API and/or configuration */
  +if (foInputHandler instanceof FOTreeHandler) {
  +if (currentDocument.getLayoutStrategy() == null) {
  +currentDocument.setLayoutStrategy(new 
LayoutManagerLS(currentDocument));
  +}
  +}
  +
   // TODO: - do this stuff in a better way
   // PIJ: I guess the structure handler should be created by the renderer.
   if (rendererType == RENDER_MIF) {
  @@ -537,22 +550,9 @@
   }
   foInputHandler = new FOTreeHandler(currentDocument, true);
   }
  +currentDocument.foInputHandler = foInputHandler;
   
   foInputHandler.enableLogging(getLogger());
  -
  -/** Document creation is hard-wired for now, but needs to be made
  - accessible through the API and/or configuration */
  -if (currentDocument == null) {
  -currentDocument = new Document(this);
  -}
  -currentDocument.foInputHandler = foInputHandler;
  -/** LayoutStrategy is hard-wired for now, but needs to be made
  -accessible through the API and/or configuration */
  -if (foInputHandler instanceof FOTreeHandler) {
  -if (currentDocument.getLayoutStrategy() == null) {
  -currentDocument.setLayoutStrategy(new 
LayoutManagerLS(currentDocument));
  -}
  -}
   
   treeBuilder.setUserAgent(getUserAgent());
   treeBuilder.setFOInputHandler(foInputHandler);
  
  
  

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



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

2003-11-08 Thread jeremias
jeremias2003/11/08 06:30:01

  Modified:src/java/org/apache/fop/apps Driver.java
  Log:
  Another fix, making Area Tree Renderers work again. Damn, when am I going to get it 
right?
  
  Revision  ChangesPath
  1.47  +7 -7  xml-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.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- Driver.java   8 Nov 2003 14:00:02 -   1.46
  +++ Driver.java   8 Nov 2003 14:30:01 -   1.47
  @@ -529,13 +529,6 @@
   if (currentDocument == null) {
   currentDocument = new Document(this);
   }
  -/** LayoutStrategy is hard-wired for now, but needs to be made
  -accessible through the API and/or configuration */
  -if (foInputHandler instanceof FOTreeHandler) {
  -if (currentDocument.getLayoutStrategy() == null) {
  -currentDocument.setLayoutStrategy(new 
LayoutManagerLS(currentDocument));
  -}
  -}
   
   // TODO: - do this stuff in a better way
   // PIJ: I guess the structure handler should be created by the renderer.
  @@ -551,6 +544,13 @@
   foInputHandler = new FOTreeHandler(currentDocument, true);
   }
   currentDocument.foInputHandler = foInputHandler;
  +/** LayoutStrategy is hard-wired for now, but needs to be made
  +accessible through the API and/or configuration */
  +if (foInputHandler instanceof FOTreeHandler) {
  +if (currentDocument.getLayoutStrategy() == null) {
  +currentDocument.setLayoutStrategy(new 
LayoutManagerLS(currentDocument));
  +}
  +}
   
   foInputHandler.enableLogging(getLogger());
   
  
  
  

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



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

2003-11-08 Thread jeremias
jeremias2003/11/08 07:16:53

  Modified:src/java/org/apache/fop/apps Driver.java
  Log:
  Now all setup code is moved from render() to getContentHandler() except for the 
FOTreeListener.
  
  Revision  ChangesPath
  1.48  +17 -16xml-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.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- Driver.java   8 Nov 2003 14:30:01 -   1.47
  +++ Driver.java   8 Nov 2003 15:16:53 -   1.48
  @@ -514,8 +514,9 @@
* renderers (e.g. PDF  PostScript) use a ContentHandler that builds an FO
* Tree.
* @return a SAX ContentHandler for handling the SAX events.
  + * @throws FOPException if setting up the ContentHandler fails
*/
  -public ContentHandler getContentHandler() {
  +public ContentHandler getContentHandler() throws FOPException {
   if (!isInitialized()) {
   initialize();
   }
  @@ -542,6 +543,21 @@
   Renderer not set when using standard foInputHandler);
   }
   foInputHandler = new FOTreeHandler(currentDocument, true);
  +currentDocument.areaTree = new AreaTree(currentDocument);
  +currentDocument.atModel = new RenderPagesModel(renderer);
  +//this.atModel = new CachedRenderPagesModel(renderer);
  +currentDocument.areaTree.setTreeModel(currentDocument.atModel);
  +try {
  +renderer.setupFontInfo(currentDocument);
  +// check that the any,normal,400 font exists
  +if (!currentDocument.isSetupValid()) {
  +throw new FOPException(
  +No default font defined by OutputConverter);
  +}
  +renderer.startRenderer(stream);
  +} catch (IOException e) {
  +throw new FOPException(e);
  +}
   }
   currentDocument.foInputHandler = foInputHandler;
   /** LayoutStrategy is hard-wired for now, but needs to be made
  @@ -588,21 +604,6 @@
   if (foInputHandler instanceof FOTreeHandler) {
   FOTreeHandler foTreeHandler = (FOTreeHandler)foInputHandler;
   foTreeHandler.addFOTreeListener(currentDocument);
  -currentDocument.areaTree = new AreaTree(currentDocument);
  -currentDocument.atModel = new RenderPagesModel(renderer);
  -//this.atModel = new CachedRenderPagesModel(renderer);
  -currentDocument.areaTree.setTreeModel(currentDocument.atModel);
  -try {
  -renderer.setupFontInfo(currentDocument);
  -// check that the any,normal,400 font exists
  -if (!currentDocument.isSetupValid()) {
  -throw new SAXException(new FOPException(
  -No default font defined by OutputConverter));
  -}
  -renderer.startRenderer(stream);
  -} catch (IOException e) {
  -throw new SAXException(e);
  -}
   }
   /**
The following statement triggers virtually all of the processing
  
  
  

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



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

2003-11-07 Thread jeremias
jeremias2003/11/07 13:49:02

  Modified:src/java/org/apache/fop/apps Driver.java
  Log:
  Tried to fix basic driver tests but didn't manage, yet.
  Some initialisation code moved from render() to getContentHandler().
  
  Revision  ChangesPath
  1.45  +15 -17xml-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.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- Driver.java   4 Nov 2003 23:59:11 -   1.44
  +++ Driver.java   7 Nov 2003 21:49:02 -   1.45
  @@ -540,8 +540,23 @@
   
   foInputHandler.enableLogging(getLogger());
   
  +/** Document creation is hard-wired for now, but needs to be made
  + accessible through the API and/or configuration */
  +if (currentDocument == null) {
  +currentDocument = new Document(this);
  +}
  +currentDocument.foInputHandler = foInputHandler;
  +/** LayoutStrategy is hard-wired for now, but needs to be made
  +accessible through the API and/or configuration */
  +if (foInputHandler instanceof FOTreeHandler) {
  +if (currentDocument.getLayoutStrategy() == null) {
  +currentDocument.setLayoutStrategy(new 
LayoutManagerLS(currentDocument));
  +}
  +}
  +
   treeBuilder.setUserAgent(getUserAgent());
   treeBuilder.setFOInputHandler(foInputHandler);
  +treeBuilder.foTreeControl = currentDocument;
   
   return treeBuilder;
   }
  @@ -568,24 +583,7 @@
*/
   public synchronized void render(XMLReader parser, InputSource source)
   throws FOPException {
  -if (!isInitialized()) {
  -initialize();
  -}
  -/** Document creation is hard-wired for now, but needs to be made
  - accessible through the API and/or configuration */
  -if (currentDocument == null) {
  -currentDocument = new Document(this);
  -}
   parser.setContentHandler(getContentHandler());
  -currentDocument.foInputHandler = foInputHandler;
  -/** LayoutStrategy is hard-wired for now, but needs to be made
  -accessible through the API and/or configuration */
  -if (foInputHandler instanceof FOTreeHandler) {
  -if (currentDocument.getLayoutStrategy() == null) {
  -currentDocument.setLayoutStrategy(new 
LayoutManagerLS(currentDocument));
  -}
  -}
  -treeBuilder.foTreeControl = currentDocument;
   try {
   if (foInputHandler instanceof FOTreeHandler) {
   FOTreeHandler foTreeHandler = (FOTreeHandler)foInputHandler;
  
  
  

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



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

2003-09-17 Thread vmote
vmote   2003/09/17 09:25:47

  Modified:src/java/org/apache/fop/apps Driver.java
  Log:
  set the (default) LayoutStrategy only if it has not been set already
  
  Revision  ChangesPath
  1.40  +3 -1  xml-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.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- Driver.java   10 Sep 2003 06:25:36 -  1.39
  +++ Driver.java   17 Sep 2003 16:25:47 -  1.40
  @@ -581,7 +581,9 @@
   /** LayoutStrategy is hard-wired for now, but needs to be made
   accessible through the API and/or configuration */
   if (foInputHandler instanceof FOTreeHandler) {
  -currentDocument.setLayoutStrategy(new LayoutManagerLS(currentDocument));
  +if (currentDocument.getLayoutStrategy() == null) {
  +currentDocument.setLayoutStrategy(new 
LayoutManagerLS(currentDocument));
  +}
   }
   treeBuilder.foTreeControl = currentDocument;
   try {
  
  
  

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



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

2003-09-17 Thread vmote
vmote   2003/09/17 09:48:02

  Modified:src/java/org/apache/fop/apps Driver.java
  Log:
  add accessor methods for currentDocument
  
  Revision  ChangesPath
  1.41  +16 -1 xml-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.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- Driver.java   17 Sep 2003 16:25:47 -  1.40
  +++ Driver.java   17 Sep 2003 16:48:02 -  1.41
  @@ -686,5 +686,20 @@
   }
   }
   
  -}
  +/**
  + * Public accessor for setting the currentDocument to process.
  + * @param document the Document object that should be processed.
  + */
  +public void setCurrentDocument(Document document) {
  +currentDocument = document;
  +}
  +
  +/**
  + * Public accessor for getting the currentDocument
  + * @return the currentDocument
  + */
  +public Document getCurrentDocument() {
  +   return currentDocument;
  +}
   
  +}
  
  
  

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



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

2003-08-19 Thread gmazza
gmazza  2003/08/19 15:17:58

  Modified:src/java/org/apache/fop/apps Driver.java
  Log:
  Deprecated (since mid-2001) setRenderer(rendererClassName, version) method removed.
  Fix to Bug 22561:  Driver.run() incorrectly setting output type to PDF for the 
structure (MIF and RTF) types.
  Submitted by: Michael Cosby (michael at cosby dot dhs dot org).
  
  Revision  ChangesPath
  1.29  +12 -18xml-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.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Driver.java   19 Aug 2003 05:19:21 -  1.28
  +++ Driver.java   19 Aug 2003 22:17:57 -  1.29
  @@ -141,6 +141,11 @@
   public class Driver implements LogEnabled, FOTreeListener {
   
   /**
  + * 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;
  @@ -198,7 +203,7 @@
   /**
* the renderer type code given by setRenderer
*/
  -private int rendererType;
  +private int rendererType = NOT_SET;
   
   /**
* the renderer to use to output the area tree
  @@ -435,7 +440,8 @@
   //foInputHandler will be set later
   break;
   default:
  -throw new IllegalArgumentException(Unknown renderer type);
  +rendererType = NOT_SET;
  +throw new IllegalArgumentException(Unknown renderer type  + renderer);
   }
   }
   
  @@ -462,20 +468,6 @@
   }
   
   /**
  - * Sets the renderer.
  - * @param rendererClassName the fully qualified classname of the renderer
  - * class to use.
  - * @param version version number
  - * @deprecated use renderer.setProducer(version) + setRenderer(renderer) or
  - * just setRenderer(rendererType) which will use the default producer string.
  - * @see #setRenderer(int)
  - * @see #setRenderer(Renderer)
  - */
  -public void setRenderer(String rendererClassName, String version) {
  -setRenderer(rendererClassName);
  -}
  -
  -/**
* Set the class name of the Renderer to use as well as the
* producer string for those renderers that can make use of it.
* @param rendererClassName classname of the renderer to use such as
  @@ -668,8 +660,10 @@
   if (!isInitialized()) {
   initialize();
   }
  -if (renderer == null) {
  -setRenderer(RENDER_PDF);
  +
  +if (renderer == null  rendererType != RENDER_RTF 
  + rendererType != RENDER_MIF) {
  +setRenderer(RENDER_PDF);
   }
   
   if (source == null) {
  
  
  

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



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

2003-08-15 Thread gmazza
gmazza  2003/08/15 13:37:51

  Modified:src/java/org/apache/fop/apps Driver.java
  Log:
  Removed error message when logger not explicitly set; Driver will continue to use 
ConsoleLogger as default in such circumstances.  (Allows for coding simple 
command-line processes without needing to explicitly code in Avalon ConsoleLoggers)
  
  Revision  ChangesPath
  1.25  +1 -1  xml-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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Driver.java   15 Aug 2003 15:52:10 -  1.24
  +++ Driver.java   15 Aug 2003 20:37:51 -  1.25
  @@ -323,8 +323,8 @@
*/
   protected Logger getLogger() {
   if (this.log == null) {
  +// use ConsoleLogger as default when logger not explicitly set
   this.log = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
  -this.log.error(Logger not set. Using ConsoleLogger as default.);
   }
   
   return this.log;
  
  
  

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



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

2003-08-14 Thread vmote
vmote   2003/08/11 10:44:15

  Modified:src/java/org/apache/fop/apps Driver.java
  Log:
  some javadoc changes
  
  Revision  ChangesPath
  1.18  +7 -7  xml-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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Driver.java   5 Aug 2003 22:39:51 -   1.17
  +++ Driver.java   11 Aug 2003 17:44:15 -  1.18
  @@ -197,7 +197,7 @@
   private Renderer renderer;
   
   /**
  - * the structure handler
  + * the SAX ContentHandler
*/
   private FOInputHandler foInputHandler;
   
  @@ -510,12 +510,12 @@
   }
   
   /**
  - * Returns the tree builder (a SAX ContentHandler).
  - *
  - * Used in situations where SAX is used but not via a FOP-invoked
  - * SAX parser. A good example is an XSLT engine that fires SAX
  - * events but isn't a SAX Parser itself.
  - * @return a content handler for handling the SAX events.
  + * Determines which SAX ContentHandler is appropriate for the rendererType.
  + * Structure renderers (e.g. MIF  RTF) each have a specialized
  + * ContentHandler that directly place data into the output stream. Layout
  + * renderers (e.g. PDF  PostScript) use a ContentHandler that builds an FO
  + * Tree.
  + * @return a SAX ContentHandler for handling the SAX events.
*/
   public ContentHandler getContentHandler() {
   if (!isInitialized()) {
  
  
  

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



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

2003-08-14 Thread vmote
vmote   2003/08/11 10:51:25

  Modified:src/java/org/apache/fop/apps Driver.java
  Log:
  fix minor checkstyle errors
  
  Revision  ChangesPath
  1.19  +1 -2  xml-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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Driver.java   11 Aug 2003 17:44:15 -  1.18
  +++ Driver.java   11 Aug 2003 17:51:25 -  1.19
  @@ -58,7 +58,6 @@
   import org.apache.fop.fo.FOTreeHandler;
   import org.apache.fop.mif.MIFHandler;
   import org.apache.fop.render.Renderer;
  -import org.apache.fop.render.awt.AWTPrintRenderer;
   import org.apache.fop.render.awt.AWTRenderer;
   import org.apache.fop.rtf.renderer.RTFHandler;
   import org.apache.fop.tools.DocumentInputSource;
  @@ -550,7 +549,7 @@
   
   /**
* Render the FO document read by a SAX Parser from an InputHandler
  - * @param InputHandler the input handler containing the source and
  + * @param inputHandler the input handler containing the source and
* parser information.
* @throws FOPException if anything goes wrong.
*/
  
  
  

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



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

2003-08-12 Thread vmote
vmote   2003/08/11 11:08:06

  Modified:src/java/org/apache/fop/apps Driver.java
  Log:
  set up render(XMLReader, InputSource) as the main render() method, and normalize 
render(Document document) to this form.
  
  Revision  ChangesPath
  1.20  +9 -21 xml-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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Driver.java   11 Aug 2003 17:51:25 -  1.19
  +++ Driver.java   11 Aug 2003 18:08:06 -  1.20
  @@ -560,7 +560,9 @@
   }
   
   /**
  - * Render the FO document read by a SAX Parser from an InputSource.
  + * This is the main render() method. The other render() methods are for
  + * convenience, and normalize to this form, then run this.
  + * Renders the FO document read by a SAX Parser from an InputSource.
* @param parser the SAX parser.
* @param source the input source the parser reads from.
* @throws FOPException if anything goes wrong.
  @@ -586,31 +588,17 @@
   }
   
   /**
  - * Render the FO ducument represented by a DOM Document.
  + * This method overloads the main render() method, adding the convenience
  + * of using a DOM Document as input.
  + * @see render(XMLReader, InputSource)
* @param document the DOM document to read from
* @throws FOPException if anything goes wrong.
*/
   public synchronized void render(Document document)
   throws FOPException {
  -if (!isInitialized()) {
  -initialize();
  -}
  -try {
  -DocumentInputSource source = new DocumentInputSource(document);
  -DocumentReader reader = new DocumentReader();
  -reader.setContentHandler(getContentHandler());
  -reader.parse(source);
  -} catch (SAXException e) {
  -if (e.getException() instanceof FOPException) {
  -// Undo exception tunneling.
  -throw (FOPException)e.getException();
  -} else {
  -throw new FOPException(e);
  -}
  -} catch (IOException e) {
  -throw new FOPException(e);
  -}
  -
  +DocumentInputSource source = new DocumentInputSource(document);
  +DocumentReader reader = new DocumentReader();
  +render(reader, source);
   }
   
   /**
  
  
  

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



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

2003-08-05 Thread gmazza
gmazza  2003/08/05 15:39:51

  Modified:src/java/org/apache/fop/apps Driver.java
  Log:
  Safer handling of treebuilder variable within Driver.reset(), also 
Driver.setRenderer(renderer) will now set the rendererType variable when given an 
AWTRenderer.
  
  Revision  ChangesPath
  1.17  +8 -1  xml-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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Driver.java   4 Aug 2003 00:52:16 -   1.16
  +++ Driver.java   5 Aug 2003 22:39:51 -   1.17
  @@ -59,6 +59,7 @@
   import org.apache.fop.mif.MIFHandler;
   import org.apache.fop.render.Renderer;
   import org.apache.fop.render.awt.AWTPrintRenderer;
  +import org.apache.fop.render.awt.AWTRenderer;
   import org.apache.fop.rtf.renderer.RTFHandler;
   import org.apache.fop.tools.DocumentInputSource;
   import org.apache.fop.tools.DocumentReader;
  @@ -321,7 +322,9 @@
   source = null;
   stream = null;
   reader = null;
  -treeBuilder.reset();
  +if (treeBuilder != null) {
  +treeBuilder.reset();
  +}
   }
   
   /**
  @@ -424,6 +427,10 @@
* @param renderer the renderer instance to use (Note: Logger must be set at 
this point)
*/
   public void setRenderer(Renderer renderer) {
  +// AWTStarter calls this function directly
  +if (renderer instanceof AWTRenderer) {
  +rendererType = RENDER_AWT;
  +}
   renderer.setProducer(Version.getVersion());
   renderer.setUserAgent(getUserAgent());
   this.renderer = renderer;
  
  
  

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



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

2003-07-05 Thread vmote
vmote   2003/07/05 02:28:34

  Modified:src/java/org/apache/fop/apps Driver.java FOPException.java
  Log:
  style changes only
  
  Revision  ChangesPath
  1.9   +15 -18xml-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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Driver.java   4 Jul 2003 18:45:48 -   1.8
  +++ Driver.java   5 Jul 2003 09:28:34 -   1.9
  @@ -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
*[EMAIL PROTECTED]
  - * 
  + *
* 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,12 +42,12 @@
* (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 [EMAIL PROTECTED]. For more information on the Apache
* Software Foundation, please see http://www.apache.org/.
  - */ 
  + */
   package org.apache.fop.apps;
   
   // FOP
  @@ -79,10 +79,8 @@
   import javax.xml.parsers.SAXParserFactory;
   
   // Java
  -import java.io.BufferedReader;
   import java.io.IOException;
   import java.io.OutputStream;
  -import java.util.Map;
   
   /**
* Primary class that drives overall FOP process.
  @@ -292,8 +290,8 @@
   }
   
   /**
  - * Provide the Driver instance with a logger. More information on Avalon 
  - * logging can be found at the 
  + * Provide the Driver instance with a logger. More information on Avalon
  + * logging can be found at the
* a href=http://avalon.apache.org;Avalon site/a.
*
* @param log the logger. Must not be codenull/code.
  @@ -308,7 +306,7 @@
   }
   
   /**
  - * Provide the Driver instance with a logger. 
  + * Provide the Driver instance with a logger.
* @param log the logger. Must not be codenull/code.
* @deprecated Use #enableLogging(Logger) instead.
*/
  @@ -458,7 +456,7 @@
* @param rendererClassName the fully qualified classname of the renderer
* class to use.
* @param version version number
  - * @deprecated use renderer.setProducer(version) + setRenderer(renderer) or 
  + * @deprecated use renderer.setProducer(version) + setRenderer(renderer) or
* just setRenderer(rendererType) which will use the default producer string.
* @see #setRenderer(int)
* @see #setRenderer(Renderer)
  @@ -513,7 +511,6 @@
   /**
* Add the element mapping with the given class name.
* @param mappingClassName the class name representing the element mapping.
  - * @throws IllegalArgumentException if there was not such element mapping.
*/
   

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

2003-06-03 Thread jeremias
jeremias2003/06/02 15:17:36

  Modified:src/java/org/apache/fop/apps Driver.java
  Log:
  Make more dummy-safe (more verbose error messages).
  Reintroduce setLogger() method from maint-branch (deprecated, for 
backwards-compatibility)
  
  Revision  ChangesPath
  1.4   +34 -4 xml-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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Driver.java   12 Mar 2003 11:00:21 -  1.3
  +++ Driver.java   2 Jun 2003 22:17:36 -   1.4
  @@ -261,11 +261,17 @@
   this.stream = stream;
   }
   
  +private boolean isInitialized() {
  +return (treeBuilder != null);
  +}
  +
   /**
* Initializes the Driver object.
*/
   public void initialize() {
  -stream = null;
  +if (isInitialized()) {
  +throw new IllegalStateException(Driver already initialized);
  +}
   treeBuilder = new FOTreeBuilder();
   treeBuilder.setUserAgent(getUserAgent());
   setupDefaultMappings();
  @@ -305,6 +311,15 @@
   }
   }
   
  +/**
  + * Provide the Driver instance with a logger. 
  + * @param log the logger. Must not be codenull/code.
  + * @deprecated Use #enableLogging(Logger) instead.
  + */
  +public void setLogger(Logger log) {
  +enableLogging(log);
  +}
  +
   
   /**
* Returns the logger for use by FOP.
  @@ -349,6 +364,12 @@
   this.stream = stream;
   }
   
  +private void validateOutputStream() {
  +if (this.stream == null) {
  +throw new IllegalStateException(OutputStream has not been set);
  +}
  +}
  +
   /**
* Set the source for the FO document. This can be a normal SAX
* InputSource, or an DocumentInputSource containing a DOM document.
  @@ -553,10 +574,10 @@
* @return a content handler for handling the SAX events.
*/
   public ContentHandler getContentHandler() {
  -if (treeBuilder == null) {
  -throw new NullPointerException(Driver isn't initialized. 
  -+ You may have to call initialize() first.);
  +if (!isInitialized()) {
  +initialize();
   }
  +validateOutputStream();
   
   // TODO: - do this stuff in a better way
   // PIJ: I guess the structure handler should be created by the renderer.
  @@ -588,6 +609,9 @@
*/
   public synchronized void render(XMLReader parser, InputSource source)
   throws FOPException {
  +if (!isInitialized()) {
  +initialize();
  +}
   parser.setContentHandler(getContentHandler());
   try {
   parser.parse(source);
  @@ -610,6 +634,9 @@
*/
   public synchronized void render(Document document)
   throws FOPException {
  +if (!isInitialized()) {
  +initialize();
  +}
   try {
   DocumentInputSource source = new DocumentInputSource(document);
   DocumentReader reader = new DocumentReader();
  @@ -638,6 +665,9 @@
* @throws FOPException if anything else goes wrong.
*/
   public synchronized void run() throws IOException, FOPException {
  +if (!isInitialized()) {
  +initialize();
  +}
   if (renderer == null) {
   setRenderer(RENDER_PDF);
   }
  
  
  

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



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

2003-03-12 Thread jeremias
jeremias2003/03/12 02:48:04

  Modified:src/java/org/apache/fop/apps Driver.java
  Log:
  Give a good message if the Driver isn't initialized.
  
  Revision  ChangesPath
  1.2   +5 -0  xml-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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Driver.java   11 Mar 2003 13:05:28 -  1.1
  +++ Driver.java   12 Mar 2003 10:48:04 -  1.2
  @@ -552,6 +552,11 @@
* @return a content handler for handling the SAX events.
*/
   public ContentHandler getContentHandler() {
  +if (treeBuilder == null) {
  +throw new NullPointerException(Driver isn't initialized. 
  ++ You may have to call initialize() first.);
  +}
  +
   // TODO: - do this stuff in a better way
   // PIJ: I guess the structure handler should be created by the renderer.
   if (rendererType == RENDER_MIF) {
  
  
  

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



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

2003-03-12 Thread jeremias
jeremias2003/03/12 03:00:22

  Modified:src/java/org/apache/fop/apps Driver.java
  Log:
  Make parser namespace-aware so the run() method works with XSL-FO files as input.
  
  Revision  ChangesPath
  1.3   +4 -2  xml-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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Driver.java   12 Mar 2003 10:48:04 -  1.2
  +++ Driver.java   12 Mar 2003 11:00:21 -  1.3
  @@ -73,6 +73,7 @@
   import org.xml.sax.SAXException;
   import org.xml.sax.XMLReader;
   import javax.xml.parsers.ParserConfigurationException;
  +import javax.xml.parsers.SAXParserFactory;
   
   // Java
   import java.io.BufferedReader;
  @@ -648,8 +649,9 @@
   if (reader == null) {
   if (!(source instanceof DocumentInputSource)) {
   try {
  -reader = javax.xml.parsers.SAXParserFactory.newInstance()
  -.newSAXParser().getXMLReader();
  +SAXParserFactory spf = 
javax.xml.parsers.SAXParserFactory.newInstance();
  +spf.setNamespaceAware(true);
  +reader = spf.newSAXParser().getXMLReader();
   } catch (SAXException e) {
   throw new FOPException(e);
   } catch (ParserConfigurationException e) {
  
  
  

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