2 * Rhynodge - Starter.java - Copyright © 2013 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.rhynodge.engine;
20 import net.pterodactylus.rhynodge.loader.ChainWatcher;
21 import net.pterodactylus.rhynodge.states.StateManager;
23 import com.lexicalscope.jewel.cli.CliFactory;
24 import com.lexicalscope.jewel.cli.Option;
27 * Rhynodge main starter class.
29 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
31 public class Starter {
34 * JVM main entry method.
37 * Command-line arguments
39 public static void main(String... arguments) {
41 /* parse command line. */
42 Parameters parameters = CliFactory.parseArguments(Parameters.class, arguments);
44 /* create the state manager. */
45 StateManager stateManager = new StateManager(parameters.getStateDirectory());
47 /* create the engine. */
48 Engine engine = new Engine(stateManager);
50 /* start a watcher. */
51 ChainWatcher chainWatcher = new ChainWatcher(engine, parameters.getChainDirectory());
54 /* start the engine. */
59 * Definition of the command-line parameters.
61 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
63 private static interface Parameters {
66 * Returns the directory to watch for chains.
68 * @return The chain directory
70 @Option(defaultValue = "chains", shortName = "c", description = "The directory to watch for chains")
71 String getChainDirectory();
74 * Returns the directory to store states in.
76 * @return The states directory
78 @Option(defaultValue = "states", shortName = "s", description = "The directory to store states in")
79 String getStateDirectory();