Changeset 19547
- Timestamp:
- 2009-05-21T16:44:28+12:00 (15 years ago)
- Location:
- gli/trunk/src/org/greenstone/gatherer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/trunk/src/org/greenstone/gatherer/greenstone/LocalLibraryServer.java
r19544 r19547 415 415 String url = llssite_cfg_file.getURL(); 416 416 if(url != null) { 417 if(isURLPending()) { 418 running = false; 419 return; 420 } 421 422 // else, valid URL: 417 423 try { 418 424 Configuration.library_url = new URL(url); … … 422 428 exception.printStackTrace(); 423 429 } 424 } else { 425 // need to restart the server again 426 427 // if we were running an independently launched GSI before, but the GSI has been 428 // exited, it would need to be relaunched, but from within GLI (dependent) this time. 429 if(llssite_cfg_file.isIndependentGSI()) { 430 // first save the current configFile (llssite.cfg), then set to use glisite.cfg 431 llssite_cfg_file.save(); 432 llssite_cfg_file.relaunchAsDependentGSI(local_library_server_file); 430 } 431 else { // NO URL in current ConfigFile, check the other configfile for a URL 432 // to see if the server was restarted using that file. 433 // Otherwise need to restart the server again with GLIsite.cfg 434 llssite_cfg_file.save(); // save the configfile, because we may be reloading another 435 436 if(llssite_cfg_file.usingLLS_configFile()) { // if a GSI is already using llssite_cfg, this would have loaded it in 437 if(isURLPending()) { 438 running = false; 439 } else { 440 running = true; 441 } 442 return; // don't need to launch the server, one has been independently launched 433 443 } else { 434 // We were using glisite.cfg before, don't need to swap config files 435 llssite_cfg_file.set(); 436 } 437 // Spawn local library server process 438 String local_library_server_command = local_library_server_file.getAbsolutePath() + getExtraLaunchArguments(llssite_cfg_file); 439 running = false; 440 Gatherer.spawnApplication(local_library_server_command, ID); 441 try { 442 testServerRunning(); // don't return until the webserver is up and running 443 } catch (IOException bad_url_connection) { 444 DebugStream.println("Can't connect to server on address " + Configuration.library_url); 444 // else we try using the glisite configfile 445 llssite_cfg_file.useGLISiteCfg(local_library_server_file); 446 //llssite_cfg_file.set(); 447 448 // Spawn local library server process 449 String local_library_server_command = local_library_server_file.getAbsolutePath() + getExtraLaunchArguments(llssite_cfg_file); 445 450 running = false; 451 Gatherer.spawnApplication(local_library_server_command, ID); 452 try { 453 testServerRunning(); // don't return until the webserver is up and running 454 } catch (IOException bad_url_connection) { 455 DebugStream.println("Can't connect to server on address " + Configuration.library_url); 456 running = false; 457 } 446 458 } 447 459 } … … 492 504 static final public String URL_PENDING = "URL_pending"; 493 505 506 494 507 public LLSSiteConfig(File server_exe) { 495 508 debug("New LLSSiteConfig for: " + server_exe.getAbsolutePath()); … … 508 521 // else we try using the glisite configfile 509 522 useGLISiteCfg(server_exe); 510 }511 512 if(configFile != null && configFile.exists()) {513 System.err.println("Using configfile: " + configFile);514 lastModified = configFile.lastModified();515 523 } 516 524 } … … 542 550 configFile = glisite_cfg; 543 551 load(false); // force reload 552 lastModified = configFile.lastModified(); 544 553 } 545 554 } … … 552 561 * and, if so, it would have loaded in the llssite_cfg configFile. 553 562 */ 554 p rivateboolean usingLLS_configFile() {563 public boolean usingLLS_configFile() { 555 564 if(!llssite_cfg.exists()) { 556 565 return false; 557 566 } 558 567 559 // check if the configfile contains the URL line568 // Now to check if the configfile contains the URL line 560 569 configFile = llssite_cfg; 561 570 load(false); // force load … … 567 576 } 568 577 578 lastModified = configFile.lastModified(); 569 579 //System.err.println("***** we're using llssite_configfile, url:" + getURL()); 570 580 return true; … … 575 585 public boolean isIndependentGSI() { 576 586 return (configFile == llssite_cfg); 577 }578 579 /** Call this when an independently launched GSI server has been stopped580 * (one using llssite_cfg) and GLI needs to next launch another server.581 * In such a case, since GLI itself is relaunching the GSI, we use glisite_cfg.582 */583 public void relaunchAsDependentGSI(File server_exe) {584 useGLISiteCfg(server_exe);585 587 } 586 588 -
gli/trunk/src/org/greenstone/gatherer/gui/PreviewButton.java
r19544 r19547 91 91 // !! Don't like this here 92 92 LocalLibraryServer.checkServerRunning(); 93 if(LocalLibraryServer.isURLPending()) { 94 // Remind the user to press Enter Library, and return from this method 95 JOptionPane.showMessageDialog(Gatherer.g_man, 96 Dictionary.get("General.LLS_Not_Started"), 97 Dictionary.get("General.LLS_Not_Started_Title"), 98 JOptionPane.ERROR_MESSAGE); 99 preview_address = null; 100 return; 101 } 93 102 94 103 // FLI or GLI for GS2 case (no library_url) … … 135 144 Gatherer.c_man.saveCollection(); 136 145 137 if(LocalLibraryServer.isURLPending()) { 138 // Remind the user to press Enter Library, and return from this method 139 JOptionPane.showMessageDialog(Gatherer.g_man, 140 Dictionary.get("General.LLS_Not_Started"), 141 Dictionary.get("General.LLS_Not_Started_Title"), 142 JOptionPane.ERROR_MESSAGE); 143 return; 144 145 } else { 146 configureHomeURL(); 147 } 146 configureHomeURL(); 148 147 149 148 if (Gatherer.GS3) { … … 152 151 Gatherer.configGS3Server(Configuration.site_name, ServletConfiguration.ADD_COMMAND + Gatherer.c_man.getLoadedCollectionName()); 153 152 } 154 Gatherer.spawnBrowser(preview_address); 153 if(preview_address != null) { 154 Gatherer.spawnBrowser(preview_address); 155 } 155 156 156 157 }
Note:
See TracChangeset
for help on using the changeset viewer.