- Timestamp:
- 2003-06-12T17:55:59+12:00 (21 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r4594 r4620 163 163 } 164 164 try { 165 165 // Create log 166 166 log = new Log(); 167 167 // Load Config 168 168 loadConfig(gsdl_path, exec_path, perl_path); 169 169 170 170 // Read Dictionary 171 171 dictionary = new Dictionary(config.getLocale("general.locale", true), config.getFont("general.font", true)); 172 172 173 173 // If we were given a server run it if neccessary. 174 174 if(config.exec_file != null) { 175 175 startServerEXE(); 176 176 } 177 177 178 178 // Having loaded the configuration (necessary to determine if certain warnings have been disabled) and dictionary, we now check if the necessary path variables have been provided. 179 179 180 180 if(config.exec_file == null && config.exec_address == null) { … … 184 184 missingGSDL(dictionary); 185 185 } 186 186 // Perl path is a little different as it is perfectly ok to start the Gatherer without providing a perl path 187 187 boolean found_perl = false; 188 188 if(config.perl_path != null) { … … 275 275 } 276 276 } 277 /** Writes a message to the debug filestream. 278 * @param message The message as a <strong>String</strong>. 279 */ 280 // public void debug(String message) { 281 //debug(null, message); 282 // } 283 /** Writes a message to the debug filestream. 284 * @param error The <strong>Exception</strong> associated with this message, or <i>null</i> for no exception. 285 * @param message The message as a <strong>String</strong>. 286 * @see java.io.FileOutputStream 287 * @see java.io.PrintStream 288 * @see java.lang.Exception 289 */ 290 // public void debug(Exception exception, String message) { 291 //if(message != null) { 292 // Gatherer.println(message); 293 //} 294 //if(exception != null) { 295 // Gatherer.printStackTrace(exception); 296 //} 297 // } 277 298 278 /** Exits the Gatherer after ensuring that things needing saving are saved. 299 279 * @see java.io.FileOutputStream … … 704 684 gsdlsite_cfg.set(); 705 685 // Spawn server 706 server = new ExternalApplication(config.exec_file.getAbsolutePath()); 686 String[] command = new String[3]; 687 command[0] = config.exec_file.getAbsolutePath(); 688 command[1] = "-config_file"; 689 command[2] = gsdlsite_cfg.getSiteConfigFilename(); 690 server = new ExternalApplication(command); 707 691 server.start(); 692 command = null; 708 693 // Now we have to wait until program has started. We do this by reloading and checking 709 694 try { … … 780 765 private Process process = null; 781 766 /** The initial command string given to this sub-process. */ 782 private String command = null;767 private String[] command = null; 783 768 /** Constructor. 784 769 * @param command The initial command <strong>String</strong>. 785 770 */ 786 771 public ExternalApplication(String command) { 772 this.command = new String[1]; 773 this.command[0] = command; 774 } 775 776 public ExternalApplication(String[] command) { 787 777 this.command = command; 788 778 } … … 797 787 // Call an external process using the args. 798 788 try { 799 println("Running " + command); 789 StringBuffer whole_command = new StringBuffer(); 790 for(int i = 0; i < command.length; i++) { 791 whole_command.append(command[i]); 792 whole_command.append(" "); 793 } 794 println("Running " + whole_command.toString()); 795 whole_command = null; 800 796 Runtime rt = Runtime.getRuntime(); 801 797 process = rt.exec(command); -
trunk/gli/src/org/greenstone/gatherer/util/GSDLSiteConfig.java
r4384 r4620 7 7 extends LinkedHashMap { 8 8 private File gsdlsite_cfg; 9 private File glisite_cfg; 9 10 private String autoenter_initial; 10 11 private String start_browser_initial; … … 13 14 static final public String RELEASE_COMMAND = "?a=config&cmd=release-collection&c="; 14 15 static final public String QUIT_COMMAND = "?a=config&cmd=kill"; 15 16 16 17 static final private String AUTOENTER = "autoenter"; 17 18 static final private String COLON = ":"; 18 19 static final private String ENTERLIB = "enterlib"; 19 20 static final private String FALSE = "0"; 21 static final private String GLISITE = null ;//"glisite.cfg"; 20 22 static final private String GSDL = "gsdl"; 21 23 static final private String GSDLSITE_CFG = "gsdlsite.cfg"; … … 29 31 debug("New GSDLSiteConfig for: " + server_exe.getAbsolutePath()); 30 32 gsdlsite_cfg = new File(server_exe.getParentFile(), GSDLSITE_CFG); 31 33 //glisite_cfg = new File(server_exe.getParentFile(), GLISITE_CFG); 32 34 autoenter_initial = null; 33 35 start_browser_initial = null; … … 37 39 public boolean exists() { 38 40 return gsdlsite_cfg.exists(); 41 } 42 43 public String getSiteConfigFilename() { 44 //return GLISITE_CFG; 45 return GSDLSITE_CFG; 39 46 } 40 47 … … 97 104 /** Restore the autoenter value to its initial value, and remove url if present. */ 98 105 public void restore() { 99 debug("Restore Initial Settings"); 100 put(AUTOENTER, autoenter_initial); 101 put(STARTBROWSER, start_browser_initial); 102 remove(URL); 103 save(); 106 if(glisite_cfg != null) { 107 // Delete the file 108 glisite_cfg.delete(); 109 } 110 else { 111 debug("Restore Initial Settings"); 112 put(AUTOENTER, autoenter_initial); 113 put(STARTBROWSER, start_browser_initial); 114 remove(URL); 115 save(); 116 } 104 117 } 105 118 … … 125 138 private void save() { 126 139 debug("Save: " + gsdlsite_cfg.getAbsolutePath()); 140 //debug("Save: " + glisite_cfg.getAbsolutePath()); 127 141 try { 128 142 BufferedWriter out = new BufferedWriter(new FileWriter(gsdlsite_cfg, false)); 143 //BufferedWriter out = new BufferedWriter(new FileWriter(glisite_cfg, false)); 129 144 for(Iterator keys = keySet().iterator(); keys.hasNext(); ) { 130 145 String key = (String) keys.next();
Note:
See TracChangeset
for help on using the changeset viewer.