Changeset 10006
- Timestamp:
- 2005-06-03T14:36:41+12:00 (19 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/Configuration.java
r9869 r10006 159 159 // Create a new config from the default configuration file from our xml library 160 160 if (general_config == null) { 161 general_config = Utility.parse(TEMPLATE_CONFIG_XML, true);161 general_config = XMLTools.parseXMLFile(TEMPLATE_CONFIG_XML, true); 162 162 just_updated_config_xml_file = true; 163 163 } … … 205 205 { 206 206 // Check if the configuration file actually needs updating by looking at the version numbers 207 Document new_document = Utility.parse(TEMPLATE_CONFIG_XML, true);207 Document new_document = XMLTools.parseXMLFile(TEMPLATE_CONFIG_XML, true); 208 208 Document old_document = XMLTools.parseXMLFile(config_xml_file); 209 209 -
trunk/gli/src/org/greenstone/gatherer/ServletConfiguration.java
r9828 r10006 87 87 88 88 this.mappings = new HashMap(); 89 Document web_config = Utility.parse(web_xml.getAbsolutePath(), false);89 Document web_config = XMLTools.parseXMLFile(web_xml.getAbsolutePath(), false); 90 90 91 91 NodeList servlet_mappings = web_config.getElementsByTagName("servlet-mapping"); -
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionConfiguration.java
r9908 r10006 326 326 String collect_config_name = collect_config_file.getName(); 327 327 if(collect_config_name.equals(COLLECTCONFIGURATION_XML)) { 328 // Parse with Utility but don't use class loader329 328 document = XMLTools.parseXMLFile(collect_config_file); 330 329 } 331 330 // Otherwise if this is a legacy collect.cfg file then read in the template and send to magic parser 332 331 else if(collect_config_name.equals(COLLECT_CFG)) { 333 document = Utility.parse(PSEUDO_COLLECTCONFIGURATION_XML, true);332 document = XMLTools.parseXMLFile("xml/CollectionConfig.xml", true); 334 333 parse(collect_config_file); 335 334 } -
trunk/gli/src/org/greenstone/gatherer/cdm/LanguageManager.java
r9564 r10006 44 44 import org.greenstone.gatherer.gui.GLIButton; 45 45 import org.greenstone.gatherer.util.Utility; 46 import org.greenstone.gatherer.util.XMLTools; 46 47 import org.w3c.dom.*; 47 48 … … 53 54 extends DOMProxyListModel { 54 55 55 static public Document LANGUAGES_DOCUMENT = Utility.parse("xml/languages.xml", true);56 static public Document LANGUAGES_DOCUMENT = XMLTools.parseXMLFile("xml/languages.xml", true); 56 57 57 58 static final private Dimension COMPONENT_SIZE = new Dimension(125,25); -
trunk/gli/src/org/greenstone/gatherer/collection/Collection.java
r9166 r10006 96 96 // If that fails load the default settings for a collection. 97 97 if(document == null) { 98 document = Utility.parse(COLLECTION_XML_TEMPLATE, true);98 document = XMLTools.parseXMLFile(COLLECTION_XML_TEMPLATE, true); 99 99 } 100 100 if (document == null) { -
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r9864 r10006 452 452 { 453 453 try { 454 Document default_lockfile = Utility.parse("xml/" + LOCK_FILE, true);454 Document default_lockfile = XMLTools.parseXMLFile("xml/" + LOCK_FILE, true); 455 455 String user_name = System.getProperty("user.name"); 456 456 Element person_element = (Element) XMLTools.getNodeFromNamed(default_lockfile.getDocumentElement(), "User"); -
trunk/gli/src/org/greenstone/gatherer/collection/ScriptOptions.java
r9135 r10006 57 57 // replace .pl with .xml to get the template name 58 58 String template_name = script_name.replaceAll("\\.pl$", "\\.xml"); 59 Document document = Utility.parse("xml/"+template_name, true);59 Document document = XMLTools.parseXMLFile("xml/" + template_name, true); 60 60 if (document != null) { 61 61 arguments_element = document.getDocumentElement(); -
trunk/gli/src/org/greenstone/gatherer/gems/GEMS.java
r9943 r10006 66 66 import org.greenstone.gatherer.util.Codec; 67 67 import org.greenstone.gatherer.util.Utility; 68 import org.greenstone.gatherer.util.XMLTools; 68 69 import org.w3c.dom.*; 69 70 … … 716 717 private Vector attributeLists = null; 717 718 718 org.w3c.dom.Document lang = Utility.parse(Configuration.gsdl_path + File.separator + "gli" + File.separator + "classes" + File.separator + "xml" + File.separator + "languages.xml", false);719 org.w3c.dom.Document lang = XMLTools.parseXMLFile(Configuration.gsdl_path + File.separator + "gli" + File.separator + "classes" + File.separator + "xml" + File.separator + "languages.xml", false); 719 720 720 721 /** Constructor. */ -
trunk/gli/src/org/greenstone/gatherer/gems/MetadataSet.java
r9855 r10006 83 83 84 84 this.file = new File(metadata_template); 85 this.document = Utility.parse(metadata_template, true);85 this.document = XMLTools.parseXMLFile(metadata_template, true); 86 86 87 87 init(true); // use class loader -
trunk/gli/src/org/greenstone/gatherer/gui/HelpFrame.java
r8579 r10006 48 48 import org.greenstone.gatherer.util.StaticStrings; 49 49 import org.greenstone.gatherer.util.Utility; 50 import org.greenstone.gatherer.util.XMLTools; 50 51 import org.w3c.dom.*; 51 52 … … 162 163 try { 163 164 String help_index = Utility.getHelpFolder() + StaticStrings.HELP_INDEX_FILENAME; 164 Document document = Utility.parse(help_index,true);165 Document document = XMLTools.parseXMLFile(help_index, true); 165 166 166 167 // Traverse the document hierarchy, building a tree representing its structure -
trunk/gli/src/org/greenstone/gatherer/gui/Preferences.java
r9887 r10006 48 48 import org.greenstone.gatherer.util.CheckListEntry; 49 49 import org.greenstone.gatherer.util.StaticStrings; 50 import org.greenstone.gatherer.util. Utility;50 import org.greenstone.gatherer.util.XMLTools; 51 51 import org.w3c.dom.*; 52 52 … … 503 503 504 504 // Read all the warnings from the general xml/config.xml file, and their values from the user config.xml file 505 Document general_config_xml_file_document = Utility.parse("xml/config.xml", true);505 Document general_config_xml_file_document = XMLTools.parseXMLFile("xml/config.xml", true); 506 506 NodeList argument_elements_nodelist = general_config_xml_file_document.getDocumentElement().getElementsByTagName("Argument"); 507 507 for (int i = 0; i < argument_elements_nodelist.getLength(); i++) { … … 528 528 // Read in the predefined configurations file 529 529 Vector predefined = new Vector(); 530 Document predefined_document = Utility.parse("xml/workflows.xml", true);530 Document predefined_document = XMLTools.parseXMLFile("xml/workflows.xml", true); 531 531 Element predefined_element = predefined_document.getDocumentElement(); 532 532 NodeList workflow_elements = predefined_element.getElementsByTagName("Workflow"); -
trunk/gli/src/org/greenstone/gatherer/metadata/MetadataXMLFileManager.java
r9856 r10006 32 32 import org.greenstone.gatherer.DebugStream; 33 33 import org.greenstone.gatherer.collection.CollectionTreeNode; 34 import org.greenstone.gatherer.util.Utility;35 34 import org.greenstone.gatherer.util.XMLTools; 36 35 … … 76 75 // Create a new (empty) metadata.xml file in the file's directory... 77 76 File new_metadata_xml_file_file = new File(current_file_directory, "metadata.xml"); 78 XMLTools.writeXMLFile(new_metadata_xml_file_file, Utility.parse("xml/metadata.xml", true));77 XMLTools.writeXMLFile(new_metadata_xml_file_file, XMLTools.parseXMLFile("xml/metadata.xml", true)); 79 78 80 79 // ...load it... -
trunk/gli/src/org/greenstone/gatherer/metadata/ProfileXMLFileManager.java
r8164 r10006 30 30 import java.io.*; 31 31 import java.util.*; 32 import org.greenstone.gatherer.util.Utility;33 32 import org.greenstone.gatherer.util.XMLTools; 34 33 … … 56 55 if (!profile_xml_file_file.exists()) { 57 56 // Create a new (empty) profile.xml file in this directory... 58 XMLTools.writeXMLFile(profile_xml_file_file, Utility.parse("xml/profile.xml", true));57 XMLTools.writeXMLFile(profile_xml_file_file, XMLTools.parseXMLFile("xml/profile.xml", true)); 59 58 } 60 59 -
trunk/gli/src/org/greenstone/gatherer/util/StaticStrings.java
r9906 r10006 191 191 static final public String PLUGIN_STR = "plugin"; 192 192 static final public String PROPERTIES_FILE_EXTENSION = ".properties"; 193 static final public String PSEUDO_COLLECTCONFIGURATION_XML = "xml/CollectionConfig.xml";194 193 static final public String RANGE_ELEMENT = "Range"; 195 194 static final public String RBRACKET_CHARACTER = "]"; -
trunk/gli/src/org/greenstone/gatherer/util/Utility.java
r9981 r10006 1037 1037 1038 1038 1039 /** Parse in a xml document from a given filename. Note that this filename may need to be resolved by the class loader, especially for template files within a jar. */1040 static public Document parse(String filename, boolean use_classloader)1041 {1042 // Try the class loader if desired (for the applet JAR file)1043 if (use_classloader) {1044 InputStream is = base.getResourceAsStream("/" + filename);1045 if (is != null) {1046 return XMLTools.parseXML(is);1047 }1048 }1049 1050 // Try the file outside the classes directory1051 return XMLTools.parseXMLFile(new File(filename));1052 }1053 1054 1055 1039 static public StringBuffer readXMLStream(InputStream input_stream) 1056 1040 { -
trunk/gli/src/org/greenstone/gatherer/util/XMLTools.java
r9856 r10006 96 96 } 97 97 return child; 98 } 99 100 101 /** Parse an XML document from a given file path */ 102 static public Document parseXMLFile(String xml_file_path, boolean use_class_loader) 103 { 104 if (use_class_loader == true) { 105 InputStream is = Utility.base.getResourceAsStream("/" + xml_file_path); // !! 106 if (is != null) { 107 return parseXML(is); 108 } 109 } 110 111 // Try the file outside the classes directory 112 return parseXMLFile(new File(xml_file_path)); 98 113 } 99 114
Note:
See TracChangeset
for help on using the changeset viewer.