Docmosis API 2.1.0

com.docmosis.document.converter
Class ConversionInstruction

java.lang.Object
  extended bycom.docmosis.document.converter.ConversionInstruction
All Implemented Interfaces:
Serializable

public class ConversionInstruction
extends Object
implements Serializable

This class is used to specify various settings for a document to be rendered. Control features include:

  1. specifying output formats
  2. any one-off or overriding renderers to be applied
  3. if producing multiple formats, the name for the files within the zip result

See Also:
Serialized Form

Constructor Summary
ConversionInstruction()
           
 
Method Summary
 boolean cleanupDataProvider()
          Determine if the DataProvider should be cleaned up at the end of the render process.
 boolean compressSingleDocument()
          Determine whether to compress (zip) the resulting document if only a single format is being used.
 ConversionFormat[] getConversionFormats()
          Get the conversion formats specified by this instruction.
 String getConverterGroupName()
          Get the name of the Converter Group to use to render the document.
 String getOutputFileName()
           
 RendererRegistry getRendererRegistry()
          Get the collection of renderers registry that have been set into this instruction.
 boolean isCompressingSingleDocument()
          Determine if a single resulting document should be automatically zipped to create a smaller file.
 void setCleanupDataProvider(boolean cleanupDataProvider)
          Specify whether the data provider should be cleaned up at the end of the render process.
 void setCompressingSingleDocument(boolean compressingSingleDocument)
          Specify whether a single resulting document should be automatically zipped to create a smaller file.
 void setConversionFormats(ConversionFormat[] conversionFormats)
          Specify the conversion formats for the returned result.
 void setConverterGroupName(String converterGroupName)
          Specify the name of the converter pool group to which this task is to be assigned.
 void setOutputFileName(String outputFileName)
          Specify the filename for output.
 void setRenderer(Class forClass, FieldRenderer renderer)
          Set a renderer against the given Class for use with this instruction.
 void setRenderer(String name, FieldRenderer renderer)
          Set a renderer with the given name for use with this instruction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConversionInstruction

public ConversionInstruction()
Method Detail

getOutputFileName

public String getOutputFileName()

setOutputFileName

public void setOutputFileName(String outputFileName)
Specify the filename for output. Since a single render can produce an archive of documents, this setting is used to control the name of the files within the (zip) archive. It doesn't control the name of the final file being rendered since that is a parameter to the render methods of DocumentProcessor.

Parameters:
outputFileName - the name of the file

isCompressingSingleDocument

public boolean isCompressingSingleDocument()
Determine if a single resulting document should be automatically zipped to create a smaller file. It is up to the caller to make sure that the filename used to render the document (passed to DocumentProcessor.render()) is suitable (typically this means that it should have a .zip extension).

Returns:
true if single resulting documents should be zipped.

getConversionFormats

public ConversionFormat[] getConversionFormats()
Get the conversion formats specified by this instruction. If multiple formats are specified, a single render call will produce a zip archive with multiple documents inside.

Returns:
the list of conversion formats.

compressSingleDocument

public boolean compressSingleDocument()
Determine whether to compress (zip) the resulting document if only a single format is being used.

Returns:
true if the document should be compressed

setCompressingSingleDocument

public void setCompressingSingleDocument(boolean compressingSingleDocument)
Specify whether a single resulting document should be automatically zipped to create a smaller file. It is up to the caller to make sure that the filename used to render the document (passed to DocumentProcessor.render()) is suitable (typically this means that it should have a .zip extension).

Parameters:
compressingSingleDocument - if true, single documents will be zipped.

setConversionFormats

public void setConversionFormats(ConversionFormat[] conversionFormats)
Specify the conversion formats for the returned result. If multiple formats are specified, a single render call will produce a zip archive with multiple documents inside. Each internal file will be named according to setOutputFileName().

Parameters:
conversionFormats - the array of formats desired

getConverterGroupName

public String getConverterGroupName()
Get the name of the Converter Group to use to render the document. This only applies if multiple groups of converters are being used in a large-scale system.

Returns:
the group name to use.

setConverterGroupName

public void setConverterGroupName(String converterGroupName)
Specify the name of the converter pool group to which this task is to be assigned. This optional setting is helpful when groups of converters have been configured and different tasks can be managed by different groups. If no group name has been set for this instruction the default group is used.

Parameters:
converterGroupName - the name of the group.

cleanupDataProvider

public boolean cleanupDataProvider()
Determine if the DataProvider should be cleaned up at the end of the render process. This is particularly useful where dataproviders are holding image streams or file handles.

Returns:
true if the dataprovider should be cleaned up.

setCleanupDataProvider

public void setCleanupDataProvider(boolean cleanupDataProvider)
Specify whether the data provider should be cleaned up at the end of the render process. The default is true.

Parameters:
cleanupDataProvider - set to false to disable auto cleanup

setRenderer

public void setRenderer(String name,
                        FieldRenderer renderer)
Set a renderer with the given name for use with this instruction. Setting a renderer here overrides any default renderer associated with the same name.

Parameters:
name - the name against which the renderer is associated
renderer - the renderer

setRenderer

public void setRenderer(Class forClass,
                        FieldRenderer renderer)
Set a renderer against the given Class for use with this instruction. Setting a renderer here overrides any default renderer associated with the same Class.

Parameters:
renderer - the renderer

getRendererRegistry

public RendererRegistry getRendererRegistry()
Get the collection of renderers registry that have been set into this instruction.

Returns:
null if no renderers have been set.

Docmosis API 2.1.0

Copyright © 2007 Docmosis. All Rights Reserved.