Changeset 14974 for gli/trunk/src/org/greenstone/gatherer/collection
- Timestamp:
- 2008-02-12T16:13:13+13:00 (16 years ago)
- Location:
- gli/trunk/src/org/greenstone/gatherer/collection
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/trunk/src/org/greenstone/gatherer/collection/Collection.java
r13819 r14974 86 86 /** The name of the import element. */ 87 87 static final private String IMPORT = "Import"; 88 /** The name of the import element. */ 89 static final private String EXPORT = "Export"; 88 90 /** The name of the imported attribute. */ 89 91 static final private String IMPORTED = "imported"; … … 111 113 } 112 114 // Finally create all of the child managers that are directly dependant on a collection 113 build_options = new ScriptOptions(getBuildValues(), "buildcol.pl"); 114 import_options = new ScriptOptions(getImportValues(), "import.pl"); 115 116 if (Configuration.fedora_info.isActive()) { 117 build_options = new ScriptOptions(getValues(BUILD), "g2f-buildcol.pl"); 118 import_options = new ScriptOptions(getValues(IMPORT), "g2f-import.pl"); 119 } 120 else { 121 build_options = new ScriptOptions(getBuildValues(), "buildcol.pl"); 122 import_options = new ScriptOptions(getImportValues(), "import.pl"); 123 } 115 124 } 116 125 … … 334 343 335 344 345 /** Method to retrieve the current import/build/export/whatever options associated with this Collection. */ 346 private Element getValues(String val_type) { 347 Element values_element = null; 348 try { 349 Element document_element = document.getDocumentElement(); 350 Element config_element = (Element) XMLTools.getNodeFromNamed(document_element, BUILD_CONFIG); 351 values_element = (Element) XMLTools.getNodeFromNamed(config_element, val_type); 352 config_element = null; 353 document_element = null; 354 } 355 catch (Exception error) { 356 DebugStream.printStackTrace(error); 357 } 358 return values_element; 359 } 360 336 361 337 362 /** Method to retrieve the current build options associated with this Collection. */ … … 350 375 return build_values_element; 351 376 } 377 352 378 353 379 /** Count either documents or folders, depending on the state of the given boolean. */ -
gli/trunk/src/org/greenstone/gatherer/collection/CollectionManager.java
r14817 r14974 159 159 command_parts_list.add("-S"); 160 160 } 161 command_parts_list.add(LocalGreenstone.getBinScriptDirectoryPath() + "buildcol.pl"); 161 162 if (Configuration.fedora_info.isActive()) { 163 command_parts_list.add(LocalGreenstone.getBinScriptDirectoryPath() + "g2f-buildcol.pl"); 164 165 command_parts_list.add("-hostname"); 166 command_parts_list.add(Configuration.fedora_info.getHostname()); 167 168 command_parts_list.add("-port"); 169 command_parts_list.add(Configuration.fedora_info.getPort()); 170 171 command_parts_list.add("-username"); 172 command_parts_list.add(Configuration.fedora_info.getUsername()); 173 174 command_parts_list.add("-password"); 175 command_parts_list.add(Configuration.fedora_info.getPassword()); 176 177 command_parts_list.add("-protocol"); 178 command_parts_list.add(Configuration.fedora_info.getProtocol()); 179 180 } 181 else { 182 command_parts_list.add(LocalGreenstone.getBinScriptDirectoryPath() + "buildcol.pl"); 183 } 162 184 command_parts_list.add("-gli"); 163 185 command_parts_list.add("-language"); … … 193 215 public boolean built() { 194 216 if(collection != null) { 195 // Determine if the collection has been built by looking for the build.cfg or buildConfig.xml file 196 String file_name = (Gatherer.GS3)? Utility.BUILD_CONFIG_XML : Utility.BUILD_CFG; 197 File build_cfg_file = new File(getLoadedCollectionIndexDirectoryPath() + file_name); 198 return build_cfg_file.exists(); 217 // Determine if the collection has been built by looking for the build.cfg (gs20 buildConfig.xml (gs3) or export.inf (fedora) file 218 String file_name = ""; 219 220 if (Gatherer.GS3) { 221 file_name = getLoadedCollectionIndexDirectoryPath() + Utility.BUILD_CONFIG_XML; 222 } 223 else { 224 if (Configuration.fedora_info.isActive()) { 225 // Fedora build 226 //file_name = getLoadedCollectionArchivesDirectoryPath() + "import.inf"; 227 file_name = getLoadedCollectionExportDirectoryPath() + "export.inf"; 228 } 229 else { 230 file_name = getLoadedCollectionIndexDirectoryPath() + Utility.BUILD_CFG; 231 } 232 } 233 234 File test_file = new File(file_name); 235 return test_file.exists(); 199 236 } 200 237 return false; … … 592 629 } 593 630 631 /** Returns the absolute filename of the loaded collection's export directory. 632 */ 633 static public String getLoadedCollectionExportDirectoryPath() 634 { 635 return getLoadedCollectionDirectoryPath() + "export" + File.separator; 636 } 637 638 594 639 595 640 /** Returns the absolute filename of the loaded collection's building directory. … … 764 809 command_parts_list.add("-S"); 765 810 } 766 command_parts_list.add(LocalGreenstone.getBinScriptDirectoryPath() + "import.pl"); 811 812 if (Configuration.fedora_info.isActive()) { 813 command_parts_list.add(LocalGreenstone.getBinScriptDirectoryPath() + "g2f-import.pl"); 814 815 command_parts_list.add("-hostname"); 816 command_parts_list.add(Configuration.fedora_info.getHostname()); 817 818 command_parts_list.add("-port"); 819 command_parts_list.add(Configuration.fedora_info.getPort()); 820 821 command_parts_list.add("-username"); 822 command_parts_list.add(Configuration.fedora_info.getUsername()); 823 824 command_parts_list.add("-password"); 825 command_parts_list.add(Configuration.fedora_info.getPassword()); 826 827 command_parts_list.add("-protocol"); 828 command_parts_list.add(Configuration.fedora_info.getProtocol()); 829 } 830 else { 831 command_parts_list.add(LocalGreenstone.getBinScriptDirectoryPath() + "import.pl"); 832 } 833 767 834 command_parts_list.add("-gli"); 768 835 command_parts_list.add("-language"); … … 1339 1406 private boolean installCollection() 1340 1407 { 1408 if (Configuration.fedora_info.isActive()) { 1409 DebugStream.println("Fedora build complete. No need to move files."); 1410 return true; 1411 } 1412 1413 1341 1414 DebugStream.println("Build complete. Moving files."); 1342 1415 -
gli/trunk/src/org/greenstone/gatherer/collection/ScriptOptions.java
r13753 r14974 247 247 } 248 248 249 249 250 // Create the process. 250 251 Runtime runtime = Runtime.getRuntime(); 251 252 Process process = runtime.exec(args); 253 254 /* 255 for (int i=0; i<args.length; i++) { 256 System.err.print(args[i] + " "); 257 } 258 System.err.println(""); 259 */ 260 261 252 262 document = XMLTools.parseXML(process.getErrorStream()); 263 264 if (document == null) { 265 // command has not generated XML, script has probably failed in some way 266 for (int i=0; i<args.length; i++) { 267 DebugStream.print(args[i] + " "); 268 } 269 DebugStream.println(""); 270 } 253 271 } 254 272
Note:
See TracChangeset
for help on using the changeset viewer.