Changeset 22660

Show
Ignore:
Timestamp:
17.08.2010 18:25:53 (9 years ago)
Author:
ak19
Message:

Updated Server2 to work with changes to GLI's LocalLibraryServer?: moveable collectdir.

Files:
1 modified

Legend:

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

    r22085 r22660  
    5151        // wait for a connection 
    5252        connection = serverSocket.accept(); 
     53        boolean stop = false; 
    5354 
    5455        // read input 
     
    5657            BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); 
    5758            String line = null; 
    58             if((line = reader.readLine()) != null) { 
     59            while((line = reader.readLine()) != null) { 
    5960            if(line.equals("QUIT")) { 
     61                stop = true;                 
    6062                // Server2.this.recordSuccess("In QuitListener - line is QUIT"); 
    6163                reader.close(); 
     
    6365                serverSocket.close(); 
    6466                serverSocket = null; 
     67                break; 
     68            } else if(line.equals("RECONFIGURE")) { 
     69                server_control_.displayMessage(dictionary.get("ServerControl.Configuring")); 
     70                reconfigRequired(); 
     71            } else if(line.equals("RESTART")) { 
     72 
     73                // If the GSI is set to NOT autoenter/autostart the server, then write url=URL_PENDING out to the file. 
     74                // When the user finally presses the Enter Library button and so has started up the server, the correct 
     75                // url will be written out to the configfile. 
     76                if(config_properties.getProperty(BaseServer.Property.AUTOSTART, "").equals("0")) { 
     77                if(config_properties.getProperty("url") == null) { 
     78                    config_properties.setProperty("url", URL_PENDING); 
     79                    ScriptReadWrite scriptReadWrite = new ScriptReadWrite(); 
     80                    ArrayList fileLines = scriptReadWrite.readInFile(BaseServer.config_properties_file); 
     81                    scriptReadWrite.replaceOrAddLine(fileLines, "url", URL_PENDING, true); 
     82                    scriptReadWrite.writeOutFile(config_properties_file, fileLines); 
     83                } 
     84                } 
     85 
     86                autoStart(); 
    6587            } 
    6688            } 
     
    6890            Server2.this.recordError("Exception in QuitListener thread."); 
    6991        } finally { 
    70             Server2.this.stop(); 
    71             System.exit(0); 
     92            if(stop) { 
     93            Server2.this.stop(); 
     94            System.exit(0); 
     95            } 
    7296        } 
    7397        } catch(IOException ioe) {