Changeset 6590 for trunk/gli/src/org/greenstone/gatherer/collection
- Timestamp:
- 2004-01-22T16:19:34+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/collection/Job.java
r6582 r6590 45 45 import org.greenstone.gatherer.Gatherer; 46 46 import org.greenstone.gatherer.WGet; 47 import org.greenstone.gatherer.file.FileNode; 48 import org.greenstone.gatherer.file.FileSystemModel; 49 import org.greenstone.gatherer.file.WorkspaceTreeModel; 47 50 import org.greenstone.gatherer.gui.GProgressBar; 48 51 import org.greenstone.gatherer.util.GURL; 52 import org.greenstone.gatherer.util.SynchronizedTreeModelTools; 49 53 import org.greenstone.gatherer.util.Utility; 50 54 /** … … 163 167 ///ystem.out.println("addLink("+url+", "+type+")"); 164 168 if(!encountered_urls.contains(raw_url)) { 165 169 // Add it to the urls we've seen. 166 170 encountered_urls.add(raw_url); 167 168 169 171 // Add it the to links for the current GURL. 172 173 // Add it to the progress file count. 170 174 progress.increaseFileCount(); 171 175 return true; … … 280 284 } 281 285 } 282 // If line contains " saved [<size>]" set currently286 // If line contains "/s) - `" set currently 283 287 // downloading url to "Download Complete". 284 else if(line.lastIndexOf(") - `") != -1) { 288 else if(line.lastIndexOf("/s) - `") != -1) { 289 String current_file_downloading = line.substring(line.indexOf("`") + 1, line.lastIndexOf("'")); 285 290 if(!ignore_for_robots) { 291 System.err.println("Not ignore for robots"); 286 292 // Download complete 287 downloadComplete( );293 downloadComplete(current_file_downloading); 288 294 } 289 295 else { 296 System.err.println("Ignore for robots"); 290 297 ignore_for_robots = false; 291 298 } … … 445 452 public void downloadComplete() { 446 453 progress.downloadComplete(); 447 /* @todo 448 model.add(url.getURL(), destination); 449 */ 454 url = null; 455 current_url = null; 456 } 457 458 public void downloadComplete(String current_file_downloading) { 459 progress.downloadComplete(); 460 ///ystem.err.println("Current File: " + current_file_downloading); 461 //WorkspaceTreeModel.refreshWebCacheMappings(); 462 if(Gatherer.g_man.collection_pane.workspace_tree != null) { 463 FileSystemModel tree_model = (FileSystemModel) Gatherer.g_man.collection_pane.workspace_tree.getModel(); 464 File new_file = new File(current_file_downloading); 465 File parent_file = new_file.getParentFile(); 466 String download_cache = Utility.getCacheDir().getAbsolutePath(); 467 ArrayList raw_path = new ArrayList(); 468 while(parent_file != null && !parent_file.getAbsolutePath().equals(download_cache)) { 469 raw_path.add(0, parent_file.getName()); 470 parent_file = parent_file.getParentFile(); 471 } 472 download_cache = null; 473 // Add download cache name 474 /** @todo - add to dictionary */ 475 raw_path.add(0, "Mirror Cache"); 476 // And the root node 477 raw_path.add(0, tree_model.getRoot()); 478 TreePath destination_path = new TreePath(raw_path.toArray()); 479 raw_path = null; 480 // Retrieve the destination node 481 FileNode destination_node = (FileNode) tree_model.getNode(destination_path); 482 // destination_path = null; 483 FileNode new_file_node = new FileNode(new_file); 484 SynchronizedTreeModelTools.insertNodeInto(tree_model, destination_node, new_file_node); 485 System.err.println("Ready to insert new FileNode."); 486 System.err.println("Model: " + tree_model); 487 System.err.println("Destination path: " + destination_path); 488 System.err.println("Destination node: " + destination_node); 489 System.err.println("New node: " + new_file_node); 490 491 new_file_node = null; 492 destination_node = null; 493 tree_model = null; 494 } 450 495 url = null; 451 496 current_url = null;
Note:
See TracChangeset
for help on using the changeset viewer.