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