Changeset 4669
- Timestamp:
- 2003-06-16T09:58:50+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r4620 r4669 49 49 import org.greenstone.gatherer.Configuration; 50 50 import org.greenstone.gatherer.GAuthenticator; 51 import org.greenstone.gatherer.cdm.CommandTokenizer; 51 52 import org.greenstone.gatherer.collection.CollectionManager; 52 53 import org.greenstone.gatherer.file.FileManager; … … 298 299 } 299 300 if(assoc_man != null) { 300 assoc_man. destroy();301 assoc_man.save(); 301 302 assoc_man = null; 302 303 } … … 684 685 gsdlsite_cfg.set(); 685 686 // Spawn server 686 String[] command = new String[ 3];687 String[] command = new String[2]; 687 688 command[0] = config.exec_file.getAbsolutePath(); 688 command[1] = "-config_file"; 689 command[2] = gsdlsite_cfg.getSiteConfigFilename(); 689 command[1] = gsdlsite_cfg.getSiteConfigFilename(); 690 690 server = new ExternalApplication(command); 691 691 server.start(); … … 702 702 // Ta-da. Now the url should be available. 703 703 config.exec_address = new URL(url); 704 705 // A quick test involves opening a connection to get the home page for this collection. If this fails then we try changing the url to be localhost. 706 try { 707 Gatherer.println("Try connecting to server on config url."); 708 URLConnection connection = config.exec_address.openConnection(); 709 connection.getContent(); 710 } 711 catch(IOException bad_url_connection) { 712 try { 713 Gatherer.println("Try connecting to server on local host."); 714 config.exec_address = new URL(gsdlsite_cfg.getLocalHostURL()); 715 URLConnection connection = config.exec_address.openConnection(); 716 connection.getContent(); 717 } 718 catch(IOException worse_url_connection) { 719 Gatherer.println("Can't connect to server on either address."); 720 config.exec_address = null; 721 config.exec_file = null; 722 } 723 } 704 724 } 705 725 catch (Exception error) { … … 769 789 * @param command The initial command <strong>String</strong>. 770 790 */ 771 public ExternalApplication(String command) { 772 this.command = new String[1]; 773 this.command[0] = command; 791 public ExternalApplication(String large_command) { 792 CommandTokenizer tokenizer = new CommandTokenizer(large_command); 793 while(tokenizer.hasMoreTokens()) { 794 if(command == null) { 795 command = new String[1]; 796 command[0] = tokenizer.nextToken(); 797 } 798 else { 799 command = ArrayTools.add(command, tokenizer.nextToken()); 800 } 801 } 774 802 } 775 803
Note:
See TracChangeset
for help on using the changeset viewer.