Enabled saving of config files.
This commit is contained in:
@ -78,9 +78,9 @@ public class Main {
|
||||
//log.log(Log.ERROR, null, ex);
|
||||
}
|
||||
|
||||
_conf.parseConfigStr("server-name=127.0.0.1");
|
||||
_conf.parseConfigStr("server-port=5555");
|
||||
_conf.parseConfigStr("server-target=jsonrpc");
|
||||
_conf.parseConfigStr("server.hostname=127.0.0.1");
|
||||
_conf.parseConfigStr("server.port=5555");
|
||||
_conf.parseConfigStr("server.target=jsonrpc");
|
||||
|
||||
|
||||
|
||||
@ -120,6 +120,12 @@ public class Main {
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
public static void beginShutdown(){
|
||||
_conf.writeConfFile();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoids the app terminating because no Window is opened anymore.
|
||||
* More info: http://java.sun.com/javase/6/docs/api/java/awt/doc-files/AWTThreadIssues.html#Autoshutdown
|
||||
|
@ -129,7 +129,7 @@ public class TrayManager {
|
||||
|
||||
@Override
|
||||
protected Object doInBackground() throws Exception {
|
||||
System.exit(0);
|
||||
Main.beginShutdown();
|
||||
return null;
|
||||
}
|
||||
}.execute();
|
||||
|
@ -34,7 +34,9 @@ public class ConfigurationManager {
|
||||
//Configurations with an Integer as value
|
||||
private static Map<String, Integer> integerConfigurations = new HashMap<String, Integer>();
|
||||
|
||||
private ConfigurationManager() {}
|
||||
private ConfigurationManager() {
|
||||
readConfFile();
|
||||
}
|
||||
|
||||
public synchronized static ConfigurationManager getInstance() {
|
||||
if(instance == null) {
|
||||
@ -69,7 +71,7 @@ public class ConfigurationManager {
|
||||
}
|
||||
br.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
_log.error("Unable to find config file, " + DEFAULT_CONFIG_LOCATION);
|
||||
_log.info("Unable to find config file, " + DEFAULT_CONFIG_LOCATION);
|
||||
} catch (IOException e) {
|
||||
_log.error("Unable to read from config file, " + DEFAULT_CONFIG_LOCATION);
|
||||
}
|
||||
|
@ -40,9 +40,9 @@ public class JSONInterface {
|
||||
|
||||
public static void setupSession() {
|
||||
URL srvURL = null;
|
||||
String srvHost = _conf.getConf("server-hostname", "localhost");
|
||||
int srvPort = _conf.getConf("server-port", 7656);
|
||||
String srvTarget = _conf.getConf("server-target", "jsonrpc");
|
||||
String srvHost = _conf.getConf("server.hostname", "localhost");
|
||||
int srvPort = _conf.getConf("server.port", 7656);
|
||||
String srvTarget = _conf.getConf("server.target", "jsonrpc");
|
||||
try {
|
||||
srvURL = new URL("https://" + srvHost + ":" + srvPort + "/"
|
||||
+ srvTarget);
|
||||
|
Reference in New Issue
Block a user