Commit b35c0339 authored by helene ortiz's avatar helene ortiz
Browse files

re-implement code to generate GUI files for a controller or driver

parent 5f6c892d
......@@ -75,29 +75,7 @@ public class ResourceManager {
return ServantManagerAccessor.getInstance(serverId).readResourceFile(controllerType, fileName);
}
public void setFileContent(String controllerType, String fileName, String content) {
//System.out.println("H.ORTIZ: call to writeResourceFile commented .................................................." + fileName);
//ServantManagerAccessor.getInstance(serverId).writeResourceFile(controllerType, fileName, content);
/*
String fullFilePath = "/home/dpt/ortizh/tmp/" + fileName;
if (!new File(fullFilePath).exists()) {
try {
BufferedWriter out = new BufferedWriter(new FileWriter(fullFilePath));
out.write(content);
out.close();
} catch (IOException e) {
System.err.println("IOException while setting content of file " + fullFilePath);
e.printStackTrace();
}
}
*/
}
public void saveFile(String fileName, String content, int fileType) {
CommandZoneAccessor.getInstance(serverId).saveFile(fileName, content, fileType);
}
......
......@@ -485,7 +485,7 @@ public class PropertyManager {
} catch (ResourceNotFoundException e) {
// file does not exist on server side either
String propertiesFile = propertyParser.createPropertyFile(servant.getType(), propertyNamesAndTypes);
String propertiesFile = propertyParser.createPropertyFile("", servant.getType(), propertyNamesAndTypes);
if (propertiesFile != null) {
propertyParser.parseXmlFile(propertiesFile);
if (propertyParser.getProperties() != null) {
......
......@@ -207,7 +207,7 @@ public class PropertyParser extends GenericParser {
* Create a new file
* @param type
*/
public String createPropertyFile(String controllerType, Map propertiesAndTypes) {
public String createPropertyFile(String directory, String controllerType, Map propertiesAndTypes) {
String filename = controllerType + ConfigManager.PROPERTIES_PATTERN;
......@@ -234,8 +234,8 @@ public class PropertyParser extends GenericParser {
}
}
fileContent = fileContent + "</" + TAG_CONTROLLER + ">" + LINE_SEPARATOR;
ResourceManager.getInstance().setFileContent(controllerType, filename, fileContent);
filename = directory + ConfigManager.FILE_SEPARATOR + filename;
ResourceManager.getInstance().saveFile(filename, fileContent, -1);
return filename;
}
......
......@@ -58,6 +58,7 @@ public class ConfigManager {
public final static String PROPERTIES_EXTENSION = ".properties";
public final static String PROPERTIES_PATTERN = "Properties.xml";
public final static String VIEW_PATTERN = "View.xml";
public final static String COMMAND_VIEW_PATTERN = "CommandView.xml";
public final static String NOMAD_CLIENT_FILES = System.getProperty("user.home");
public static final String DOT_NOMAD_DIRECTORY = ".nomad";
......
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