Changeset 20629 for gsdl/trunk


Ignore:
Timestamp:
2009-09-18T12:18:01+12:00 (15 years ago)
Author:
mdewsnip
Message:

Added new "oaisetname" and "oaisetdescription" configuration options in the oai.cfg file, for setting the setName and setDescription values in the ListSets response.

Location:
gsdl/trunk/runtime-src/src/oaiservr
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/runtime-src/src/oaiservr/listsetsaction.cpp

    r20626 r20629  
    186186    output << "  <set>" << endl;
    187187    output << "    <setSpec>" << collection << "</setSpec>" << endl;
    188     output << "    <setName>" << collection << "</setName>" << endl;
     188    if (this->configuration->getSetName(collection) != "")
     189    {
     190      output << "    <setName>" << this->configuration->getSetName(collection) << "</setName>" << endl;
     191    }
     192    else
     193    {
     194      output << "    <setName>" << collection << "</setName>" << endl;
     195    }
     196    if (this->configuration->getSetDescription(collection) != "")
     197    {
     198      output << "    <setDescription>" << this->configuration->getSetDescription(collection) << "</setDescription>" << endl;
     199    }
    189200    output << "  </set>" << endl;
    190201    this->setsOutput++;
     
    216227
    217228      // Otherwise output this set and increment the count
    218       text_t set_title = set_response.docInfo[0].metadata["Title"].values[0];
    219229      output << "  <set>" << endl;
    220230      output << "    <setSpec>" << collection << ":" << set << "</setSpec>" << endl;
    221       output << "    <setName>" << collection << ":" << set_title << "</setName>" << endl;
     231      if (this->configuration->getSetName(collection + ":" + set) != "")
     232      {
     233    output << "    <setName>" << this->configuration->getSetName(collection + ":" + set) << "</setName>" << endl;
     234      }
     235      else
     236      {
     237    output << "    <setName>" << set_response.docInfo[0].metadata["Title"].values[0] << "</setName>" << endl;
     238      }
     239      if (this->configuration->getSetDescription(collection + ":" + set) != "")
     240      {
     241    output << "    <setDescription>" << this->configuration->getSetDescription(collection + ":" + set) << "</setDescription>" << endl;
     242      }
    222243      output << "  </set>" << endl;
    223244      this->setsOutput++;
  • gsdl/trunk/runtime-src/src/oaiservr/oaiconfig.cpp

    r20607 r20629  
    217217    }
    218218  }
     219  else if (key == "oaisetname" && cfgline.size() == 2) {
     220    this->setNameMap[cfgline[0]] = cfgline[1];
     221  }
     222  else if (key == "oaisetdescription" && cfgline.size() == 2) {
     223    this->setDescriptionMap[cfgline[0]] = cfgline[1];
     224  }
    219225  else if (key == "oaiversion" && cfgline.size() >= 1) {
    220226    this->oaiVersion = cfgline[0];
     
    390396  }
    391397}
     398
     399
     400text_t oaiconfig::getSetName(const text_t &setSpec)
     401{
     402  if (setNameMap.find(setSpec) != setNameMap.end())
     403  {
     404    return setNameMap[setSpec];
     405  }
     406
     407  return "";
     408}
     409
     410
     411text_t oaiconfig::getSetDescription(const text_t &setSpec)
     412{
     413  if (setDescriptionMap.find(setSpec) != setDescriptionMap.end())
     414  {
     415    return setDescriptionMap[setSpec];
     416  }
     417
     418  return "";
     419}
  • gsdl/trunk/runtime-src/src/oaiservr/oaiconfig.h

    r18903 r20629  
    3434  text_t        getMapping(const text_t &collection, const text_t &collectfield, const text_t &format);
    3535  text_tmap   * getInformation() { return &this->infoMap; }
     36  text_t        getSetName(const text_t &setSpec);
     37  text_t        getSetDescription(const text_t &setSpec);
    3638  int           getOAIVersion();
    3739  int           resumeAfter();
     
    4345  text_tmap infoMap;        // Holds the information to be given in the case
    4446                            // of an OAI identify request
     47  text_tmap setNameMap;     // Holds user-defined names for the sets
     48  text_tmap setDescriptionMap;  // Holds user-defined descriptions for the sets
    4549  oaicollectmap collectMap; // The configuration of collections
    4650  text_t collection;        // Used to track which collection is being configured
Note: See TracChangeset for help on using the changeset viewer.