Ignore:
Timestamp:
2017-08-18T19:28:42+12:00 (6 years ago)
Author:
ak19
Message:

I hope these are all the changes necessary on the runtime side of GS2 to get the OAI server validation working for GS2: instead of working out the earliest datetime stamp of the OAI repository by comparing the builddate in index/build.cfg of each OAI collection and selecting the earliest, the oai-inf.db is now storing the special earliesttimestamp record. The timestamp of this record represents its collection's earliest timestamp. And the earliest of these among all OAI collections is now the earliest datetime of the OAI repository.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/oaiservr/oaiaction.cpp

    r31390 r31903  
    551551}
    552552
     553// works out the earliest date/timestamp of the OAI repository,
     554// which compares and then selects the earliest timestamp value among all collections.
     555// In the past, the earliest date/timestamp used to be the unix epoch,
     556// later it became the earliest among each collection's builddate in build.cfg,
     557// and now, after implementing the OAI deletion policy, it needed to become the earliest
     558// among each collection's OAI_EARLIESTTIMESTAMP_OID record's timestamp value.
     559
    553560text_t oaiaction::calcEarliestDatestamp(recptproto *protocol, oaiargs &params) {
    554561   
     
    570577    // (the earliestDatestamp for a collection has already been extracted from
    571578    // their build.cfg file at this point by collectserver::configure. The field
    572     // is declared in comtypes.h)   
    573    
     579    // is declared in comtypes.h)
     580   
     581    // We've changed this again to grab the timestamp field of the OAI_EARLIESTTIMESTAMP_OID
     582    // record of each collection's oai-inf.db (representing the time that collection was
     583    // built for the very first time) and choosing the earliest among all of them.
    574584   
    575585    // Get a list of the OAI-enabled collections available
     
    597607            collection_iterator++;
    598608        }
     609
     610        ofstream         logout("oai.log", ios::app);
    599611       
    600612        // Now loop through the remaining collections
     
    604616            collection_name = (*collection_iterator);
    605617           
     618            text_tset        metadata;
     619            FilterResponse_t response;
     620
     621            // get timestamps from etc/oai-inf.<db> now, no longer from build.cfg
     622            // request the special record with OID=OAI_EARLIESTTIMESTAMP_OID for the collection
     623            bool status_ok = get_oai_info(OAI_EARLIESTTIMESTAMP_OID, collection_name, "", metadata, false, protocol, response, logout);
     624           
     625            if(status_ok) {
     626              ResultDocInfo_t doc_info = response.docInfo[0];
     627              text_t collEarliestTimestamp;
     628              // the timestamp we want lives in the "lastmodified" field of the OAI_EARLIESTTIMESTAMP_OID record
     629              this->getLastModifiedDate(doc_info, collEarliestTimestamp);
     630             
     631              if(earliestDatestamp == "") { // first earliestdatestamp we've seen for an oai collection
     632                earliestDatestamp = collEarliestTimestamp;
     633              } else if(collEarliestTimestamp < earliestDatestamp) {
     634                earliestDatestamp = collEarliestTimestamp;
     635              }
     636            } /*else { // collection may not have oai-inf.db (yet), check build.cfg?
     637                // No: no need to use the old way as fallback
     638               
    606639            ColInfoResponse_t cinfo;
    607640            comerror_t err;
     
    618651                }
    619652            }
     653              }
     654              */
    620655            collection_iterator++;
    621656           
    622         }       
     657        }
     658        logout.close();
    623659    }
    624660       
Note: See TracChangeset for help on using the changeset viewer.