Changeset 24503

Show
Ignore:
Timestamp:
27.08.2011 19:23:36 (8 years ago)
Author:
ak19
Message:

Still part of the changes for introducing the --mode=gli flag that's passed to the GS2 server so that we can merge the two cfg files glisite and llssite. Now the url property in the config file is also to be prefixed with the mode, so that GLI's LocalLibraryServer? can work out whether GLI launched the GSI or whether it was launched independently (outside GLI).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/server/Server2.java

    r24491 r24503  
    3535     
    3636    protected String libraryURL; 
     37    protected String property_prefix; 
    3738     
    3839    private class QuitListener extends Thread  
     
    7677                // When the user finally presses the Enter Library button and so has started up the server, the correct 
    7778                // url will be written out to the configfile. 
     79                String url = property_prefix+"url"; 
    7880                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); 
    8183                    ScriptReadWrite scriptReadWrite = new ScriptReadWrite(); 
    8284                    ArrayList fileLines = scriptReadWrite.readInFile(BaseServer.config_properties_file); 
    83                     scriptReadWrite.replaceOrAddLine(fileLines, "url", URL_PENDING, true); 
     85                    scriptReadWrite.replaceOrAddLine(fileLines, url, URL_PENDING, true); 
    8486                    scriptReadWrite.writeOutFile(config_properties_file, fileLines); 
    8587                } 
     
    104106 
    105107 
    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) 
    107109    { 
    108110    super(gsdl2_home, lang, configfile, "etc"+File.separator+"logs-gsi");    
     
    113115     
    114116    // 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; 
    116119    if(!property_prefix.equals("") && !property_prefix.endsWith(".")) { // ensure a '.' is suffixed if non-empty 
    117120        property_prefix += "."; 
     
    164167    // url will be written out to the configfile. 
    165168    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); 
    168172        ScriptReadWrite scriptReadWrite = new ScriptReadWrite(); 
    169173        ArrayList fileLines = scriptReadWrite.readInFile(BaseServer.config_properties_file); 
    170         scriptReadWrite.replaceOrAddLine(fileLines, "url", URL_PENDING, true); 
     174        scriptReadWrite.replaceOrAddLine(fileLines, url, URL_PENDING, true); 
    171175        scriptReadWrite.writeOutFile(config_properties_file, fileLines); 
    172176        } 
     
    374378    for (int i = fileLines.size()-1; i >= 0 && !done; i--) { 
    375379        String line = ((String) fileLines.get(i)).trim(); 
    376         if(line.startsWith("url=")) { 
     380        if(line.startsWith(property_prefix+"url=")) { 
    377381        fileLines.remove(i); 
    378382        done = true; 
     
    429433    ScriptReadWrite scriptReadWrite = new ScriptReadWrite(); 
    430434    ArrayList fileLines = scriptReadWrite.readInFile(BaseServer.config_properties_file); 
    431     scriptReadWrite.replaceOrAddLine(fileLines, "url", libraryURL, true); 
     435    scriptReadWrite.replaceOrAddLine(fileLines, property_prefix+"url", libraryURL, true); 
    432436    scriptReadWrite.replaceOrAddLine(fileLines, "portnumber", port, false); // write the correct port 
    433437    scriptReadWrite.writeOutFile(config_properties_file, fileLines);