Changeset 4341
- Timestamp:
- 2003-05-27T11:44:37+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/util/Utility.java
r4318 r4341 48 48 import org.w3c.dom.*; 49 49 import org.xml.sax.*; 50 /** To provide a library of common methods, in a static context, for use in the Gatherer. 50 /** To provide a library of common methods, in a static context, for use in the Gatherer. 51 51 * @author John Thompson, Greenstone Digital Library, University of Waikato 52 52 * @version 2.3b … … 69 69 static final public String CFG_COLLECTIONMETA_COLLECTIONNAME = "collectionmeta collectionname"; 70 70 static final public String CFG_COLLECTIONMETA_COLLECTIONEXTRA = "collectionmeta collectionextra"; 71 static final public String CFG_COLLECTIONMETA_ICONCOLLECTION = "collectionmeta iconcollection"; 71 72 static final public String CFG_CLASSIFY = "classify"; 73 static final public String CFG_CLASSIFY_BUTTONNAME = "-buttonname"; 72 74 static final public String CFG_CLASSIFY_HFILE = "-hfile"; 73 75 static final public String CFG_CLASSIFY_METADATA = "-metadata"; … … 150 152 * @param in_col A <i>boolean</i> indicating whether we are looking for a file within a collection of not. If <i>true</i> then the tree paths head in the collection name, and no element in the path refers to the import directory. Otherwise the paths head will be one of the system roots and all traversed file locations will exist in the path. 151 153 * @return A <strong>TreePath</strong> which traverses the file system tree to the specified file. 152 */ 154 */ 153 155 public static TreePath createTreePath(File file, boolean in_col) { 154 156 TreePath path = null; … … 261 263 } 262 264 263 /** Using this method we can request that a certain document be written, as valid XML, to a certain output stream. This makes use of the Xerces Serialization suite, which should in no way be confused with the usual method of Serialization used by Java. */ 265 /** Using this method we can request that a certain document be written, as valid XML, to a certain output stream. This makes use of the Xerces Serialization suite, which should in no way be confused with the usual method of Serialization used by Java. */ 264 266 static public boolean export(Document document, String filename) { 265 267 return export(document, new File(filename)); … … 279 281 // Generate a new serializer from the above. 280 282 XMLSerializer s = new XMLSerializer(w, f); 281 s.asDOMSerializer(); 283 s.asDOMSerializer(); 282 284 // Finally serialize the document to file. 283 285 s.serialize(document); … … 286 288 return true; 287 289 } 288 // A file not found exception is most likely thrown because the directory the metadata.xml file is attempting to be written to no longer has any files in it. I'll add a test in GDMDocument to test for this, but if it still happens ignore it (a non-existant directory can't really have metadata added to it any way. 290 // A file not found exception is most likely thrown because the directory the metadata.xml file is attempting to be written to no longer has any files in it. I'll add a test in GDMDocument to test for this, but if it still happens ignore it (a non-existant directory can't really have metadata added to it any way. 289 291 catch (FileNotFoundException fnf_exception) { 290 292 if(!file.getName().endsWith(METADATA_XML)) { … … 445 447 } 446 448 } 447 } 449 } 448 450 } 449 451 String result = line; … … 486 488 if(raw.indexOf(File.separator) == -1 && raw.startsWith("...")) { 487 489 raw = raw.substring(3); 488 } 490 } 489 491 return raw; 490 492 } … … 770 772 Document document = null; 771 773 try { 772 FileInputStream fis = new FileInputStream(file); 774 FileInputStream fis = new FileInputStream(file); 773 775 InputStreamReader isr = new InputStreamReader(fis); 774 776 Reader r = new BufferedReader(isr); … … 790 792 fis = null; 791 793 file = null; 792 } 794 } 793 795 catch (Exception error) { 794 796 if(noisey) { … … 898 900 roots[i] = (File)valid.get(i); 899 901 } 900 return roots; 902 return roots; 901 903 } 902 904 }
Note:
See TracChangeset
for help on using the changeset viewer.