Changeset 6590


Ignore:
Timestamp:
2004-01-22T16:19:34+13:00 (20 years ago)
Author:
jmt12
Message:

Started effecting the changes requested by Ian and David. So far I've removed the complex arguments, and have ensured that the path is correct for downloads without page requisites. I've also tried to get the workspace tree to update properly, and it is much closer than before but it is now temporarily displaying the same node twice.

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/WGet.java

    r6582 r6590  
    257257    // Create the job and fill in the details from gatherer.config.
    258258    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 us
     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 and paths. If page requisites is used then WGet will do this for us
    260260    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);
    262269    }
    263270    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  
    4545import org.greenstone.gatherer.Gatherer;
    4646import org.greenstone.gatherer.WGet;
     47import org.greenstone.gatherer.file.FileNode;
     48import org.greenstone.gatherer.file.FileSystemModel;
     49import org.greenstone.gatherer.file.WorkspaceTreeModel;
    4750import org.greenstone.gatherer.gui.GProgressBar;
    4851import org.greenstone.gatherer.util.GURL;
     52import org.greenstone.gatherer.util.SynchronizedTreeModelTools;
    4953import org.greenstone.gatherer.util.Utility;
    5054/**
     
    163167    ///ystem.out.println("addLink("+url+", "+type+")");
    164168    if(!encountered_urls.contains(raw_url)) {
    165                 // Add it to the urls we've seen.
     169        // Add it to the urls we've seen.
    166170        encountered_urls.add(raw_url);
    167                 // Add it the to links for the current GURL.
    168 
    169                 // Add it to the progress file count.
     171        // Add it the to links for the current GURL.
     172
     173        // Add it to the progress file count.
    170174        progress.increaseFileCount();
    171175        return true;
     
    280284            }
    281285        }
    282         // If line contains "saved [<size>]" set currently
     286        // If line contains "/s) - `" set currently
    283287        // 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("'"));
    285290            if(!ignore_for_robots) {
     291            System.err.println("Not ignore for robots");
    286292            // Download complete
    287             downloadComplete();
     293            downloadComplete(current_file_downloading);
    288294            }
    289295            else {
     296            System.err.println("Ignore for robots");
    290297            ignore_for_robots = false;
    291298            }
     
    445452    public void downloadComplete() {
    446453    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    }
    450495    url = null;
    451496    current_url = null;
  • trunk/gli/src/org/greenstone/gatherer/file/FileSystemModel.java

    r6255 r6590  
    5858    FileNode first_node = (FileNode)path.getPathComponent(0);
    5959    if(current.equals(first_node)) {
    60         ///atherer.println("First path component matches root node.");
     60        Gatherer.println("First path component matches root node.");
    6161        // For each path with this tree path
    6262        for(int i = 1; current != null && i < path.getPathCount(); i++) {
    6363        // 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 + "': ");
    6670        // Locate the fresh node by searching current's children. Remember to ensure that current is mapped.
    6771        current.map();
     
    7175        for(int j = 0; !found && j < current.getChildCount(); j++) {
    7276            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())) {
    7579            found = true;
    7680            current = child_node;
    77             ///atherer.println("Found!");
     81            Gatherer.println("Found!");
    7882            }
    7983            child_node = null;
     
    8286        for(int j = 0; !found && j < current.size(); j++) {
    8387            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())) {
    8690            found = true;
    8791            current = child_node;
    88             ///atherer.println("Found!");
     92            Gatherer.println("Found!");
    8993            }
    9094            child_node = null;
     
    9397        if(!found) {
    9498            current = null;
    95             ///atherer.println("Not Found!");
     99            Gatherer.println("Not Found!");
    96100        }
    97101        // Repeat as necessary
    98102        }
    99103    }
    100     ///atherer.println("Returning node: " + new TreePath(current.getPath()));
     104    Gatherer.println("Returning node: " + new TreePath(current.getPath()));
    101105    return current;
    102106    }
  • trunk/gli/src/org/greenstone/gatherer/file/WorkspaceTreeModel.java

    r6582 r6590  
    9191
    9292    loadWebCacheMappings();
     93       
    9394    }
    9495
  • trunk/gli/src/org/greenstone/gatherer/gui/CollectionPane.java

    r6395 r6590  
    7373    /** The tree showing the files within the collection. */
    7474    private DragTree collection_tree         =  null;
    75     /** The tree showing the available source workspace. */
    76     private WorkspaceTree workspace_tree     =  null;
    7775    /** The threaded queue that handles the actually movement of files, so that the gui remains responsive. */
    7876    private FileQueue file_queue          =  null;
     
    127125    /** The initial size of the trees. */
    128126    static private Dimension TREE_SIZE   = new Dimension(400, 430);
     127
     128    /** The tree showing the available source workspace. */
     129    public WorkspaceTree workspace_tree  =  null;
    129130
    130131    /* Constructor.
  • trunk/gli/src/org/greenstone/gatherer/gui/GProgressBar.java

    r6318 r6590  
    254254    }
    255255    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");
    257259
    258260    action.setIcon(Utility.getImage("vcrfastforward.gif"));
  • trunk/gli/src/org/greenstone/gatherer/gui/MirrorPane.java

    r6582 r6590  
    136136    url_pane.add(url_textfield, BorderLayout.CENTER);
    137137
    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);
    141142
    142143    details_pane.setLayout(new GridLayout(6,1,0,5));
Note: See TracChangeset for help on using the changeset viewer.