Ignore:
Timestamp:
2011-04-20T21:02:12+12:00 (13 years ago)
Author:
ak19
Message:

GS3's OAIserver passes final official oaiserver validation tests: to do with earliestDatestamp. Both the datestamp of the records (documents) returned by listRecords, listIdentifiers and getRecord, as well as the earliestDatestamp returned by an Identify request are now in sync with each other. Related code changes made to perllib to write the earliestDatestamp into GS3's buildconfig.xml (and build.cfg for GS2), and to write new fields oailastmodified and oailastmodifieddate into the collection's database for each document.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/OAIReceptionist.java

    r23913 r23938  
    296296       *  Use the time value plus the current system time to get the expiration date string.
    297297       */
    298       String expiration_date = OAIXML.getTime(System.currentTimeMillis() + OAIXML.getTokenExpiration());
     298    String expiration_date = OAIXML.getTime(System.currentTimeMillis() + OAIXML.getTokenExpiration()); // in milliseconds
    299299      token.setAttribute(OAIXML.EXPIRATION_DATE, expiration_date);
    300300    }
     
    10341034    // See OAIConfig.xml
    10351035    // dynamically works out what the earliestDateStamp is, since it varies by collection
     1036    // returns this time in *milliseconds*.
    10361037    protected long getEarliestDateStamp(NodeList oai_coll) {
    10371038    //do the earliestDatestamp
    1038     long lastmodified = System.currentTimeMillis();
     1039    long earliestDatestamp = System.currentTimeMillis();   
    10391040    int oai_coll_size = oai_coll.getLength();
    10401041    if (oai_coll_size == 0) {
    10411042        logger.info("returned oai collection list is empty. Setting repository earliestDatestamp to be 1970-01-01.");
    1042         lastmodified = 0;
     1043        earliestDatestamp = 0;
    10431044    }
    1044     //the collection build time is determined by the last modified time of the buildConfig.xml file
     1045    // the earliestDatestamp is now stored as a metadata element in the collection's buildConfig.xml file
     1046    // we get the earliestDatestamp among the collections
    10451047    for(int i=0; i<oai_coll_size; i++) {
    1046         long coll_build_time = Long.parseLong(((Element)oai_coll.item(i)).getAttribute(OAIXML.LASTMODIFIED));
    1047         lastmodified = (lastmodified > coll_build_time)? coll_build_time : lastmodified;
     1048        long coll_earliestDatestamp = Long.parseLong(((Element)oai_coll.item(i)).getAttribute(OAIXML.EARLIEST_DATESTAMP));
     1049        earliestDatestamp = (earliestDatestamp > coll_earliestDatestamp)? coll_earliestDatestamp : earliestDatestamp;
    10481050    }
    1049     return lastmodified;
     1051
     1052    return earliestDatestamp*1000; // converting from seconds to milliseconds
    10501053    }
    10511054}
Note: See TracChangeset for help on using the changeset viewer.