Changeset 5075
- Timestamp:
- 2003-08-01T14:44:58+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r5071 r5075 732 732 gsdlsite_cfg.set(); 733 733 // Spawn server 734 String[] command = new String[2]; 735 command[0] = config.exec_file.getAbsolutePath(); 736 command[1] = gsdlsite_cfg.getSiteConfigFilename(); 734 String command = config.exec_file.getAbsolutePath() + " " + gsdlsite_cfg.getSiteConfigFilename(); 737 735 server = new ExternalApplication(command); 738 736 server.start(); … … 759 757 } 760 758 761 if( gsdlsite_cfg.getURL() != null) {759 if((url = gsdlsite_cfg.getURL()) != null) { 762 760 // Ta-da. Now the url should be available. 763 761 config.exec_address = new URL(url); … … 847 845 private Process process = null; 848 846 /** The initial command string given to this sub-process. */ 849 private String[] command = null; 847 private String command = null; 848 private String[] commands = null; 850 849 /** Constructor. 851 850 * @param command The initial command <strong>String</strong>. 852 851 */ 853 public ExternalApplication(String large_command) { 854 CommandTokenizer tokenizer = new CommandTokenizer(large_command); 855 while(tokenizer.hasMoreTokens()) { 856 if(command == null) { 857 command = new String[1]; 858 command[0] = tokenizer.nextToken(); 859 } 860 else { 861 command = ArrayTools.add(command, tokenizer.nextToken()); 862 } 863 } 864 } 865 866 public ExternalApplication(String[] command) { 852 public ExternalApplication(String command) { 867 853 this.command = command; 854 } 855 856 public ExternalApplication(String[] commands) { 857 this.commands = commands; 868 858 } 869 859 /** We start the child process inside a new thread so it doesn't block the rest of Gatherer. … … 877 867 // Call an external process using the args. 878 868 try { 879 StringBuffer whole_command = new StringBuffer(); 880 for(int i = 0; i < command.length; i++) { 881 whole_command.append(command[i]); 882 whole_command.append(" "); 869 if(commands != null) { 870 StringBuffer whole_command = new StringBuffer(); 871 for(int i = 0; i < commands.length; i++) { 872 whole_command.append(commands[i]); 873 whole_command.append(" "); 874 } 875 println("Running " + whole_command.toString()); 876 Runtime rt = Runtime.getRuntime(); 877 process = rt.exec(commands); 878 process.waitFor(); 883 879 } 884 println("Running " + whole_command.toString()); 885 whole_command = null; 886 Runtime rt = Runtime.getRuntime(); 887 process = rt.exec(command); 888 process.waitFor(); 880 else { 881 println("Running " + command); 882 Runtime rt = Runtime.getRuntime(); 883 process = rt.exec(command); 884 process.waitFor(); 885 } 889 886 } 890 887 catch (Exception error) {
Note:
See TracChangeset
for help on using the changeset viewer.