Changeset 6590
- Timestamp:
- 2004-01-22T16:19:34+13:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/WGet.java
r6582 r6590 257 257 // Create the job and fill in the details from gatherer.config. 258 258 Gatherer.println("About to create a new job"); 259 // If it was decided not to download page requisites, then create the destination by basing it on the given destination, but appending the url host . If page requisites is used then WGet will do this for us259 // If it was decided not to download page requisites, then create the destination by basing it on the given destination, but appending the url host and paths. If page requisites is used then WGet will do this for us 260 260 if(!page_requisites) { 261 destination = destination + url.getHost(); 261 System.err.println("Initially destination: " + destination); 262 String almost_the_entire_path = url.getPath(); 263 int index = -1; 264 if((index = almost_the_entire_path.lastIndexOf("/")) != -1) { 265 almost_the_entire_path = almost_the_entire_path.substring(0, index); 266 } 267 destination = destination + url.getHost() + almost_the_entire_path + "/"; 268 System.err.println("Finale destination: " + destination); 262 269 } 263 270 Job new_job = new Job(Gatherer.config.get("mirroring.debug", false), no_parents, other_hosts, page_requisites, Gatherer.config.get("mirroring.quiet", false), url, depth, destination, Gatherer.config.proxy_pass, Gatherer.config.proxy_user, this, simple); -
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; -
trunk/gli/src/org/greenstone/gatherer/file/FileSystemModel.java
r6255 r6590 58 58 FileNode first_node = (FileNode)path.getPathComponent(0); 59 59 if(current.equals(first_node)) { 60 ///atherer.println("First path component matches root node.");60 Gatherer.println("First path component matches root node."); 61 61 // For each path with this tree path 62 62 for(int i = 1; current != null && i < path.getPathCount(); i++) { 63 63 // Retrieve the stale path 64 FileNode stale_node = (FileNode) path.getPathComponent(i); 65 ///atherer.print("Searching for '" + stale_node + "': "); 64 Object stale_object = path.getPathComponent(i); 65 FileNode stale_node = null; 66 if(stale_object instanceof FileNode) { 67 stale_node = (FileNode) stale_object; 68 } 69 Gatherer.print("Searching for '" + stale_node + "': "); 66 70 // Locate the fresh node by searching current's children. Remember to ensure that current is mapped. 67 71 current.map(); … … 71 75 for(int j = 0; !found && j < current.getChildCount(); j++) { 72 76 FileNode child_node = (FileNode) current.getChildAt(j); 73 ///atherer.print(child_node + " ");74 if( stale_node.equals(child_node)) {77 Gatherer.print(child_node + " "); 78 if((stale_node != null && stale_node.equals(child_node)) || stale_object.toString().equals(child_node.toString())) { 75 79 found = true; 76 80 current = child_node; 77 ///atherer.println("Found!");81 Gatherer.println("Found!"); 78 82 } 79 83 child_node = null; … … 82 86 for(int j = 0; !found && j < current.size(); j++) { 83 87 FileNode child_node = (FileNode) current.get(j); 84 ///atherer.print(child_node + " ");85 if( stale_node.equals(child_node)) {88 Gatherer.print(child_node + " "); 89 if((stale_node != null && stale_node.equals(child_node)) || stale_object.toString().equals(child_node.toString())) { 86 90 found = true; 87 91 current = child_node; 88 ///atherer.println("Found!");92 Gatherer.println("Found!"); 89 93 } 90 94 child_node = null; … … 93 97 if(!found) { 94 98 current = null; 95 ///atherer.println("Not Found!");99 Gatherer.println("Not Found!"); 96 100 } 97 101 // Repeat as necessary 98 102 } 99 103 } 100 ///atherer.println("Returning node: " + new TreePath(current.getPath()));104 Gatherer.println("Returning node: " + new TreePath(current.getPath())); 101 105 return current; 102 106 } -
trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTreeModel.java
r6582 r6590 91 91 92 92 loadWebCacheMappings(); 93 93 94 } 94 95 -
trunk/gli/src/org/greenstone/gatherer/gui/CollectionPane.java
r6395 r6590 73 73 /** The tree showing the files within the collection. */ 74 74 private DragTree collection_tree = null; 75 /** The tree showing the available source workspace. */76 private WorkspaceTree workspace_tree = null;77 75 /** The threaded queue that handles the actually movement of files, so that the gui remains responsive. */ 78 76 private FileQueue file_queue = null; … … 127 125 /** The initial size of the trees. */ 128 126 static private Dimension TREE_SIZE = new Dimension(400, 430); 127 128 /** The tree showing the available source workspace. */ 129 public WorkspaceTree workspace_tree = null; 129 130 130 131 /* Constructor. -
trunk/gli/src/org/greenstone/gatherer/gui/GProgressBar.java
r6318 r6590 254 254 } 255 255 progress.setValue(progress.getMaximum()); 256 Dictionary.setText(progress, "Mirroring.Job.Mirror_Complete"); 256 /** @todo - put into dictionary */ 257 progress.setString("Mirroring.Job.Mirror_Complete"); 258 //Dictionary.setText(progress, "Mirroring.Job.Mirror_Complete"); 257 259 258 260 action.setIcon(Utility.getImage("vcrfastforward.gif")); -
trunk/gli/src/org/greenstone/gatherer/gui/MirrorPane.java
r6582 r6590 136 136 url_pane.add(url_textfield, BorderLayout.CENTER); 137 137 138 depth_pane.setLayout(new BorderLayout()); 139 depth_pane.add(depth_label, BorderLayout.CENTER); 140 depth_pane.add(depth_combobox, BorderLayout.EAST); 138 depth_pane.setLayout(new GridLayout(1,3)); 139 depth_pane.add(depth_label); 140 depth_pane.add(new JPanel()); 141 depth_pane.add(depth_combobox); 141 142 142 143 details_pane.setLayout(new GridLayout(6,1,0,5));
Note:
See TracChangeset
for help on using the changeset viewer.