Ignore:
Timestamp:
2020-09-15T20:26:19+12:00 (4 years ago)
Author:
ak19
Message:

Bugfix 1 for GLI metadata slowdown: selecting multiple Gathererd files in GLI became very slow. Kathy and Dr Bainbridge had tracked this down to code I had added to support non basic ASCII filenames in GLI, which was making an expensive win operating system function call on Windows for each selected file, launching a Java Process for each. The speed of selecting multiple files is now back to being almost as fast as in 3.09. Tested on Windows and linux. Had to treat windows as a special case because I can't get the code modifications to work on Linux: the perl code stores a hex-encoded string for the filename that GLI now uses when OS is Windows and compares against the hex encoded name of a file selected. But on linux the hex encoded value generated by perl is not the same as that which java generates and after trying repeatedly, I'e not been able to succeed to get it to work. So the code behaves as before for Linux.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/metadata/DocXMLFileManager.java

    r17101 r34394  
    3131import java.util.*;
    3232import org.greenstone.gatherer.DebugStream;
    33 
     33import org.greenstone.gatherer.util.Utility;
    3434
    3535/** This class is a static class that manages the doc.xml files */
     
    3737{
    3838    static private ArrayList doc_xml_files = new ArrayList();
    39 
    4039
    4140    static public void clearDocXMLFiles()
     
    4746    static public ArrayList getMetadataExtractedFromFile(File file)
    4847    {
     48    // Work out relative file path and its hex encoded value here,
     49    // avoids making DocXMLFile.java recalculate these each time
     50    String file_relative_path = file.getAbsolutePath();
     51    int import_index = file_relative_path.indexOf("import");
     52    if (import_index != -1) {
     53        file_relative_path = file_relative_path.substring(import_index + "import".length() + 1);
     54    }
     55    String searchFileName = DocXMLFile.isWin ? Utility.stringToHex(file_relative_path) : file_relative_path;
     56       
    4957    // Build up a list of metadata values extracted from this file
    5058    ArrayList metadata_values = new ArrayList();
     
    5361    for (int i = 0; i < doc_xml_files.size(); i++) {
    5462        DocXMLFile doc_xml_file = (DocXMLFile) doc_xml_files.get(i);
    55         metadata_values.addAll(doc_xml_file.getMetadataExtractedFromFile(file));
     63        ///System.err.println("@@@@ Looking at doc.xml file: " + doc_xml_files.get(i));
     64        metadata_values.addAll(doc_xml_file.getMetadataExtractedFromFile(file, searchFileName));
    5665    }
    5766
Note: See TracChangeset for help on using the changeset viewer.