org.foray.core
Class FOrayDocument

java.lang.Object
  extended by org.foray.core.FOrayDocument

public class FOrayDocument
extends Object

This class manages the process of parsing an input FO document and creating an FOTree.


Constructor Summary
FOrayDocument(FOraySession session, Document domDocument)
          Constructor for processing a DOM Document containing an FO document.
FOrayDocument(FOraySession session, InputSource inputSource, XMLReader parser)
          Constructor for processing a SAX InputSource containing an FO document.
FOrayDocument(FOraySession session, Transformer jaxpTransformer, Source jaxpSource)
          Constructor for processing a semantic XML document using a JAXP Transformer.
FOrayDocument(FOraySession session, URL xmlInput, URL xsltInput)
          Constructor for JAXP processing, using supplied URLs to the xml and xslt input.
 
Method Summary
 void cleanup(FOrayTarget target)
          A hook for clients to call, allowing the document to clean up after itself.
 void dumpError(Exception exception)
          Dumps an error to the logger.
 org.axsl.area.AreaTreeFactory getAreaTreeFactory()
          Returns the AreaTreeFactory for this document.
 URL getBaseURL()
          Required by FOTreeControl interface.
 ContentHandler getContentHandler()
          Returns the tree builder (a SAX ContentHandler).
 org.axsl.font.FontConsumer getFontConsumer()
          Returns the FontConsumer for this document.
 org.axsl.font.FontServer getFontServer()
          Returns the FontServer.
 org.axsl.fo.FoTree getFOTreeBuilder()
          Returns the FOTree for this document.
 org.axsl.graphic.GraphicServer getGraphicServer()
          Returns the GraphicServer for this document.
 SAXResult getJAXPResult()
          Returns the JAXP SAXResult (which encapsulates a SAX ContentHandler).
 org.axsl.layout.LayoutFactory getLayoutFactory()
          Returns the LayoutFactory for this document.
 org.apache.commons.logging.Log getLogger()
          Returns the logger.
 String getParserClassName()
          Returns the name of the SAX parser class to use.
 SessionConfig getSessionConfig()
          Returns the SessionConfig for this document.
 org.axsl.speech.SpeechServer getSpeechServer()
          Returns the SpeechServer for this document.
 org.axsl.text.TextServer getTextServer()
          Returns the TextServer for this document.
 void process()
          Process the target.
 void processTarget(FOrayTarget target)
          Process a given target by building the formatting object tree from the input.
protected  void registerTarget(FOrayTarget target)
          Registers a FOrayTarget instance that this FOrayDocument should process.
 void run()
          Runs the formatting and renderering process using the previously set inputsource and outputstream.
 void setTarget(FOrayTarget target)
          Sets the target of this document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FOrayDocument

public FOrayDocument(FOraySession session,
                     InputSource inputSource,
                     XMLReader parser)
              throws FOrayException
Constructor for processing a SAX InputSource containing an FO document. If the document has not yet been transformed to XSL-FO, use the JAXP constructor instead.

Parameters:
session - The parent FOraySession.
inputSource - A SAX InputSource which encapsulated an FO document, that is, a document which is already in the XSL-FO namespace.
parser - A SAX parser. If null is passed, a default parser will be provided.
Throws:
FOrayException - If "null" parser is passed and there is an error creating one.

FOrayDocument

public FOrayDocument(FOraySession session,
                     Document domDocument)
              throws FOrayException
Constructor for processing a DOM Document containing an FO document. If the document has not yet been transformed to XSL-FO, use the JAXP constructor instead.

Parameters:
session - The parent FOraySession.
domDocument - A DOM Document.
Throws:
FOrayException - For errors instantiating the document.

FOrayDocument

public FOrayDocument(FOraySession session,
                     Transformer jaxpTransformer,
                     Source jaxpSource)
              throws FOrayException
Constructor for processing a semantic XML document using a JAXP Transformer.

Parameters:
session - The parent FOraySession.
jaxpTransformer - The JAXP Transformer.
jaxpSource - The JAXP source.
Throws:
FOrayException - For errors instantiating the document.

FOrayDocument

public FOrayDocument(FOraySession session,
                     URL xmlInput,
                     URL xsltInput)
              throws FOrayException
Constructor for JAXP processing, using supplied URLs to the xml and xslt input.

Parameters:
session - The parent FOraySession.
xmlInput - The semantic XML input file to be processed.
xsltInput - The stylesheet to be processed.
Throws:
FOrayException - For errors instantiating the document.
Method Detail

registerTarget

protected void registerTarget(FOrayTarget target)
Registers a FOrayTarget instance that this FOrayDocument should process.

Parameters:
target - The FOrayTarget instance that should be processed.

getContentHandler

public ContentHandler getContentHandler()
Returns the tree builder (a SAX ContentHandler). Used in situations where SAX is used but not via a FOray-invoked SAX parser, i.e. where some upstream process wishes to be in control of the parsing and event-firing, usually because there is a pipeline of processes that are both SAX consumers and producers. Cocoon is one example of such a system.

Returns:
The SAX content handler.

getJAXPResult

public SAXResult getJAXPResult()
Returns the JAXP SAXResult (which encapsulates a SAX ContentHandler). See getContentHandler() for the use-case.

Returns:
The JAXP result.

setTarget

public void setTarget(FOrayTarget target)
               throws FOrayException
Sets the target of this document.

Parameters:
target - The child target.
Throws:
FOrayException - If the child target is not a child of this document.

process

public void process()
             throws FOrayException
Process the target.

Throws:
FOrayException - For errors during processing.

processTarget

public void processTarget(FOrayTarget target)
                   throws FOrayException
Process a given target by building the formatting object tree from the input.

Parameters:
target - The target to be processed.
Throws:
FOrayException - For errors during processing.

cleanup

public void cleanup(FOrayTarget target)
A hook for clients to call, allowing the document to clean up after itself.

Parameters:
target - The target for which cleanup is needed.

dumpError

public void dumpError(Exception exception)
Dumps an error to the logger.

Parameters:
exception - The exception that should be logged.

run

public void run()
         throws IOException,
                FOrayException
Runs the formatting and renderering process using the previously set inputsource and outputstream.

Throws:
IOException - For I/O errors.
FOrayException - For errors during processing.

getLogger

public org.apache.commons.logging.Log getLogger()
Returns the logger.

Returns:
The logger.

getFontServer

public org.axsl.font.FontServer getFontServer()
Returns the FontServer.

Returns:
The FontServer.

getParserClassName

public String getParserClassName()
Returns the name of the SAX parser class to use.

Returns:
The name of the SAX parser.

getBaseURL

public URL getBaseURL()
Required by FOTreeControl interface.

Returns:
The base URL that should be used for finding external files, like graphical images, etc.

getFontConsumer

public org.axsl.font.FontConsumer getFontConsumer()
Returns the FontConsumer for this document.

Returns:
The FontConsumer for this document.

getSpeechServer

public org.axsl.speech.SpeechServer getSpeechServer()
Returns the SpeechServer for this document.

Returns:
The SpeechServer for this document.

getTextServer

public org.axsl.text.TextServer getTextServer()
Returns the TextServer for this document.

Returns:
The TextServer for this document.

getGraphicServer

public org.axsl.graphic.GraphicServer getGraphicServer()
Returns the GraphicServer for this document.

Returns:
The GraphicServer for this document.

getSessionConfig

public SessionConfig getSessionConfig()
Returns the SessionConfig for this document.

Returns:
The SessionConfig for this document.

getFOTreeBuilder

public org.axsl.fo.FoTree getFOTreeBuilder()
Returns the FOTree for this document.

Returns:
The FOTree for this document.

getAreaTreeFactory

public org.axsl.area.AreaTreeFactory getAreaTreeFactory()
Returns the AreaTreeFactory for this document.

Returns:
The AreaTreeFactory for this document.

getLayoutFactory

public org.axsl.layout.LayoutFactory getLayoutFactory()
Returns the LayoutFactory for this document.

Returns:
The LayoutFactory for this document.


Copyright © 2017. All rights reserved.