You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Driver.java 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. /*
  2. * Copyright 1999-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.apps;
  18. // FOP
  19. import org.apache.fop.area.AreaTree;
  20. import org.apache.fop.area.RenderPagesModel;
  21. import org.apache.fop.fo.ElementMapping;
  22. import org.apache.fop.fo.FOTreeBuilder;
  23. import org.apache.fop.fo.FOInputHandler;
  24. import org.apache.fop.fo.FOTreeHandler;
  25. import org.apache.fop.render.Renderer;
  26. import org.apache.fop.render.awt.AWTRenderer;
  27. import org.apache.fop.render.mif.MIFHandler;
  28. import org.apache.fop.render.rtf.RTFHandler;
  29. import org.apache.fop.tools.DocumentInputSource;
  30. import org.apache.fop.tools.DocumentReader;
  31. import org.apache.fop.tools.ProxyContentHandler;
  32. import org.apache.fop.layoutmgr.LayoutManagerLS;
  33. // Avalon
  34. import org.apache.avalon.framework.logger.ConsoleLogger;
  35. import org.apache.avalon.framework.logger.LogEnabled;
  36. import org.apache.avalon.framework.logger.Logger;
  37. // DOM
  38. /* org.w3c.dom.Document is not imported to reduce confusion with
  39. org.apache.fop.control.Document */
  40. // SAX
  41. import org.xml.sax.ContentHandler;
  42. import org.xml.sax.InputSource;
  43. import org.xml.sax.SAXException;
  44. import org.xml.sax.XMLReader;
  45. // Java
  46. import java.io.IOException;
  47. import java.io.OutputStream;
  48. /**
  49. * Primary class that drives overall FOP process.
  50. * <P>
  51. * The simplest way to use this is to instantiate it with the
  52. * InputSource and OutputStream, then set the renderer desired, and
  53. * calling run();
  54. * <P>
  55. * Here is an example use of Driver which outputs PDF:
  56. *
  57. * <PRE>
  58. * Driver driver = new Driver(new InputSource (args[0]),
  59. * new FileOutputStream(args[1]));
  60. * driver.enableLogging(myLogger); //optional
  61. * driver.setRenderer(RENDER_PDF);
  62. * driver.run();
  63. * </PRE>
  64. * If neccessary, calling classes can call into the lower level
  65. * methods to setup and
  66. * render. Methods can be called to set the
  67. * Renderer to use, the (possibly multiple) ElementMapping(s) to
  68. * use and the OutputStream to use to output the results of the
  69. * rendering (where applicable). In the case of the Renderer and
  70. * ElementMapping(s), the Driver may be supplied either with the
  71. * object itself, or the name of the class, in which case Driver will
  72. * instantiate the class itself. The advantage of the latter is it
  73. * enables runtime determination of Renderer and ElementMapping(s).
  74. * <P>
  75. * Once the Driver is set up, the render method
  76. * is called. Depending on whether DOM or SAX is being used, the
  77. * invocation of the method is either render(Document) or
  78. * buildFOTree(Parser, InputSource) respectively.
  79. * <P>
  80. * A third possibility may be used to build the FO Tree, namely
  81. * calling getContentHandler() and firing the SAX events yourself.
  82. * <P>
  83. * Once the FO Tree is built, the format() and render() methods may be
  84. * called in that order.
  85. * <P>
  86. * Here is an example use of Driver which outputs to AWT:
  87. *
  88. * <PRE>
  89. * Driver driver = new Driver();
  90. * driver.enableLogging(myLogger); //optional
  91. * driver.setRenderer(new org.apache.fop.render.awt.AWTRenderer(translator));
  92. * driver.render(parser, fileInputSource(args[0]));
  93. * </PRE>
  94. */
  95. public class Driver implements LogEnabled {
  96. /**
  97. * private constant to indicate renderer was not defined.
  98. */
  99. private static final int NOT_SET = 0;
  100. /**
  101. * Render to PDF. OutputStream must be set
  102. */
  103. public static final int RENDER_PDF = 1;
  104. /**
  105. * Render to a GUI window. No OutputStream neccessary
  106. */
  107. public static final int RENDER_AWT = 2;
  108. /**
  109. * Render to MIF. OutputStream must be set
  110. */
  111. public static final int RENDER_MIF = 3;
  112. /**
  113. * Render to XML. OutputStream must be set
  114. */
  115. public static final int RENDER_XML = 4;
  116. /**
  117. * Render to PRINT. No OutputStream neccessary
  118. */
  119. public static final int RENDER_PRINT = 5;
  120. /**
  121. * Render to PCL. OutputStream must be set
  122. */
  123. public static final int RENDER_PCL = 6;
  124. /**
  125. * Render to Postscript. OutputStream must be set
  126. */
  127. public static final int RENDER_PS = 7;
  128. /**
  129. * Render to Text. OutputStream must be set
  130. */
  131. public static final int RENDER_TXT = 8;
  132. /**
  133. * Render to SVG. OutputStream must be set
  134. */
  135. public static final int RENDER_SVG = 9;
  136. /**
  137. * Render to RTF. OutputStream must be set
  138. */
  139. public static final int RENDER_RTF = 10;
  140. /**
  141. * the FO tree builder
  142. */
  143. private FOTreeBuilder treeBuilder;
  144. /**
  145. * the renderer type code given by setRenderer
  146. */
  147. private int rendererType = NOT_SET;
  148. /**
  149. * the renderer to use to output the area tree
  150. */
  151. private Renderer renderer;
  152. /**
  153. * the SAX ContentHandler
  154. */
  155. private FOInputHandler foInputHandler;
  156. /**
  157. * the source of the FO file
  158. */
  159. private InputSource source;
  160. /**
  161. * the stream to use to output the results of the renderer
  162. */
  163. private OutputStream stream;
  164. /**
  165. * The XML parser to use when building the FO tree
  166. */
  167. private XMLReader reader;
  168. /**
  169. * the system resources that FOP will use
  170. */
  171. private Logger log = null;
  172. private FOUserAgent userAgent = null;
  173. private Document currentDocument = null;
  174. /**
  175. * Main constructor for the Driver class.
  176. */
  177. public Driver() {
  178. stream = null;
  179. }
  180. /**
  181. * Convenience constructor for directly setting input and output.
  182. * @param source InputSource to take the XSL-FO input from
  183. * @param stream Target output stream
  184. */
  185. public Driver(InputSource source, OutputStream stream) {
  186. this();
  187. this.source = source;
  188. this.stream = stream;
  189. }
  190. private boolean isInitialized() {
  191. return (treeBuilder != null);
  192. }
  193. /**
  194. * Initializes the Driver object.
  195. */
  196. public void initialize() {
  197. if (isInitialized()) {
  198. throw new IllegalStateException("Driver already initialized");
  199. }
  200. treeBuilder = new FOTreeBuilder();
  201. treeBuilder.setUserAgent(getUserAgent());
  202. }
  203. /**
  204. * Optionally sets the FOUserAgent instance for FOP to use. The Driver
  205. * class sets up its own FOUserAgent if none is set through this method.
  206. * @param agent FOUserAgent to use
  207. */
  208. public void setUserAgent(FOUserAgent agent) {
  209. userAgent = agent;
  210. }
  211. protected FOUserAgent getUserAgent() {
  212. if (userAgent == null) {
  213. userAgent = new FOUserAgent();
  214. userAgent.enableLogging(getLogger());
  215. userAgent.setBaseURL("");
  216. }
  217. return userAgent;
  218. }
  219. /**
  220. * Provide the Driver instance with a logger. More information on Avalon
  221. * logging can be found at the
  222. * <a href="http://avalon.apache.org">Avalon site</a>.
  223. *
  224. * @param log the logger. Must not be <code>null</code>.
  225. * @see org.apache.avalon.framework.logger.LogEnabled#enableLogging(Logger)
  226. */
  227. public void enableLogging(Logger log) {
  228. if (this.log == null) {
  229. this.log = log;
  230. } else {
  231. getLogger().warn("Logger is already set! Won't use the new logger.");
  232. }
  233. }
  234. /**
  235. * Provide the Driver instance with a logger.
  236. * @param log the logger. Must not be <code>null</code>.
  237. * @deprecated Use #enableLogging(Logger) instead.
  238. */
  239. public void setLogger(Logger log) {
  240. enableLogging(log);
  241. }
  242. /**
  243. * Returns the logger for use by FOP.
  244. * @return the logger
  245. * @see #enableLogging(Logger)
  246. */
  247. public Logger getLogger() {
  248. if (this.log == null) {
  249. // use ConsoleLogger as default when logger not explicitly set
  250. this.log = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
  251. }
  252. return this.log;
  253. }
  254. /**
  255. * Resets the Driver so it can be reused. Property and element
  256. * mappings are reset to defaults.
  257. * The output stream is cleared. The renderer is cleared.
  258. */
  259. public synchronized void reset() {
  260. source = null;
  261. stream = null;
  262. reader = null;
  263. if (treeBuilder != null) {
  264. treeBuilder.reset();
  265. }
  266. }
  267. /**
  268. * Indicates whether FOP has already received input data.
  269. * @return true, if input data was received
  270. */
  271. public boolean hasData() {
  272. return (treeBuilder.hasData());
  273. }
  274. /**
  275. * Set the OutputStream to use to output the result of the Renderer
  276. * (if applicable)
  277. * @param stream the stream to output the result of rendering to
  278. */
  279. public void setOutputStream(OutputStream stream) {
  280. this.stream = stream;
  281. }
  282. private void validateOutputStream() {
  283. if (this.stream == null) {
  284. throw new IllegalStateException("OutputStream has not been set");
  285. }
  286. }
  287. /**
  288. * Set the source for the FO document. This can be a normal SAX
  289. * InputSource, or an DocumentInputSource containing a DOM document.
  290. * @see DocumentInputSource
  291. */
  292. public void setInputSource(InputSource source) {
  293. this.source = source;
  294. }
  295. /**
  296. * Sets the reader used when reading in the source. If not set,
  297. * this defaults to a basic SAX parser.
  298. * @param reader the reader to use.
  299. */
  300. public void setXMLReader(XMLReader reader) {
  301. this.reader = reader;
  302. }
  303. /**
  304. * Shortcut to set the rendering type to use. Must be one of
  305. * <ul>
  306. * <li>RENDER_PDF</li>
  307. * <li>RENDER_AWT</li>
  308. * <li>RENDER_PRINT</li>
  309. * <li>RENDER_MIF</li>
  310. * <li>RENDER_XML</li>
  311. * <li>RENDER_PCL</li>
  312. * <li>RENDER_PS</li>
  313. * <li>RENDER_TXT</li>
  314. * <li>RENDER_SVG</li>
  315. * <li>RENDER_RTF</li>
  316. * </ul>
  317. * @param renderer the type of renderer to use
  318. * @throws IllegalArgumentException if an unsupported renderer type was required.
  319. */
  320. public void setRenderer(int renderer) throws IllegalArgumentException {
  321. rendererType = renderer;
  322. switch (renderer) {
  323. case RENDER_PDF:
  324. setRenderer("org.apache.fop.render.pdf.PDFRenderer");
  325. break;
  326. case RENDER_AWT:
  327. throw new IllegalArgumentException("Use renderer form of setRenderer() for AWT");
  328. case RENDER_PRINT:
  329. setRenderer("org.apache.fop.render.awt.AWTPrintRenderer");
  330. break;
  331. case RENDER_PCL:
  332. setRenderer("org.apache.fop.render.pcl.PCLRenderer");
  333. break;
  334. case RENDER_PS:
  335. setRenderer("org.apache.fop.render.ps.PSRenderer");
  336. break;
  337. case RENDER_TXT:
  338. setRenderer("org.apache.fop.render.txt.TXTRenderer()");
  339. break;
  340. case RENDER_MIF:
  341. //foInputHandler will be set later
  342. break;
  343. case RENDER_XML:
  344. setRenderer("org.apache.fop.render.xml.XMLRenderer");
  345. break;
  346. case RENDER_SVG:
  347. setRenderer("org.apache.fop.render.svg.SVGRenderer");
  348. break;
  349. case RENDER_RTF:
  350. //foInputHandler will be set later
  351. break;
  352. default:
  353. rendererType = NOT_SET;
  354. throw new IllegalArgumentException("Unknown renderer type " + renderer);
  355. }
  356. }
  357. /**
  358. * Set the Renderer to use.
  359. * @param renderer the renderer instance to use (Note: Logger must be set at this point)
  360. */
  361. public void setRenderer(Renderer renderer) {
  362. // AWTStarter calls this function directly
  363. if (renderer instanceof AWTRenderer) {
  364. rendererType = RENDER_AWT;
  365. }
  366. renderer.setProducer(Version.getVersion());
  367. renderer.setUserAgent(getUserAgent());
  368. this.renderer = renderer;
  369. }
  370. /**
  371. * Returns the currently active renderer.
  372. * @return the renderer
  373. */
  374. public Renderer getRenderer() {
  375. return renderer;
  376. }
  377. /**
  378. * Set the class name of the Renderer to use as well as the
  379. * producer string for those renderers that can make use of it.
  380. * @param rendererClassName classname of the renderer to use such as
  381. * "org.apache.fop.render.pdf.PDFRenderer"
  382. * @exception IllegalArgumentException if the classname was invalid.
  383. * @see #setRenderer(int)
  384. */
  385. public void setRenderer(String rendererClassName)
  386. throws IllegalArgumentException {
  387. try {
  388. renderer = (Renderer)Class.forName(rendererClassName).newInstance();
  389. if (renderer instanceof LogEnabled) {
  390. ((LogEnabled)renderer).enableLogging(getLogger());
  391. }
  392. renderer.setProducer(Version.getVersion());
  393. renderer.setUserAgent(getUserAgent());
  394. } catch (ClassNotFoundException e) {
  395. throw new IllegalArgumentException("Could not find "
  396. + rendererClassName);
  397. } catch (InstantiationException e) {
  398. throw new IllegalArgumentException("Could not instantiate "
  399. + rendererClassName);
  400. } catch (IllegalAccessException e) {
  401. throw new IllegalArgumentException("Could not access "
  402. + rendererClassName);
  403. } catch (ClassCastException e) {
  404. throw new IllegalArgumentException(rendererClassName
  405. + " is not a renderer");
  406. }
  407. }
  408. /**
  409. * Add the given element mapping.
  410. * An element mapping maps element names to Java classes.
  411. *
  412. * @param mapping the element mappingto add
  413. */
  414. public void addElementMapping(ElementMapping mapping) {
  415. treeBuilder.addElementMapping(mapping);
  416. }
  417. /**
  418. * Add the element mapping with the given class name.
  419. * @param mappingClassName the class name representing the element mapping.
  420. */
  421. public void addElementMapping(String mappingClassName) {
  422. treeBuilder.addElementMapping(mappingClassName);
  423. }
  424. /**
  425. * Determines which SAX ContentHandler is appropriate for the rendererType.
  426. * Structure renderers (e.g. MIF & RTF) each have a specialized
  427. * ContentHandler that directly place data into the output stream. Layout
  428. * renderers (e.g. PDF & PostScript) use a ContentHandler that builds an FO
  429. * Tree.
  430. * @return a SAX ContentHandler for handling the SAX events.
  431. * @throws FOPException if setting up the ContentHandler fails
  432. */
  433. public ContentHandler getContentHandler() throws FOPException {
  434. if (!isInitialized()) {
  435. initialize();
  436. }
  437. if (rendererType != RENDER_PRINT && rendererType != RENDER_AWT) {
  438. validateOutputStream();
  439. }
  440. /** Document creation is hard-wired for now, but needs to be made
  441. accessible through the API and/or configuration */
  442. if (currentDocument == null) {
  443. currentDocument = new Document(this);
  444. }
  445. // TODO: - do this stuff in a better way
  446. // PIJ: I guess the structure handler should be created by the renderer.
  447. if (rendererType == RENDER_MIF) {
  448. foInputHandler = new MIFHandler(currentDocument, stream);
  449. } else if (rendererType == RENDER_RTF) {
  450. foInputHandler = new RTFHandler(currentDocument, stream);
  451. } else {
  452. if (renderer == null) {
  453. throw new IllegalStateException(
  454. "Renderer not set when using standard foInputHandler");
  455. }
  456. foInputHandler = new FOTreeHandler(currentDocument, true);
  457. currentDocument.areaTree = new AreaTree(currentDocument);
  458. currentDocument.atModel = new RenderPagesModel(renderer);
  459. //this.atModel = new CachedRenderPagesModel(renderer);
  460. currentDocument.areaTree.setTreeModel(currentDocument.atModel);
  461. try {
  462. renderer.setupFontInfo(currentDocument);
  463. // check that the "any,normal,400" font exists
  464. if (!currentDocument.isSetupValid()) {
  465. throw new FOPException(
  466. "No default font defined by OutputConverter");
  467. }
  468. renderer.startRenderer(stream);
  469. } catch (IOException e) {
  470. throw new FOPException(e);
  471. }
  472. }
  473. currentDocument.foInputHandler = foInputHandler;
  474. /** LayoutStrategy is hard-wired for now, but needs to be made
  475. accessible through the API and/or configuration */
  476. if (foInputHandler instanceof FOTreeHandler) {
  477. if (currentDocument.getLayoutStrategy() == null) {
  478. currentDocument.setLayoutStrategy(new LayoutManagerLS(currentDocument));
  479. }
  480. }
  481. foInputHandler.enableLogging(getLogger());
  482. treeBuilder.setUserAgent(getUserAgent());
  483. treeBuilder.setFOInputHandler(foInputHandler);
  484. treeBuilder.foTreeControl = currentDocument;
  485. return new ProxyContentHandler(treeBuilder) {
  486. public void startDocument() throws SAXException {
  487. if (foInputHandler instanceof FOTreeHandler) {
  488. FOTreeHandler foTreeHandler = (FOTreeHandler)foInputHandler;
  489. foTreeHandler.addFOTreeListener(currentDocument);
  490. }
  491. super.startDocument();
  492. }
  493. public void endDocument() throws SAXException {
  494. super.endDocument();
  495. if (foInputHandler instanceof FOTreeHandler) {
  496. FOTreeHandler foTreeHandler = (FOTreeHandler)foInputHandler;
  497. foTreeHandler.removeFOTreeListener(currentDocument);
  498. }
  499. }
  500. };
  501. }
  502. /**
  503. * Render the FO document read by a SAX Parser from an InputHandler
  504. * @param inputHandler the input handler containing the source and
  505. * parser information.
  506. * @throws FOPException if anything goes wrong.
  507. */
  508. public synchronized void render(InputHandler inputHandler)
  509. throws FOPException {
  510. XMLReader parser = inputHandler.getParser();
  511. render(parser, inputHandler.getInputSource());
  512. }
  513. /**
  514. * This is the main render() method. The other render() methods are for
  515. * convenience, and normalize to this form, then run this.
  516. * Renders the FO document read by a SAX Parser from an InputSource.
  517. * @param parser the SAX parser.
  518. * @param source the input source the parser reads from.
  519. * @throws FOPException if anything goes wrong.
  520. */
  521. public synchronized void render(XMLReader parser, InputSource source)
  522. throws FOPException {
  523. parser.setContentHandler(getContentHandler());
  524. /**
  525. * The following statement handles the case of a LayoutStrategy that
  526. * does not wish to build an FO Tree, but wishes to parse the incoming
  527. * document some other way. This applies primarily to the alt-design
  528. * system.
  529. */
  530. if (currentDocument.getLayoutStrategy() != null) {
  531. if (!currentDocument.getLayoutStrategy().foTreeNeeded()) {
  532. currentDocument.getLayoutStrategy().format(null, null);
  533. return;
  534. }
  535. }
  536. /**
  537. * For all other cases, we wish to parse normally.
  538. */
  539. try {
  540. /**
  541. The following statement triggers virtually all of the processing
  542. for this document. The SAX parser fires events that are handled by
  543. the appropriate InputHandler object, which means that you will need
  544. to look in those objects to see where FOP picks up control of
  545. processing again. For Structure Renderers (e.g. MIF & RTF), the SAX
  546. events are handled directly. For Layout Renderers (e.g. PDF &
  547. PostScript), an FO Tree is built by the FOTreeHandler, which in
  548. turn fires events when a PageSequence object is complete. This
  549. allows higher-level control objects (such as this class) to work
  550. directly with PageSequence objects. See foPageSequenceComplete()
  551. where this level of control is implemented.
  552. */
  553. parser.parse(source);
  554. } catch (SAXException e) {
  555. if (e.getException() instanceof FOPException) {
  556. // Undo exception tunneling.
  557. throw (FOPException)e.getException();
  558. } else {
  559. throw new FOPException(e);
  560. }
  561. } catch (IOException e) {
  562. throw new FOPException(e);
  563. }
  564. }
  565. /**
  566. * This method overloads the main render() method, adding the convenience
  567. * of using a DOM Document as input.
  568. * @see #render(XMLReader, InputSource)
  569. * @param document the DOM document to read from
  570. * @throws FOPException if anything goes wrong.
  571. */
  572. public synchronized void render(org.w3c.dom.Document document)
  573. throws FOPException {
  574. DocumentInputSource source = new DocumentInputSource(document);
  575. DocumentReader reader = new DocumentReader();
  576. render(reader, source);
  577. }
  578. /**
  579. * Runs the formatting and renderering process using the previously set
  580. * parser, input source, renderer and output stream.
  581. * If the renderer was not set, default to PDF.
  582. * If no parser was set, and the input source is not a dom document,
  583. * get a default SAX parser.
  584. * @throws IOException in case of IO errors.
  585. * @throws FOPException if anything else goes wrong.
  586. */
  587. public synchronized void run() throws IOException, FOPException {
  588. if (!isInitialized()) {
  589. initialize();
  590. }
  591. if (renderer == null && rendererType != RENDER_RTF
  592. && rendererType != RENDER_MIF) {
  593. setRenderer(RENDER_PDF);
  594. }
  595. if (source == null) {
  596. throw new FOPException("InputSource is not set.");
  597. }
  598. if (reader == null) {
  599. if (!(source instanceof DocumentInputSource)) {
  600. reader = FOFileHandler.createParser();
  601. }
  602. }
  603. if (source instanceof DocumentInputSource) {
  604. render(((DocumentInputSource)source).getDocument());
  605. } else {
  606. render(reader, source);
  607. }
  608. }
  609. /**
  610. * Public accessor for setting the currentDocument to process.
  611. * @param document the Document object that should be processed.
  612. */
  613. public void setCurrentDocument(Document document) {
  614. currentDocument = document;
  615. }
  616. /**
  617. * Public accessor for getting the currentDocument
  618. * @return the currentDocument
  619. */
  620. public Document getCurrentDocument() {
  621. return currentDocument;
  622. }
  623. }