org.extex.backend
Class BackendDriverImpl

java.lang.Object
  extended by org.extex.backend.BackendDriverImpl
All Implemented Interfaces:
BackendDriver, MultipleDocumentStream, ColorAware, FontAware

public class BackendDriverImpl
extends java.lang.Object
implements BackendDriver, MultipleDocumentStream, ColorAware, FontAware

This back-end driver can be used to combine several components.

Version:
$Revision: 4728 $
Author:
Gerd Neugebauer

Constructor Summary
BackendDriverImpl()
          Creates a new object.
 
Method Summary
 void add(PagePipe processor)
          Adder for a processor.
 void close()
          This method is invoked upon the end of the processing.
 DocumentWriter getDocumentWriter()
          Getter for the document writer.
 java.lang.String getDocumentWriterType()
          Getter for the document writer.
 java.lang.String getExtension()
          Getter for the extension associated with this kind of output.
 int getPages()
          Getter for the number of pages already produced.
 void setColorConverter(ColorConverter converter)
          Setter for the color converter.
 void setDocumentWriterFactory(DocumentWriterFactory documentWriterFactory)
          Setter for the document writer factory.
 void setDocumentWriterType(java.lang.String type)
          Setter for the document writer.
 void setFontFactory(CoreFontFactory factory)
          Setter for the font factory.
 void setOutputStreamFactory(OutputStreamFactory factory)
          Setter for the output stream.
 void setParameter(java.lang.String name, java.lang.String value)
          Setter for a named parameter.
 void setProperties(java.util.Properties properties)
          
 void setResourceFinder(ResourceFinder f)
          
 int shipout(Page page)
          This is the entry point for the document writer.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BackendDriverImpl

public BackendDriverImpl()
Creates a new object.

Method Detail

add

public void add(PagePipe processor)
Adder for a processor.

Specified by:
add in interface BackendDriver
Parameters:
processor - the processor to append
See Also:
BackendDriver.add( org.extex.backend.pageFilter.PagePipe)

close

public void close()
           throws BackendException
This method is invoked upon the end of the processing.

Specified by:
close in interface BackendDriver
Throws:
BackendException - in case of an error
See Also:
BackendDriver.close()

getDocumentWriter

public DocumentWriter getDocumentWriter()
                                 throws DocumentWriterException
Getter for the document writer.

Specified by:
getDocumentWriter in interface BackendDriver
Returns:
the document writer
Throws:
DocumentWriterException - in case of an error
See Also:
BackendDriver.getDocumentWriter()

getDocumentWriterType

public java.lang.String getDocumentWriterType()
Getter for the document writer.

Specified by:
getDocumentWriterType in interface BackendDriver
Returns:
the document writer type
See Also:
BackendDriver.getDocumentWriterType()

getExtension

public java.lang.String getExtension()
Getter for the extension associated with this kind of output. For instance pdf is the expected value for PDF files and dvi is the expected value for DVI files.

Specified by:
getExtension in interface BackendDriver
Returns:
the appropriate extension for file names
See Also:
DocumentWriter.getExtension()

getPages

public int getPages()
Getter for the number of pages already produced.

Specified by:
getPages in interface BackendDriver
Returns:
the number of pages already shipped out
See Also:
BackendDriver.getPages()

setColorConverter

public void setColorConverter(ColorConverter converter)
Setter for the color converter.

Specified by:
setColorConverter in interface ColorAware
Parameters:
converter - the color converter
See Also:
ColorAware.setColorConverter(org.extex.color.ColorConverter)

setDocumentWriterFactory

public void setDocumentWriterFactory(DocumentWriterFactory documentWriterFactory)
Setter for the document writer factory.

Specified by:
setDocumentWriterFactory in interface BackendDriver
Parameters:
documentWriterFactory - the document writer factory to set
See Also:
BackendDriver.setDocumentWriterFactory( org.extex.backend.documentWriter.DocumentWriterFactory)

setDocumentWriterType

public void setDocumentWriterType(java.lang.String type)
                           throws BackendDocumentWriterDefinedException,
                                  BackendUnknownDocumentWriterException
Setter for the document writer.

Specified by:
setDocumentWriterType in interface BackendDriver
Parameters:
type - the document writer type
Throws:
BackendDocumentWriterDefinedException - in case that the document writer is already in use
BackendUnknownDocumentWriterException - in case that the document writer has no associated configuration
See Also:
BackendDriver.setDocumentWriterType(java.lang.String)

setFontFactory

public void setFontFactory(CoreFontFactory factory)
Setter for the font factory.

Specified by:
setFontFactory in interface FontAware
Parameters:
factory - the font factory
See Also:
FontAware.setFontFactory(org.extex.font.CoreFontFactory)

setOutputStreamFactory

public void setOutputStreamFactory(OutputStreamFactory factory)
Setter for the output stream.

Specified by:
setOutputStreamFactory in interface MultipleDocumentStream
Parameters:
factory - the output stream
See Also:
MultipleDocumentStream.setOutputStreamFactory( org.extex.backend.outputStream.OutputStreamFactory)

setParameter

public void setParameter(java.lang.String name,
                         java.lang.String value)
Setter for a named parameter. Parameters are a general mechanism to influence the behavior of the document writer. Any parameter not known by the document writer has to be ignored.

If the document writer is in use already then the parameter is passed to the document writer. Otherwise the parameter is stored until a document writer is created. Then the parameter is passed on.

Specified by:
setParameter in interface BackendDriver
Parameters:
name - the name of the parameter
value - the value of the parameter
See Also:
DocumentWriter.setParameter( java.lang.String, java.lang.String)

setProperties

public void setProperties(java.util.Properties properties)

See Also:
org.extex.resource.PropertyAware#setProperties(java.util.Properties)

setResourceFinder

public void setResourceFinder(ResourceFinder f)

See Also:
org.extex.resource.ResourceAware#setResourceFinder( org.extex.resource.ResourceFinder)

shipout

public int shipout(Page page)
            throws BackendException
This is the entry point for the document writer. Here it receives a complete node list to be sent to the output writer. It can be assumed that all values for width, height, and depth of the node lists are properly filled. Thus all information should be present to place the ink on the paper.

Specified by:
shipout in interface BackendDriver
Parameters:
page - the page to send
Returns:
returns the number of pages shipped
Throws:
BackendException - in case of an error
See Also:
BackendDriver.shipout( org.extex.typesetter.type.page.Page)

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()