b04473d5011432981526b8030d6c8b4cfdb8cb1f
[jSite.git] / src / de / todesbaum / jsite / main / Main.java
1 /*
2  * jSite - a tool for uploading websites into Freenet
3  * Copyright (C) 2006 David Roden
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 package de.todesbaum.jsite.main;
21
22 import java.awt.event.ActionEvent;
23 import java.awt.event.ActionListener;
24 import java.io.File;
25 import java.io.IOException;
26 import java.text.MessageFormat;
27 import java.util.HashMap;
28 import java.util.Locale;
29 import java.util.Map;
30 import java.util.Set;
31 import java.util.Map.Entry;
32
33 import javax.swing.AbstractAction;
34 import javax.swing.Action;
35 import javax.swing.ButtonGroup;
36 import javax.swing.Icon;
37 import javax.swing.JList;
38 import javax.swing.JMenu;
39 import javax.swing.JMenuBar;
40 import javax.swing.JOptionPane;
41 import javax.swing.JPanel;
42 import javax.swing.JRadioButtonMenuItem;
43 import javax.swing.event.ListSelectionEvent;
44 import javax.swing.event.ListSelectionListener;
45
46 import de.todesbaum.jsite.application.FileOption;
47 import de.todesbaum.jsite.application.Freenet7Interface;
48 import de.todesbaum.jsite.application.Node;
49 import de.todesbaum.jsite.application.Project;
50 import de.todesbaum.jsite.gui.NodeManagerListener;
51 import de.todesbaum.jsite.gui.NodeManagerPage;
52 import de.todesbaum.jsite.gui.ProjectFilesPage;
53 import de.todesbaum.jsite.gui.ProjectInsertPage;
54 import de.todesbaum.jsite.gui.ProjectPage;
55 import de.todesbaum.jsite.gui.UpdateChecker;
56 import de.todesbaum.jsite.i18n.I18n;
57 import de.todesbaum.jsite.i18n.I18nContainer;
58 import de.todesbaum.util.image.IconLoader;
59 import de.todesbaum.util.swing.TWizard;
60 import de.todesbaum.util.swing.TWizardPage;
61 import de.todesbaum.util.swing.WizardListener;
62
63 /**
64  * The main class that ties together everything.
65  *
66  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
67  */
68 public class Main implements ActionListener, ListSelectionListener, WizardListener, NodeManagerListener {
69
70         /** Whether the debug mode is activated. */
71         private static boolean debug = false;
72
73         /** The configuration. */
74         private Configuration configuration;
75
76         /** The freenet interface. */
77         private Freenet7Interface freenetInterface = new Freenet7Interface();
78
79         /** The update checker. */
80         private final UpdateChecker updateChecker;
81
82         /** The jSite icon. */
83         private Icon jSiteIcon;
84
85         /**
86          * Enumeration for all possible pages.
87          *
88          * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
89          */
90         private static enum PageType {
91
92                 /** The node manager page. */
93                 PAGE_NODE_MANAGER,
94
95                 /** The project page. */
96                 PAGE_PROJECTS,
97
98                 /** The project files page. */
99                 PAGE_PROJECT_FILES,
100
101                 /** The project insert page. */
102                 PAGE_INSERT_PROJECT
103
104         }
105
106         /** The supported locales. */
107         private static final Locale[] SUPPORTED_LOCALES = new Locale[] { Locale.ENGLISH, Locale.GERMAN, Locale.FRENCH, Locale.ITALIAN, new Locale("pl") };
108
109         /** The actions that switch the language. */
110         private Map<Locale, Action> languageActions = new HashMap<Locale, Action>();
111
112         /** The “manage nodes” action. */
113         private Action manageNodeAction;
114
115         /** The “check for updates” action. */
116         private Action checkForUpdatesAction;
117
118         /** The “about jSite” action. */
119         private Action aboutAction;
120
121         /** The wizard. */
122         private TWizard wizard;
123
124         /** The node menu. */
125         private JMenu nodeMenu;
126
127         /** The currently selected node. */
128         private Node selectedNode;
129
130         /** Mapping from page type to page. */
131         private final Map<PageType, TWizardPage> pages = new HashMap<PageType, TWizardPage>();
132
133         /**
134          * Creates a new core with the default configuration file.
135          */
136         private Main() {
137                 this(null);
138         }
139
140         /**
141          * Creates a new core with the given configuration from the given file.
142          *
143          * @param configFilename
144          *            The name of the configuration file
145          */
146         private Main(String configFilename) {
147                 if (configFilename != null) {
148                         configuration = new Configuration(configFilename);
149                 } else {
150                         configuration = new Configuration();
151                 }
152                 Locale.setDefault(configuration.getLocale());
153                 I18n.setLocale(configuration.getLocale());
154                 if (!configuration.createLockFile()) {
155                         int option = JOptionPane.showOptionDialog(null, I18n.getMessage("jsite.main.already-running"), "", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new Object[] { I18n.getMessage("jsite.main.already-running.override"), I18n.getMessage("jsite.wizard.quit") }, I18n.getMessage("jsite.wizard.quit"));
156                         if (option != 0) {
157                                 throw new IllegalStateException("Lockfile override not active, refusing start.");
158                         }
159                         configuration.removeLockfileOnExit();
160                 }
161                 wizard = new TWizard();
162                 createActions();
163                 wizard.setJMenuBar(createMenuBar());
164                 wizard.setQuitName(I18n.getMessage("jsite.wizard.quit"));
165                 wizard.setPreviousEnabled(false);
166                 wizard.setNextEnabled(true);
167                 wizard.addWizardListener(this);
168                 jSiteIcon = IconLoader.loadIcon("/jsite-icon.png");
169                 wizard.setIcon(jSiteIcon);
170
171                 updateChecker = new UpdateChecker(wizard, freenetInterface);
172
173                 initPages();
174                 showPage(PageType.PAGE_PROJECTS);
175         }
176
177         /**
178          * Creates all actions.
179          */
180         private void createActions() {
181                 for (final Locale locale : SUPPORTED_LOCALES) {
182                         languageActions.put(locale, new AbstractAction(I18n.getMessage("jsite.menu.language." + locale.getLanguage()), IconLoader.loadIcon("/flag-" + locale.getLanguage() + ".png")) {
183
184                                 @SuppressWarnings("synthetic-access")
185                                 public void actionPerformed(ActionEvent actionEvent) {
186                                         switchLanguage(locale);
187                                 }
188                         });
189                 }
190                 manageNodeAction = new AbstractAction(I18n.getMessage("jsite.menu.nodes.manage-nodes")) {
191
192                         @SuppressWarnings("synthetic-access")
193                         public void actionPerformed(ActionEvent actionEvent) {
194                                 showPage(PageType.PAGE_NODE_MANAGER);
195                                 wizard.setPreviousName(I18n.getMessage("jsite.wizard.previous"));
196                                 wizard.setNextName(I18n.getMessage("jsite.wizard.next"));
197                         }
198                 };
199                 checkForUpdatesAction = new AbstractAction(I18n.getMessage("jsite.menu.help.check-for-updates")) {
200
201                         /**
202                          * {@inheritDoc}
203                          */
204                         @SuppressWarnings("synthetic-access")
205                         public void actionPerformed(ActionEvent actionEvent) {
206                                 updateChecker.checkForUpdates();
207                         }
208                 };
209                 aboutAction = new AbstractAction(I18n.getMessage("jsite.menu.help.about")) {
210
211                         @SuppressWarnings("synthetic-access")
212                         public void actionPerformed(ActionEvent e) {
213                                 JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.about.message"), Version.getVersion()), null, JOptionPane.INFORMATION_MESSAGE, jSiteIcon);
214                         }
215                 };
216
217                 I18nContainer.getInstance().registerRunnable(new Runnable() {
218
219                         @SuppressWarnings("synthetic-access")
220                         public void run() {
221                                 manageNodeAction.putValue(Action.NAME, I18n.getMessage("jsite.menu.nodes.manage-nodes"));
222                                 aboutAction.putValue(Action.NAME, I18n.getMessage("jsite.menu.help.about"));
223                         }
224                 });
225         }
226
227         /**
228          * Creates the menu bar.
229          *
230          * @return The menu bar
231          */
232         private JMenuBar createMenuBar() {
233                 JMenuBar menuBar = new JMenuBar();
234                 final JMenu languageMenu = new JMenu(I18n.getMessage("jsite.menu.languages"));
235                 menuBar.add(languageMenu);
236                 ButtonGroup languageButtonGroup = new ButtonGroup();
237                 for (Locale locale : SUPPORTED_LOCALES) {
238                         Action languageAction = languageActions.get(locale);
239                         JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(languageActions.get(locale));
240                         if (locale.equals(Locale.getDefault())) {
241                                 menuItem.setSelected(true);
242                         }
243                         languageAction.putValue("menuItem", menuItem);
244                         languageButtonGroup.add(menuItem);
245                         languageMenu.add(menuItem);
246                 }
247                 nodeMenu = new JMenu(I18n.getMessage("jsite.menu.nodes"));
248                 menuBar.add(nodeMenu);
249                 selectedNode = configuration.getSelectedNode();
250                 nodesUpdated(configuration.getNodes());
251
252                 /* evil hack to right-align the help menu */
253                 JPanel panel = new JPanel();
254                 panel.setOpaque(false);
255                 menuBar.add(panel);
256
257                 final JMenu helpMenu = new JMenu(I18n.getMessage("jsite.menu.help"));
258                 menuBar.add(helpMenu);
259                 helpMenu.add(checkForUpdatesAction);
260                 helpMenu.add(aboutAction);
261
262                 I18nContainer.getInstance().registerRunnable(new Runnable() {
263
264                         @SuppressWarnings("synthetic-access")
265                         public void run() {
266                                 languageMenu.setText(I18n.getMessage("jsite.menu.languages"));
267                                 nodeMenu.setText(I18n.getMessage("jsite.menu.nodes"));
268                                 helpMenu.setText(I18n.getMessage("jsite.menu.help"));
269                                 for (Map.Entry<Locale, Action> languageActionEntry : languageActions.entrySet()) {
270                                         languageActionEntry.getValue().putValue(Action.NAME, I18n.getMessage("jsite.menu.language." + languageActionEntry.getKey().getLanguage()));
271                                 }
272                         }
273                 });
274
275                 return menuBar;
276         }
277
278         /**
279          * Initializes all pages.
280          */
281         private void initPages() {
282                 NodeManagerPage nodeManagerPage = new NodeManagerPage(wizard);
283                 nodeManagerPage.setName("page.node-manager");
284                 nodeManagerPage.addNodeManagerListener(this);
285                 nodeManagerPage.setNodes(configuration.getNodes());
286                 pages.put(PageType.PAGE_NODE_MANAGER, nodeManagerPage);
287
288                 ProjectPage projectPage = new ProjectPage(wizard);
289                 projectPage.setName("page.project");
290                 projectPage.setProjects(configuration.getProjects());
291                 projectPage.setFreenetInterface(freenetInterface);
292                 projectPage.addListSelectionListener(this);
293                 pages.put(PageType.PAGE_PROJECTS, projectPage);
294
295                 ProjectFilesPage projectFilesPage = new ProjectFilesPage(wizard);
296                 projectFilesPage.setName("page.project.files");
297                 pages.put(PageType.PAGE_PROJECT_FILES, projectFilesPage);
298
299                 ProjectInsertPage projectInsertPage = new ProjectInsertPage(wizard);
300                 projectInsertPage.setDebug(debug);
301                 projectInsertPage.setName("page.project.insert");
302                 projectInsertPage.setFreenetInterface(freenetInterface);
303                 pages.put(PageType.PAGE_INSERT_PROJECT, projectInsertPage);
304         }
305
306         /**
307          * Shows the page with the given type.
308          *
309          * @param pageType
310          *            The page type to show
311          */
312         private void showPage(PageType pageType) {
313                 wizard.setPreviousEnabled(pageType.ordinal() > 0);
314                 wizard.setNextEnabled(pageType.ordinal() < (pages.size() - 1));
315                 wizard.setPage(pages.get(pageType));
316                 wizard.setTitle(pages.get(pageType).getHeading() + " - jSite");
317         }
318
319         /**
320          * Saves the configuration.
321          *
322          * @return <code>true</code> if the configuration could be saved,
323          *         <code>false</code> otherwise
324          */
325         private boolean saveConfiguration() {
326                 NodeManagerPage nodeManagerPage = (NodeManagerPage) pages.get(PageType.PAGE_NODE_MANAGER);
327                 configuration.setNodes(nodeManagerPage.getNodes());
328                 if (selectedNode != null) {
329                         configuration.setSelectedNode(selectedNode);
330                 }
331
332                 ProjectPage projectPage = (ProjectPage) pages.get(PageType.PAGE_PROJECTS);
333                 configuration.setProjects(projectPage.getProjects());
334
335                 return configuration.save();
336         }
337
338         /**
339          * Finds a supported locale for the given locale.
340          *
341          * @param forLocale
342          *            The locale to find a supported locale for
343          * @return The supported locale that was found, or the default locale if no
344          *         supported locale could be found
345          */
346         private Locale findSupportedLocale(Locale forLocale) {
347                 for (Locale locale : SUPPORTED_LOCALES) {
348                         if (locale.equals(forLocale)) {
349                                 return locale;
350                         }
351                 }
352                 for (Locale locale : SUPPORTED_LOCALES) {
353                         if (locale.getCountry().equals(forLocale.getCountry()) && locale.getLanguage().equals(forLocale.getLanguage())) {
354                                 return locale;
355                         }
356                 }
357                 for (Locale locale : SUPPORTED_LOCALES) {
358                         if (locale.getLanguage().equals(forLocale.getLanguage())) {
359                                 return locale;
360                         }
361                 }
362                 return SUPPORTED_LOCALES[0];
363         }
364
365         //
366         // ACTIONS
367         //
368
369         /**
370          * Switches the language of the interface to the given locale.
371          *
372          * @param locale
373          *            The locale to switch to
374          */
375         private void switchLanguage(Locale locale) {
376                 Locale supportedLocale = findSupportedLocale(locale);
377                 Action languageAction = languageActions.get(supportedLocale);
378                 JRadioButtonMenuItem menuItem = (JRadioButtonMenuItem) languageAction.getValue("menuItem");
379                 menuItem.setSelected(true);
380                 I18n.setLocale(supportedLocale);
381                 for (Runnable i18nRunnable : I18nContainer.getInstance()) {
382                         try {
383                                 i18nRunnable.run();
384                         } catch (Throwable t) {
385                                 /* we probably shouldn't swallow this. */
386                         }
387                 }
388                 wizard.setPage(wizard.getPage());
389                 configuration.setLocale(supportedLocale);
390         }
391
392         //
393         // INTERFACE ListSelectionListener
394         //
395
396         /**
397          * {@inheritDoc}
398          */
399         public void valueChanged(ListSelectionEvent e) {
400                 JList list = (JList) e.getSource();
401                 int selectedRow = list.getSelectedIndex();
402                 wizard.setNextEnabled(selectedRow > -1);
403         }
404
405         //
406         // INTERFACE WizardListener
407         //
408
409         /**
410          * {@inheritDoc}
411          */
412         public void wizardNextPressed(TWizard wizard) {
413                 String pageName = wizard.getPage().getName();
414                 if ("page.node-manager".equals(pageName)) {
415                         showPage(PageType.PAGE_PROJECTS);
416                 } else if ("page.project".equals(pageName)) {
417                         ProjectPage projectPage = (ProjectPage) wizard.getPage();
418                         Project project = projectPage.getSelectedProject();
419                         if ((project.getLocalPath() == null) || (project.getLocalPath().trim().length() == 0)) {
420                                 JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project.warning.no-local-path"), null, JOptionPane.ERROR_MESSAGE);
421                                 return;
422                         }
423                         if ((project.getPath() == null) || (project.getPath().trim().length() == 0)) {
424                                 JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project.warning.no-path"), null, JOptionPane.ERROR_MESSAGE);
425                                 return;
426                         }
427                         ((ProjectFilesPage) pages.get(PageType.PAGE_PROJECT_FILES)).setProject(project);
428                         ((ProjectInsertPage) pages.get(PageType.PAGE_INSERT_PROJECT)).setProject(project);
429                         showPage(PageType.PAGE_PROJECT_FILES);
430                 } else if ("page.project.files".equals(pageName)) {
431                         ProjectPage projectPage = (ProjectPage) pages.get(PageType.PAGE_PROJECTS);
432                         Project project = projectPage.getSelectedProject();
433                         if (selectedNode == null) {
434                                 JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project-files.no-node-selected"), null, JOptionPane.ERROR_MESSAGE);
435                                 return;
436                         }
437                         if (project.getIndexFile() == null) {
438                                 if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.project-files.empty-index"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.OK_OPTION) {
439                                         return;
440                                 }
441                         } else {
442                                 File indexFile = new File(project.getLocalPath(), project.getIndexFile());
443                                 if (!indexFile.exists()) {
444                                         JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project-files.index-missing"), null, JOptionPane.ERROR_MESSAGE);
445                                         return;
446                                 }
447                         }
448                         String indexFile = project.getIndexFile();
449                         boolean hasIndexFile = (indexFile != null);
450                         if (hasIndexFile && !project.getFileOption(indexFile).getContainer().equals("")) {
451                                 if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.project-files.container-index"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.OK_OPTION) {
452                                         return;
453                                 }
454                         }
455                         if (hasIndexFile && !project.getFileOption(indexFile).getMimeType().equals("text/html")) {
456                                 if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.project-files.index-not-html"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.OK_OPTION) {
457                                         return;
458                                 }
459                         }
460                         Map<String, FileOption> fileOptions = project.getFileOptions();
461                         Set<Entry<String, FileOption>> fileOptionEntries = fileOptions.entrySet();
462                         for (Entry<String, FileOption> fileOptionEntry : fileOptionEntries) {
463                                 FileOption fileOption = fileOptionEntry.getValue();
464                                 if (!fileOption.isInsert() && ((fileOption.getCustomKey().length() == 0) || "CHK@".equals(fileOption.getCustomKey()))) {
465                                         JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.project-files.no-custom-key"), fileOptionEntry.getKey()), null, JOptionPane.ERROR_MESSAGE);
466                                         return;
467                                 }
468                         }
469                         boolean nodeRunning = false;
470                         try {
471                                 nodeRunning = freenetInterface.isNodePresent();
472                         } catch (IOException e) {
473                                 /* ignore. */
474                         }
475                         if (!nodeRunning) {
476                                 JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project-files.no-node-running"), null, JOptionPane.ERROR_MESSAGE);
477                                 return;
478                         }
479                         configuration.save();
480                         showPage(PageType.PAGE_INSERT_PROJECT);
481                         ((ProjectInsertPage) pages.get(PageType.PAGE_INSERT_PROJECT)).startInsert();
482                         nodeMenu.setEnabled(false);
483                 } else if ("page.project.insert".equals(pageName)) {
484                         showPage(PageType.PAGE_PROJECTS);
485                         nodeMenu.setEnabled(true);
486                 }
487         }
488
489         /**
490          * {@inheritDoc}
491          */
492         public void wizardPreviousPressed(TWizard wizard) {
493                 String pageName = wizard.getPage().getName();
494                 if ("page.project".equals(pageName)) {
495                         showPage(PageType.PAGE_NODE_MANAGER);
496                 } else if ("page.project.files".equals(pageName)) {
497                         showPage(PageType.PAGE_PROJECTS);
498                 } else if ("page.project.insert".equals(pageName)) {
499                         showPage(PageType.PAGE_PROJECT_FILES);
500                 }
501         }
502
503         /**
504          * {@inheritDoc}
505          */
506         public void wizardQuitPressed(TWizard wizard) {
507                 if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.quit.question"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) {
508                         if (saveConfiguration()) {
509                                 System.exit(0);
510                         }
511                         if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.quit.config-not-saved"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
512                                 System.exit(0);
513                         }
514                 }
515         }
516
517         //
518         // INTERFACE NodeManagerListener
519         //
520
521         /**
522          * {@inheritDoc}
523          */
524         public void nodesUpdated(Node[] nodes) {
525                 nodeMenu.removeAll();
526                 ButtonGroup nodeButtonGroup = new ButtonGroup();
527                 Node newSelectedNode = null;
528                 for (Node node : nodes) {
529                         JRadioButtonMenuItem nodeMenuItem = new JRadioButtonMenuItem(node.getName());
530                         nodeMenuItem.putClientProperty("Node", node);
531                         nodeMenuItem.addActionListener(this);
532                         nodeButtonGroup.add(nodeMenuItem);
533                         if (node.equals(selectedNode)) {
534                                 newSelectedNode = node;
535                                 nodeMenuItem.setSelected(true);
536                         }
537                         nodeMenu.add(nodeMenuItem);
538                 }
539                 nodeMenu.addSeparator();
540                 nodeMenu.add(manageNodeAction);
541                 selectedNode = newSelectedNode;
542                 freenetInterface.setNode(selectedNode);
543         }
544
545         /**
546          * {@inheritDoc}
547          */
548         public void actionPerformed(ActionEvent e) {
549                 Object source = e.getSource();
550                 if (source instanceof JRadioButtonMenuItem) {
551                         JRadioButtonMenuItem menuItem = (JRadioButtonMenuItem) source;
552                         Node node = (Node) menuItem.getClientProperty("Node");
553                         selectedNode = node;
554                         freenetInterface.setNode(selectedNode);
555                 }
556         }
557
558         //
559         // MAIN METHOD
560         //
561
562         /**
563          * Main method that is called by the VM.
564          *
565          * @param args
566          *            The command-line arguments
567          */
568         public static void main(String[] args) {
569                 String configFilename = null;
570                 boolean nextIsConfigFilename = false;
571                 for (String argument : args) {
572                         if (nextIsConfigFilename) {
573                                 configFilename = argument;
574                                 nextIsConfigFilename = false;
575                         }
576                         if ("--help".equals(argument)) {
577                                 printHelp();
578                                 return;
579                         } else if ("--debug".equals(argument)) {
580                                 debug = true;
581                         } else if ("--config-file".equals(argument)) {
582                                 nextIsConfigFilename = true;
583                         }
584                 }
585                 if (nextIsConfigFilename) {
586                         System.out.println("--config-file needs parameter!");
587                         return;
588                 }
589                 new Main(configFilename);
590         }
591
592         /**
593          * Prints a small syntax help.
594          */
595         private static void printHelp() {
596                 System.out.println("--help\tshows this cruft");
597                 System.out.println("--debug\tenables some debug output");
598                 System.out.println("--config-file <file>\tuse specified configuration file");
599         }
600
601 }