Changeset 18650

Show
Ignore:
Timestamp:
10.03.2009 13:42:44 (10 years ago)
Author:
ak19
Message:

Renaming toplevel gsdlsite.cfg to llssite.cfg (lls = local library server)

Files:
1 modified

Legend:

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

    r18136 r18650  
    4545    static final private String QUIT_COMMAND = "?a=config&cmd=kill"; 
    4646 
    47     static private GSDLSiteConfig gsdlsite_cfg_file = null; 
     47    static private LLSSiteConfig llssite_cfg_file = null; 
    4848    static private File local_library_server_file = null; 
    4949 
     
    9797    { 
    9898    if (!running) return false; 
    99     gsdlsite_cfg_file.load(); 
    100     if (gsdlsite_cfg_file.getURL() == null)  return false; 
     99    llssite_cfg_file.load(); 
     100    if (llssite_cfg_file.getURL() == null)  return false; 
    101101    return true; 
    102102    } 
     
    124124 
    125125    // Check if the server is already running 
    126     gsdlsite_cfg_file = new GSDLSiteConfig(local_library_server_file); 
    127     String url = gsdlsite_cfg_file.getURL(); 
     126    llssite_cfg_file = new LLSSiteConfig(local_library_server_file); 
     127    String url = llssite_cfg_file.getURL(); 
    128128    if (url != null) { 
    129129        // If it is already running then set the Greenstone web server address and we're done 
     
    139139 
    140140    // Configure the server for immediate entry 
    141     //gsdlsite_cfg_file.set(); 
     141    //llssite_cfg_file.set(); 
    142142 
    143143    // Spawn local library server process 
    144     String local_library_server_command = local_library_server_file.getAbsolutePath() + " " + gsdlsite_cfg_file.getSiteConfigFilename(); 
     144    String local_library_server_command = local_library_server_file.getAbsolutePath() + " " + llssite_cfg_file.getSiteConfigFilename(); 
    145145    Gatherer.spawnApplication(local_library_server_command); 
    146146 
    147147    // Wait until program has started, by reloading and checking the URL field 
    148     gsdlsite_cfg_file.load(); 
     148    llssite_cfg_file.load(); 
    149149    int attempt_count = 0; 
    150     while (gsdlsite_cfg_file.getURL() == null) { 
     150    while (llssite_cfg_file.getURL() == null) { 
    151151        new OneSecondWait();  // Wait one second (give or take) 
    152         gsdlsite_cfg_file.load(); 
     152        llssite_cfg_file.load(); 
    153153        attempt_count++; 
    154154 
     
    165165    // Ta-da. Now the url should be available 
    166166    try { 
    167         Configuration.library_url = new URL(gsdlsite_cfg_file.getURL()); 
     167        Configuration.library_url = new URL(llssite_cfg_file.getURL()); 
    168168    } 
    169169    catch (MalformedURLException exception) { 
     
    180180        try { 
    181181        // If this fails then we try changing the url to be localhost 
    182         Configuration.library_url = new URL(gsdlsite_cfg_file.getLocalHostURL()); 
     182        Configuration.library_url = new URL(llssite_cfg_file.getLocalHostURL()); 
    183183        DebugStream.println("Try connecting to server on local host: '" + Configuration.library_url + "'"); 
    184184        URLConnection connection = Configuration.library_url.openConnection(); 
     
    206206 
    207207    // Wait until program has stopped, by reloading and checking the URL field 
    208     gsdlsite_cfg_file.load(); 
     208    llssite_cfg_file.load(); 
    209209    int attempt_count = 0; 
    210     while (gsdlsite_cfg_file.getURL() != null) { 
     210    while (llssite_cfg_file.getURL() != null) { 
    211211        new OneSecondWait();  // Wait one second (give or take) 
    212         gsdlsite_cfg_file.load(); 
     212        llssite_cfg_file.load(); 
    213213        attempt_count++; 
    214214 
     
    223223    } 
    224224 
    225     // Restore the gsdlsite_cfg. 
    226     gsdlsite_cfg_file.restore(); 
     225    // Restore the llssite_cfg. 
     226    llssite_cfg_file.restore(); 
    227227 
    228228    // If the local server is still running then our changed values will get overwritten. 
    229     if (gsdlsite_cfg_file.getURL() != null) { 
     229    if (llssite_cfg_file.getURL() != null) { 
    230230        JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("Server.QuitManual"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE); 
    231231    } 
     
    236236    static public void checkServerRunning() { 
    237237    if (!running) return; // don't worry about it if its not supposed to be running  
    238     gsdlsite_cfg_file.load(); 
    239     if (gsdlsite_cfg_file.getURL() == null) { 
     238    llssite_cfg_file.load(); 
     239    if (llssite_cfg_file.getURL() == null) { 
    240240        // need to restart the server again 
    241         gsdlsite_cfg_file.set(); 
     241        llssite_cfg_file.set(); 
    242242 
    243243        // Spawn local library server process 
    244         String local_library_server_command = local_library_server_file.getAbsolutePath() + " " + gsdlsite_cfg_file.getSiteConfigFilename(); 
     244        String local_library_server_command = local_library_server_file.getAbsolutePath() + " " + llssite_cfg_file.getSiteConfigFilename(); 
    245245        Gatherer.spawnApplication(local_library_server_command); 
    246246 
     
    262262 
    263263 
    264     static public class GSDLSiteConfig 
     264    static public class LLSSiteConfig 
    265265    extends LinkedHashMap { 
    266     private File gsdlsite_cfg; 
     266    private File llssite_cfg; 
    267267    private File glisite_cfg; 
    268268    private String autoenter_initial; 
     
    275275    static final private String GLISITE_CFG = "glisite.cfg"; 
    276276    static final private String GSDL = "gsdl"; 
    277     static final private String GSDLSITE_CFG = "gsdlsite.cfg"; 
     277    static final private String LLSSITE_CFG = "llssite.cfg"; 
    278278    static final private String LOCAL_HOST = "http://localhost";  
    279279    static final private String PORTNUMBER = "portnumber"; 
     
    284284    static final private String URL = "url"; 
    285285 
    286     public GSDLSiteConfig(File server_exe) { 
    287         debug("New GSDLSiteConfig for: " + server_exe.getAbsolutePath()); 
     286    public LLSSiteConfig(File server_exe) { 
     287        debug("New LLSSiteConfig for: " + server_exe.getAbsolutePath()); 
    288288         
    289         gsdlsite_cfg = new File(server_exe.getParentFile(), GSDLSITE_CFG); 
     289        llssite_cfg = new File(server_exe.getParentFile(), LLSSITE_CFG); 
    290290        glisite_cfg = new File(server_exe.getParentFile(), GLISITE_CFG); 
    291291 
     
    293293        if(glisite_cfg.exists()) { 
    294294        configFile = glisite_cfg; 
    295         } else if(gsdlsite_cfg.exists()) { 
    296         configFile = gsdlsite_cfg; 
     295        } else if(llssite_cfg.exists()) { 
     296        configFile = llssite_cfg; 
    297297        } else { 
    298         debug("Neither the file glisite.cfg nor GSDLsite.cfg can be found!"); 
     298        debug("Neither the file glisite.cfg nor llssite.cfg can be found!"); 
    299299        } 
    300300         
     
    329329     
    330330    public boolean exists() { 
    331         return gsdlsite_cfg.exists(); 
     331        return llssite_cfg.exists(); 
    332332    } 
    333333 
     
    449449 
    450450    private void save() { 
    451         //debug("Save: " + gsdlsite_cfg.getAbsolutePath()); 
     451        //debug("Save: " + llssite_cfg.getAbsolutePath()); 
    452452        debug("Save: " + glisite_cfg.getAbsolutePath()); 
    453453        try { 
    454         //BufferedWriter out = new BufferedWriter(new FileWriter(gsdlsite_cfg, false)); 
     454        //BufferedWriter out = new BufferedWriter(new FileWriter(llssite_cfg, false)); 
    455455        BufferedWriter out = new BufferedWriter(new FileWriter(glisite_cfg, false)); 
    456456        for(Iterator keys = keySet().iterator(); keys.hasNext(); ) {