Class CommandLineOptions
java.lang.Object
org.apache.fop.cli.CommandLineOptions
Options parses the commandline arguments
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intinput: Area Tree XML fileprivate Fileprivate URIprivate Stringprivate booleanprivate FopFactoryprivate booleanstatic final intinput: fo fileprivate Fileprivate FOUserAgentstatic final intinput: Intermediate Format XML fileprivate Filestatic final intinput: Image fileprivate Fileprivate InputHandlerprivate intprivate org.apache.commons.logging.Logprivate Stringstatic final int(input) not setprivate Fileprivate Stringprivate Stringprivate booleanstatic final intUsed to indicate that only the result of the XSL transformation should be outputprivate Mapprivate Booleanprivate booleanprivate Booleanprivate floatprivate booleanprivate booleanprivate Fileprivate booleanprivate booleanprivate Filestatic final intinput: xml+xsl fileprivate Fileprivate Vector -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddXSLTParameter(String name, String value) private voidchecks whether all necessary information has been given in a consistent wayprivate InputHandlerCreate an InputHandler object based on command-line parametersprivate voidOutputs all commandline settingsprivate voidprivate URIgetBaseURI(File file) Returns the XSL-FO file if set.protected FOUserAgentGet the FOUserAgent for this Command-Line runReturns the input file.org.apache.commons.logging.LogGet the logger.Returns the output fileprotected Stringprivate PDFEncryptionParamsReturns the user configuration file to be used.Returns the input XML file if set.Returns the stylesheet to be used for transformation to XSL-FO.Indicates whether the XML renderer should generate coarse area XMLbooleanIndicates whether input comes from standard input (stdin).private booleanChecks whether the given argument is the next option or the specification of stdin/stdout.booleanIndicates whether output is sent to standard output (stdout).private booleanisSystemInOutFile(String filename) booleanParses the command line arguments.private intparseAFPOutputOption(String[] args, int i) private intparseAreaTreeInputOption(String[] args, int i) private intparseAreaTreeOption(String[] args, int i) private intparseAWTOutputOption(String[] args, int i) private intparseCacheOption(String[] args, int i) private intparseConfigurationOption(String[] args, int i) private intparseCopiesOption(String[] args, int i) private intparseCustomOutputOption(String[] args, int i) private intparseFOInputOption(String[] args, int i) private intparseFOOutputOption(String[] args, int i) private intparseIFInputOption(String[] args, int i) private intparseImageInputOption(String[] args, int i) private intparseIntermediateFormatOption(String[] args, int i) private intparseLanguageOption(String[] args, int i) private intparseMIFOutputOption(String[] args, int i) private booleanparseOptions(String[] args) Parses the command line arguments.private intparsePCLOutputOption(String[] args, int i) private intparsePDFOutputOption(String[] args, int i, String pdfAMode) private intparsePDFOwnerPassword(String[] args, int i) private intparsePDFProfile(String[] args, int i) private intparsePDFUserPassword(String[] args, int i) private intparsePNGOutputOption(String[] args, int i) private intparsePostscriptOutputOption(String[] args, int i) private intparsePrintOutputOption(String[] args, int i) private intparseResolution(String[] args, int i) private intparseRTFOutputOption(String[] args, int i) private intparseSVGOutputOption(String[] args, int i) private intparseTextOutputOption(String[] args, int i) private intparseTIFFOutputOption(String[] args, int i) private intparseUnknownOption(String[] args, int i) private intparseXMLInputOption(String[] args, int i) private intparseXSLInputOption(String[] args, int i) static voidprintUsage(PrintStream out) Shows the command line syntax including a summary of all available options and some examples.private voidshows the options for print outputprivate static voidprivate voidsetInputFormat(int format) private voidsetOutputFile(String filename) private voidsetOutputMode(String mime) private voidSets the user configuration.
-
Field Details
-
RENDER_NONE
public static final int RENDER_NONEUsed to indicate that only the result of the XSL transformation should be output- See Also:
-
NOT_SET
public static final int NOT_SET(input) not set- See Also:
-
FO_INPUT
public static final int FO_INPUTinput: fo file- See Also:
-
XSLT_INPUT
public static final int XSLT_INPUTinput: xml+xsl file- See Also:
-
AREATREE_INPUT
public static final int AREATREE_INPUTinput: Area Tree XML file- See Also:
-
IF_INPUT
public static final int IF_INPUTinput: Intermediate Format XML file- See Also:
-
IMAGE_INPUT
public static final int IMAGE_INPUTinput: Image file- See Also:
-
showConfiguration
-
suppressLowLevelAreas
-
userConfigFile
-
fofile
-
xsltfile
-
xmlfile
-
areatreefile
-
iffile
-
imagefile
-
outfilename
-
outfile
-
inputmode
private int inputmode -
outputmode
-
useStdIn
private boolean useStdIn -
useStdOut
private boolean useStdOut -
useCatalogResolver
private boolean useCatalogResolver -
renderingOptions
-
targetResolution
private float targetResolution -
strictValidation
private boolean strictValidation -
conserveMemoryPolicy
private boolean conserveMemoryPolicy -
useComplexScriptFeatures
private boolean useComplexScriptFeatures -
overrideTargetResolution
private boolean overrideTargetResolution -
factory
-
foUserAgent
-
inputHandler
-
log
private org.apache.commons.logging.Log log -
xsltParams
-
mimicRenderer
-
flushCache
private boolean flushCache -
baseURI
-
cacheName
-
-
Constructor Details
-
CommandLineOptions
public CommandLineOptions()Construct a command line option object.
-
-
Method Details
-
parse
Parses the command line arguments.- Parameters:
args- the command line arguments.- Returns:
- true if the processing can continue, false to abort
- Throws:
FOPException- for general errorsIOException- if the the configuration file could not be loaded
-
getInputHandler
- Returns:
- the InputHandler instance defined by the command-line options.
-
getLogger
public org.apache.commons.logging.Log getLogger()Get the logger.- Returns:
- the logger
-
addXSLTParameter
-
parseOptions
Parses the command line arguments.- Returns:
- true if processing can continue, false if it should stop (nothing to do)
- Throws:
FOPException- if there was an error in the format of the options
-
parseCacheOption
- Throws:
FOPException
-
parseConfigurationOption
- Throws:
FOPException
-
parseLanguageOption
- Throws:
FOPException
-
parseResolution
- Throws:
FOPException
-
parseFOInputOption
- Throws:
FOPException
-
parseXSLInputOption
- Throws:
FOPException
-
parseXMLInputOption
- Throws:
FOPException
-
getBaseURI
-
parseAWTOutputOption
- Throws:
FOPException
-
parsePDFOutputOption
- Throws:
FOPException
-
setOutputFile
-
isOption
Checks whether the given argument is the next option or the specification of stdin/stdout. TODO this is very ad-hoc and should be better handled. Consider the adoption of Apache Commons CLI.- Parameters:
arg- an argument- Returns:
- true if the argument is an option ("-something"), false otherwise
-
isSystemInOutFile
-
parseMIFOutputOption
- Throws:
FOPException
-
parseRTFOutputOption
- Throws:
FOPException
-
parseTIFFOutputOption
- Throws:
FOPException
-
parsePNGOutputOption
- Throws:
FOPException
-
parsePrintOutputOption
- Throws:
FOPException
-
parseCopiesOption
- Throws:
FOPException
-
parsePCLOutputOption
- Throws:
FOPException
-
parsePostscriptOutputOption
- Throws:
FOPException
-
parseTextOutputOption
- Throws:
FOPException
-
parseSVGOutputOption
- Throws:
FOPException
-
parseAFPOutputOption
- Throws:
FOPException
-
parseFOOutputOption
- Throws:
FOPException
-
parseCustomOutputOption
- Throws:
FOPException
-
parseUnknownOption
- Throws:
FOPException
-
parseAreaTreeOption
- Throws:
FOPException
-
parseIntermediateFormatOption
- Throws:
FOPException
-
parseAreaTreeInputOption
- Throws:
FOPException
-
parseIFInputOption
- Throws:
FOPException
-
parseImageInputOption
- Throws:
FOPException
-
getPDFEncryptionParams
- Throws:
FOPException
-
parsePDFOwnerPassword
- Throws:
FOPException
-
parsePDFUserPassword
- Throws:
FOPException
-
parsePDFProfile
- Throws:
FOPException
-
setOutputMode
- Throws:
FOPException
-
setInputFormat
- Throws:
FOPException
-
checkSettings
checks whether all necessary information has been given in a consistent way- Throws:
FOPExceptionFileNotFoundException
-
setUserConfig
Sets the user configuration.- Throws:
FOPException- if creating the user configuration failsIOException
-
getOutputFormat
- Returns:
- the chosen output format (MIME type)
- Throws:
FOPException- for invalid output formats
-
createInputHandler
Create an InputHandler object based on command-line parameters- Returns:
- a new InputHandler instance
- Throws:
IllegalArgumentException- if invalid/missing parameters
-
getFOUserAgent
Get the FOUserAgent for this Command-Line run- Returns:
- FOUserAgent instance
-
getFOFile
-
getXMLFile
Returns the input XML file if set.- Returns:
- the input XML file, null if not set
-
getXSLFile
Returns the stylesheet to be used for transformation to XSL-FO.- Returns:
- stylesheet
-
getOutputFile
-
getUserConfigFile
Returns the user configuration file to be used.- Returns:
- the userconfig.xml file
-
isCoarseAreaXml
Indicates whether the XML renderer should generate coarse area XML- Returns:
- true if coarse area XML is desired
-
isInputFromStdIn
public boolean isInputFromStdIn()Indicates whether input comes from standard input (stdin).- Returns:
- true if input comes from standard input (stdin)
-
isOutputToStdOut
public boolean isOutputToStdOut()Indicates whether output is sent to standard output (stdout).- Returns:
- true if output is sent to standard output (stdout)
-
getInputFile
-
printVersion
private static void printVersion() -
printUsage
Shows the command line syntax including a summary of all available options and some examples.- Parameters:
out- the stream to which the message must be printed
-
printUsagePrintOutput
private void printUsagePrintOutput()shows the options for print output -
dumpConfiguration
private void dumpConfiguration()Outputs all commandline settings -
flushCache
- Throws:
FOPException
-