Implemented server to manage a list of available servers on the internet.

- Implemented a server manager that keeps track of servers & room codes, and removes old servers
- Implemented queries to find a server with a specific room code
- Implemented protocol to register servers

#story[1281]
This commit is contained in:
Michael Rausch
2017-09-20 20:26:14 +12:00
parent 034e4c252a
commit e17e9749d8
14 changed files with 615 additions and 8 deletions
+14 -2
View File
@@ -10,11 +10,13 @@ import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import seng302.serverRepository.ServerRepository;
import seng302.visualiser.controllers.ViewManager;
public class App extends Application {
private static Logger logger = LoggerFactory.getLogger(App.class);
private static boolean isRunningAsCache = false;
public static void parseArgs(String[] args) throws ParseException {
Options options = new Options();
@@ -25,9 +27,14 @@ public class App extends Application {
.getLogger(Logger.ROOT_LOGGER_NAME);
options.addOption("debugLevel", true, "Set the application debug level");
options.addOption("runAsCache", false, "Run as a server cache for server discovery");
cmd = parser.parse(options, args);
if (cmd.hasOption("runAsCache")){
isRunningAsCache = true;
}
if (cmd.hasOption("debugLevel")) {
switch (cmd.getOptionValue("debugLevel")) {
@@ -67,14 +74,19 @@ public class App extends Application {
}
public static void main(String[] args) {
public static void main(String[] args) throws Exception {
try {
parseArgs(args);
} catch (ParseException e) {
logger.error("Could not parse command line arguments");
}
launch(args);
if (!isRunningAsCache){
launch(args);
}
else{
ServerRepository serverRepository = new ServerRepository();
}
}
}