Changeset 6322
- Timestamp:
- 06/24/15 12:21:17 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.3-oeaw/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java
r6321 r6322 93 93 */ 94 94 public MetadataImporter() {} 95 96 public MetadataImporter(String clDatarootsList) { 97 this.clDatarootsList = clDatarootsList; 98 } 95 99 96 100 /** … … 207 211 for (DataRoot dataRoot : dataRoots) { 208 212 if (!dataRoot.getRootFile().exists()) { 209 LOG. error("Root file " + dataRoot.getRootFile() + " does not exist. It could be configuration error! Proceeding with next ...");213 LOG.warn("Root file " + dataRoot.getRootFile() + " does not exist. It could be configuration error! Proceeding with next ..."); 210 214 } else{ 211 215 existingDataRoots.add(dataRoot); … … 223 227 */ 224 228 protected List<DataRoot> filterDataRootsWithCLArgs(List<DataRoot> dataRoots){ 225 if( CL_DATAROOTS_LIST== null)229 if(clDatarootsList == null) 226 230 return dataRoots; 227 231 228 //filter data229 232 230 LOG.info("Filtering configured data root files with command line arguments: " + CL_DATAROOTS_LIST) ;233 LOG.info("Filtering configured data root files with command line arguments: \"" + clDatarootsList + "\"" ) ; 231 234 232 LinkedList<File> cl_dataroots = new LinkedList<File>();235 LinkedList<File> fsDataRoots = new LinkedList<File>(); 233 236 234 List<String> paths = Arrays.asList(( CL_DATAROOTS_LIST.split("\\s+")));237 List<String> paths = Arrays.asList((clDatarootsList.split("\\s+"))); 235 238 239 //Convert String paths to File objects for comparison 236 240 for(String path: paths) 237 cl_dataroots.add(new File(path));241 fsDataRoots.add(new File(path)); 238 242 239 243 List<DataRoot> filteredDataRoots = new LinkedList<DataRoot>(); 240 244 try{ 245 //filter data 241 246 dr: for(DataRoot dataRoot: dataRoots){ 242 for(File cldr: cl_dataroots){243 if( cldr.getCanonicalPath().equals(dataRoot.getRootFile().getCanonicalPath())){247 for(File fsDataRoot: fsDataRoots){ 248 if(fsDataRoot.getCanonicalPath().equals(dataRoot.getRootFile().getCanonicalPath())){ 244 249 filteredDataRoots.add(dataRoot); 245 cl_dataroots.remove(cldr);250 fsDataRoots.remove(fsDataRoot); 246 251 continue dr; 247 252 } … … 566 571 567 572 //data roots passed from command line 568 p ublic static String CL_DATAROOTS_LIST= null;573 private String clDatarootsList = null; 569 574 570 575 /** … … 580 585 // use the Apache cli framework for getting command line parameters 581 586 Options options = new Options(); 587 588 // Data root list passed from command line with -l option 589 String cldrList = null; 582 590 583 591 /** 584 592 * Add a "c" option, the option indicating the specification of an XML 585 593 * configuration file 594 * 595 * "l" option - to specify which data roots (from config file) to import 596 * imports all by default 586 597 */ 587 598 options.addOption("c", true, "-c <file> : use parameters specified in <file>"); … … 602 613 603 614 if(cmd.hasOption("l")){ 604 CL_DATAROOTS_LIST= cmd.getOptionValue("l");615 cldrList = cmd.getOptionValue("l"); 605 616 } 606 617 … … 651 662 // optionally, modify the configuration here 652 663 // create and start the importer 653 MetadataImporter importer = new MetadataImporter( );664 MetadataImporter importer = new MetadataImporter(cldrList); 654 665 importer.startImport(); 655 666
Note: See TracChangeset
for help on using the changeset viewer.