Ignore:
Timestamp:
2017-08-21T18:03:37+12:00 (7 years ago)
Author:
ak19
Message:

Now GS3 tries to obtain the _earliesttimestamp entry of the oai-inf.db for each collection to, work out the earliest among them to be the earliest timestamp of the repository. For each collection, if there is no such entry or the oai-inf db doesn't exist or can't be accessed, the collection falls back to using the value in the build config file as before. Also as before, if that doesn't exist either, it uses the lastmod date of the collection (I think also taken from build config) as the next fallback value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/OAIPMH.java

    r31911 r31912  
    233233  }
    234234
     235    /**
     236     * @return the associated OAICollection's OAI_EARLIEST_TIMESTAMP_OID record's
     237     * OAI_INF_TIMESTAMP field from the collection's oai-inf.db IN MILLISECONDS
     238     */
     239    public long getEarliestTimestamp() {
     240    long timestamp = -1;
     241   
     242    DBInfo oai_info = null;
     243    if(oaiinf_db != null) {
     244        // get internal record containing the earliest timestamp of the collection
     245        oai_info = this.oaiinf_db.getInfo(OAIXML.OAI_EARLIEST_TIMESTAMP_OID);
     246        if (oai_info == null) {
     247        logger.warn("Can't get collection " + this.cluster_name + "'s earliest timestamp from oai-inf db. No entry for 'OID' " + OAIXML.OAI_EARLIEST_TIMESTAMP_OID + " in the db.");       
     248        } else {
     249        timestamp = Long.parseLong(oai_info.getInfo(OAIXML.OAI_INF_TIMESTAMP)) * 1000; // stored in seconds, so x1000 to  convert to milliseconds
     250        //logger.info("@@@ found earliest OAI timestamp for collection " + this.coll_name + ": " + timestamp + " (ms)");
     251        }
     252    }
     253    return timestamp;
     254    }
     255   
    235256  protected Element findNamedMetadataFormat(Element list_meta_formats, String prefix) {
    236257    NodeList formats = list_meta_formats.getElementsByTagName(OAIXML.METADATA_FORMAT);
Note: See TracChangeset for help on using the changeset viewer.