Changeset 18360
- Timestamp:
- 2009-01-12T11:18:49+13:00 (15 years ago)
- Location:
- gli/branches/rtl-gli/src/org/greenstone/gatherer/shell
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
gli/branches/rtl-gli/src/org/greenstone/gatherer/shell/GImportProgressMonitor.java
r12294 r18360 110 110 /** The element name of a file not recognised. */ 111 111 static final private String NONRECOGNISEDFILE_ELEMENT = "NonRecognisedFile"; 112 /** The element name of a Warning message */ 113 static final private String WARNING_ELEMENT = "Warning"; 112 114 /** The element name of a BadArgument message */ 113 115 static final private String BADARGUMENT_ELEMENT = "BadArgument"; … … 315 317 } 316 318 } 319 else if (name.equals(WARNING_ELEMENT)) { 320 if(Configuration.getMode() <= threshold) { 321 String args[] = new String[1]; 322 args[0] = element.getAttribute(PLUGIN_ATTRIBUTE); 323 String reason = element.getAttribute(REASON_ATTRIBUTE); 324 queue.add(new GShellEvent(event.getSource(), 0, event.getType(), Dictionary.get("GShell.Import.Warning", args) + " " + reason, event.getStatus())); 325 args = null; 326 } 327 } 328 329 317 330 // Or the import complete element 318 331 else if(name.equals(IMPORTCOMPLETE_ELEMENT)) { -
gli/branches/rtl-gli/src/org/greenstone/gatherer/shell/GShell.java
r14305 r18360 89 89 static final public int CONVERT = 5; 90 90 static final public int EXPLODE = 6; 91 static final public int SRCREPLACE = 7; // for replacing source docs with their html 92 static final public int SCHEDULE = 8; 91 93 92 94 /** Elements in status type enumeration. */ … … 103 105 static public String GSHELL_CONVERT = "gshell_convert"; 104 106 static public String GSHELL_EXPLODE = "gshell_explode"; 107 static public String GSHELL_SRCREPLACE = "gshell_srcreplace"; // for replacing source docs with their html versions 108 static public String GSHELL_SCHEDULE = "gshell_schedule"; 105 109 106 110 /** Determine if the given process is still executing. It does this by attempting to throw an exception - not the most efficient way, but the only one as far as I know … … 165 169 if(line_buffer.length() > 0) { 166 170 String line = line_buffer.toString(); 167 // DebugStream.println("* " + line + " *"); 171 // DebugStream.println("* " + line + " *"); 168 172 fireMessage(type, typeAsString(type) + "> " + line, status, bos); 169 173 line_buffer = new StringBuffer(); … … 191 195 String collection_name = args[args.length - 1]; 192 196 System.err.println("Collection name: " + collection_name); 197 193 198 194 199 String script_args = ""; … … 212 217 System.err.println("Script args: " + script_args); 213 218 buffered_output_stream = bos; 214 String command_output = RemoteGreenstoneServer.runScript(collection_name, script_name, script_args, this);219 String command_output = Gatherer.remoteGreenstoneServer.runScript(collection_name, script_name, script_args, this); 215 220 status = (command_output.equals("") ? CANCELLED : OK); 216 221 } … … 235 240 Runtime rt = Runtime.getRuntime(); 236 241 Process prcs = null; 237 if (Utility.isWindows()){ 238 prcs = rt.exec(args); 239 }else{ 240 prcs = rt.exec(command); 241 } 242 243 prcs = rt.exec(args); 244 // If we used single argument exec, spaces in filenames or paths cause problems 245 // I.e. better to avoid: prcs = rt.exec(command); 242 246 243 247 InputStreamReader eisr = new InputStreamReader( prcs.getErrorStream(), "UTF-8" ); 244 InputStreamReader stdisr = new InputStreamReader( prcs.getInputStream(), "UTF-8" ); 248 InputStreamReader stdisr = new InputStreamReader( prcs.getInputStream(), "UTF-8" ); 245 249 246 250 StringBuffer eline_buffer = new StringBuffer(); … … 260 264 sleep(100); 261 265 } 262 catch(Exception exception) { 266 catch(Exception exception) { 263 267 } 264 268 } … … 344 348 String out_name = null; 345 349 BufferedOutputStream bos = null; 346 if(type == IMPORT || type == BUILD ) {350 if(type == IMPORT || type == BUILD || type == SCHEDULE) { 347 351 if(type == IMPORT) { 348 352 out_name = (String) Gatherer.c_man.getCollection().import_options.getValue("out"); 349 353 } 350 else {354 else if(type == BUILD) { 351 355 out_name = (String) Gatherer.c_man.getCollection().build_options.getValue("out"); 356 } 357 else { // SCHEDULE 358 out_name = (String) Gatherer.c_man.getCollection().schedule_options.getValue("out"); 352 359 } 353 360 if(out_name != null && out_name.length() > 0) { … … 376 383 if (type == NEW) { 377 384 if (Gatherer.isGsdlRemote) { 378 RemoteGreenstoneServer.downloadCollection(col_name);385 Gatherer.remoteGreenstoneServer.downloadCollection(col_name); 379 386 } 380 387 } … … 388 395 } 389 396 390 RemoteGreenstoneServer.downloadCollectionArchives(col_name);397 Gatherer.remoteGreenstoneServer.downloadCollectionArchives(col_name); 391 398 392 399 if (progress!=null) { … … 398 405 fireMessage(type, typeAsString(type) + "> " + Dictionary.get("GShell.Parsing_Metadata_Start"), status, null); 399 406 DocXMLFileManager.clearDocXMLFiles(); 400 DocXMLFileManager.loadDocXMLFiles(new File(CollectionManager.getLoadedCollectionArchivesDirectoryPath())); 407 if (Configuration.fedora_info.isActive()) { // FLI case 408 File collection_export_directory = new File(CollectionManager.getLoadedCollectionExportDirectoryPath()); 409 DocXMLFileManager.loadDocXMLFiles(collection_export_directory,"docmets.xml"); 410 } 411 else { 412 File collection_archives_directory = new File(CollectionManager.getLoadedCollectionArchivesDirectoryPath()); 413 DocXMLFileManager.loadDocXMLFiles(collection_archives_directory,"doc.xml"); 414 } 415 416 401 417 fireMessage(type, typeAsString(type) + "> " + Dictionary.get("GShell.Parsing_Metadata_Complete"), status, null); 402 418 } … … 404 420 else if(type == BUILD) { 405 421 // download the building directory (if gsdl server is remote) 406 if ( Gatherer.isGsdlRemote) {422 if ((Gatherer.isGsdlRemote) && (!Configuration.fedora_info.isActive())) { 407 423 if (progress!=null) { 408 424 progress.messageOnProgressBar("Downloading index data from server"); 409 425 } 410 426 411 427 if (!Gatherer.GS3){ 412 428 // Only need to download build.cfg file 413 429 File build_cfg_file = new File(CollectionManager.getLoadedCollectionBuildingDirectoryPath(), "build.cfg"); 414 RemoteGreenstoneServer.downloadCollectionFile(col_name, build_cfg_file);430 Gatherer.remoteGreenstoneServer.downloadCollectionFile(col_name, build_cfg_file); 415 431 }else{ 416 432 // Only need to download buildConfig.xml file 417 433 File buildConfig_xml_file = new File(CollectionManager.getLoadedCollectionBuildingDirectoryPath(), "buildConfig.xml"); 418 RemoteGreenstoneServer.downloadCollectionFile(col_name, buildConfig_xml_file);434 Gatherer.remoteGreenstoneServer.downloadCollectionFile(col_name, buildConfig_xml_file); 419 435 } 420 436 … … 545 561 concerned = null; 546 562 } 563 564 String msg = ""; 565 // If we are creating collection and have trouble with permissions, we need more messages 566 if(status == ERROR && type == GShell.NEW){ 567 msg = args[args.length-1]; 568 } 547 569 // And firing off an event 548 GShellEvent event = new GShellEvent(this, 0, type, "", status);570 GShellEvent event = new GShellEvent(this, 0, type, msg, status); 549 571 Object[] concerned = listeners.getListenerList(); 550 572 for(int i = 0; i < concerned.length ; i++) { … … 597 619 name = "explode_metadata_database.pl"; 598 620 break; 621 case SRCREPLACE: // To work with replace_srcdoc_with_html.pl 622 name = "replace_srcdoc_with_html.pl"; 623 break; 624 case SCHEDULE: 625 name = "schedule.pl"; 626 break; 599 627 default: 600 628 name = "";
Note:
See TracChangeset
for help on using the changeset viewer.