Changeset 10642 for trunk/gli


Ignore:
Timestamp:
2005-09-26T14:49:03+12:00 (19 years ago)
Author:
kjdon
Message:

added a new method to LocalLIbraryServer to check that the server.exe is actually running, and restart it if not, and call this when click preview button, so that if local library is down, then it gets restarted.

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/LocalLibraryServer.java

    r10517 r10642  
    4242
    4343    static private GSDLSiteConfig gsdlsite_cfg_file = null;
     44    static private File local_library_server_file = null;
     45
    4446    static private boolean running = false;
    45 
    4647
    4748    static public void addCollection(String collection_name)
     
    8687    }
    8788
    88 
    8989    static public void releaseCollection(String collection_name)
    9090    {
     
    9898    {
    9999    // Check the local library server.exe file exists
    100     File local_library_server_file = new File(local_library_server_file_path);
     100    local_library_server_file = new File(local_library_server_file_path);
    101101    if (!local_library_server_file.exists()) {
    102102        DebugStream.println("No local library at given file path.");
     
    223223    running = false;
    224224    }
    225 
    226 
     225   
     226    static public void checkServerRunning() {
     227    gsdlsite_cfg_file.load();
     228    if (gsdlsite_cfg_file.getURL() == null) {
     229        // need to restart the server again
     230        gsdlsite_cfg_file.set();
     231
     232        // Spawn local library server process
     233        String local_library_server_command = local_library_server_file.getAbsolutePath() + " " + gsdlsite_cfg_file.getSiteConfigFilename();
     234        Gatherer.spawnApplication(local_library_server_command);
     235
     236    }
     237    }
    227238    static private class OneSecondWait
    228239    {
  • trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java

    r10531 r10642  
    4848import org.greenstone.gatherer.Dictionary;
    4949import org.greenstone.gatherer.Gatherer;
     50import org.greenstone.gatherer.LocalLibraryServer;
    5051import org.greenstone.gatherer.cdm.SearchTypeManager;
    5152import org.greenstone.gatherer.cdm.CollectionDesignManager;
     
    799800        Gatherer.c_man.getCollection().cdm.save(); // save the config file just in case
    800801        configureHomeURL();
     802        if (LocalLibraryServer.isRunning()) {
     803        // if we are using the local library (isRunning is true), we need to make sure it is actually running
     804        LocalLibraryServer.checkServerRunning();
     805        }
    801806        Gatherer.spawnBrowser(homepage);
    802807
Note: See TracChangeset for help on using the changeset viewer.