com.lunasil.xf
Class XincFormatter

java.lang.Object
  extended bycom.lunasil.xf.XincFormatter

public class XincFormatter
extends Object

The Xinc Formatting API.


Field Summary
static String RENDERER_DEFAULT
           
static String RENDERER_PDF
           
static String RENDERER_PRINT
           
static String RENDERER_XML
           
 
Constructor Summary
XincFormatter()
          Default Constructor.
 
Method Summary
 void format(InputSource src, OutputStream outputStream)
          Format a document.
 void format(InputSource docSource, Source styleSource, OutputStream outputStream)
          Format a document.
 void format(String docUrl, String styleUrl, OutputStream outputStream)
          Format a document.
 void format(String docUrl, String styleUrl, String outputFileName)
          Format a document.
 Document getConfiguration()
          Get the current Configuration.
static org.apache.commons.logging.Log getLogger()
          Get the Log instance currently in effect for Xinc.
 String getRenderer()
          Returns the current Renderer setting.
 List getWarnings()
          Deprecated. This method will be removed in some future release. Logging should be used instead.
 void setConfiguration(Document configuration)
          Set the Configuration to be used when formatting documents using this instance of XincEngine.
static void setLicenseText(String licenseText)
          Used to programmatically set the license to be used by the formatter.
static void setLogger(org.apache.commons.logging.Log log)
          Set the Log instance currently in effect for Xinc.
 void setRenderer(String rendererType)
          Set the Renderer used to generate output.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RENDERER_PDF

public static final String RENDERER_PDF
See Also:
Constant Field Values

RENDERER_XML

public static final String RENDERER_XML
See Also:
Constant Field Values

RENDERER_PRINT

public static final String RENDERER_PRINT
See Also:
Constant Field Values

RENDERER_DEFAULT

public static final String RENDERER_DEFAULT
See Also:
Constant Field Values
Constructor Detail

XincFormatter

public XincFormatter()
Default Constructor.

Method Detail

setLicenseText

public static void setLicenseText(String licenseText)
Used to programmatically set the license to be used by the formatter. The licenseText should be the contents of your 'XincLicense.xml' file. This call is unnecessary if your license file is located in the Xinc Home directory. The Xinc Home directory is deter

Parameters:
licenseText -

format

public void format(String docUrl,
                   String styleUrl,
                   OutputStream outputStream)
            throws XincException
Format a document.

Parameters:
docUrl - A URL which refers to the XML document to be formatted.
styleUrl - A URL which refers to an XSLT stylesheet. This value may be null if the docUrlStr refers to a valid xsl-fo file. The XSLT stylesheet is used to transform the XML document into valid xsl-fo before rendering it.
outputStream - An OutputStream to which the resultant document will be written. Should be set to null if output is being sent directly to a printer. The caller is responsible for closing the stream.
Throws:
XincException

format

public void format(String docUrl,
                   String styleUrl,
                   String outputFileName)
            throws XincException
Format a document.

Parameters:
docUrl - A URL which refers to the XML document to be formatted.
styleUrl - A URL which refers to an XSLT stylesheet. This value may be null if the docUrlStr refers to a valid xsl-fo file. The XSLT stylesheet is used to transform the XML document into valid xsl-fo before rendering it.
outputFileName - The name of a file to which the result will be written. Should be set to null if output is being sent directly to a printer.
Throws:
XincException

format

public void format(InputSource src,
                   OutputStream outputStream)
            throws XincException
Format a document.

Parameters:
src - An InputSource which represents the XSL-FO document to be formatted.
outputStream - An OutputStream to which the resultant document will be written. Should be set to null if output is being sent directly to a printer. The caller is responsible for closing the stream.
Throws:
XincException

format

public void format(InputSource docSource,
                   Source styleSource,
                   OutputStream outputStream)
            throws XincException
Format a document.

Parameters:
docSource - An InputSource which represents the XML document to be formatted.
styleSource - A Source which represents an XSLT stylesheet. The XSLT stylesheet is used to transform the XML document into valid xsl-fo before rendering it.
outputStream - An OutputStream to which the resultant document will be written. Should be set to null if output is being sent directly to a printer. The caller is responsible for closing the stream.
Throws:
XincException

setRenderer

public void setRenderer(String rendererType)
                 throws IllegalArgumentException
Set the Renderer used to generate output. Currently, only PDF is supported.

Parameters:
rendererType - Only XincFormatter.RENDERER_PDF is supported.
Throws:
IllegalArgumentException

getWarnings

public List getWarnings()
Deprecated. This method will be removed in some future release. Logging should be used instead.

This method will return any warnings which may have occurred during the last format. The returned list contains String objects, each one of which contains the text of a warning message. A warning message may contain line separator characters.

Returns:
Returns a list of String objects.

getConfiguration

public Document getConfiguration()
                          throws XincException
Get the current Configuration.

Returns:
Returns a clone of the current configuration.
Throws:
XincException

setConfiguration

public void setConfiguration(Document configuration)
Set the Configuration to be used when formatting documents using this instance of XincEngine. If no Configuration is specified, Xinc will attempt to load a default Configuration from a file called '.xincconfig.xml' in your user.home directory. If no such file exists, A default configuration will be created which has some 'reasonable' values.

Parameters:
configuration - The configuration to set.

setLogger

public static void setLogger(org.apache.commons.logging.Log log)
Set the Log instance currently in effect for Xinc. One Log instance is used by Xinc, even if multiple Threads and multiple instances of Xinc are being used.

Parameters:
log - The new Log.

getLogger

public static org.apache.commons.logging.Log getLogger()
Get the Log instance currently in effect for Xinc. One Log instance is used by Xinc, even if multiple Threads and multiple instances of Xinc are being used.

Returns:
Log

getRenderer

public String getRenderer()
Returns the current Renderer setting. This value indicates the type of output document which will be created.

Returns:
A String which indicates the current Renderer.