1 | package de.ugoe.cs.eventbench;
|
---|
2 |
|
---|
3 | import de.ugoe.cs.eventbench.log4j.Log4JLogger;
|
---|
4 | import de.ugoe.cs.eventbench.swt.MainWindow;
|
---|
5 | import de.ugoe.cs.util.console.CommandExecuter;
|
---|
6 | import de.ugoe.cs.util.console.Console;
|
---|
7 | import 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 | */
|
---|
20 | public 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 | }
|
---|