org.apache.batik.apps.rasterizer

Class Main

public class Main extends Object implements SVGConverterController

Handles command line parameters to configure the SVGConverter and rasterizer images.
Each command line option is handled by an OptionHandler which is responsible for converting the option into a configuration of the SVGConverter which is used to perform the conversion.
Nested Class Summary
abstract static classMain.AbstractOptionHandler
This abstract implementation of the OptionHandler interface throws an exception if the number of arguments passed to the handleOption method does not match the number of expected optionValues.
abstract static classMain.ColorOptionHandler
Base class for options which expect a Color optionValue.
abstract static classMain.FloatOptionHandler
Base class for options which expect the single optionValue to be a float.
abstract static classMain.NoValueOptionHandler
Base class for options with no option value (i.e., the presence of the option means something in itself.
static interfaceMain.OptionHandler
Interface for handling one command line option
abstract static classMain.RectangleOptionHandler
Base class for options which expect a Rectangle optionValue.
abstract static classMain.SingleValueOptionHandler
Base class for options with a single option value.
abstract static classMain.TimeOptionHandler
Base class for options which expect the single optionValue to be a time value.
Field Summary
protected Listargs
List of arguments describing the conversion task to be performed.
static StringCL_OPTION_ALLOWED_SCRIPTS
Option to specify the set of allowed scripts
static StringCL_OPTION_ALLOWED_SCRIPTS_DESCRIPTION
static StringCL_OPTION_ALTERNATE_STYLESHEET
Option to specify the CSS alternate stylesheet when converting the SVG images
static StringCL_OPTION_ALTERNATE_STYLESHEET_DESCRIPTION
static StringCL_OPTION_AOI
Option to specify the area of interest in the output image.
static StringCL_OPTION_AOI_DESCRIPTION
static StringCL_OPTION_BACKGROUND_COLOR
Option to specify the output image's background color
static StringCL_OPTION_BACKGROUND_COLOR_DESCRIPTION
static StringCL_OPTION_CONSTRAIN_SCRIPT_ORIGIN
Option to determine whether scripts a constrained to the same origin as the document referencing them.
static StringCL_OPTION_CONSTRAIN_SCRIPT_ORIGIN_DESCRIPTION
static StringCL_OPTION_DEFAULT_FONT_FAMILY
Option to specify the default value for the font-family CSS property when converting the SVG image
static StringCL_OPTION_DEFAULT_FONT_FAMILY_DESCRIPTION
static StringCL_OPTION_DPI
Option to specify the resolution for the output image
static StringCL_OPTION_DPI_DESCRIPTION
static StringCL_OPTION_HEIGHT
Option to specify the output image's height
static StringCL_OPTION_HEIGHT_DESCRIPTION
static StringCL_OPTION_INDEXED
Option to specify if the PNG should be indexed.
static StringCL_OPTION_INDEXED_DESCRIPTION
static StringCL_OPTION_LANGUAGE
Option to specify the user language with which SVG documents should be processed
static StringCL_OPTION_LANGUAGE_DESCRIPTION
static StringCL_OPTION_MAX_HEIGHT
Option to specify the output image's maximum height.
static StringCL_OPTION_MAX_HEIGHT_DESCRIPTION
static StringCL_OPTION_MAX_WIDTH
Option to specify the output image's maximum width.
static StringCL_OPTION_MAX_WIDTH_DESCRIPTION
static StringCL_OPTION_MEDIA_TYPE
Option to specify the CSS media type when converting the SVG image
static StringCL_OPTION_MEDIA_TYPE_DESCRIPTION
static StringCL_OPTION_MIME_TYPE
Option to specify the output image's mime type
static StringCL_OPTION_MIME_TYPE_DESCRIPTION
static StringCL_OPTION_ONLOAD
Option to specify that the converted SVG files should be after the dispatch of the 'onload' event.
static StringCL_OPTION_ONLOAD_DESCRIPTION
static StringCL_OPTION_OUTPUT
Option to specify the output directory or file
static StringCL_OPTION_OUTPUT_DESCRIPTION
static StringCL_OPTION_QUALITY
Option to specify the output JPEG quality
static StringCL_OPTION_QUALITY_DESCRIPTION
static StringCL_OPTION_SECURITY_OFF
Option to turn off secure execution of scripts
static StringCL_OPTION_SECURITY_OFF_DESCRIPTION
static StringCL_OPTION_SNAPSHOT_TIME
Option to specify that the document should be rasterized after seeking to the specified document time.
static StringCL_OPTION_SNAPSHOT_TIME_DESCRIPTION
static StringCL_OPTION_USER_STYLESHEET
Option to specify an addition user stylesheet
static StringCL_OPTION_USER_STYLESHEET_DESCRIPTION
static StringCL_OPTION_VALIDATE
Option to specify that the converted SVG files should be validated during the conversion process.
static StringCL_OPTION_VALIDATE_DESCRIPTION
static StringCL_OPTION_WIDTH
Option to specify the output image's width
static StringCL_OPTION_WIDTH_DESCRIPTION
static StringERROR_ILLEGAL_ARGUMENT
Error when an illegal option value was passed to the app {0} Option {1} Option description
static StringERROR_NOT_ENOUGH_OPTION_VALUES
Error when there are missing option values: {0} Option {1} Option description
static StringERROR_WHILE_CONVERTING_FILES
protected static MapmimeTypeMap
Static map containing all the mime types understood by the rasterizer
static StringMESSAGE_ABOUT_TO_TRANSCODE
static StringMESSAGE_ABOUT_TO_TRANSCODE_SOURCE
static StringMESSAGE_CONVERSION_FAILED
static StringMESSAGE_CONVERSION_SUCCESS
protected static MapoptionMap
Static map containing all the option handlers able to analyze the various options.
static StringRASTERIZER_SECURITY_POLICY
URL for Squiggle's security policy file
static StringUSAGE
Describes the command line options for the rasterizer
Constructor Summary
Main(String[] args)
Method Summary
protected voiderror(String errorCode, Object[] errorArgs)
voidexecute()
protected String[]expandSources(List sources)
Scans the input vector and replaces directories with the list of SVG files they contain
static voidmain(String[] args)
voidonSourceTranscodingSuccess(SVGConverterSource source, File dest)
booleanproceedOnSourceTranscodingFailure(SVGConverterSource source, File dest, String errorCode)
booleanproceedWithComputedTask(Transcoder transcoder, Map hints, List sources, List dest)
booleanproceedWithSourceTranscoding(SVGConverterSource source, File dest)
protected StringtoString(String[] v)
voidvalidateConverterConfig(SVGConverter c)
Template methods which subclasses may implement to do whatever is needed.

Field Detail

args

protected List args
List of arguments describing the conversion task to be performed.

CL_OPTION_ALLOWED_SCRIPTS

public static String CL_OPTION_ALLOWED_SCRIPTS
Option to specify the set of allowed scripts

CL_OPTION_ALLOWED_SCRIPTS_DESCRIPTION

public static String CL_OPTION_ALLOWED_SCRIPTS_DESCRIPTION

CL_OPTION_ALTERNATE_STYLESHEET

public static String CL_OPTION_ALTERNATE_STYLESHEET
Option to specify the CSS alternate stylesheet when converting the SVG images

CL_OPTION_ALTERNATE_STYLESHEET_DESCRIPTION

public static String CL_OPTION_ALTERNATE_STYLESHEET_DESCRIPTION

CL_OPTION_AOI

public static String CL_OPTION_AOI
Option to specify the area of interest in the output image.

CL_OPTION_AOI_DESCRIPTION

public static String CL_OPTION_AOI_DESCRIPTION

CL_OPTION_BACKGROUND_COLOR

public static String CL_OPTION_BACKGROUND_COLOR
Option to specify the output image's background color

CL_OPTION_BACKGROUND_COLOR_DESCRIPTION

public static String CL_OPTION_BACKGROUND_COLOR_DESCRIPTION

CL_OPTION_CONSTRAIN_SCRIPT_ORIGIN

public static String CL_OPTION_CONSTRAIN_SCRIPT_ORIGIN
Option to determine whether scripts a constrained to the same origin as the document referencing them.

CL_OPTION_CONSTRAIN_SCRIPT_ORIGIN_DESCRIPTION

public static String CL_OPTION_CONSTRAIN_SCRIPT_ORIGIN_DESCRIPTION

CL_OPTION_DEFAULT_FONT_FAMILY

public static String CL_OPTION_DEFAULT_FONT_FAMILY
Option to specify the default value for the font-family CSS property when converting the SVG image

CL_OPTION_DEFAULT_FONT_FAMILY_DESCRIPTION

public static String CL_OPTION_DEFAULT_FONT_FAMILY_DESCRIPTION

CL_OPTION_DPI

public static String CL_OPTION_DPI
Option to specify the resolution for the output image

CL_OPTION_DPI_DESCRIPTION

public static String CL_OPTION_DPI_DESCRIPTION

CL_OPTION_HEIGHT

public static String CL_OPTION_HEIGHT
Option to specify the output image's height

CL_OPTION_HEIGHT_DESCRIPTION

public static String CL_OPTION_HEIGHT_DESCRIPTION

CL_OPTION_INDEXED

public static String CL_OPTION_INDEXED
Option to specify if the PNG should be indexed.

CL_OPTION_INDEXED_DESCRIPTION

public static String CL_OPTION_INDEXED_DESCRIPTION

CL_OPTION_LANGUAGE

public static String CL_OPTION_LANGUAGE
Option to specify the user language with which SVG documents should be processed

CL_OPTION_LANGUAGE_DESCRIPTION

public static String CL_OPTION_LANGUAGE_DESCRIPTION

CL_OPTION_MAX_HEIGHT

public static String CL_OPTION_MAX_HEIGHT
Option to specify the output image's maximum height.

CL_OPTION_MAX_HEIGHT_DESCRIPTION

public static String CL_OPTION_MAX_HEIGHT_DESCRIPTION

CL_OPTION_MAX_WIDTH

public static String CL_OPTION_MAX_WIDTH
Option to specify the output image's maximum width.

CL_OPTION_MAX_WIDTH_DESCRIPTION

public static String CL_OPTION_MAX_WIDTH_DESCRIPTION

CL_OPTION_MEDIA_TYPE

public static String CL_OPTION_MEDIA_TYPE
Option to specify the CSS media type when converting the SVG image

CL_OPTION_MEDIA_TYPE_DESCRIPTION

public static String CL_OPTION_MEDIA_TYPE_DESCRIPTION

CL_OPTION_MIME_TYPE

public static String CL_OPTION_MIME_TYPE
Option to specify the output image's mime type

CL_OPTION_MIME_TYPE_DESCRIPTION

public static String CL_OPTION_MIME_TYPE_DESCRIPTION

CL_OPTION_ONLOAD

public static String CL_OPTION_ONLOAD
Option to specify that the converted SVG files should be after the dispatch of the 'onload' event.

CL_OPTION_ONLOAD_DESCRIPTION

public static String CL_OPTION_ONLOAD_DESCRIPTION

CL_OPTION_OUTPUT

public static String CL_OPTION_OUTPUT
Option to specify the output directory or file

CL_OPTION_OUTPUT_DESCRIPTION

public static String CL_OPTION_OUTPUT_DESCRIPTION

CL_OPTION_QUALITY

public static String CL_OPTION_QUALITY
Option to specify the output JPEG quality

CL_OPTION_QUALITY_DESCRIPTION

public static String CL_OPTION_QUALITY_DESCRIPTION

CL_OPTION_SECURITY_OFF

public static String CL_OPTION_SECURITY_OFF
Option to turn off secure execution of scripts

CL_OPTION_SECURITY_OFF_DESCRIPTION

public static String CL_OPTION_SECURITY_OFF_DESCRIPTION

CL_OPTION_SNAPSHOT_TIME

public static String CL_OPTION_SNAPSHOT_TIME
Option to specify that the document should be rasterized after seeking to the specified document time.

CL_OPTION_SNAPSHOT_TIME_DESCRIPTION

public static String CL_OPTION_SNAPSHOT_TIME_DESCRIPTION

CL_OPTION_USER_STYLESHEET

public static String CL_OPTION_USER_STYLESHEET
Option to specify an addition user stylesheet

CL_OPTION_USER_STYLESHEET_DESCRIPTION

public static String CL_OPTION_USER_STYLESHEET_DESCRIPTION

CL_OPTION_VALIDATE

public static String CL_OPTION_VALIDATE
Option to specify that the converted SVG files should be validated during the conversion process.

CL_OPTION_VALIDATE_DESCRIPTION

public static String CL_OPTION_VALIDATE_DESCRIPTION

CL_OPTION_WIDTH

public static String CL_OPTION_WIDTH
Option to specify the output image's width

CL_OPTION_WIDTH_DESCRIPTION

public static String CL_OPTION_WIDTH_DESCRIPTION

ERROR_ILLEGAL_ARGUMENT

public static final String ERROR_ILLEGAL_ARGUMENT
Error when an illegal option value was passed to the app {0} Option {1} Option description

ERROR_NOT_ENOUGH_OPTION_VALUES

public static final String ERROR_NOT_ENOUGH_OPTION_VALUES
Error when there are missing option values: {0} Option {1} Option description

ERROR_WHILE_CONVERTING_FILES

public static final String ERROR_WHILE_CONVERTING_FILES

mimeTypeMap

protected static Map mimeTypeMap
Static map containing all the mime types understood by the rasterizer

MESSAGE_ABOUT_TO_TRANSCODE

public static final String MESSAGE_ABOUT_TO_TRANSCODE

MESSAGE_ABOUT_TO_TRANSCODE_SOURCE

public static final String MESSAGE_ABOUT_TO_TRANSCODE_SOURCE

MESSAGE_CONVERSION_FAILED

public static final String MESSAGE_CONVERSION_FAILED

MESSAGE_CONVERSION_SUCCESS

public static final String MESSAGE_CONVERSION_SUCCESS

optionMap

protected static Map optionMap
Static map containing all the option handlers able to analyze the various options.

RASTERIZER_SECURITY_POLICY

public static final String RASTERIZER_SECURITY_POLICY
URL for Squiggle's security policy file

USAGE

public static String USAGE
Describes the command line options for the rasterizer

Constructor Detail

Main

public Main(String[] args)

Method Detail

error

protected void error(String errorCode, Object[] errorArgs)

execute

public void execute()

expandSources

protected String[] expandSources(List sources)
Scans the input vector and replaces directories with the list of SVG files they contain

main

public static void main(String[] args)

onSourceTranscodingSuccess

public void onSourceTranscodingSuccess(SVGConverterSource source, File dest)

proceedOnSourceTranscodingFailure

public boolean proceedOnSourceTranscodingFailure(SVGConverterSource source, File dest, String errorCode)

proceedWithComputedTask

public boolean proceedWithComputedTask(Transcoder transcoder, Map hints, List sources, List dest)

proceedWithSourceTranscoding

public boolean proceedWithSourceTranscoding(SVGConverterSource source, File dest)

toString

protected String toString(String[] v)

validateConverterConfig

public void validateConverterConfig(SVGConverter c)
Template methods which subclasses may implement to do whatever is needed. For example, this can be used for test purposes.
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.