Changeset 8490
- Timestamp:
- 2004-11-09T11:22:56+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/BuildManager.java
r8489 r8490 21 21 String outputDir; 22 22 String archiveDir; 23 24 public BuildManager(List inputRoots, String site, String collection, String outputDir) 23 24 public BuildManager(List inputRoots, String site, String collection, String outputDir) 25 25 { 26 // get the collection configuration information26 // set up the collection manager 27 27 this.collectionManager = new CollectionManager(site, collection); 28 28 this.collectionManager.setBuildManager(this); 29 29 30 // set up the list of input directories 30 31 if (inputRoots.size() == 0) { … … 32 33 System.out.println("Adding collection import directory to input list " + this.collectionManager.getImportDirectory()); 33 34 } 34 this.docList = new DocumentList(new DocumentIDFactory(this.collectionManager),35 this.collectionManager.getDatabase());36 35 this.inputRoots = inputRoots; 37 38 // set up the output director y36 37 // set up the output directories (building and archive) 39 38 this.outputDir = outputDir != null ? outputDir : this.collectionManager.getBuildDirectory(); 40 39 File outputDirFile = new File(this.outputDir); 41 if (!outputDirFile. exists() || !outputDirFile.isDirectory()) {40 if (!outputDirFile.isDirectory()) { 42 41 System.err.println("Unable to open directory " + this.outputDir + " for writing"); 43 42 System.exit(1); 44 43 } 45 44 System.out.println("Output directory set to " + this.outputDir); 46 45 46 // set up the archive directory - this will definitely exist 47 47 this.archiveDir = this.collectionManager.getArchiveDirectory(); 48 48 49 // TODO: initialise the expanders here... 50 51 // initialise any recognisers 52 this.recogniserManager = new RecogniserManager(); 53 RecogniserInterface recogniser = new HTMLRecogniser(docList); 54 recogniserManager.addRecogniser(recogniser); 55 recogniserManager.addRecogniser(new IndexRecogniser(docList)); 56 recogniser = new TextRecogniser(docList); 57 recogniserManager.addRecogniser(recogniser); 58 recogniser = new JPEGRecogniser(docList); 59 recogniserManager.addRecogniser(recogniser); 60 /* recogniser = new ExtXMLRecogniser(docList); 61 recogniserManager.addRecogniser(recogniser);*/ 62 recogniser = new MetadataRecogniser(docList); 63 recogniserManager.addRecogniser(recogniser); 64 recogniser = new GS2METSRecogniser(docList); 65 recogniserManager.addRecogniser(recogniser); 66 67 // set up the extractors 49 // the list that documents get added to when they are recognised 50 this.docList = new DocumentList(new DocumentIDFactory(this.collectionManager), 51 this.collectionManager.getDatabase()); 52 53 // set up the various managers 54 this.recogniserManager = new RecogniserManager(this.docList); 68 55 this.extractorManager = new ExtractorManager(this.docList); 56 this.classifierManager = new ClassifierManager(this.docList, collectionManager.getDatabase()); 57 this.indexerManager = new IndexerManager(this.docList); 58 59 // configure the collection - this will add classifiers, indexers, recognisers to the various managers. 60 this.collectionManager.configureCollection(); 61 62 // add in expanders by hand cos they are not in the config file yet 63 // TODO 64 // add in extractors by hand cos they are not in the config file yet 69 65 this.extractorManager.addExtractor(new IndexExtractor()); 70 /* this.extractorManager.addExtractor(new ExtXMLExtractor());*/71 66 this.extractorManager.addExtractor(new MetaXMLExtractor()); 72 73 // TODO: set up the enrichers... 74 75 // set up the classifiers 76 this.classifierManager = new ClassifierManager(this.docList, collectionManager.getDatabase()); 77 78 // set up the indexers 79 this.indexerManager = new IndexerManager(this.docList); 80 81 // configure the collection 82 this.collectionManager.configureCollection(); 83 67 68 // add in enrichers by hand cos they are not in the config file yet 69 // TODO 70 84 71 // prepare a file crawler on the etc directory, and a crawl observer to respond to 85 72 // the appropriate files. … … 105 92 } 106 93 94 public RecogniserManager getRecogniserManager() 95 { 96 return this.recogniserManager; 97 } 98 107 99 public void addIndexer(IndexerInterface iface) 108 100 { … … 115 107 // Initialise collection manager - note start of build 116 108 this.collectionManager.startBuild(); 117 109 118 110 // TODO: add expansion (e.g. Zip files) 119 111 … … 121 113 for (int i = 0; i < this.inputRoots.size(); i ++) { 122 114 FileCrawler fileCrawler = new FileCrawler(new File((String) this.inputRoots.get(i)), recogniserManager); 123 115 124 116 fileCrawler.crawl(); 125 117 } … … 134 126 // This should only occur at the end of building in case the build is cancelled... 135 127 docList.updateTimestamps(this.collectionManager.getBuildDate()); 136 128 137 129 // TODO: validation phase 138 130 139 131 if (this.archiveDir != null) { 140 132 this.docList.writeDocuments(new File(this.archiveDir)); 141 133 //this.docList.writeSQLDocuments(this.collectionManager.getDatabase()); 142 134 } 143 135 144 136 this.collectionManager.setCollectionMetadata("gsdl3", "documentCount", Integer.toString(this.docList.getCount())); 145 137 … … 150 142 151 143 public void addInputDirectory(String inputDir) 152 { 144 { 153 145 this.inputRoots.add(inputDir); 154 146 }
Note:
See TracChangeset
for help on using the changeset viewer.