Changeset 16329
- Timestamp:
- 2008-07-10T12:26:44+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/trunk/src/org/greenstone/gatherer/Gatherer.java
r15506 r16329 170 170 // We don't have a local Greenstone! 171 171 go.gsdl_path = null; 172 go.gsdl3_path=null; 173 go.gsdl3_src_path=null; 172 174 173 175 // We have to use our own collect directory since we can't use the Greenstone one 174 176 setCollectDirectoryPath(getGLIUserDirectoryPath() + "collect" + File.separator); 175 if (go.run_gsdl3){176 GS3=true;177 go.gsdl3_path=null;178 go.gsdl3_src_path=null;179 }180 177 } 181 178 // No, we have a local Greenstone … … 198 195 } 199 196 200 if (!go.run_gsdl3){ 201 Configuration.CONFIG_XML = "configRemote.xml"; 202 }else{ 203 Configuration.GS3_CONFIG_XML = "config3Remote.xml"; 204 } 197 Configuration.CONFIG_XML = "configRemote.xml"; 205 198 206 199 File collect_directory = new File(Gatherer.getCollectDirectoryPath()); … … 212 205 if (go.fedora_info.isActive()) { 213 206 Configuration.TEMPLATE_CONFIG_XML = "xml/" + Configuration.FEDORA_CONFIG_PREFIX + Configuration.CONFIG_XML; 214 215 }207 } 208 // else, the CONFIG_XML uses the default config file, which is for the local GS server 216 209 } 217 210 … … 268 261 new Configuration(getGLIUserDirectoryPath(), gsdl_path, gsdl3_path, gsdl3_src_path, site_name, 269 262 fedora_info); 270 263 271 264 // Check we know where Perl is 272 265 Configuration.perl_path = perl_path; … … 304 297 } 305 298 299 // Finally, we're ready to find out the version of the remote Greenstone server 300 if(isGsdlRemote) { 301 int greenstoneVersion = 2; 302 requestGLIServerURL(); 303 gliserver_url_string = Configuration.gliserver_url.toString(); 304 305 greenstoneVersion = RemoteGreenstoneServer.getGreenstoneVersion(); 306 // Display the version to make error reports a lot more useful 307 System.err.println("Remote Greenstone server version: " + greenstoneVersion); 308 if(greenstoneVersion >= 3) { 309 this.GS3 = true; 310 Configuration.prepareForGS3(); 311 } 312 313 library_url_string = RemoteGreenstoneServer.getLibraryURL(Configuration.gliserver_url.toString()); 314 } 306 315 307 316 // Start up the local library server, if that's what we want … … 309 318 LocalLibraryServer.start(gsdl_path, local_library_path); 310 319 } 311 320 312 321 // The "-library_url" option overwrites anything in the config files 313 322 if (library_url_string != null && library_url_string.length() > 0) { … … 320 329 } 321 330 } 331 322 332 323 333 // Check that we now know the Greenstone library URL, since we need this for previewing collections … … 325 335 if (Configuration.library_url == null) { 326 336 missingEXEC(); 327 328 if ((Configuration.library_url!=null) && isGsdlRemote && (gliserver_url_string==null)){329 if (GS3){330 default_gliserver_url = new URL(Configuration.library_url.toString() + "/cgi-bin/gliserver4gs3.pl");331 }else{332 String default_gliserver_str = "";333 String library_url_str = Configuration.library_url.toString();334 int cut_pos = library_url_str.lastIndexOf("/library");335 336 if (cut_pos>0) {337 default_gliserver_str = library_url_str.substring(0,cut_pos) + "/gliserver.pl";338 }339 else {340 cut_pos = library_url_str.lastIndexOf("/");341 if (cut_pos>0) {342 default_gliserver_str = library_url_str.substring(0,cut_pos) + "/gliserver.pl";343 }344 else {345 default_gliserver_str = library_url_str + "/gliserver.pl";346 }347 }348 349 default_gliserver_url = new URL(default_gliserver_str);350 }351 missingGLIServer();352 }353 337 } 354 338 … … 366 350 // If we're using a remote Greenstone we need to know where the gliserver script is 367 351 DebugStream.println("Configuration.gliserver_url = " + Configuration.gliserver_url); 368 if (isGsdlRemote) {369 if (Configuration.gliserver_url == null) {370 if (Configuration.library_url != null) {371 if (GS3){372 default_gliserver_url = new URL(Configuration.library_url.toString() + "/cgi-bin/gliserver4gs3.pl");373 }else{374 String library_url = Configuration.library_url.toString();375 default_gliserver_url = new URL(library_url.substring(0,library_url.lastIndexOf("/library")) + "/gliserver.pl");376 }377 }378 missingGLIServer();379 }380 if (Configuration.gliserver_url != null) {381 gliserver_url_string = Configuration.gliserver_url.toString();382 }383 }384 352 385 353 if (GS3) { … … 480 448 } 481 449 450 482 451 // Create GUI Manager (last) or else suffer the death of a thousand NPE's 483 452 g_man = new GUIManager(size); … … 497 466 498 467 } 468 469 470 /** Returns the correct version of the (local or remote) Greenstone server if init() has already been called. */ 471 public static int serverVersionNumber() { 472 return GS3 ? 3 : 2; 473 } 474 475 /** Returns "Server: version number" if init() has already been called. */ 476 public static String getServerVersionAsString() { 477 return "Server: v" + serverVersionNumber(); 478 } 499 479 500 480 public void openGUI() … … 607 587 608 588 // Get the gui to deallocate 609 g_man.destroy(); 610 g_man_built = false; 589 if(g_man != null) { 590 g_man.destroy(); 591 g_man_built = false; 592 } 611 593 612 594 // Flush debug … … 818 800 dialog = new WarningDialog("warning.MissingEXEC", Dictionary.get("MissingEXEC.Title"), Dictionary.get("MissingEXEC.Message"), "general.library_url", false); 819 801 } 820 dialog.setValueField(new URLField (Configuration.getColor("coloring.editable_foreground", false), Configuration.getColor("coloring.editable_background", false)));802 dialog.setValueField(new URLField.Text(Configuration.getColor("coloring.editable_foreground", false), Configuration.getColor("coloring.editable_background", false))); 821 803 dialog.display(); 822 804 dialog.dispose(); … … 891 873 } 892 874 catch (Exception exception) { 875 // TODO: move into dictionary 893 876 String[] errorMessage = {"Failed to connect to the Fedora server.", "It might not be running, or", 894 877 "incorrect username and/or password."}; … … 909 892 910 893 911 static private void missingGLIServer()894 static private void requestGLIServerURL() 912 895 { 913 896 WarningDialog dialog; 914 if (GS3) { 915 dialog = new WarningDialog("warning.MissingGLIServer", Dictionary.get("MissingGLIServer_GS3.Title"), Dictionary.get("MissingGLIServer_GS3.Message"), "general.gliserver_url", false); 916 }else { 917 dialog = new WarningDialog("warning.MissingGLIServer", Dictionary.get("MissingGLIServer.Title"), Dictionary.get("MissingGLIServer.Message"), "general.gliserver_url", false); 918 } 919 dialog.setValueField(new URLField(Configuration.getColor("coloring.editable_foreground", false), Configuration.getColor("coloring.editable_background", false))); 920 897 String[] defaultURLs = { 898 "http://localhost:8080/greenstone3/cgi-bin/gliserver.pl", 899 "http://localhost:8080/gsdl/cgi-bin/gliserver.pl" 900 }; 901 902 // Warning dialog with no cancel button and no "turn off warning" checkbox 903 // (since user-input of the gliserver script is mandatory) 904 dialog = new WarningDialog("warning.MissingGLIServer", Dictionary.get("MissingGLIServer.Title"), Dictionary.get("MissingGLIServer.Message"), "general.gliserver_url", false, false); 905 906 dialog.setValueField(new URLField.DropDown(Configuration.getColor("coloring.editable_foreground", false), 907 Configuration.getColor("coloring.editable_background", false), 908 defaultURLs, "general.gliserver_url", "general.open_collection", 909 "gliserver.pl")); 910 921 911 if (Gatherer.default_gliserver_url!=null){ 922 912 dialog.setValueField(Gatherer.default_gliserver_url.toString()); 923 913 } 914 915 // A WarningDialog cannot always be made to respond (let alone to exit the program) on close. We 916 // handle the response of this particular WarningDialog here: a URL for gliserver.pl is a crucial 917 // piece of user-provided data. Therefore, if no URL was entered for gliserver.pl, it'll exit safely. 918 dialog.addWindowListener(new WindowAdapter() { 919 public void windowClosing(WindowEvent e) { 920 Gatherer.exit(); 921 } 922 }); 924 923 925 924 dialog.display(); 926 925 dialog.dispose(); 927 926 dialog = null; 927 928 928 929 929 String gliserver_url_string = Configuration.getString("general.gliserver_url", true);
Note:
See TracChangeset
for help on using the changeset viewer.