Changeset 22678

Show
Ignore:
Timestamp:
18.08.2010 21:26:45 (9 years ago)
Author:
ak19
Message:

More changes for making the collectdir movable (ticket 152): (1) Changes to GLI code so that llssite and glisite are updated to contain the COLLECTHOME property to tell server.exe where the new collect dir is. (2) server.exe must be told that it needs to restart (so it can read the new collecthome).

Location:
main/trunk/gli/src/org/greenstone/gatherer
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java

    r22605 r22678  
    424424    ProfileXMLFileManager.clearProfileXMLFile(); 
    425425 
     426    // If we're using the Local Library we must release the collection before writing to the collect.cfg file 
     427    if(Gatherer.isLocalLibrary) { 
     428        LocalLibraryServer.releaseCollection(collection.getName()); 
     429    } 
     430     
    426431    collection.destroy(); 
    427432    collection = null; 
  • main/trunk/gli/src/org/greenstone/gatherer/greenstone/LocalLibraryServer.java

    r22661 r22678  
     1/** 
    12/** 
    23 *############################################################################ 
     
    4849    static final private String RELEASE_COMMAND = "?a=config&cmd=release-collection&c="; 
    4950    static final private String QUIT_COMMAND = "?a=config&cmd=kill"; 
     51    static final private String RESTART_COMMAND = "?a=config&cmd=restart"; 
    5052 
    5153    static private LLSSiteConfig llssite_cfg_file = null; 
     
    295297     * the web server launched by GLI. */ 
    296298    static public void reconfigure() { 
    297     if(isPersistentServer) { 
    298         System.err.println("***** Reconfigure is not yet implemented for server.exe"); 
     299    if(isPersistentServer) {                 
     300        // 1st: server may have nulled URL if server was stopped inbetween,  
     301        // so load that new URL, if GLI conf file modified 
     302        // Then put the new collectDir into the GLI configfile being used 
     303        llssite_cfg_file.load(true);         
     304         
     305        String collectDir = Gatherer.getCollectDirectoryPath(); 
     306        collectDir = collectDir.substring(0, collectDir.length()-1); // remove file separator at end 
     307        llssite_cfg_file.put(LLSSiteConfig.COLLECTHOME, collectDir);             
     308        llssite_cfg_file.save(); 
     309         
     310        // tell the server to restart, so it will read the new configuration 
     311         
     312        // (1) need a server to be running in order for us to send a restart message to it 
     313        if(checkServerRunning()) { // if true, it wasn't running before, but has now restarted the server. We're done 
     314            return;  
     315        } 
     316        // (2) otherwise the server may already have been running, need to tell it to restart after setting the collect dir 
     317        if(running) { 
     318            config(RESTART_COMMAND);         
     319        }        
    299320        return; 
    300321    } 
     
    650671    static final private String TRUE = "1"; 
    651672    static final private String URL = "url"; 
    652  
     673    static final private String COLLECTHOME = "collecthome"; 
     674     
    653675    static final public String URL_PENDING = "URL_pending"; 
    654676 
     
    850872            put(key, value); 
    851873            } 
    852             in.close(); 
     874             
     875            in.close(); 
    853876        } 
    854877        catch (Exception error) {