source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/Runner.java @ 246

Last change on this file since 246 was 207, checked in by sherbold, 13 years ago

+ added log file based on the log4j API

File size: 1.6 KB
Line 
1package de.ugoe.cs.eventbench;
2
3import de.ugoe.cs.eventbench.log4j.Log4JLogger;
4import de.ugoe.cs.eventbench.swt.MainWindow;
5import de.ugoe.cs.util.console.CommandExecuter;
6import de.ugoe.cs.util.console.Console;
7import de.ugoe.cs.util.console.TextConsole;
8
9/**
10 * <p>
11 * Start-up class of the application.
12 * </p>
13 * <p>
14 * It sets up and starts the {@link Console}.
15 * </p>
16 *
17 * @author Steffen Herbold
18 * @version 1.0
19 */
20public class Runner {
21
22        /**
23         * <p>
24         * Main method of the application.
25         * </p>
26         *
27         * @param args
28         *            if parameters are defined, they are interpreted as commands
29         *            for the {@link Console} and executed before the user can use
30         *            the console; can be used to perform batch operations
31         */
32        public static void main(String[] args) {
33                CommandExecuter.getInstance().addCommandPackage(
34                                "de.ugoe.cs.eventbench.commands");
35                CommandExecuter.getInstance().addCommandPackage(
36                                "de.ugoe.cs.eventbench.windows.commands");
37                CommandExecuter.getInstance().addCommandPackage(
38                                "de.ugoe.cs.eventbench.web.commands");
39                CommandExecuter.getInstance().addCommandPackage(
40                                "de.ugoe.cs.eventbench.efg.commands");
41                TextConsole textConsole = new TextConsole();
42                new Log4JLogger();
43                boolean swtGuiRunning = false;
44                if (args.length >= 1) {
45                        if( args[0].equals("-swt") ) {
46                                MainWindow mainWindow = new MainWindow();
47                                mainWindow.open();
48                                swtGuiRunning = true;
49                        } else {
50                                for (String command : args) {
51                                        CommandExecuter.getInstance().exec(command);
52                                }
53                        }
54                }
55                if( !swtGuiRunning ) {
56                        textConsole.run(true);
57                }
58        }
59
60}
Note: See TracBrowser for help on using the repository browser.