Ignore:
Timestamp:
2004-10-13T04:48:30+13:00 (20 years ago)
Author:
cs025
Message:

Minor changes to configuration handling; modified log file to be oai.log.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/oaiservr/oaiconfig.cpp

    r8276 r8303  
    4646  // parameter, read in all the collection's individual configurations
    4747  if (gsdlcollect == "") {
    48     text_tset::iterator here = this->collectList.begin();
    49     text_tset::iterator end  = this->collectList.end();
     48    text_tarray::iterator here = this->collectList.begin();
     49    text_tarray::iterator end  = this->collectList.end();
    5050    while (here != end) {       
    5151      this->configureCollection(gsdlhome, *here);
     
    8888  if (key == "oaimapping" && cfgline.size() > 1) {
    8989    text_t::const_iterator colonAt;
    90     text_t index, name;
     90    text_t index, name, configCollection;
     91
     92    // Take a default collection as being whatever the collection being configured is...
     93    configCollection = this->collection;
    9194   
    9295    // get the name of the (collection) field to map; this may actually
     
    9497    // <collection name>:<field name>
    9598    index = cfgline[0];
     99    if ((colonAt = find(index.begin(), index.end(), ':')) != index.end()) {
     100      configCollection = substr(index.begin(), colonAt);
     101
     102      if (this->collection != "" && configCollection != this->collection) {
     103    cerr << "Attempt to configure OAI mappings for " << configCollection << " in " << this->collection << endl;
     104      }
     105
     106      colonAt += 1;
     107      index = substr(colonAt, index.end());
     108    }
    96109   
    97110    // the second parameter is the metadata field to map the collection
     
    110123    }
    111124   
    112     // now 'index' is in the form:
    113     //   (collection):<collectionfield>:(formatname) and name is
    114     // simply formatfieldname
     125    // now 'index' is in the form <collectionfield>:(formatname)
     126    //     'name' is simply the fieldname within the format
     127    //     'configCollection' is the collection to be configured
    115128   
    116129    // now simply map the field name (index) onto the collection name (name)
    117     if (this->collectMap[this->collection] == NULL) {
    118       this->collectMap[this->collection] = new oaicollectconfig(this->collection);
    119     }
    120     this->collectMap[this->collection]->fieldMap[index] = name;
    121    
    122     // cerr << "Mapping " << index << " to " << name << " in " << this->collection << endl;
     130    if (this->collectMap[configCollection] == NULL) {
     131      this->collectMap[configCollection] = new oaicollectconfig(configCollection);
     132    }
     133    this->collectMap[configCollection]->fieldMap[index] = name;
     134   
     135    //    cerr << "Mapping " << index << " to " << name << " in " << configCollection << endl;
    123136   
    124137    // TODO: check that the mapped field is actually in use
    125138  }
    126   else if (key == "oaicollection" && cfgline.size() > 1) {
     139  else if (key == "oaicollection" && cfgline.size() >= 1) {
    127140    // Configure a collection to be used as part of the OAI archive.
    128141    // This line should read:
     
    145158    }
    146159    for (int c = 0; c < cfgline.size(); c ++) {
    147       this->collectList.insert(cfgline[c]);
     160      this->collectList.push_back(cfgline[c]);
    148161    }
    149162  }
Note: See TracChangeset for help on using the changeset viewer.