Package org.apache.fop.render
Class RendererFactory
java.lang.Object
org.apache.fop.render.RendererFactory
Factory for FOEventHandlers and Renderers.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDocumentHandlerMaker(String className) Add a new document handler maker.voidAdd a new document handler maker.voidaddFOEventHandlerMaker(String className) Add a new FOEventHandlerMaker.voidAdd a new FOEventHandlerMaker.voidaddRendererMaker(String className) Add a new RendererMaker.voidAdd a new RendererMaker.createDocumentHandler(FOUserAgent userAgent, String outputFormat) Creates aIFDocumentHandlerobject based on the desired output format.createFOEventHandler(FOUserAgent userAgent, String outputFormat, OutputStream out) Creates FOEventHandler instances based on the desired output.createRenderer(FOUserAgent userAgent, String outputFormat) Creates a Renderer object based on render-type desiredprivate RenderercreateRendererForDocumentHandler(IFDocumentHandler documentHandler) private voidDiscoversIFDocumentHandlerimplementations through the classpath and dynamically registers them.private voidDiscovers FOEventHandler implementations through the classpath and dynamically registers them.private voidDiscovers Renderer implementations through the classpath and dynamically registers them.private AbstractIFDocumentHandlerMakerReturns a RendererMaker which handles the given MIME type.getFOEventHandlerMaker(String mime) Returns a FOEventHandlerMaker which handles the given MIME type.getRendererMaker(String mime) Returns a RendererMaker which handles the given MIME type.booleanIndicates whether aRendereris preferred over aIFDocumentHandlerif both are available for the same MIME type.String[]private RenderertryIFDocumentHandlerMaker(FOUserAgent userAgent, String outputFormat) private RenderertryRendererMaker(FOUserAgent userAgent, String outputFormat)
-
Field Details
-
log
private static org.apache.commons.logging.Log logthe logger -
rendererMakerMapping
-
eventHandlerMakerMapping
-
documentHandlerMakerMapping
-
rendererPreferred
private final boolean rendererPreferred
-
-
Constructor Details
-
RendererFactory
public RendererFactory(boolean rendererPreferred) Main constructor.- Parameters:
rendererPreferred- Controls whether aRendereris preferred over aIFDocumentHandlerif both are available for the same MIME type. True to prefer theRenderer, false to prefer theIFDocumentHandler.
-
-
Method Details
-
isRendererPreferred
public boolean isRendererPreferred()Indicates whether aRendereris preferred over aIFDocumentHandlerif both are available for the same MIME type.- Returns:
- true if the
Rendereris preferred, false if theIFDocumentHandleris preferred.
-
addRendererMaker
Add a new RendererMaker. If another maker has already been registered for a particular MIME type, this call overwrites the existing one.- Parameters:
maker- the RendererMaker
-
addFOEventHandlerMaker
Add a new FOEventHandlerMaker. If another maker has already been registered for a particular MIME type, this call overwrites the existing one.- Parameters:
maker- the FOEventHandlerMaker
-
addDocumentHandlerMaker
Add a new document handler maker. If another maker has already been registered for a particular MIME type, this call overwrites the existing one.- Parameters:
maker- the intermediate format document handler maker
-
addRendererMaker
Add a new RendererMaker. If another maker has already been registered for a particular MIME type, this call overwrites the existing one.- Parameters:
className- the fully qualified class name of the RendererMaker
-
addFOEventHandlerMaker
Add a new FOEventHandlerMaker. If another maker has already been registered for a particular MIME type, this call overwrites the existing one.- Parameters:
className- the fully qualified class name of the FOEventHandlerMaker
-
addDocumentHandlerMaker
Add a new document handler maker. If another maker has already been registered for a particular MIME type, this call overwrites the existing one.- Parameters:
className- the fully qualified class name of the document handler maker
-
getRendererMaker
Returns a RendererMaker which handles the given MIME type.- Parameters:
mime- the requested output format- Returns:
- the requested RendererMaker or null if none is available
-
getFOEventHandlerMaker
Returns a FOEventHandlerMaker which handles the given MIME type.- Parameters:
mime- the requested output format- Returns:
- the requested FOEventHandlerMaker or null if none is available
-
getDocumentHandlerMaker
Returns a RendererMaker which handles the given MIME type.- Parameters:
mime- the requested output format- Returns:
- the requested RendererMaker or null if none is available
-
createRenderer
Creates a Renderer object based on render-type desired- Parameters:
userAgent- the user agent for access to configurationoutputFormat- the MIME type of the output format to use (ex. "application/pdf").- Returns:
- the new Renderer instance
- Throws:
FOPException- if the renderer cannot be properly constructed
-
tryIFDocumentHandlerMaker
private Renderer tryIFDocumentHandlerMaker(FOUserAgent userAgent, String outputFormat) throws FOPException - Throws:
FOPException
-
tryRendererMaker
- Throws:
FOPException
-
createRendererForDocumentHandler
-
createFOEventHandler
public FOEventHandler createFOEventHandler(FOUserAgent userAgent, String outputFormat, OutputStream out) throws FOPException Creates FOEventHandler instances based on the desired output.- Parameters:
userAgent- the user agent for access to configurationoutputFormat- the MIME type of the output format to use (ex. "application/pdf").out- the OutputStream where the output is written to (if applicable)- Returns:
- the newly constructed FOEventHandler
- Throws:
FOPException- if the FOEventHandler cannot be properly constructed
-
createDocumentHandler
public IFDocumentHandler createDocumentHandler(FOUserAgent userAgent, String outputFormat) throws FOPException Creates aIFDocumentHandlerobject based on the desired output format.- Parameters:
userAgent- the user agent for access to configurationoutputFormat- the MIME type of the output format to use (ex. "application/pdf").- Returns:
- the new
IFDocumentHandlerinstance - Throws:
FOPException- if the document handler cannot be properly constructed
-
listSupportedMimeTypes
- Returns:
- an array of all supported MIME types
-
discoverRenderers
private void discoverRenderers()Discovers Renderer implementations through the classpath and dynamically registers them. -
discoverFOEventHandlers
private void discoverFOEventHandlers()Discovers FOEventHandler implementations through the classpath and dynamically registers them. -
discoverDocumentHandlers
private void discoverDocumentHandlers()DiscoversIFDocumentHandlerimplementations through the classpath and dynamically registers them.
-