Ignore:
Timestamp:
2005-02-28T10:29:08+13:00 (19 years ago)
Author:
mdewsnip
Message:

More GLI applet improvements, by Matthew Whyte. Now uploads only metadata when only metadata has been changed, and only the source files when only the source files have been changed.

Location:
trunk/gli/src/org/greenstone/gatherer/util
Files:
2 edited

Legend:

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

    r7820 r9202  
    103103    }
    104104    catch (IOException ioe) {
    105         System.err.println("Unhandled exception:");
     105        System.err.println("Unhandled exception on " + args[1]);
    106106        ioe.printStackTrace();
    107107        return;
  • trunk/gli/src/org/greenstone/gatherer/util/Utility.java

    r9195 r9202  
    7171    static final public int BUFFER_SIZE = FACTOR * 1024;
    7272    /** Definition of an important directory name, in this case the base dir, or the working directory of the Gatherer. */
    73     /** The regular expression that marks if we only want doc.xml files. Will this work in Windows?? --Matthew */
    74     static final public String METADATA_ONLY_EXPR = "\".*" + File.separator + "doc\\.xml\"";
    7573
    7674    static public String BASE_DIR  = System.getProperty("user.dir") + File.separator;
     
    627625    if((reject_expr != "") && (file_path.matches(reject_expr))) {
    628626        // matches reject expression
    629         DebugStream.println("File \'" + file_path + "\' matches the reject expression \'" + reject_expr + "\'");
     627        //DebugStream.println("File \'" + file_path + "\' matches the reject expression \'" + reject_expr + "\'");
    630628        return encountered_file;
    631629    }
     
    633631    if ((accept_expr != "") && (!file_path.matches(accept_expr))) {
    634632        // does not match accept expression
    635         DebugStream.println("File \'" + file_path + "\' doesn't match accept expression \'" + accept_expr + "\'");
     633        //DebugStream.println("File \'" + file_path + "\' doesn't match accept expression \'" + accept_expr + "\'");
    636634        return encountered_file;
    637635    }
     
    639637    //Special case: we only want the metadata. Parse the xml files.
    640638    if(accept_expr.compareTo(".*doc.xml") == 0) {
    641         System.err.println("Only want to get metadata"); //debug
     639        DebugStream.println("Only want to get metadata");
    642640        Document old_document = XMLTools.parseXMLFile(new File(file_path));
    643641        NodeList content = old_document.getElementsByTagName("Content");
     
    719717    static protected boolean dirFunc (ZipOutputStream zos, String dir_name, int prefix_strip, GShell source, boolean encountered_file, String accept_expr, String reject_expr)
    720718    {
    721     /*
    722     if (reject_expr != "" && (dir_name.matches(reject_expr))) {
    723         // matches reject expression
    724         System.err.println("matches reject expression");
    725         return encountered_file;
    726     }
    727    
    728     if ((accept_expr != "") && (!dir_name.matches(accept_expr))) {
    729         // does not match accept expression
    730         System.err.println("doesn't match accept expression");
    731         return encountered_file;
    732     }
    733     */
    734 
    735719    File dirObj = new File(dir_name);
    736720
     
    859843
    860844        if (zipentry.isDirectory()) {
    861             // Create named directory
    862             boolean success = (new File(zentryname)).mkdir();
    863             if (!success) {
    864             System.err.println("Error: unable to create directory '"+zentryname+"'");
     845            if(!file.exists()) {
     846            // Create named directory, if it doesn't already exist.
     847            boolean success = (file.mkdir());
     848            if (!success) {
     849                System.err.println("Error: unable to create directory '"+zentryname+"'");
     850            }
    865851            }
    866852        }
     
    894880    catch (ZipException error) {
    895881        System.err.println("Error: Unable to open '"+zip_fname+"'");
     882        System.err.println("This maybe caused by the zip file being empty.");
    896883        DebugStream.printStackTrace(error);
    897884    }
Note: See TracChangeset for help on using the changeset viewer.