Changeset 8303


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.

Location:
trunk/gsdl/src/oaiservr
Files:
6 edited

Legend:

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

    r8223 r8303  
    261261  FilterResponse_t response;
    262262  text_tset        metadata;
    263   ofstream         logout("grb.log", ios::app);
     263  ofstream         logout("oai.log", ios::app);
    264264
    265265  // exclude false children of a top-level classifier immediately...
     
    300300  FilterResponse_t response;
    301301  text_tset        metadata;
    302   ofstream         logout("grb.log", ios::app);
     302  ofstream         logout("oai.log", ios::app);
    303303  text_t           from = params["from"];
    304304  text_t           until = params["until"];
     
    391391  FilterResponse_t response;
    392392  text_tset        metadata;
    393   ofstream         logout("grb.log", ios::app);
     393  ofstream         logout("oai.log", ios::app);
    394394  bool             prevDocSeen = false;
    395395
  • trunk/gsdl/src/oaiservr/listsetsaction.cpp

    r8182 r8303  
    3939  FilterResponse_t response;
    4040  comerror_t       err;
    41   text_tarray      collections;
     41  text_tarray &    collections = this->configuration->getCollectionsList();
    4242  text_tset        metadata;
    43   ofstream         logout("grb.log", ios::app);
     43  ofstream         logout("oai.log", ios::app);
    4444  text_tarray *result = new text_tarray;
    4545 
    4646  // get a list of the collections available
    47   protocol->get_collection_list(collections, err, output);
    48   //  cerr << "Found " << collections.size() << " collections.\n";
     47  //  protocol->get_collection_list(collections, err, output);
     48  if (collections.size() == 0) {
     49    logout << "Found *no* OAI collections - check main.cfg for oaicollection items and read the OAI documentation.\n";
     50  }
    4951
    50   for(int current_col = 0; current_col < collections.size(); current_col++){
     52  for(int current_col = 0; current_col < collections.size(); current_col++) {
    5153    // output the collection as a set, first, then its children
    5254    text_t gsdlCollect = collections[current_col];
     
    7577  FilterResponse_t response;
    7678  text_tset        metadata;
    77   ofstream         logout("grb.log", ios::app);
     79  ofstream         logout("oai.log", ios::app);
    7880
    7981  metadata.insert("contains");
  • trunk/gsdl/src/oaiservr/metaformat.cpp

    r8276 r8303  
    121121  FilterResponse_t response;
    122122  text_tset        metadata;
    123   ofstream         logout("grb.log", ios::app);
     123  ofstream         logout("oai.log", ios::app);
    124124
    125125  // get the document information
  • 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  }
  • trunk/gsdl/src/oaiservr/oaiconfig.h

    r8182 r8303  
    2525  oaiconfig(text_t &gsdlhome, text_t &gsdlcollect);
    2626  ~oaiconfig();
    27   virtual void configure(const text_t &key, const text_tarray &cfgline);
    28   text_t       getCollectionConfig(const text_t &collection, const text_t &field);
    29   text_t       getMapping(const text_t &collection, const text_t &collectfield);
    30   text_t       getMapping(const text_t &collection, const text_t &collectfield, const text_t &format);
    31   text_tmap   *getInformation() { return &this->infoMap; }
    32   int          getOAIVersion();
     27  virtual void  configure(const text_t &key, const text_tarray &cfgline);
     28  text_t        getCollectionConfig(const text_t &collection, const text_t &field);
     29  text_tarray & getCollectionsList() { return this->collectList; }
     30  text_t        getMapping(const text_t &collection, const text_t &collectfield);
     31  text_t        getMapping(const text_t &collection, const text_t &collectfield, const text_t &format);
     32  text_tmap   * getInformation() { return &this->infoMap; }
     33  int           getOAIVersion();
    3334 private:
    3435  void configureCollection(const text_t &gsdlhome, const text_t &collection);
    3536 
    36   text_tset collectList;    // The list of collections to be taken in hand
     37  text_tarray collectList;  // The list of collections to be taken in hand
    3738  text_tmap infoMap;        // Holds the information to be given in the case
    3839                            // of an OAI identify request
  • trunk/gsdl/src/oaiservr/recordaction.cpp

    r8182 r8303  
    8888{
    8989  text_tset        metadata;
    90   ofstream         logout("grb.log", ios::app);
     90  ofstream         logout("oai.log", ios::app);
    9191
    9292  // get the document information
Note: See TracChangeset for help on using the changeset viewer.