Changeset 24503
- Timestamp:
- 2011-08-27T19:23:36+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/server/Server2.java
r24491 r24503 35 35 36 36 protected String libraryURL; 37 protected String property_prefix; 37 38 38 39 private class QuitListener extends Thread … … 76 77 // When the user finally presses the Enter Library button and so has started up the server, the correct 77 78 // url will be written out to the configfile. 79 String url = property_prefix+"url"; 78 80 if(config_properties.getProperty(BaseServer.Property.AUTOSTART, "").equals("0")) { 79 if(config_properties.getProperty( "url") == null) {80 config_properties.setProperty( "url", URL_PENDING);81 if(config_properties.getProperty(url) == null) { 82 config_properties.setProperty(url, URL_PENDING); 81 83 ScriptReadWrite scriptReadWrite = new ScriptReadWrite(); 82 84 ArrayList fileLines = scriptReadWrite.readInFile(BaseServer.config_properties_file); 83 scriptReadWrite.replaceOrAddLine(fileLines, "url", URL_PENDING, true);85 scriptReadWrite.replaceOrAddLine(fileLines, url, URL_PENDING, true); 84 86 scriptReadWrite.writeOutFile(config_properties_file, fileLines); 85 87 } … … 104 106 105 107 106 public Server2(String gsdl2_home, String lang, String configfile, int quitPort, String property_prefix)108 public Server2(String gsdl2_home, String lang, String configfile, int quitPort, String mode) 107 109 { 108 110 super(gsdl2_home, lang, configfile, "etc"+File.separator+"logs-gsi"); … … 113 115 114 116 // property_prefix is the mode we're running in (gli or empty) and contains the prefix 115 // string to look for in config file for auto_enter and start_browser properties 117 // string to look for in config file for auto_enter, start_browser and url properties 118 property_prefix = mode; 116 119 if(!property_prefix.equals("") && !property_prefix.endsWith(".")) { // ensure a '.' is suffixed if non-empty 117 120 property_prefix += "."; … … 164 167 // url will be written out to the configfile. 165 168 if(config_properties.getProperty(BaseServer.Property.AUTOSTART, "").equals("0")) {//if(configfile.endsWith("llssite.cfg")) { 166 if(config_properties.getProperty("url") == null) { 167 config_properties.setProperty("url", URL_PENDING); 169 String url = property_prefix+"url"; 170 if(config_properties.getProperty(url) == null) { 171 config_properties.setProperty(url, URL_PENDING); 168 172 ScriptReadWrite scriptReadWrite = new ScriptReadWrite(); 169 173 ArrayList fileLines = scriptReadWrite.readInFile(BaseServer.config_properties_file); 170 scriptReadWrite.replaceOrAddLine(fileLines, "url", URL_PENDING, true);174 scriptReadWrite.replaceOrAddLine(fileLines, url, URL_PENDING, true); 171 175 scriptReadWrite.writeOutFile(config_properties_file, fileLines); 172 176 } … … 374 378 for (int i = fileLines.size()-1; i >= 0 && !done; i--) { 375 379 String line = ((String) fileLines.get(i)).trim(); 376 if(line.startsWith( "url=")) {380 if(line.startsWith(property_prefix+"url=")) { 377 381 fileLines.remove(i); 378 382 done = true; … … 429 433 ScriptReadWrite scriptReadWrite = new ScriptReadWrite(); 430 434 ArrayList fileLines = scriptReadWrite.readInFile(BaseServer.config_properties_file); 431 scriptReadWrite.replaceOrAddLine(fileLines, "url", libraryURL, true);435 scriptReadWrite.replaceOrAddLine(fileLines, property_prefix+"url", libraryURL, true); 432 436 scriptReadWrite.replaceOrAddLine(fileLines, "portnumber", port, false); // write the correct port 433 437 scriptReadWrite.writeOutFile(config_properties_file, fileLines);
Note:
See TracChangeset
for help on using the changeset viewer.