Changeset 5793
- Timestamp:
- 2003-11-07T10:39:53+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/msm/GDMManager.java
r5589 r5793 72 72 Gatherer.c_man.getCollection().msm.addMSMListener(this); 73 73 // Now create and start the synchronous GDM loader. 74 gdm_loader = new GDMLoader(); 74 gdm_loader = new GDMLoader(false); 75 gdm_loader.start(); 76 ///atherer.println("New GDMManager created."); 77 } 78 79 80 81 82 public GDMManager(boolean dummy_load) { 83 super(); 84 this.metadata_cache = new HashMap3D(Gatherer.c_man.getCollection().msm.getSize()); 85 // Connect 86 Gatherer.c_man.getCollection().msm.addMSMListener(this); 87 // Now create and start the synchronous GDM loader. 88 gdm_loader = new GDMLoader(dummy_load); 75 89 gdm_loader.start(); 76 90 ///atherer.println("New GDMManager created."); … … 84 98 } 85 99 } 86 /** Destructor necessary for clean exit, subsequent to saving of metadata.xml files. 100 101 /** Destructor necessary for clean exit, subsequent to saving of metadata.xml files. 87 102 * @see org.greenstone.gatherer.Gatherer 88 103 * @see org.greenstone.gatherer.collection.CollectionManager … … 152 167 } 153 168 169 // returns metadata file from cache or creates a new one 170 public GDMDocument getDummyDocument(File file) { 171 ///ystem.err.println("Get the GDMDocument for " + file.getAbsolutePath()); 172 GDMDocument metadata_xml = null; 173 // Determine the name of the target files metadata.xml file. 174 File metadata_file = null; 175 if(file.isFile()) { 176 metadata_file = new File(file.getParentFile(), METADATA_XML); 177 } 178 else { 179 metadata_file = new File(file, METADATA_XML); 180 } 181 // Then try to retrieve it from cache. First we consider the case of a cache hit. 182 if(containsKey(metadata_file)) { 183 metadata_xml = (GDMDocument) get(metadata_file); 184 } 185 else { 186 metadata_xml = new GDMDocument(); 187 put(metadata_file, metadata_xml); 188 } 189 return metadata_xml; 190 } 191 192 public synchronized void dummyGetMetadata(File file) { 193 String filename = null; 194 if(file.isFile()) { 195 filename = file.getName(); 196 file = file.getParentFile(); 197 } 198 GDMDocument document = getDummyDocument(file); 199 200 201 } 154 202 /** Recover the metadata associated with a particular file. Note that this call is synchronized, so that all of the data holders don't need to be. */ 155 203 public synchronized ArrayList getMetadata(File file) { … … 390 438 extends Thread { 391 439 private boolean complete = false; 440 private boolean dummy_load = false; 441 442 GDMLoader(boolean dummy_load) { 443 super("blarg"); 444 this.dummy_load = dummy_load; 445 } 446 447 392 448 public void run() { 393 449 // Can't open a collections metadata when the collection isn't open! … … 407 463 if(!record.isLeaf()) { 408 464 ///atherer.println("Retrieving metadata.xml for " + record); 409 getMetadata(record.getFile()); 465 if (this.dummy_load) { 466 dummyGetMetadata(record.getFile()); 467 } else { 468 getMetadata(record.getFile()); 469 } 410 470 for(int i = 0; i < record.getChildCount(); i++) { 411 471 remaining.add(record.getChildAt(i));
Note:
See TracChangeset
for help on using the changeset viewer.