com.lunasil.xf
Class XincEngine

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

public final class XincEngine
extends Object

The low level Xinc Formatting API. This API is useful if you need to generate documents using a SAX ContentHandler. For instance, if you want to use SAX XMLFilter's you will need to use this API to get the ContentHandler from Xinc.


Constructor Summary
XincEngine()
          Default Constructor.
 
Method Summary
 ContentHandler createContentHandler()
          Create a ContentHandler.
 URL getBaseUrl()
          Get the current Base URL.
 Document getConfiguration()
          Get the current Configuration.
static org.apache.commons.logging.Log getLogger()
          Get the Log instance currently in effect for Xinc.
 OutputStream getOutputStream()
          Get the current OutputStream.
 String getRenderer()
          Returns the current Renderer setting.
static com.lunasil.xf.common.Version getVersion()
           
 void setBaseUrl(URL baseUrl)
          Set the base URL.
 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 setOutputStream(OutputStream outputStream)
          Set the OutputStream to which the PDF document will be written.
 void setRenderer(String renderer)
          Sets the current Renderer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XincEngine

public XincEngine()
Default Constructor.

Method Detail

getVersion

public static com.lunasil.xf.common.Version getVersion()
Returns:
Returns the mVersion.

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.

setRenderer

public void setRenderer(String renderer)
Sets the current Renderer. This value indicates the type of output document which will be created. If this method is not called, the renderer will default to PDF.

Parameters:
renderer - A String which indicates the current Renderer.

setBaseUrl

public void setBaseUrl(URL baseUrl)
Set the base URL. This URL will be used to resolve relative URL's found in the XSL-FO, usually in external-graphic elements.

Parameters:
baseUrl -

createContentHandler

public ContentHandler createContentHandler()
                                    throws XincException
Create a ContentHandler. This method will create and return a SAX ContentHandler. As document events are fired on this ContentHandler, Xinc will process the events until the document has been completed. Do not try to use the returned ContentHandler more than once or an exception will be thrown. You may call createContentHandler multiple times if you wish.

Returns:
ContentHandler
Throws:
XincException

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.

Parameters:
licenseText -

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

getOutputStream

public OutputStream getOutputStream()
Get the current OutputStream.

Returns:
Returns the current outputStream.

setOutputStream

public void setOutputStream(OutputStream outputStream)
Set the OutputStream to which the PDF document will be written. You are responsible for closing the Stream after the formatting process has completed. If you want decent performance, make sure that the OutputStream is buffered.

Parameters:
outputStream - The outputStream to set.

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.

getBaseUrl

public URL getBaseUrl()
Get the current Base URL.

Returns:
Returns the baseUrl.