Commit 32eb3784 authored by legoc's avatar legoc
Browse files

Moved methods in class

parent 670a5d8f
......@@ -43,7 +43,7 @@
<dependency>
<groupId>fr.ill.ics</groupId>
<artifactId>nomadcommandsystem</artifactId>
<version>4.0.28</version>
<version>4.0.33</version>
</dependency>
</dependencies>
......
......@@ -65,6 +65,48 @@ public class MailSender {
System.exit(exitCode);
}
private String getInstrumentName(String endpoint) {
int pos1 = endpoint.lastIndexOf('/');
int pos2 = endpoint.lastIndexOf(':');
return endpoint.substring(pos1 + 1, pos2);
}
private boolean connectToNomadServer() {
String sessionPropertiesFile = ConfigManager.NOMADENDPOINT_DIRECTORY + ConfigManager.FILE_SEPARATOR + ConfigManager.NOMADENDPOINT_FILE;
Properties sessionProperties = new Properties();
try {
FileInputStream inputStream = new FileInputStream(sessionPropertiesFile);
sessionProperties.load(inputStream);
inputStream.close();
} catch (Exception e) {
System.err.println("Error while reading session properties.");
}
String nomadServerEndpoint = sessionProperties.getProperty("nomadServerEndpoint");
String instrumentName = getInstrumentName(nomadServerEndpoint);
System.out.println("nomadServerEndpoint = " + nomadServerEndpoint);
System.out.println("instrument = " + instrumentName);
String virtualHomeValue = System.getProperty(VIRTUAL_HOME);
System.out.println(VIRTUAL_HOME + " = " + virtualHomeValue);
ConfigManager.initInstance(virtualHomeValue);
SessionManager.getInstance(CommandZoneWrapper.SERVER_ID).setSessionInformation("", "", instrumentName);
String[] cameoArgs = {ConfigManager.getInstance().getServerEndpoint() + ":nomadmail"};
Application.This.init(cameoArgs);
ServerInstance.getInstance().init();
return true;
}
private void init(String[] args) {
......@@ -122,47 +164,4 @@ public class MailSender {
}
}
private String getInstrumentName(String endpoint) {
int pos1 = endpoint.lastIndexOf('/');
int pos2 = endpoint.lastIndexOf(':');
return endpoint.substring(pos1 + 1, pos2);
}
private boolean connectToNomadServer() {
String sessionPropertiesFile = ConfigManager.NOMADENDPOINT_DIRECTORY + ConfigManager.FILE_SEPARATOR + ConfigManager.NOMADENDPOINT_FILE;
Properties sessionProperties = new Properties();
try {
FileInputStream inputStream = new FileInputStream(sessionPropertiesFile);
sessionProperties.load(inputStream);
inputStream.close();
} catch (Exception e) {
System.err.println("Error while reading session properties.");
}
String nomadServerEndpoint = sessionProperties.getProperty("nomadServerEndpoint");
String instrumentName = getInstrumentName(nomadServerEndpoint);
System.out.println("nomadServerEndpoint = " + nomadServerEndpoint);
System.out.println("instrument = " + instrumentName);
String virtualHomeValue = System.getProperty(VIRTUAL_HOME);
System.out.println(VIRTUAL_HOME + " = " + virtualHomeValue);
ConfigManager.initInstance(virtualHomeValue);
SessionManager.getInstance(CommandZoneWrapper.SERVER_ID).setSessionInformation("", "", instrumentName);
String[] cameoArgs = {ConfigManager.getInstance().getServerEndpoint() + ":nomadmail"};
Application.This.init(cameoArgs);
ServerInstance.getInstance().init();
return true;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment