Changeset 12798
- Timestamp:
- 2006-09-21T11:16:14+12:00 (18 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer/cdm
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/ArgumentContainer.java
r12641 r12798 106 106 // The trick thing is that we have to create a new element in the DOM as well. 107 107 Argument new_argument = base_argument.copy(); 108 Element argument_element = Collection DesignManager.collect_config.document.createElement(StaticStrings.OPTION_ELEMENT);108 Element argument_element = CollectionConfiguration.createElement(StaticStrings.OPTION_ELEMENT); 109 109 argument_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, base_argument_name); 110 110 argument_element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.FALSE_STR); -
trunk/gli/src/org/greenstone/gatherer/cdm/ClassifierManager.java
r12749 r12798 420 420 421 421 // Create a new element in the DOM 422 Element new_classifier_element = Collection DesignManager.collect_config.document.createElement(StaticStrings.CLASSIFY_ELEMENT);422 Element new_classifier_element = CollectionConfiguration.createElement(StaticStrings.CLASSIFY_ELEMENT); 423 423 new_classifier_element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, classifier.getName()); 424 424 Classifier new_classifier = new Classifier(new_classifier_element, classifier); -
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionConfiguration.java
r12416 r12798 56 56 static final public String ENCODING = "UTF-8"; 57 57 58 static public Document document; 58 static private Document document; 59 60 61 static public Element createElement(String element_name) 62 { 63 return document.createElement(element_name); 64 } 65 59 66 60 67 /** Find the best insertion position for the given DOM Element. This should try to match command tag, and if found should then try to group by name or type (eg CollectionMeta), or append to end is no such grouping exists (eg Plugins). Failing a command match it will check against the command order for the best insertion location. -
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionMeta.java
r12641 r12798 58 58 /** Constructor to create a new piece of metadata given its name. */ 59 59 public CollectionMeta(String name) { 60 element = Collection DesignManager.collect_config.document.createElement(StaticStrings.COLLECTIONMETADATA_ELEMENT);60 element = CollectionConfiguration.createElement(StaticStrings.COLLECTIONMETADATA_ELEMENT); 61 61 element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name); 62 62 element.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, Configuration.getLanguage()); … … 66 66 /** Constructor to create a new piece of metadata given its name. */ 67 67 public CollectionMeta(String name, String language) { 68 element = Collection DesignManager.collect_config.document.createElement(StaticStrings.COLLECTIONMETADATA_ELEMENT);68 element = CollectionConfiguration.createElement(StaticStrings.COLLECTIONMETADATA_ELEMENT); 69 69 element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name); 70 70 element.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, language); -
trunk/gli/src/org/greenstone/gatherer/cdm/Format.java
r12641 r12798 127 127 public Format(Object feature, String part, boolean state) { 128 128 129 element = Collection DesignManager.collect_config.document.createElement(StaticStrings.FORMAT_ELEMENT);129 element = CollectionConfiguration.createElement(StaticStrings.FORMAT_ELEMENT); 130 130 setName(feature, part); 131 131 setState(state); … … 140 140 public Format(Object feature, String part, String value) { 141 141 142 element = Collection DesignManager.collect_config.document.createElement(StaticStrings.FORMAT_ELEMENT);142 element = CollectionConfiguration.createElement(StaticStrings.FORMAT_ELEMENT); 143 143 setName(feature, part); 144 144 setValue(value); -
trunk/gli/src/org/greenstone/gatherer/cdm/Index.java
r12641 r12798 66 66 this.sources = sources; 67 67 // Create a new element 68 Document document = CollectionDesignManager.collect_config.document; 69 this.element = document.createElement(StaticStrings.INDEX_ELEMENT); 68 this.element = CollectionConfiguration.createElement(StaticStrings.INDEX_ELEMENT); 70 69 // For each source add a content element 71 70 int size = sources.size(); 72 71 for(int i = 0; i < size; i++) { 73 Element content_element = document.createElement(StaticStrings.CONTENT_ELEMENT);72 Element content_element = CollectionConfiguration.createElement(StaticStrings.CONTENT_ELEMENT); 74 73 Object source_object = sources.get(i); 75 74 if (source_object instanceof MetadataElement) { … … 84 83 content_element = null; 85 84 } 86 document = null;87 85 } 88 86 -
trunk/gli/src/org/greenstone/gatherer/cdm/Language.java
r12641 r12798 56 56 this.code = code; 57 57 // Create the new element 58 element = Collection DesignManager.collect_config.document.createElement(StaticStrings.LANGUAGE_ELEMENT);58 element = CollectionConfiguration.createElement(StaticStrings.LANGUAGE_ELEMENT); 59 59 element.setAttribute(StaticStrings.NAME_ATTRIBUTE, code); 60 60 element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR); … … 74 74 } 75 75 this.code = code_str.toString(); 76 element = Collection DesignManager.collect_config.document.createElement(StaticStrings.LANGUAGE_ELEMENT);76 element = CollectionConfiguration.createElement(StaticStrings.LANGUAGE_ELEMENT); 77 77 element.setAttribute(StaticStrings.NAME_ATTRIBUTE, code); 78 78 element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.TRUE_STR); -
trunk/gli/src/org/greenstone/gatherer/cdm/Level.java
r12641 r12798 54 54 */ 55 55 public Level(String level) { 56 this.element = Collection DesignManager.collect_config.document.createElement(StaticStrings.LEVEL_ELEMENT);56 this.element = CollectionConfiguration.createElement(StaticStrings.LEVEL_ELEMENT); 57 57 this.element.setAttribute(StaticStrings.NAME_ATTRIBUTE, level); 58 58 } -
trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java
r12749 r12798 342 342 } 343 343 } 344 Element element = Collection DesignManager.collect_config.document.createElement(StaticStrings.PLUGIN_ELEMENT);344 Element element = CollectionConfiguration.createElement(StaticStrings.PLUGIN_ELEMENT); 345 345 element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, StaticStrings.SEPARATOR_ATTRIBUTE); 346 346 element.setAttribute(StaticStrings.SEPARATOR_ATTRIBUTE, StaticStrings.TRUE_STR); … … 588 588 589 589 // Create a new element in the DOM 590 Element new_plugin_element = Collection DesignManager.collect_config.document.createElement(StaticStrings.PLUGIN_ELEMENT);590 Element new_plugin_element = CollectionConfiguration.createElement(StaticStrings.PLUGIN_ELEMENT); 591 591 new_plugin_element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, plugin.getName()); 592 592 Plugin new_plugin = new Plugin(new_plugin_element, plugin); … … 958 958 959 959 // Create a new element in the DOM 960 Element new_plugin_element = Collection DesignManager.collect_config.document.createElement(StaticStrings.PLUGIN_ELEMENT);960 Element new_plugin_element = CollectionConfiguration.createElement(StaticStrings.PLUGIN_ELEMENT); 961 961 new_plugin_element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, plugin.getName()); 962 962 Plugin new_plugin = new Plugin(new_plugin_element, plugin); -
trunk/gli/src/org/greenstone/gatherer/cdm/Subcollection.java
r12641 r12798 83 83 } 84 84 // Create a new DOM Element with the appropriate attributes and text value 85 element = Collection DesignManager.collect_config.document.createElement(StaticStrings.SUBCOLLECTION_ELEMENT);85 element = CollectionConfiguration.createElement(StaticStrings.SUBCOLLECTION_ELEMENT); 86 86 element.setAttribute(StaticStrings.CONTENT_ATTRIBUTE, source); 87 87 element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name); -
trunk/gli/src/org/greenstone/gatherer/cdm/SubcollectionIndex.java
r12641 r12798 57 57 this.sources = new ArrayList(); 58 58 // Create a new element 59 Document document = CollectionDesignManager.collect_config.document; 60 element = document.createElement(StaticStrings.INDEX_ELEMENT); 59 element = CollectionConfiguration.createElement(StaticStrings.INDEX_ELEMENT); 61 60 // For each source add a content element 62 61 int size = raw_sources.length; … … 65 64 String subcollection_name = subcollection.getName(); 66 65 sources.add(subcollection_name); 67 Element content_element = document.createElement(StaticStrings.CONTENT_ELEMENT);66 Element content_element = CollectionConfiguration.createElement(StaticStrings.CONTENT_ELEMENT); 68 67 content_element.setAttribute(StaticStrings.NAME_ATTRIBUTE, subcollection_name); 69 68 element.appendChild(content_element); 70 69 content_element = null; 71 70 } 72 document = null;73 71 } 74 72
Note:
See TracChangeset
for help on using the changeset viewer.