Changeset 7744
- Timestamp:
- 2004-07-16T14:03:57+12:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/msm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/msm/MetadataSet.java
r7535 r7744 77 77 78 78 public MetadataSet(String metadata_template) { 79 URL url = ClassLoader.getSystemResource(metadata_template); 80 try { 81 init(new File(URLDecoder.decode(url.getFile(), "UTF-8"))); 82 } 83 catch(UnsupportedEncodingException exception) { 84 Gatherer.printStackTrace(exception); 85 } 79 80 this.file = new File(metadata_template); 81 this.value_trees = new Hashtable(); 82 this.document = Utility.parse(metadata_template, true); 83 84 init(true); // use class loader 86 85 } 87 86 … … 90 89 */ 91 90 public MetadataSet(File file) { 92 init(file); 91 this.file = file; 92 this.value_trees = new Hashtable(); 93 this.document = Utility.parse(file, false); 94 95 init(false); // don't use class loader 93 96 } 94 97 … … 583 586 } 584 587 585 private void init(File file) { 586 this.file = file; 587 this.value_trees = new Hashtable(); 588 this.document = Utility.parse(file, false); 589 if(document != null) { 588 private void init(boolean use_classloader) { 589 590 if(this.document != null) { 590 591 this.elements = document.getElementsByTagName("Element"); 591 592 this.root = document.getDocumentElement(); … … 596 597 ///ystem.err.println("Searching for " + value_file.getAbsolutePath()); 597 598 if(value_file.exists()) { 598 Document value_document = Utility.parse(value_file, false); 599 Document value_document; 600 if (use_classloader) { 601 value_document = Utility.parse(value_file.toString(), true); 602 } 603 else { 604 value_document = Utility.parse(value_file, false); 605 } 599 606 if(value_document != null) { 600 607 value_trees.put(value_element, new GValueModel(value_element, value_document)); -
trunk/gli/src/org/greenstone/gatherer/msm/MetadataXMLFileManager.java
r7523 r7744 335 335 */ 336 336 public synchronized void metadataChanged(MSMEvent event) { 337 // System.err.println("In MetadataXMLFileManager::metadataChanged(" + event + ")..."); 337 // System.err.println("In MetadataXMLFileManager::metadataChanged(" + event + ")..."); 338 338 339 File file = event.getFile(); 339 340 if(file == null) { … … 361 362 if(new_metadata != null) { 362 363 // File level 364 365 String filename = file.toString(); 366 if (!filename.startsWith(File.separator)) { 367 String collection_dir = Utility.getCollectionDir(); 368 File full_file = new File(collection_dir + filename); 369 file = full_file; 370 } 371 363 372 if(file.isFile()) { 364 373 // System.err.println("Calling metadata_xml.addMetadata(" + new_metadata + ")...");
Note:
See TracChangeset
for help on using the changeset viewer.