Changeset 7292
- Timestamp:
- 2004-05-07T13:02:33+12:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/msm/GreenstoneArchiveParser.java
r7204 r7292 76 76 // Determine the collection archive directory. 77 77 File archive_directory = new File(Gatherer.c_man.getCollectionArchive()); 78 // For each of the hash coded directories within. 79 File document_directories[] = archive_directory.listFiles(); 80 for(int i = 0; i < document_directories.length; i++) { 81 // Find the doc.xml file within 82 if(document_directories[i].isDirectory()) { 83 File document_file = new File(document_directories[i], "doc.xml"); 84 // Then extract the metadata from it. 85 if(document_file.exists()) { 86 int count = extractMetadata(document_file); 87 // Display a pretty progress message. 88 String[] args = new String[2]; 89 args[0] = document_directories[i].getName(); 90 args[1] = String.valueOf(count); 91 shell.fireMessage(GShell.IMPORT, shell.typeAsString(GShell.IMPORT) + "> " + Dictionary.get("GShell.Extracted", args), GShell.OK, null); 92 args = null; 93 progress.increment(); 94 } 95 } 96 } 78 // Start the extraction process 79 processDirectory(archive_directory, progress); 97 80 } 98 81 // All done. Outta here like a bald man. 82 } 83 84 private void processDirectory(File directory, GShellProgressMonitor progress) { 85 // look for a doc.xml file here 86 File document_file = new File(directory, "doc.xml"); 87 // Then extract the metadata from it. 88 if(document_file.exists()) { 89 int count = extractMetadata(document_file); 90 // Display a pretty progress message. 91 String[] args = new String[2]; 92 args[0] = directory.getName(); 93 args[1] = String.valueOf(count); 94 this.shell.fireMessage(GShell.IMPORT, shell.typeAsString(GShell.IMPORT) + "> " + Dictionary.get("GShell.Extracted", args), GShell.OK, null); 95 args = null; 96 progress.increment(); 97 } 98 99 // for each directory here, process it 100 File sub_directories[] = directory.listFiles(); 101 for(int i = 0; i < sub_directories.length; i++) { 102 // Find the doc.xml file within 103 if(sub_directories[i].isDirectory()) { 104 processDirectory(sub_directories[i], progress); 105 } 106 } 99 107 } 100 108 … … 149 157 { 150 158 String name = metadata_element.getAttribute(StaticStrings.NAME_ATTRIBUTE); 151 152 159 // There is also a special case when the metadata name is gsdlsourcefilename, as we use this to find the FileRecord we want to add metadata to. 153 160 if (name.equals("gsdlsourcefilename")) { … … 161 168 return false; 162 169 } 170 } 171 172 // namespaced metadata, we don't extract at the moment 173 if (name.indexOf(MSMUtils.NS_SEP)!=-1) { 174 return false; 163 175 } 164 176 … … 197 209 return false; 198 210 } 199 200 211 // Create a new metadata object. 201 212 GValueModel value_tree = Gatherer.c_man.msm.getValueTree(element);
Note:
See TracChangeset
for help on using the changeset viewer.