- Timestamp:
- 2013-06-04T11:05:08+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/runtime-src/src/oaiservr/oaiconfig.cpp
r24114 r27528 29 29 #include <stdlib.h> 30 30 #include "fileutil.h" 31 32 31 33 32 /** … … 211 210 } 212 211 } 212 else if (key == "oaisupercollection" && cfgline.size() > 1) { 213 214 // Configure a hierarchical super set 215 // The line should read 216 // 217 // oaisupercollection <setName> [collections part of this set] 218 // 219 // Records in specified collections will be advertised as being part 220 // of the SetName set as well as their collectionName set 221 // 222 // This configuration should only appear in oai.cfg 223 // 224 if (this->collection != "") { 225 cerr << "Attempt to configure an oai super collection outside of oai.cfg" << endl; 226 cerr << "Configuration attempted in " << this->collection << " collection." << endl; 227 exit(1); 228 } 229 230 text_t super_set = cfgline[0]; 231 this->superCollectList.push_back(super_set); 232 this->superCollectMap[super_set] = new oaisupercollectconfig(super_set); 233 for (int c = 1; c < cfgline.size(); ++c) { 234 text_t sub_coll = cfgline[c]; 235 // Add the collection into the list for this supercoll 236 this->superCollectMap[super_set]->collectionList.push_back(sub_coll); 237 // Add the super coll into the list for the collection 238 if (this->collectMap[sub_coll]== NULL) { 239 this->collectMap[sub_coll] = new oaicollectconfig(sub_coll); 240 } 241 this->collectMap[sub_coll]->superCollectList.push_back(super_set); 242 } 243 } 213 244 else if (key == "oaimetadata" && cfgline.size() >= 1) { 214 245 // List of metadata prefixes to suuport … … 274 305 } 275 306 if (value != "") { 276 if (this->collectMap[coll_name] == NULL) { 277 this->collectMap[coll_name] = new oaicollectconfig(coll_name); 278 } 279 if (key == "oaisetname") { 280 this->collectMap[coll_name]->setName = value; 281 } else if (key == "oaisetdescription") { 282 this->collectMap[coll_name]->setDescription = value; 307 // check first for super collection 308 if (this->superCollectMap[coll_name] != NULL) { 309 if (key == "oaisetname") { 310 this->superCollectMap[coll_name]->setName = value; 311 } else if (key == "oaisetdescription") { 312 this->superCollectMap[coll_name]->setDescription = value; 313 } 314 } else { 315 if (this->collectMap[coll_name] == NULL) { 316 this->collectMap[coll_name] = new oaicollectconfig(coll_name); 317 } 318 if (key == "oaisetname") { 319 this->collectMap[coll_name]->setName = value; 320 } else if (key == "oaisetdescription") { 321 this->collectMap[coll_name]->setDescription = value; 322 } 283 323 } 284 324 } … … 418 458 text_t oaiconfig::getSetName(const text_t &setSpec) 419 459 { 420 if (this->collectMap[setSpec] == NULL) { 421 return "" ; 422 } 460 if (this->collectMap[setSpec] != NULL) { 461 this->collectMap[setSpec]->setName; 462 } 463 if (this->superCollectMap[setSpec] != NULL) { 464 return this->superCollectMap[setSpec]->setName; 465 } 466 return "" ; 423 467 424 return this->collectMap[setSpec]->setName; 468 } 469 470 text_t oaiconfig::getSetDescription(const text_t &setSpec) 471 { 472 if (this->collectMap[setSpec] != NULL) { 473 return this->collectMap[setSpec]->setDescription; 474 } 475 if (this->superCollectMap[setSpec] != NULL) { 476 return this->superCollectMap[setSpec]->setDescription; 477 } 425 478 426 } 427 428 text_t oaiconfig::getSetDescription(const text_t &setSpec) 429 { 430 if (this->collectMap[setSpec] == NULL) { 431 return "" ; 432 } 479 return "" ; 433 480 434 return this->collectMap[setSpec]->setDescription; 435 } 436 481 } 482 483 text_tarray oaiconfig::getSuperCollectionsForThisCollection(const text_t &collection) { 484 485 text_tarray super_colls; 486 if (this->superCollectList.size() == 0) { 487 return super_colls; 488 } 489 490 for (int s = 0; s < this->superCollectList.size(); s++) { 491 text_tarray colls = this->superCollectMap[this->superCollectList[s]]->collectionList; 492 for (int c = 0; c < colls.size(); c++) 493 { 494 if (colls[c] == collection) 495 { 496 super_colls.push_back(this->superCollectList[s]); 497 break; 498 } 499 } 500 } 501 502 return super_colls; 503 }
Note:
See TracChangeset
for help on using the changeset viewer.