Commit 2c6e94e2 authored by helene ortiz's avatar helene ortiz
Browse files

Adapt PropertyManager class for compatibility with NomadServerGUI

parent 93beaf9b
...@@ -79,6 +79,8 @@ public class PropertyManager { ...@@ -79,6 +79,8 @@ public class PropertyManager {
private Map<String, String> sizePropertyNames; // KEY=controllerType.propertyName VALUE=size property name private Map<String, String> sizePropertyNames; // KEY=controllerType.propertyName VALUE=size property name
private String nomadHome;
/** -------------------------------------------------------------------------------------------------- **/ /** -------------------------------------------------------------------------------------------------- **/
private static PropertyManager instance = null; private static PropertyManager instance = null;
...@@ -99,6 +101,8 @@ public class PropertyManager { ...@@ -99,6 +101,8 @@ public class PropertyManager {
* *
*/ */
public void init() { public void init() {
nomadHome = System.getenv("NOMADCLIENT_HOME");
clientFilesFoundPerControllerType = new HashMap<String, Boolean>(); clientFilesFoundPerControllerType = new HashMap<String, Boolean>();
sizePropertyNames = new HashMap<String, String>(); sizePropertyNames = new HashMap<String, String>();
propertyParser = new PropertyParser(); propertyParser = new PropertyParser();
...@@ -114,6 +118,7 @@ public class PropertyManager { ...@@ -114,6 +118,7 @@ public class PropertyManager {
Iterator<ClientServantDescriptor> it = ServantDatabase.getInstance().getDrivers().iterator(); Iterator<ClientServantDescriptor> it = ServantDatabase.getInstance().getDrivers().iterator();
while (it.hasNext()) { while (it.hasNext()) {
ClientServantDescriptor descriptor = it.next(); ClientServantDescriptor descriptor = it.next();
boolean clientFilesExist = readPropertiesClientFilesFor(descriptor.getType()); boolean clientFilesExist = readPropertiesClientFilesFor(descriptor.getType());
if (clientFilesExist) { if (clientFilesExist) {
Controller controller = DriverManager.getInstance().getDriver(descriptor.getName()); Controller controller = DriverManager.getInstance().getDriver(descriptor.getName());
...@@ -151,7 +156,13 @@ public class PropertyManager { ...@@ -151,7 +156,13 @@ public class PropertyManager {
return clientFilesFoundPerControllerType.get(controllerType); return clientFilesFoundPerControllerType.get(controllerType);
} }
String[] files = FileHelper.getFilesListByExtension(ConfigManager.CONTROLLERS_DIRECTORY + controllerType + ConfigManager.FILE_SEPARATOR, ConfigManager.PROPERTIES_PATTERN, true, true); // Necessary for NomadServerGUI: the client project of the PropertyManager can be another project that NomadGUI, but the client files remain in NomadGUI
String prefix = "";
if (nomadHome != null) {
prefix = nomadHome + ConfigManager.FILE_SEPARATOR;
}
String[] files = FileHelper.getFilesListByExtension(prefix + ConfigManager.CONTROLLERS_DIRECTORY + controllerType + ConfigManager.FILE_SEPARATOR, ConfigManager.PROPERTIES_PATTERN, true, true);
if (files == null || files.length == 0) { if (files == null || files.length == 0) {
// Search on server side // Search on server side
......
...@@ -151,8 +151,18 @@ public class ConfigManager { ...@@ -151,8 +151,18 @@ public class ConfigManager {
properties = new Properties(); properties = new Properties();
// Load all properties file from conf directory // Load all properties file from conf directory
List<String> propertiesFiles = new ArrayList<String>(Arrays.asList(FileHelper.getFilesListByExtension(CLIENT_CONF_DIRECTORY, PROPERTIES_EXTENSION, true, true))); List<String> propertiesFiles = new ArrayList<String>();
propertiesFiles.addAll(new ArrayList<String>(Arrays.asList(FileHelper.getFilesListByExtension(SERVER_CONF_DIRECTORY, PROPERTIES_EXTENSION, true, true))));
String[] files = FileHelper.getFilesListByExtension(CLIENT_CONF_DIRECTORY, PROPERTIES_EXTENSION, true, true);
if (files!= null) {
propertiesFiles.addAll(Arrays.asList(files));
}
files = FileHelper.getFilesListByExtension(SERVER_CONF_DIRECTORY, PROPERTIES_EXTENSION, true, true);
if (files != null) {
propertiesFiles.addAll(Arrays.asList(files));
}
Iterator<String> it = propertiesFiles.iterator(); Iterator<String> it = propertiesFiles.iterator();
while (it.hasNext()) { while (it.hasNext()) {
......
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