Commit 2f73749d authored by Locatelli's avatar Locatelli
Browse files

Check environment variable NOMAD_SETTINGS_CONFIG for eventually using a

different Setting.properties file as instrument one
parent 387e56ab
* Check environment variable NOMAD_SETTINGS_CONFIG for eventually using a different Setting.properties file as instrument one.
4.1.1 07/07/2022
------
* Method fileExists added.
......
......@@ -85,9 +85,13 @@ public class ConfigManager {
public final static String FAMILIES_DIRECTORY = SERVER_CONF_DIRECTORY + "families" + FILE_SEPARATOR;
public final static String CONTROLLERS_DIRECTORY = SERVER_CONF_DIRECTORY + "controllers" + FILE_SEPARATOR;
public final static String NOMAD_SETTINGS_PROPERTIES = "Settings" + PROPERTIES_EXTENSION;
public final static String NOMAD_SETTINGS_CONFIG = "NOMAD_SETTINGS_CONFIG";
// Preferences
private final static String PREFERENCES_FILE_NAME = DEFAULT_LOCAL_FILES_DIRECTORY + ConfigManager.FILE_SEPARATOR + "NomadGUIPreferences.properties";
//public static final String GLOBAL_PREFERENCES_FILE = ".serverPreferences.properties";
public final static String LAUNCH_PAD_TEXT_MODE = "LAUNCH_PAD_TEXT_MODE";
public final static String X_UNCLOSEABLE_SPY = "X_UNCLOSEABLE_SPY";
......@@ -97,6 +101,7 @@ public class ConfigManager {
public final static String MAGNIFY_FACTOR_INDEX = "MAGNIFY_FACTOR_INDEX";
public final static String REMOTE_USER_NAME = "REMOTE_USER_NAME";
public final static String REMOTE_INSTRUMENT = "REMOTE_INSTRUMENT";
public final static String SIMULATION_INSTRUMENT = "SIMULATION_INSTRUMENT";
public final static String USE_NOMADLOGS = "USE_NOMADLOGS";
......@@ -212,21 +217,25 @@ public class ConfigManager {
propertiesFiles.addAll(Arrays.asList(files));
}
String nomadsettingsconfigenv = System.getenv(NOMAD_SETTINGS_CONFIG);
Iterator<String> it = propertiesFiles.iterator();
while (it.hasNext()) {
String fileName = it.next();
try {
if (fileName.contains(NOMAD_SETTINGS_PROPERTIES) && (nomadsettingsconfigenv.isEmpty() == false)) {
fileName = nomadsettingsconfigenv;
}
FileInputStream inputStream = new FileInputStream(fileName);
properties.load(inputStream);
inputStream.close();
} catch (FileNotFoundException e) {
LOGGER.log(Level.WARNING, "File not found " + fileName);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "IO exception while reading " + fileName);
}
}
String instruments = getStringOrNothingAtAll("instrumentsAllowingPALFiles");
if (instruments != null) {
StringTokenizer tokenizer = new StringTokenizer(instruments, ",");
......
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