/**
* checks whether all necessary information has been given in a consistent way
*/
private void checkSettings() throws FOPException, FileNotFoundException {
if (inputmode == NOT_SET) {
throw new FOPException("No input file specified");
}
if (outputmode == null) {
throw new FOPException("No output file specified");
}
if ((outputmode.equals(MimeConstants.MIME_FOP_AWT_PREVIEW)
|| outputmode.equals(MimeConstants.MIME_FOP_PRINT))
&& outfile != null) {
throw new FOPException("Output file may not be specified "
+ "for AWT or PRINT output");
}
if (inputmode == XSLT_INPUT) {
// check whether xml *and* xslt file have been set
if (xmlfile == null) {
throw new FOPException("XML file must be specified for the transform mode");
}
if (xsltfile == null) {
throw new FOPException("XSLT file must be specified for the transform mode");
}
// warning if fofile has been set in xslt mode
if (fofile != null) {
log.warn("Can't use fo file with transform mode! Ignoring.\n"
+ "Your input is " + "\n xmlfile: "
+ xmlfile.getAbsolutePath()
+ "\nxsltfile: "
+ xsltfile.getAbsolutePath()
+ "\n fofile: "
+ fofile.getAbsolutePath());
}
if (!xmlfile.exists()) {
throw new FileNotFoundException("Error: xml file "
+ xmlfile.getAbsolutePath()
+ " not found ");
}
if (!xsltfile.exists()) {
throw new FileNotFoundException("Error: xsl file "
+ xsltfile.getAbsolutePath()
+ " not found ");
}
} else if (inputmode == FO_INPUT) {
if (outputmode.equals(MimeConstants.MIME_XSL_FO)) {
throw new FOPException(
"FO output mode is only available if you use -xml and -xsl");
}
if (xmlfile != null || xsltfile != null) {
log.warn("fo input mode, but xmlfile or xslt file are set:");
log.error("xml file: " + xmlfile.toString());
log.error("xslt file: " + xsltfile.toString());
}
if (!fofile.exists()) {
throw new FileNotFoundException("Error: fo file "
+ fofile.getAbsolutePath()
+ " not found ");
}
} else if (inputmode == AREATREE_INPUT) {
if (outputmode.equals(MimeConstants.MIME_XSL_FO)) {
throw new FOPException(
"FO output mode is only available if you use -xml and -xsl");
} else if (outputmode.equals(MimeConstants.MIME_FOP_AREA_TREE)) {
throw new FOPException(
"Area Tree Output is not available if Area Tree is used as input!");
}
if (xmlfile != null || xsltfile != null) {
log.warn("area tree input mode, but xmlfile or xslt file are set:");
log.error("xml file: " + xmlfile.toString());