Changeset 16990 for gli/trunk


Ignore:
Timestamp:
2008-08-25T13:28:51+12:00 (16 years ago)
Author:
ak19
Message:

After changing the gliserver url or library path url, a restart is now required when running the GLI client (remote GS server).

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

Legend:

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

    r16884 r16990  
    749749        }
    750750        url = null;
     751    }
     752    catch(ConnectionException connectException) {
     753       
     754        DebugStream.println(connectException.getMessage());
    751755    }
    752756    catch (Exception exception) {           
  • gli/trunk/src/org/greenstone/gatherer/gui/Preferences.java

    r16884 r16990  
    650650    public void actionPerformed(ActionEvent event)
    651651    {
     652        // Several options requiring restarting the GLI to apply:
     653        // interface font, interface language, changed gliserver url or library url
     654        boolean restart_required = false;
     655        String restart_message = "";
     656
     657       
    652658        // Connection preferences
    653659        String program_str = program_field.getText();
     
    657663        Configuration.setPreviewCommand(program_str);
    658664
     665
     666        String old_library_url = Configuration.library_url.toString();
    659667        String library_url_string = library_path_field.getText();
     668        if(!old_library_url.equals(library_url_string)) {
     669
     670        // If the server is remote and the library path's been changed, then GLI client needs restart
     671        // If the server is local, GLI is going to work with the collection of GSDLPath anyway,
     672        // even if the library path for previewing has changed
     673        if (Gatherer.isGsdlRemote) {
     674            restart_required = true;
     675            restart_message = Dictionary.get("Preferences.General.Manual_Restart_Required");
     676        }
     677        if(Gatherer.c_man.getCollection() != null) {
     678            // if the gliserver url has changed while a collection is open,
     679            // close the open collection of the old library URL
     680            Gatherer.c_man.saveCollection();
     681            Gatherer.c_man.closeCollection();
     682            Configuration.setString("general.open_collection"+Configuration.gliPropertyNameSuffix(), true, "");
     683        }
     684        }
    660685        if (library_url_string.equals("")) {
    661686        Configuration.library_url = null;
     
    674699
    675700        if (Gatherer.isGsdlRemote && !Gatherer.GS3) {
     701        String old_gliserver_url = Configuration.gliserver_url.toString();
    676702        String gliserver_url_string = gliserver_url_field.getText();
     703        if(!old_gliserver_url.equals(gliserver_url_string)) {
     704            restart_required = true;
     705            restart_message = Dictionary.get("Preferences.General.Manual_Restart_Required");
     706
     707            if(Gatherer.c_man.getCollection() != null) {
     708            // if the gliserver url has changed while a collection is open,
     709            // close the open collection of the old gliserver URL
     710            Gatherer.c_man.saveCollection();
     711            Gatherer.c_man.closeCollection();
     712            Configuration.setString("general.open_collection"+Configuration.gliPropertyNameSuffix(), true, "");
     713            }
     714        }
    677715        if (gliserver_url_string.equals("")) {
    678716            Configuration.gliserver_url = null;
     
    688726        Configuration.setString("general.gliserver_url", true, gliserver_url_string);
    689727        }
     728       
    690729
    691730        boolean site_changed = false;
     
    698737        Configuration.setSiteAndServlet(new_site, (String)servlet_combobox.getSelectedItem());
    699738        }
    700 
     739       
    701740        Configuration.set("general.use_proxy", true, use_proxy_checkbox.isSelected());
    702741        Configuration.setString("general.proxy_host", true, proxy_host_field.getText());
     
    709748        Configuration.set("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC, view_extracted_metadata_checkbox.isSelected());
    710749
    711         // Two options requiring restarting the GLI to apply: interface font, and interface language
    712         boolean restart_required = false;
    713750
    714751        // GLI interface font
     
    717754        Configuration.setString("general.font", true, font_field.getText());
    718755        restart_required = true;
     756        restart_message = Dictionary.get("Preferences.General.Restart_Required");
    719757        }
    720758
     
    724762        Configuration.setLocale("general.locale", Configuration.GENERAL_SETTING, ((DictionaryEntry) language_combobox.getSelectedItem()).getLocale());
    725763        restart_required = true;
     764        restart_message = Dictionary.get("Preferences.General.Restart_Required");
    726765        }
    727766
    728767        // Inform the user that a restart is required, if necessary
    729768        if (restart_required) {
    730         JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("Preferences.General.Restart_Required"), Dictionary.get("General.Warning"), JOptionPane.WARNING_MESSAGE);
     769        JOptionPane.showMessageDialog(Gatherer.g_man, restart_message, Dictionary.get("General.Warning"), JOptionPane.WARNING_MESSAGE);
    731770        }
    732771
     
    766805        if (Gatherer.GS3 && site_changed && Gatherer.c_man.getCollection() != null && !Gatherer.isGsdlRemote) {
    767806        // shut down the collection
    768         System.err.println("shutting down teh collection");
     807        System.err.println("shutting down the collection");
    769808        Gatherer.g_man.saveThenCloseCurrentCollection();
    770809        }
Note: See TracChangeset for help on using the changeset viewer.