Package org.apache.fop.cli
Class CommandLineOptions
java.lang.Object
org.apache.fop.cli.CommandLineOptions
Options parses the commandline arguments
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
input: Area Tree XML fileprivate File
private URI
private String
private boolean
private FopFactory
private boolean
static final int
input: fo fileprivate File
private FOUserAgent
static final int
input: Intermediate Format XML fileprivate File
static final int
input: Image fileprivate File
private InputHandler
private int
private org.apache.commons.logging.Log
private String
static final int
(input) not setprivate File
private String
private String
private boolean
static final int
Used to indicate that only the result of the XSL transformation should be outputprivate Map
private Boolean
private boolean
private Boolean
private float
private boolean
private boolean
private File
private boolean
private boolean
private File
static final int
input: xml+xsl fileprivate File
private Vector
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addXSLTParameter
(String name, String value) private void
checks whether all necessary information has been given in a consistent wayprivate InputHandler
Create an InputHandler object based on command-line parametersprivate void
Outputs all commandline settingsprivate void
private URI
getBaseURI
(File file) Returns the XSL-FO file if set.protected FOUserAgent
Get the FOUserAgent for this Command-Line runReturns the input file.org.apache.commons.logging.Log
Get the logger.Returns the output fileprotected String
private PDFEncryptionParams
Returns 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 XMLboolean
Indicates whether input comes from standard input (stdin).private boolean
Checks whether the given argument is the next option or the specification of stdin/stdout.boolean
Indicates whether output is sent to standard output (stdout).private boolean
isSystemInOutFile
(String filename) boolean
Parses the command line arguments.private int
parseAFPOutputOption
(String[] args, int i) private int
parseAreaTreeInputOption
(String[] args, int i) private int
parseAreaTreeOption
(String[] args, int i) private int
parseAWTOutputOption
(String[] args, int i) private int
parseCacheOption
(String[] args, int i) private int
parseConfigurationOption
(String[] args, int i) private int
parseCopiesOption
(String[] args, int i) private int
parseCustomOutputOption
(String[] args, int i) private int
parseFOInputOption
(String[] args, int i) private int
parseFOOutputOption
(String[] args, int i) private int
parseIFInputOption
(String[] args, int i) private int
parseImageInputOption
(String[] args, int i) private int
parseIntermediateFormatOption
(String[] args, int i) private int
parseLanguageOption
(String[] args, int i) private int
parseMIFOutputOption
(String[] args, int i) private boolean
parseOptions
(String[] args) Parses the command line arguments.private int
parsePCLOutputOption
(String[] args, int i) private int
parsePDFOutputOption
(String[] args, int i, String pdfAMode) private int
parsePDFOwnerPassword
(String[] args, int i) private int
parsePDFProfile
(String[] args, int i) private int
parsePDFUserPassword
(String[] args, int i) private int
parsePNGOutputOption
(String[] args, int i) private int
parsePostscriptOutputOption
(String[] args, int i) private int
parsePrintOutputOption
(String[] args, int i) private int
parseResolution
(String[] args, int i) private int
parseRTFOutputOption
(String[] args, int i) private int
parseSVGOutputOption
(String[] args, int i) private int
parseTextOutputOption
(String[] args, int i) private int
parseTIFFOutputOption
(String[] args, int i) private int
parseUnknownOption
(String[] args, int i) private int
parseXMLInputOption
(String[] args, int i) private int
parseXSLInputOption
(String[] args, int i) static void
printUsage
(PrintStream out) Shows the command line syntax including a summary of all available options and some examples.private void
shows the options for print outputprivate static void
private void
setInputFormat
(int format) private void
setOutputFile
(String filename) private void
setOutputMode
(String mime) private void
Sets 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:
FOPException
FileNotFoundException
-
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
Returns the XSL-FO file if set.- Returns:
- the XSL-FO file, null if not set
-
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
Returns the output file- Returns:
- the output file
-
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
Returns the input file.- Returns:
- either the fofile or the xmlfile
-
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
-