- Timestamp:
- 2004-10-08T09:46:12+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/cdm/CollectionConfiguration.java
r8231 r8236 33 33 import javax.swing.*; 34 34 import org.greenstone.gatherer.Configuration; 35 import org.greenstone.gatherer.DebugStream; 35 36 import org.greenstone.gatherer.Gatherer; 36 37 import org.greenstone.gatherer.cdm.CommandTokenizer; … … 463 464 } 464 465 if(!original_file.renameTo(backup_file)) { 465 Gatherer.println("Can't rename collect.cfg");466 DebugStream.println("Can't rename collect.cfg"); 466 467 } 467 468 } … … 514 515 } 515 516 catch (Exception exception) { 516 Gatherer.println("Error in CollectionConfiguration.save(boolean): " + exception);517 Gatherer.printStackTrace(exception);517 DebugStream.println("Error in CollectionConfiguration.save(boolean): " + exception); 518 DebugStream.printStackTrace(exception); 518 519 } 519 520 } … … 903 904 // Why can't you switch on strings eh? We pass it to the various subparsers who each have a bash at parsing the command. If none can parse the command, an unknown element is created 904 905 if(command_element == null && command_type.equals(BUILDTYPE_STR)) { 905 Gatherer.println("G2.39 Buildtype command detected. Ignoring.");906 DebugStream.println("G2.39 Buildtype command detected. Ignoring."); 906 907 command_element = document.createElement(UNKNOWN_ELEMENT); 907 908 append_element = false; … … 916 917 // If this was a G2.39 config file then we manipulate the command string a bit before we submit it to the parser. We start by adding allfields as the first index. We then space separate the remaining indexes, and remove duplicates when encountered. Of course before we do any of that we record the various space separated indexes so that we can remove the collection meta assigned to them. 917 918 if(is_twopointthreenine) { 918 Gatherer.println("G2.39 Index command detected. Modifying.");919 Gatherer.println("Before: " + command_str);919 DebugStream.println("G2.39 Index command detected. Modifying."); 920 DebugStream.println("Before: " + command_str); 920 921 StringBuffer new_command_str = new StringBuffer(command_type); 921 922 new_command_str.append(SPACE_CHARACTER); … … 958 959 command_str = new_command_str.toString(); 959 960 new_command_str = null; 960 Gatherer.println("After: " + command_str);961 DebugStream.println("After: " + command_str); 961 962 } 962 963 command_element = parseIndex(command_str); … … 967 968 // If this was a G2.39 config file then we squelch the default index (no such thing in G2.4) 968 969 if(is_twopointthreenine) { 969 Gatherer.println("G2.39 Default Index command detected. Ignoring.");970 DebugStream.println("G2.39 Default Index command detected. Ignoring."); 970 971 append_element = false; 971 972 } … … 980 981 // Again if this is G2.39 we have to do a tiny bit of magic to the levels command. We need to add document level, and change the remainder to lower case. 981 982 if(is_twopointthreenine) { 982 Gatherer.println("G2.39 Levels command detected. Modifying.");983 Gatherer.println("Before: " + command_str);983 DebugStream.println("G2.39 Levels command detected. Modifying."); 984 DebugStream.println("Before: " + command_str); 984 985 StringBuffer new_command_str = new StringBuffer(command_type); 985 986 new_command_str.append(SPACE_CHARACTER); … … 1000 1001 command_str = new_command_str.toString(); 1001 1002 new_command_str = null; 1002 Gatherer.println("After: " + command_str);1003 DebugStream.println("After: " + command_str); 1003 1004 } 1004 1005 command_element = parseLevels(command_str); … … 1066 1067 Element document_element = document.getDocumentElement(); 1067 1068 NodeList collectionmeta_elements = document_element.getElementsByTagName(COLLECTIONMETADATA_ELEMENT); 1068 Gatherer.println("There are " + obsolete_collectionmeta_names.size() + " collectionmeta to remove.");1069 Gatherer.println("There are " + changed_collectionmeta_names.size() + " collectionmeta to change.");1069 DebugStream.println("There are " + obsolete_collectionmeta_names.size() + " collectionmeta to remove."); 1070 DebugStream.println("There are " + changed_collectionmeta_names.size() + " collectionmeta to change."); 1070 1071 for(int z = collectionmeta_elements.getLength(); z > 0; z--) { 1071 1072 Element collectionmeta_element = (Element) collectionmeta_elements.item(z - 1); 1072 1073 String name = collectionmeta_element.getAttribute(NAME_ATTRIBUTE); 1073 Gatherer.println("Checking " + name);1074 DebugStream.println("Checking " + name); 1074 1075 // Remove any obsolete metadata 1075 1076 if(obsolete_collectionmeta_names.contains(name)) { 1076 Gatherer.println("G2.39 CollectMeta detected. Removing: " + name);1077 DebugStream.println("G2.39 CollectMeta detected. Removing: " + name); 1077 1078 document_element.removeChild(collectionmeta_element); 1078 1079 } … … 1080 1081 else if(changed_collectionmeta_names.containsKey(name)) { 1081 1082 String new_name = (String) changed_collectionmeta_names.get(name); 1082 Gatherer.println("G2.39 CollectMeta detected. Changing: " + name + " -> " + new_name);1083 DebugStream.println("G2.39 CollectMeta detected. Changing: " + name + " -> " + new_name); 1083 1084 collectionmeta_element.setAttribute(NAME_ATTRIBUTE, new_name); 1084 1085 new_name = null; … … 1088 1089 1089 1090 // Finally add any newly acquired collectionmeta. This general defaults to the collectionmeta name less the full stop 1090 Gatherer.println("There are " + acquired_collectionmeta_names.size() + " collectionmeta to add.");1091 DebugStream.println("There are " + acquired_collectionmeta_names.size() + " collectionmeta to add."); 1091 1092 for(int y = 0; y < acquired_collectionmeta_names.size(); y++) { 1092 1093 String name = (String) acquired_collectionmeta_names.get(y); 1093 1094 String value = name.substring(1); 1094 Gatherer.println("G2.39 CollectMeta missing. Adding: " + name + " [l=" + Configuration.getLanguage() + "] \"" + value + "\"");1095 DebugStream.println("G2.39 CollectMeta missing. Adding: " + name + " [l=" + Configuration.getLanguage() + "] \"" + value + "\""); 1095 1096 Element element = document.createElement(COLLECTIONMETADATA_ELEMENT); 1096 1097 element.setAttribute(NAME_ATTRIBUTE, name); … … 1108 1109 } 1109 1110 catch(Exception exception) { 1110 Gatherer.println("Error in CollectionConfiguration.parse(java.io.File): " + exception);1111 Gatherer.printStackTrace(exception);1111 DebugStream.println("Error in CollectionConfiguration.parse(java.io.File): " + exception); 1112 DebugStream.printStackTrace(exception); 1112 1113 } 1113 1114 } … … 1201 1202 } 1202 1203 catch (Exception exception) { 1203 Gatherer.printStackTrace(exception);1204 DebugStream.printStackTrace(exception); 1204 1205 command_element = null; 1205 1206 } … … 1394 1395 } 1395 1396 catch (Exception exception) { 1396 Gatherer.printStackTrace(exception);1397 DebugStream.printStackTrace(exception); 1397 1398 command_element = null; 1398 1399 }
Note:
See TracChangeset
for help on using the changeset viewer.