Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

CommandLineOptions.java 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  1. /*
  2. * Copyright 1999-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.apps;
  18. // java
  19. import java.io.File;
  20. import java.io.FileNotFoundException;
  21. import java.util.Locale;
  22. import java.util.Vector;
  23. // Avalon
  24. import org.apache.avalon.framework.logger.ConsoleLogger;
  25. import org.apache.avalon.framework.logger.Logger;
  26. /**
  27. * Options parses the commandline arguments
  28. */
  29. public class CommandLineOptions {
  30. /** input / output not set */
  31. public static final int NOT_SET = 0;
  32. /** input: fo file */
  33. public static final int FO_INPUT = 1;
  34. /** input: xml+xsl file */
  35. public static final int XSLT_INPUT = 2;
  36. /** output: pdf file */
  37. public static final int PDF_OUTPUT = 1;
  38. /** output: screen using swing */
  39. public static final int AWT_OUTPUT = 2;
  40. /** output: mif file */
  41. public static final int MIF_OUTPUT = 3;
  42. /** output: sent swing rendered file to printer */
  43. public static final int PRINT_OUTPUT = 4;
  44. /** output: pcl file */
  45. public static final int PCL_OUTPUT = 5;
  46. /** output: postscript file */
  47. public static final int PS_OUTPUT = 6;
  48. /** output: text file */
  49. public static final int TXT_OUTPUT = 7;
  50. /** output: svg file */
  51. public static final int SVG_OUTPUT = 8;
  52. /** output: XML area tree */
  53. public static final int AREA_OUTPUT = 9;
  54. /** output: RTF file */
  55. public static final int RTF_OUTPUT = 10;
  56. /* show configuration information */
  57. private Boolean dumpConfiguration = Boolean.FALSE;
  58. /* suppress any progress information */
  59. private Boolean quiet = Boolean.FALSE;
  60. /* for area tree XML output, only down to block area level */
  61. private Boolean suppressLowLevelAreas = Boolean.FALSE;
  62. /* user configuration file */
  63. private File userConfigFile = null;
  64. /* input fo file */
  65. private File fofile = null;
  66. /* xsltfile (xslt transformation as input) */
  67. private File xsltfile = null;
  68. /* xml file (xslt transformation as input) */
  69. private File xmlfile = null;
  70. /* output file */
  71. private File outfile = null;
  72. /* input mode */
  73. private int inputmode = NOT_SET;
  74. /* output mode */
  75. private int outputmode = NOT_SET;
  76. private java.util.HashMap rendererOptions;
  77. private Logger log;
  78. private Vector xsltParams = null;
  79. /**
  80. * Construct a command line option object from command line arguments
  81. * @param args command line parameters
  82. * @throws FOPException for general errors
  83. * @throws FileNotFoundException if an input file wasn't found.
  84. */
  85. public CommandLineOptions(String[] args)
  86. throws FOPException, FileNotFoundException {
  87. log = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
  88. boolean optionsParsed = true;
  89. rendererOptions = new java.util.HashMap();
  90. try {
  91. optionsParsed = parseOptions(args);
  92. if (optionsParsed) {
  93. checkSettings();
  94. }
  95. } catch (FOPException e) {
  96. printUsage();
  97. throw e;
  98. } catch (java.io.FileNotFoundException e) {
  99. printUsage();
  100. throw e;
  101. }
  102. }
  103. /**
  104. * Get the logger.
  105. * @return the logger
  106. */
  107. public Logger getLogger() {
  108. return log;
  109. }
  110. /**
  111. * parses the commandline arguments
  112. * @return true if parse was successful and processing can continue, false
  113. * if processing should stop
  114. * @exception FOPException if there was an error in the format of the options
  115. */
  116. private boolean parseOptions(String[] args) throws FOPException {
  117. for (int i = 0; i < args.length; i++) {
  118. if (args[i].equals("-d") || args[i].equals("--full-error-dump")) {
  119. log = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG);
  120. } else if (args[i].equals("-x")
  121. || args[i].equals("--dump-config")) {
  122. dumpConfiguration = Boolean.TRUE;
  123. } else if (args[i].equals("-q") || args[i].equals("--quiet")) {
  124. quiet = Boolean.TRUE;
  125. log = new ConsoleLogger(ConsoleLogger.LEVEL_ERROR);
  126. } else if (args[i].equals("-c")) {
  127. i = i + parseConfigurationOption(args, i);
  128. } else if (args[i].equals("-l")) {
  129. i = i + parseLanguageOption(args, i);
  130. } else if (args[i].equals("-s")) {
  131. suppressLowLevelAreas = Boolean.TRUE;
  132. } else if (args[i].equals("-fo")) {
  133. i = i + parseFOInputOption(args, i);
  134. } else if (args[i].equals("-xsl")) {
  135. i = i + parseXSLInputOption(args, i);
  136. } else if (args[i].equals("-xml")) {
  137. i = i + parseXMLInputOption(args, i);
  138. } else if (args[i].equals("-awt")) {
  139. i = i + parseAWTOutputOption(args, i);
  140. } else if (args[i].equals("-pdf")) {
  141. i = i + parsePDFOutputOption(args, i);
  142. } else if (args[i].equals("-mif")) {
  143. i = i + parseMIFOutputOption(args, i);
  144. } else if (args[i].equals("-rtf")) {
  145. i = i + parseRTFOutputOption(args, i);
  146. } else if (args[i].equals("-print")) {
  147. i = i + parsePrintOutputOption(args, i);
  148. // show print help
  149. if (i + 1 < args.length) {
  150. if (args[i + 1].equals("help")) {
  151. printUsagePrintOutput();
  152. return false;
  153. }
  154. }
  155. } else if (args[i].equals("-pcl")) {
  156. i = i + parsePCLOutputOption(args, i);
  157. } else if (args[i].equals("-ps")) {
  158. i = i + parsePostscriptOutputOption(args, i);
  159. } else if (args[i].equals("-txt")) {
  160. i = i + parseTextOutputOption(args, i);
  161. } else if (args[i].equals("-svg")) {
  162. i = i + parseSVGOutputOption(args, i);
  163. } else if (args[i].charAt(0) != '-') {
  164. i = i + parseUnknownOption(args, i);
  165. } else if (args[i].equals("-at")) {
  166. i = i + parseAreaTreeOption(args, i);
  167. } else if (args[i].equals("-param")) {
  168. if (i + 2 < args.length) {
  169. if (xsltParams == null) {
  170. xsltParams = new Vector();
  171. }
  172. String name = args[++i];
  173. xsltParams.addElement(name);
  174. String expression = args[++i];
  175. xsltParams.addElement(expression);
  176. } else {
  177. throw new FOPException("invalid param usage: use -param <name> <value>");
  178. }
  179. } else {
  180. printUsage();
  181. return false;
  182. }
  183. }
  184. return true;
  185. } // end parseOptions
  186. private int parseConfigurationOption(String[] args, int i) throws FOPException {
  187. if ((i + 1 == args.length)
  188. || (args[i + 1].charAt(0) == '-')) {
  189. throw new FOPException("if you use '-c', you must specify "
  190. + "the name of the configuration file");
  191. } else {
  192. userConfigFile = new File(args[i + 1]);
  193. return 1;
  194. }
  195. }
  196. private int parseLanguageOption(String[] args, int i) throws FOPException {
  197. if ((i + 1 == args.length)
  198. || (args[i + 1].charAt(0) == '-')) {
  199. throw new FOPException("if you use '-l', you must specify a language");
  200. } else {
  201. Locale.setDefault(new Locale(args[i + 1], ""));
  202. return 1;
  203. }
  204. }
  205. private int parseFOInputOption(String[] args, int i) throws FOPException {
  206. inputmode = FO_INPUT;
  207. if ((i + 1 == args.length)
  208. || (args[i + 1].charAt(0) == '-')) {
  209. throw new FOPException("you must specify the fo file for the '-fo' option");
  210. } else {
  211. fofile = new File(args[i + 1]);
  212. return 1;
  213. }
  214. }
  215. private int parseXSLInputOption(String[] args, int i) throws FOPException {
  216. inputmode = XSLT_INPUT;
  217. if ((i + 1 == args.length)
  218. || (args[i + 1].charAt(0) == '-')) {
  219. throw new FOPException("you must specify the stylesheet "
  220. + "file for the '-xsl' option");
  221. } else {
  222. xsltfile = new File(args[i + 1]);
  223. return 1;
  224. }
  225. }
  226. private int parseXMLInputOption(String[] args, int i) throws FOPException {
  227. inputmode = XSLT_INPUT;
  228. if ((i + 1 == args.length)
  229. || (args[i + 1].charAt(0) == '-')) {
  230. throw new FOPException("you must specify the input file "
  231. + "for the '-xml' option");
  232. } else {
  233. xmlfile = new File(args[i + 1]);
  234. return 1;
  235. }
  236. }
  237. private int parseAWTOutputOption(String[] args, int i) throws FOPException {
  238. setOutputMode(AWT_OUTPUT);
  239. return 0;
  240. }
  241. private int parsePDFOutputOption(String[] args, int i) throws FOPException {
  242. setOutputMode(PDF_OUTPUT);
  243. if ((i + 1 == args.length)
  244. || (args[i + 1].charAt(0) == '-')) {
  245. throw new FOPException("you must specify the pdf output file");
  246. } else {
  247. outfile = new File(args[i + 1]);
  248. return 1;
  249. }
  250. }
  251. private int parseMIFOutputOption(String[] args, int i) throws FOPException {
  252. setOutputMode(MIF_OUTPUT);
  253. if ((i + 1 == args.length)
  254. || (args[i + 1].charAt(0) == '-')) {
  255. throw new FOPException("you must specify the mif output file");
  256. } else {
  257. outfile = new File(args[i + 1]);
  258. return 1;
  259. }
  260. }
  261. private int parseRTFOutputOption(String[] args, int i) throws FOPException {
  262. setOutputMode(RTF_OUTPUT);
  263. if ((i + 1 == args.length)
  264. || (args[i + 1].charAt(0) == '-')) {
  265. throw new FOPException("you must specify the rtf output file");
  266. } else {
  267. outfile = new File(args[i + 1]);
  268. return 1;
  269. }
  270. }
  271. private int parsePrintOutputOption(String[] args, int i) throws FOPException {
  272. setOutputMode(PRINT_OUTPUT);
  273. return 0;
  274. }
  275. private int parsePCLOutputOption(String[] args, int i) throws FOPException {
  276. setOutputMode(PCL_OUTPUT);
  277. if ((i + 1 == args.length)
  278. || (args[i + 1].charAt(0) == '-')) {
  279. throw new FOPException("you must specify the pdf output file");
  280. } else {
  281. outfile = new File(args[i + 1]);
  282. return 1;
  283. }
  284. }
  285. private int parsePostscriptOutputOption(String[] args, int i) throws FOPException {
  286. setOutputMode(PS_OUTPUT);
  287. if ((i + 1 == args.length)
  288. || (args[i + 1].charAt(0) == '-')) {
  289. throw new FOPException("you must specify the PostScript output file");
  290. } else {
  291. outfile = new File(args[i + 1]);
  292. return 1;
  293. }
  294. }
  295. private int parseTextOutputOption(String[] args, int i) throws FOPException {
  296. setOutputMode(TXT_OUTPUT);
  297. if ((i + 1 == args.length)
  298. || (args[i + 1].charAt(0) == '-')) {
  299. throw new FOPException("you must specify the text output file");
  300. } else {
  301. outfile = new File(args[i + 1]);
  302. return 1;
  303. }
  304. }
  305. private int parseSVGOutputOption(String[] args, int i) throws FOPException {
  306. setOutputMode(SVG_OUTPUT);
  307. if ((i + 1 == args.length)
  308. || (args[i + 1].charAt(0) == '-')) {
  309. throw new FOPException("you must specify the svg output file");
  310. } else {
  311. outfile = new File(args[i + 1]);
  312. return 1;
  313. }
  314. }
  315. private int parseUnknownOption(String[] args, int i) throws FOPException {
  316. if (inputmode == NOT_SET) {
  317. inputmode = FO_INPUT;
  318. fofile = new File(args[i]);
  319. } else if (outputmode == NOT_SET) {
  320. outputmode = PDF_OUTPUT;
  321. outfile = new File(args[i]);
  322. } else {
  323. throw new FOPException("Don't know what to do with "
  324. + args[i]);
  325. }
  326. return 0;
  327. }
  328. private int parseAreaTreeOption(String[] args, int i) throws FOPException {
  329. setOutputMode(AREA_OUTPUT);
  330. if ((i + 1 == args.length)
  331. || (args[i + 1].charAt(0) == '-')) {
  332. throw new FOPException("you must specify the area-tree output file");
  333. } else {
  334. outfile = new File(args[i + 1]);
  335. return 1;
  336. }
  337. }
  338. private void setOutputMode(int mode) throws FOPException {
  339. if (outputmode == NOT_SET) {
  340. outputmode = mode;
  341. } else {
  342. throw new FOPException("you can only set one output method");
  343. }
  344. }
  345. /**
  346. * checks whether all necessary information has been given in a consistent way
  347. */
  348. private void checkSettings() throws FOPException, FileNotFoundException {
  349. if (inputmode == NOT_SET) {
  350. throw new FOPException("No input file specified");
  351. }
  352. if (outputmode == NOT_SET) {
  353. throw new FOPException("No output file specified");
  354. }
  355. if (inputmode == XSLT_INPUT) {
  356. // check whether xml *and* xslt file have been set
  357. if (xmlfile == null) {
  358. throw new FOPException("XML file must be specified for the transform mode");
  359. }
  360. if (xsltfile == null) {
  361. throw new FOPException("XSLT file must be specified for the transform mode");
  362. }
  363. // warning if fofile has been set in xslt mode
  364. if (fofile != null) {
  365. log.warn("Can't use fo file with transform mode! Ignoring.\n"
  366. + "Your input is " + "\n xmlfile: "
  367. + xmlfile.getAbsolutePath()
  368. + "\nxsltfile: "
  369. + xsltfile.getAbsolutePath()
  370. + "\n fofile: "
  371. + fofile.getAbsolutePath());
  372. }
  373. if (!xmlfile.exists()) {
  374. throw new FileNotFoundException("Error: xml file "
  375. + xmlfile.getAbsolutePath()
  376. + " not found ");
  377. }
  378. if (!xsltfile.exists()) {
  379. throw new FileNotFoundException("Error: xsl file "
  380. + xsltfile.getAbsolutePath()
  381. + " not found ");
  382. }
  383. } else if (inputmode == FO_INPUT) {
  384. if (xmlfile != null || xsltfile != null) {
  385. log.warn("fo input mode, but xmlfile or xslt file are set:");
  386. log.error("xml file: " + xmlfile.toString());
  387. log.error("xslt file: " + xsltfile.toString());
  388. }
  389. if (!fofile.exists()) {
  390. throw new FileNotFoundException("Error: fo file "
  391. + fofile.getAbsolutePath()
  392. + " not found ");
  393. }
  394. }
  395. } // end checkSettings
  396. /**
  397. * @return the type chosen renderer
  398. * @throws FOPException for invalid output modes
  399. */
  400. public int getRenderer() throws FOPException {
  401. switch (outputmode) {
  402. case NOT_SET:
  403. throw new FOPException("Renderer has not been set!");
  404. case PDF_OUTPUT:
  405. return Driver.RENDER_PDF;
  406. case AWT_OUTPUT:
  407. return Driver.RENDER_AWT;
  408. case MIF_OUTPUT:
  409. return Driver.RENDER_MIF;
  410. case PRINT_OUTPUT:
  411. return Driver.RENDER_PRINT;
  412. case PCL_OUTPUT:
  413. return Driver.RENDER_PCL;
  414. case PS_OUTPUT:
  415. return Driver.RENDER_PS;
  416. case TXT_OUTPUT:
  417. return Driver.RENDER_TXT;
  418. case SVG_OUTPUT:
  419. return Driver.RENDER_SVG;
  420. case AREA_OUTPUT:
  421. rendererOptions.put("fineDetail", isCoarseAreaXml());
  422. return Driver.RENDER_XML;
  423. case RTF_OUTPUT:
  424. return Driver.RENDER_RTF;
  425. default:
  426. throw new FOPException("Invalid Renderer setting!");
  427. }
  428. }
  429. /**
  430. * Get the input handler.
  431. * @return the input handler
  432. * @throws FOPException if creating the InputHandler fails
  433. */
  434. public InputHandler getInputHandler() throws FOPException {
  435. switch (inputmode) {
  436. case FO_INPUT:
  437. return new FOFileHandler(fofile);
  438. case XSLT_INPUT:
  439. return new XSLTInputHandler(xmlfile, xsltfile, xsltParams);
  440. default:
  441. throw new FOPException("Invalid inputmode setting!");
  442. }
  443. }
  444. /**
  445. * Get the renderer specific options.
  446. * @return hash map with option/value pairs.
  447. */
  448. public java.util.HashMap getRendererOptions() {
  449. return rendererOptions;
  450. }
  451. /**
  452. * Returns the input mode (type of input data, ex. NOT_SET or FO_INPUT)
  453. * @return the input mode
  454. */
  455. public int getInputMode() {
  456. return inputmode;
  457. }
  458. /**
  459. * Returns the output mode (output format, ex. NOT_SET or PDF_OUTPUT)
  460. * @return the output mode
  461. */
  462. public int getOutputMode() {
  463. return outputmode;
  464. }
  465. /**
  466. * Returns the XSL-FO file if set.
  467. * @return the XSL-FO file, null if not set
  468. */
  469. public File getFOFile() {
  470. return fofile;
  471. }
  472. /**
  473. * Returns the input XML file if set.
  474. * @return the input XML file, null if not set
  475. */
  476. public File getXMLFile() {
  477. return xmlfile;
  478. }
  479. /**
  480. * Returns the stylesheet to be used for transformation to XSL-FO.
  481. * @return stylesheet
  482. */
  483. public File getXSLFile() {
  484. return xsltfile;
  485. }
  486. /**
  487. * Returns the output file
  488. * @return the output file
  489. */
  490. public File getOutputFile() {
  491. return outfile;
  492. }
  493. /**
  494. * Returns the user configuration file to be used.
  495. * @return the userconfig.xml file
  496. */
  497. public File getUserConfigFile() {
  498. return userConfigFile;
  499. }
  500. /**
  501. * Indicates if FOP should be silent.
  502. * @return true if should be silent
  503. */
  504. public Boolean isQuiet() {
  505. return quiet;
  506. }
  507. /**
  508. * Indicates if FOP should dump its configuration during runtime.
  509. * @return true if config dump is enabled
  510. */
  511. public Boolean dumpConfiguration() {
  512. return dumpConfiguration;
  513. }
  514. /**
  515. * Indicates whether the XML renderer should generate course area XML
  516. * @return true if coarse area XML is desired
  517. */
  518. public Boolean isCoarseAreaXml() {
  519. return suppressLowLevelAreas;
  520. }
  521. /**
  522. * Returns the input file.
  523. * @return either the fofile or the xmlfile
  524. */
  525. public File getInputFile() {
  526. switch (inputmode) {
  527. case FO_INPUT:
  528. return fofile;
  529. case XSLT_INPUT:
  530. return xmlfile;
  531. default:
  532. return fofile;
  533. }
  534. }
  535. /**
  536. * shows the commandline syntax including a summary of all available options and some examples
  537. */
  538. public static void printUsage() {
  539. System.err.println(
  540. "\nUSAGE\nFop [options] [-fo|-xml] infile [-xsl file] "
  541. + "[-awt|-pdf|-mif|-rtf|-pcl|-ps|-txt|-at|-print] <outfile>\n"
  542. + " [OPTIONS] \n"
  543. + " -d debug mode \n"
  544. + " -x dump configuration settings \n"
  545. + " -q quiet mode \n"
  546. + " -c cfg.xml use additional configuration file cfg.xml\n"
  547. + " -l lang the language to use for user information \n"
  548. + " -s for area tree XML, down to block areas only\n\n"
  549. + " [INPUT] \n"
  550. + " infile xsl:fo input file (the same as the next) \n"
  551. + " -fo infile xsl:fo input file \n"
  552. + " -xml infile xml input file, must be used together with -xsl \n"
  553. + " -xsl stylesheet xslt stylesheet \n \n"
  554. /* + " -param name value <value> to use for parameter <name> in xslt stylesheet\n"
  555. + " (repeat '-param name value' for each parameter)\n \n" */
  556. + " [OUTPUT] \n"
  557. + " outfile input will be rendered as pdf file into outfile \n"
  558. + " -pdf outfile input will be rendered as pdf file (outfile req'd) \n"
  559. + " -awt input will be displayed on screen \n"
  560. + " -mif outfile input will be rendered as mif file (outfile req'd)\n"
  561. + " -rtf outfile input will be rendered as rtf file (outfile req'd)\n"
  562. + " -pcl outfile input will be rendered as pcl file (outfile req'd) \n"
  563. + " -ps outfile input will be rendered as PostScript file (outfile req'd) \n"
  564. + " -txt outfile input will be rendered as text file (outfile req'd) \n"
  565. + " -svg outfile input will be rendered as an svg slides file (outfile req'd) \n"
  566. + " -at outfile representation of area tree as XML (outfile req'd) \n"
  567. + " -print input file will be rendered and sent to the printer \n"
  568. + " see options with \"-print help\" \n\n"
  569. + " [Examples]\n" + " Fop foo.fo foo.pdf \n"
  570. + " Fop -fo foo.fo -pdf foo.pdf (does the same as the previous line)\n"
  571. + " Fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf\n"
  572. + " Fop foo.fo -mif foo.mif\n"
  573. + " Fop foo.fo -rtf foo.rtf\n"
  574. + " Fop foo.fo -print or Fop -print foo.fo \n"
  575. + " Fop foo.fo -awt \n");
  576. }
  577. /**
  578. * shows the options for print output
  579. */
  580. public void printUsagePrintOutput() {
  581. System.err.println("USAGE: -print [-Dstart=i] [-Dend=i] [-Dcopies=i] [-Deven=true|false] "
  582. + " org.apache.fop.apps.Fop (..) -print \n"
  583. + "Example:\n"
  584. + "java -Dstart=1 -Dend=2 org.apache.Fop.apps.Fop infile.fo -print ");
  585. }
  586. /**
  587. * debug mode. outputs all commandline settings
  588. */
  589. private void debug() {
  590. log.debug("Input mode: ");
  591. switch (inputmode) {
  592. case NOT_SET:
  593. log.debug("not set");
  594. break;
  595. case FO_INPUT:
  596. log.debug("FO ");
  597. log.debug("fo input file: " + fofile.toString());
  598. break;
  599. case XSLT_INPUT:
  600. log.debug("xslt transformation");
  601. log.debug("xml input file: " + xmlfile.toString());
  602. log.debug("xslt stylesheet: " + xsltfile.toString());
  603. break;
  604. default:
  605. log.debug("unknown input type");
  606. }
  607. log.debug("Output mode: ");
  608. switch (outputmode) {
  609. case NOT_SET:
  610. log.debug("not set");
  611. break;
  612. case PDF_OUTPUT:
  613. log.debug("pdf");
  614. log.debug("output file: " + outfile.toString());
  615. break;
  616. case AWT_OUTPUT:
  617. log.debug("awt on screen");
  618. if (outfile != null) {
  619. log.error("awt mode, but outfile is set:");
  620. log.debug("out file: " + outfile.toString());
  621. }
  622. break;
  623. case MIF_OUTPUT:
  624. log.debug("mif");
  625. log.debug("output file: " + outfile.toString());
  626. break;
  627. case RTF_OUTPUT:
  628. log.debug("rtf");
  629. log.debug("output file: " + outfile.toString());
  630. break;
  631. case PRINT_OUTPUT:
  632. log.debug("print directly");
  633. if (outfile != null) {
  634. log.error("print mode, but outfile is set:");
  635. log.error("out file: " + outfile.toString());
  636. }
  637. break;
  638. case PCL_OUTPUT:
  639. log.debug("pcl");
  640. log.debug("output file: " + outfile.toString());
  641. break;
  642. case PS_OUTPUT:
  643. log.debug("PostScript");
  644. log.debug("output file: " + outfile.toString());
  645. break;
  646. case TXT_OUTPUT:
  647. log.debug("txt");
  648. log.debug("output file: " + outfile.toString());
  649. break;
  650. case SVG_OUTPUT:
  651. log.debug("svg");
  652. log.debug("output file: " + outfile.toString());
  653. break;
  654. default:
  655. log.debug("unknown input type");
  656. }
  657. log.debug("OPTIONS");
  658. if (userConfigFile != null) {
  659. log.debug("user configuration file: "
  660. + userConfigFile.toString());
  661. } else {
  662. log.debug("no user configuration file is used [default]");
  663. }
  664. if (dumpConfiguration != null) {
  665. log.debug("dump configuration");
  666. } else {
  667. log.debug("don't dump configuration [default]");
  668. }
  669. if (quiet != null) {
  670. log.debug("quiet mode on");
  671. } else {
  672. log.debug("quiet mode off [default]");
  673. }
  674. }
  675. }