2 * jSite - a tool for uploading websites into Freenet
3 * Copyright (C) 2006-2009 David Roden
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.
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.
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.
20 package de.todesbaum.jsite.main;
22 import java.awt.event.ActionEvent;
23 import java.awt.event.ActionListener;
25 import java.io.IOException;
26 import java.text.MessageFormat;
27 import java.util.Date;
28 import java.util.HashMap;
29 import java.util.Locale;
32 import java.util.Map.Entry;
33 import java.util.logging.ConsoleHandler;
34 import java.util.logging.Handler;
35 import java.util.logging.Level;
36 import java.util.logging.Logger;
38 import javax.swing.AbstractAction;
39 import javax.swing.Action;
40 import javax.swing.ButtonGroup;
41 import javax.swing.Icon;
42 import javax.swing.JList;
43 import javax.swing.JMenu;
44 import javax.swing.JMenuBar;
45 import javax.swing.JOptionPane;
46 import javax.swing.JPanel;
47 import javax.swing.JRadioButtonMenuItem;
48 import javax.swing.event.ListSelectionEvent;
49 import javax.swing.event.ListSelectionListener;
51 import de.todesbaum.jsite.application.FileOption;
52 import de.todesbaum.jsite.application.Freenet7Interface;
53 import de.todesbaum.jsite.application.Node;
54 import de.todesbaum.jsite.application.Project;
55 import de.todesbaum.jsite.application.UpdateChecker;
56 import de.todesbaum.jsite.application.UpdateListener;
57 import de.todesbaum.jsite.gui.NodeManagerListener;
58 import de.todesbaum.jsite.gui.NodeManagerPage;
59 import de.todesbaum.jsite.gui.PreferencesPage;
60 import de.todesbaum.jsite.gui.ProjectFilesPage;
61 import de.todesbaum.jsite.gui.ProjectInsertPage;
62 import de.todesbaum.jsite.gui.ProjectPage;
63 import de.todesbaum.jsite.i18n.I18n;
64 import de.todesbaum.jsite.i18n.I18nContainer;
65 import de.todesbaum.util.image.IconLoader;
66 import de.todesbaum.util.swing.TWizard;
67 import de.todesbaum.util.swing.TWizardPage;
68 import de.todesbaum.util.swing.WizardListener;
71 * The main class that ties together everything.
73 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
75 public class Main implements ActionListener, ListSelectionListener, WizardListener, NodeManagerListener, UpdateListener {
78 private static final Version VERSION = new Version(0, 7, 1);
80 /** The configuration. */
81 private Configuration configuration;
83 /** The freenet interface. */
84 private Freenet7Interface freenetInterface = new Freenet7Interface();
86 /** The update checker. */
87 private final UpdateChecker updateChecker;
89 /** The jSite icon. */
90 private Icon jSiteIcon;
93 * Enumeration for all possible pages.
95 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
97 private static enum PageType {
99 /** The node manager page. */
102 /** The project page. */
105 /** The project files page. */
108 /** The project insert page. */
111 /** The preferences page. */
116 /** The supported locales. */
117 private static final Locale[] SUPPORTED_LOCALES = new Locale[] { Locale.ENGLISH, Locale.GERMAN, Locale.FRENCH, Locale.ITALIAN, new Locale("pl") };
119 /** The actions that switch the language. */
120 private Map<Locale, Action> languageActions = new HashMap<Locale, Action>();
122 /** The “manage nodes” action. */
123 private Action manageNodeAction;
125 /** The “preferences” action. */
126 private Action optionsPreferencesAction;
128 /** The “check for updates” action. */
129 private Action checkForUpdatesAction;
131 /** The “about jSite” action. */
132 private Action aboutAction;
135 private TWizard wizard;
137 /** The node menu. */
138 private JMenu nodeMenu;
140 /** The currently selected node. */
141 private Node selectedNode;
143 /** Mapping from page type to page. */
144 private final Map<PageType, TWizardPage> pages = new HashMap<PageType, TWizardPage>();
147 * Creates a new core with the default configuration file.
154 * Creates a new core with the given configuration from the given file.
156 * @param configFilename
157 * The name of the configuration file
159 private Main(String configFilename) {
160 if (configFilename != null) {
161 configuration = new Configuration(configFilename);
163 configuration = new Configuration();
165 Locale.setDefault(configuration.getLocale());
166 I18n.setLocale(configuration.getLocale());
167 if (!configuration.createLockFile()) {
168 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"));
170 throw new IllegalStateException("Lockfile override not active, refusing start.");
172 configuration.removeLockfileOnExit();
174 wizard = new TWizard();
176 wizard.setJMenuBar(createMenuBar());
177 wizard.setQuitName(I18n.getMessage("jsite.wizard.quit"));
178 wizard.setPreviousEnabled(false);
179 wizard.setNextEnabled(true);
180 wizard.addWizardListener(this);
181 jSiteIcon = IconLoader.loadIcon("/jsite-icon.png");
182 wizard.setIcon(jSiteIcon);
184 updateChecker = new UpdateChecker(freenetInterface);
185 updateChecker.addUpdateListener(this);
186 updateChecker.start();
189 showPage(PageType.PAGE_PROJECTS);
193 * Creates all actions.
195 private void createActions() {
196 for (final Locale locale : SUPPORTED_LOCALES) {
197 languageActions.put(locale, new AbstractAction(I18n.getMessage("jsite.menu.language." + locale.getLanguage()), IconLoader.loadIcon("/flag-" + locale.getLanguage() + ".png")) {
199 @SuppressWarnings("synthetic-access")
200 public void actionPerformed(ActionEvent actionEvent) {
201 switchLanguage(locale);
205 manageNodeAction = new AbstractAction(I18n.getMessage("jsite.menu.nodes.manage-nodes")) {
207 @SuppressWarnings("synthetic-access")
208 public void actionPerformed(ActionEvent actionEvent) {
209 showPage(PageType.PAGE_NODE_MANAGER);
210 wizard.setPreviousName(I18n.getMessage("jsite.wizard.previous"));
211 wizard.setNextName(I18n.getMessage("jsite.wizard.next"));
214 optionsPreferencesAction = new AbstractAction(I18n.getMessage("jsite.menu.options.preferences")) {
220 @SuppressWarnings("synthetic-access")
221 public void actionPerformed(ActionEvent actionEvent) {
222 optionsPreferences();
225 checkForUpdatesAction = new AbstractAction(I18n.getMessage("jsite.menu.help.check-for-updates")) {
230 @SuppressWarnings("synthetic-access")
231 public void actionPerformed(ActionEvent actionEvent) {
235 aboutAction = new AbstractAction(I18n.getMessage("jsite.menu.help.about")) {
237 @SuppressWarnings("synthetic-access")
238 public void actionPerformed(ActionEvent e) {
239 JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.about.message"), getVersion().toString()), null, JOptionPane.INFORMATION_MESSAGE, jSiteIcon);
243 I18nContainer.getInstance().registerRunnable(new Runnable() {
245 @SuppressWarnings("synthetic-access")
247 manageNodeAction.putValue(Action.NAME, I18n.getMessage("jsite.menu.nodes.manage-nodes"));
248 optionsPreferencesAction.putValue(Action.NAME, I18n.getMessage("jsite.menu.options.preferences"));
249 checkForUpdatesAction.putValue(Action.NAME, I18n.getMessage("jsite.menu.help.check-for-updates"));
250 aboutAction.putValue(Action.NAME, I18n.getMessage("jsite.menu.help.about"));
256 * Creates the menu bar.
258 * @return The menu bar
260 private JMenuBar createMenuBar() {
261 JMenuBar menuBar = new JMenuBar();
262 final JMenu languageMenu = new JMenu(I18n.getMessage("jsite.menu.languages"));
263 menuBar.add(languageMenu);
264 ButtonGroup languageButtonGroup = new ButtonGroup();
265 for (Locale locale : SUPPORTED_LOCALES) {
266 Action languageAction = languageActions.get(locale);
267 JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(languageActions.get(locale));
268 if (locale.equals(Locale.getDefault())) {
269 menuItem.setSelected(true);
271 languageAction.putValue("menuItem", menuItem);
272 languageButtonGroup.add(menuItem);
273 languageMenu.add(menuItem);
275 nodeMenu = new JMenu(I18n.getMessage("jsite.menu.nodes"));
276 menuBar.add(nodeMenu);
277 selectedNode = configuration.getSelectedNode();
278 nodesUpdated(configuration.getNodes());
280 final JMenu optionsMenu = new JMenu(I18n.getMessage("jsite.menu.options"));
281 menuBar.add(optionsMenu);
282 optionsMenu.add(optionsPreferencesAction);
284 /* evil hack to right-align the help menu */
285 JPanel panel = new JPanel();
286 panel.setOpaque(false);
289 final JMenu helpMenu = new JMenu(I18n.getMessage("jsite.menu.help"));
290 menuBar.add(helpMenu);
291 helpMenu.add(checkForUpdatesAction);
292 helpMenu.add(aboutAction);
294 I18nContainer.getInstance().registerRunnable(new Runnable() {
296 @SuppressWarnings("synthetic-access")
298 languageMenu.setText(I18n.getMessage("jsite.menu.languages"));
299 nodeMenu.setText(I18n.getMessage("jsite.menu.nodes"));
300 optionsMenu.setText(I18n.getMessage("jsite.menu.options"));
301 helpMenu.setText(I18n.getMessage("jsite.menu.help"));
302 for (Map.Entry<Locale, Action> languageActionEntry : languageActions.entrySet()) {
303 languageActionEntry.getValue().putValue(Action.NAME, I18n.getMessage("jsite.menu.language." + languageActionEntry.getKey().getLanguage()));
312 * Initializes all pages.
314 private void initPages() {
315 NodeManagerPage nodeManagerPage = new NodeManagerPage(wizard);
316 nodeManagerPage.setName("page.node-manager");
317 nodeManagerPage.addNodeManagerListener(this);
318 nodeManagerPage.setNodes(configuration.getNodes());
319 pages.put(PageType.PAGE_NODE_MANAGER, nodeManagerPage);
321 ProjectPage projectPage = new ProjectPage(wizard);
322 projectPage.setName("page.project");
323 projectPage.setProjects(configuration.getProjects());
324 projectPage.setFreenetInterface(freenetInterface);
325 projectPage.addListSelectionListener(this);
326 pages.put(PageType.PAGE_PROJECTS, projectPage);
328 ProjectFilesPage projectFilesPage = new ProjectFilesPage(wizard);
329 projectFilesPage.setName("page.project.files");
330 pages.put(PageType.PAGE_PROJECT_FILES, projectFilesPage);
332 ProjectInsertPage projectInsertPage = new ProjectInsertPage(wizard);
333 projectInsertPage.setName("page.project.insert");
334 projectInsertPage.setFreenetInterface(freenetInterface);
335 pages.put(PageType.PAGE_INSERT_PROJECT, projectInsertPage);
337 PreferencesPage preferencesPage = new PreferencesPage(wizard);
338 preferencesPage.setName("page.preferences");
339 pages.put(PageType.PAGE_PREFERENCES, preferencesPage);
343 * Shows the page with the given type.
346 * The page type to show
348 private void showPage(PageType pageType) {
349 wizard.setPreviousEnabled(pageType.ordinal() > 0);
350 wizard.setNextEnabled(pageType.ordinal() < (pages.size() - 1));
351 wizard.setPage(pages.get(pageType));
352 wizard.setTitle(pages.get(pageType).getHeading() + " - jSite");
356 * Saves the configuration.
358 * @return <code>true</code> if the configuration could be saved,
359 * <code>false</code> otherwise
361 private boolean saveConfiguration() {
362 NodeManagerPage nodeManagerPage = (NodeManagerPage) pages.get(PageType.PAGE_NODE_MANAGER);
363 configuration.setNodes(nodeManagerPage.getNodes());
364 if (selectedNode != null) {
365 configuration.setSelectedNode(selectedNode);
368 ProjectPage projectPage = (ProjectPage) pages.get(PageType.PAGE_PROJECTS);
369 configuration.setProjects(projectPage.getProjects());
371 return configuration.save();
375 * Finds a supported locale for the given locale.
378 * The locale to find a supported locale for
379 * @return The supported locale that was found, or the default locale if no
380 * supported locale could be found
382 private Locale findSupportedLocale(Locale forLocale) {
383 for (Locale locale : SUPPORTED_LOCALES) {
384 if (locale.equals(forLocale)) {
388 for (Locale locale : SUPPORTED_LOCALES) {
389 if (locale.getCountry().equals(forLocale.getCountry()) && locale.getLanguage().equals(forLocale.getLanguage())) {
393 for (Locale locale : SUPPORTED_LOCALES) {
394 if (locale.getLanguage().equals(forLocale.getLanguage())) {
398 return SUPPORTED_LOCALES[0];
402 * Returns the version.
404 * @return The version
406 public static final Version getVersion() {
415 * Switches the language of the interface to the given locale.
418 * The locale to switch to
420 private void switchLanguage(Locale locale) {
421 Locale supportedLocale = findSupportedLocale(locale);
422 Action languageAction = languageActions.get(supportedLocale);
423 JRadioButtonMenuItem menuItem = (JRadioButtonMenuItem) languageAction.getValue("menuItem");
424 menuItem.setSelected(true);
425 I18n.setLocale(supportedLocale);
426 for (Runnable i18nRunnable : I18nContainer.getInstance()) {
429 } catch (Throwable t) {
430 /* we probably shouldn't swallow this. */
433 wizard.setPage(wizard.getPage());
434 configuration.setLocale(supportedLocale);
438 * Shows a dialog with general preferences.
440 private void optionsPreferences() {
441 showPage(PageType.PAGE_PREFERENCES);
442 optionsPreferencesAction.setEnabled(false);
443 wizard.setNextEnabled(true);
447 * Shows a dialog box that shows the last version that was found by the
448 * {@link UpdateChecker}.
450 private void showLatestUpdate() {
451 Version latestVersion = updateChecker.getLatestVersion();
452 int versionDifference = latestVersion.compareTo(VERSION);
453 if (versionDifference > 0) {
454 JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.update-checker.latest-version.newer.message"), VERSION, latestVersion), I18n.getMessage("jsite.update-checker.latest-version.title"), JOptionPane.INFORMATION_MESSAGE);
455 } else if (versionDifference < 0) {
456 JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.update-checker.latest-version.older.message"), VERSION, latestVersion), I18n.getMessage("jsite.update-checker.latest-version.title"), JOptionPane.INFORMATION_MESSAGE);
458 JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.update-checker.latest-version.okay.message"), VERSION, latestVersion), I18n.getMessage("jsite.update-checker.latest-version.title"), JOptionPane.INFORMATION_MESSAGE);
463 // INTERFACE ListSelectionListener
469 public void valueChanged(ListSelectionEvent e) {
470 JList list = (JList) e.getSource();
471 int selectedRow = list.getSelectedIndex();
472 wizard.setNextEnabled(selectedRow > -1);
476 // INTERFACE WizardListener
482 public void wizardNextPressed(TWizard wizard) {
483 String pageName = wizard.getPage().getName();
484 if ("page.node-manager".equals(pageName)) {
485 showPage(PageType.PAGE_PROJECTS);
486 } else if ("page.project".equals(pageName)) {
487 ProjectPage projectPage = (ProjectPage) wizard.getPage();
488 Project project = projectPage.getSelectedProject();
489 if ((project.getLocalPath() == null) || (project.getLocalPath().trim().length() == 0)) {
490 JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project.warning.no-local-path"), null, JOptionPane.ERROR_MESSAGE);
493 if ((project.getPath() == null) || (project.getPath().trim().length() == 0)) {
494 JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project.warning.no-path"), null, JOptionPane.ERROR_MESSAGE);
497 ((ProjectFilesPage) pages.get(PageType.PAGE_PROJECT_FILES)).setProject(project);
498 ((ProjectInsertPage) pages.get(PageType.PAGE_INSERT_PROJECT)).setProject(project);
499 showPage(PageType.PAGE_PROJECT_FILES);
500 } else if ("page.project.files".equals(pageName)) {
501 ProjectPage projectPage = (ProjectPage) pages.get(PageType.PAGE_PROJECTS);
502 Project project = projectPage.getSelectedProject();
503 if (selectedNode == null) {
504 JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project-files.no-node-selected"), null, JOptionPane.ERROR_MESSAGE);
507 if ((project.getIndexFile() == null) || (project.getIndexFile().length() == 0)) {
508 if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.project-files.empty-index"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.OK_OPTION) {
512 File indexFile = new File(project.getLocalPath(), project.getIndexFile());
513 if (!indexFile.exists()) {
514 JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project-files.index-missing"), null, JOptionPane.ERROR_MESSAGE);
518 String indexFile = project.getIndexFile();
519 boolean hasIndexFile = (indexFile != null);
520 if (hasIndexFile && !project.getFileOption(indexFile).getContainer().equals("")) {
521 if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.project-files.container-index"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.OK_OPTION) {
525 if (hasIndexFile && !project.getFileOption(indexFile).getMimeType().equals("text/html")) {
526 if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.project-files.index-not-html"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.OK_OPTION) {
530 Map<String, FileOption> fileOptions = project.getFileOptions();
531 Set<Entry<String, FileOption>> fileOptionEntries = fileOptions.entrySet();
532 for (Entry<String, FileOption> fileOptionEntry : fileOptionEntries) {
533 FileOption fileOption = fileOptionEntry.getValue();
534 if (!fileOption.isInsert() && ((fileOption.getCustomKey().length() == 0) || "CHK@".equals(fileOption.getCustomKey()))) {
535 JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.project-files.no-custom-key"), fileOptionEntry.getKey()), null, JOptionPane.ERROR_MESSAGE);
539 boolean nodeRunning = false;
541 nodeRunning = freenetInterface.isNodePresent();
542 } catch (IOException e) {
546 JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project-files.no-node-running"), null, JOptionPane.ERROR_MESSAGE);
549 configuration.save();
550 showPage(PageType.PAGE_INSERT_PROJECT);
551 ((ProjectInsertPage) pages.get(PageType.PAGE_INSERT_PROJECT)).startInsert();
552 nodeMenu.setEnabled(false);
553 } else if ("page.project.insert".equals(pageName)) {
554 showPage(PageType.PAGE_PROJECTS);
555 nodeMenu.setEnabled(true);
556 } else if ("page.preferences".equals(pageName)) {
557 showPage(PageType.PAGE_PROJECTS);
558 optionsPreferencesAction.setEnabled(true);
559 String tempDirectory = ((PreferencesPage) pages.get(PageType.PAGE_PREFERENCES)).getTempDirectory();
560 ((ProjectInsertPage) pages.get(PageType.PAGE_INSERT_PROJECT)).setTempDirectory(tempDirectory);
567 public void wizardPreviousPressed(TWizard wizard) {
568 String pageName = wizard.getPage().getName();
569 if ("page.project".equals(pageName)) {
570 showPage(PageType.PAGE_NODE_MANAGER);
571 } else if ("page.project.files".equals(pageName)) {
572 showPage(PageType.PAGE_PROJECTS);
573 } else if ("page.project.insert".equals(pageName)) {
574 showPage(PageType.PAGE_PROJECT_FILES);
581 public void wizardQuitPressed(TWizard wizard) {
582 if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.quit.question"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) {
583 if (saveConfiguration()) {
586 if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.quit.config-not-saved"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
593 // INTERFACE NodeManagerListener
599 public void nodesUpdated(Node[] nodes) {
600 nodeMenu.removeAll();
601 ButtonGroup nodeButtonGroup = new ButtonGroup();
602 Node newSelectedNode = null;
603 for (Node node : nodes) {
604 JRadioButtonMenuItem nodeMenuItem = new JRadioButtonMenuItem(node.getName());
605 nodeMenuItem.putClientProperty("Node", node);
606 nodeMenuItem.addActionListener(this);
607 nodeButtonGroup.add(nodeMenuItem);
608 if (node.equals(selectedNode)) {
609 newSelectedNode = node;
610 nodeMenuItem.setSelected(true);
612 nodeMenu.add(nodeMenuItem);
614 nodeMenu.addSeparator();
615 nodeMenu.add(manageNodeAction);
616 selectedNode = newSelectedNode;
617 freenetInterface.setNode(selectedNode);
623 public void actionPerformed(ActionEvent e) {
624 Object source = e.getSource();
625 if (source instanceof JRadioButtonMenuItem) {
626 JRadioButtonMenuItem menuItem = (JRadioButtonMenuItem) source;
627 Node node = (Node) menuItem.getClientProperty("Node");
629 freenetInterface.setNode(selectedNode);
634 // INTERFACE UpdateListener
640 public void foundUpdateData(Version foundVersion, long versionTimestamp) {
641 if (foundVersion.compareTo(VERSION) > 0) {
642 JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.update-checker.found-version.message"), foundVersion.toString(), new Date(versionTimestamp)), I18n.getMessage("jsite.update-checker.found-version.title"), JOptionPane.INFORMATION_MESSAGE);
651 * Main method that is called by the VM.
654 * The command-line arguments
656 public static void main(String[] args) {
657 /* initialize logger. */
658 Logger logger = Logger.getLogger("de.todesbaum");
659 Handler handler = new ConsoleHandler();
660 logger.addHandler(handler);
661 String configFilename = null;
662 boolean nextIsConfigFilename = false;
663 for (String argument : args) {
664 if (nextIsConfigFilename) {
665 configFilename = argument;
666 nextIsConfigFilename = false;
668 if ("--help".equals(argument)) {
671 } else if ("--debug".equals(argument)) {
672 logger.setLevel(Level.ALL);
673 handler.setLevel(Level.ALL);
674 } else if ("--config-file".equals(argument)) {
675 nextIsConfigFilename = true;
678 if (nextIsConfigFilename) {
679 System.out.println("--config-file needs parameter!");
682 new Main(configFilename);
686 * Prints a small syntax help.
688 private static void printHelp() {
689 System.out.println("--help\tshows this cruft");
690 System.out.println("--debug\tenables some debug output");
691 System.out.println("--config-file <file>\tuse specified configuration file");