Changeset 6696
- Timestamp:
- 2004-02-02T16:06:45+13:00 (20 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/BuildManager.java
r6454 r6696 101 101 102 102 public void run() 103 { 103 { // Initialise collection manager - note start of build 104 104 this.collectionManager.startBuild(); 105 106 // TODO: add expansion (e.g. Zip files) 105 107 106 108 for (int i = 0; i < this.inputRoots.size(); i ++) … … 109 111 fileCrawler.crawl(); 110 112 } 111 this.indexerManager.indexDocuments();112 113 this.extractorManager.extractDocuments(); 113 114 this.classifierManager.classifyDocuments(); 115 this.indexerManager.indexDocuments(); 116 117 // TODO: validation phase 114 118 115 119 if (this.archiveDir != null) { … … 120 124 this.collectionManager.setCollectionMetadata("gsdl3", "documentCount", Integer.toString(this.docList.getCount())); 121 125 126 // TODO: write out collection configuration file (service lists, etc.) 127 122 128 this.collectionManager.endBuild(); 123 129 } -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/CollectionManager.java
r6345 r6696 94 94 public ClassifierInterface getClassifier() 95 95 { 96 if (this.type == null) { 97 return null; 98 } 96 99 if (this.type.toLowerCase().equals("hierarchy")) { 97 100 return new HierarchyClassifier(this.file, this.fields, this.sort); 101 } 102 else if (this.type.toLowerCase().equals("azlist")) { 103 return new AZListClassifier(this.fields); 98 104 } 99 105 … … 140 146 { IndexerInterface indexer = null; 141 147 148 System.out.println("Index: " + this.type); 149 142 150 if (!indexerMap.containsKey(this.type)) { 143 151 if (this.type.toLowerCase().equals("mg")) { 144 indexer = new MGIndexer(); 152 indexer = new MGIndexer(); 145 153 } 146 154 if (indexer != null) { … … 165 173 166 174 this.database = GS3SQLConnectionFactory.createConnection(collection); 167 if (this.database != null) {175 /* if (this.database != null) { 168 176 this.database.clearCollection(collection); 169 177 this.database = null; 170 178 } 179 */ 171 180 if (this.database == null) { 172 181 this.database = GS3SQLConnectionFactory.createConnection("test"); … … 201 210 202 211 this.buildDocNo = 1; 212 } 213 214 private void configureBrowsers(BuildManager buildManager, Node node) 215 { CollectionClassifier classifier = null; 216 217 NodeList children = node.getChildNodes(); 218 for (int c = 0; c < children.getLength(); c ++) 219 { // assume that non-element children are irrelevant 220 if (children.item(c).getNodeType() != org.w3c.dom.Node.ELEMENT_NODE) 221 { continue; 222 } 223 224 String name = children.item(c).getNodeName(); 225 System.out.println(name); 226 227 if (name.equals("classifier")) 228 { 229 NamedNodeMap atts = children.item(c).getAttributes(); 230 Node attribute = atts.getNamedItem("type"); 231 if (attribute == null) { 232 continue; 233 } 234 235 String type = attribute.getNodeValue(); 236 classifier = new CollectionClassifier(type, children.item(c)); 237 238 System.out.println("Found classifier " + type); 239 240 // attach the classifier 241 ClassifierInterface classify = classifier.getClassifier(); 242 buildManager.getClassifierManager().addClassifier(classify); 243 } 244 } 203 245 } 204 246 … … 213 255 Document document = builder.parse(collectionConfig); 214 256 215 CollectionClassifier classifier = null;216 217 257 Map indexerMap = new HashMap(); 218 258 … … 228 268 { // TODO: throw exception 229 269 } 270 271 System.out.println("Configuring collection"); 230 272 231 273 NodeList children = rootElement.getChildNodes(); … … 239 281 240 282 // the name is a plugin element 241 if (name.equals("index")) 242 { NamedNodeMap atts = children.item(c).getAttributes(); 243 Node attribute = atts.getNamedItem("type"); 244 String type = attribute.getNodeValue(); 245 246 attribute = atts.getNamedItem("name"); 247 String indexName = attribute.getNodeValue(); 248 249 // create the local indexer representation 250 CollectionIndexer indexer = new CollectionIndexer(type, indexName, children.item(c)); 251 252 // prepare it... 253 indexer.prepareIndexer(indexerMap); 283 if (name.equals("search")) { 284 NodeList indexChildren = children.item(c).getChildNodes(); 285 286 for (int i = 0; i < indexChildren.getLength(); i ++) { 287 String childName = indexChildren.item(i).getNodeName(); 288 289 if (childName.equals("index")) 290 { NamedNodeMap atts = indexChildren.item(i).getAttributes(); 291 Node attribute = atts.getNamedItem("type"); 292 String type = attribute.getNodeValue(); 293 294 attribute = atts.getNamedItem("name"); 295 String indexName = attribute.getNodeValue(); 296 297 // create the local indexer representation 298 CollectionIndexer indexer = new CollectionIndexer(type, indexName, indexChildren.item(i)); 299 300 // prepare it... 301 indexer.prepareIndexer(indexerMap); 302 } 303 } 254 304 } 255 305 else if (name.equals("browse")) 256 { 257 } 258 else if (name.equals("classifier")) 259 { 260 NamedNodeMap atts = children.item(c).getAttributes(); 261 Node attribute = atts.getNamedItem("type"); 262 String type = attribute.getNodeValue(); 263 classifier = new CollectionClassifier(type, children.item(c)); 264 265 // attach the classifier 266 ClassifierInterface classify = classifier.getClassifier(); 267 buildManager.getClassifierManager().addClassifier(classify); 306 { this.configureBrowsers(buildManager, children.item(c)); 268 307 } 269 308 // TODO: other elements - make a factory-method approach here... … … 278 317 279 318 // attach the classifier 280 buildManager. getIndexerManager().addIndexer(indexer);319 buildManager.addIndexer(indexer); 281 320 } 282 321 }
Note:
See TracChangeset
for help on using the changeset viewer.