Changeset 31915


Ignore:
Timestamp:
2017-08-23T18:58:38+12:00 (7 years ago)
Author:
ak19
Message:

Dr Bainbridge thought about it and decided that the correct solution is that, since a collection will always have an oai-inf db from now on, the earliest datestamp of a collection should not fall back to either buildconfig's earliestdatestamp field or else buildconfig's lastmodified. However, the latter are used as the publishing date by the RSS service, and so still stored as Collection.java's earliestDatestamp. Now OAICollection has a new additional field, earliestOAIDatestamp which contains the earliest timestamp in oai-inf db. The OAIReceptionist now determines the earliestDatestamp of the entire OAIRepository solely based on the earliestOAIDatestamp values across all OAICollections, also with no fallbacks on Collections' earliestDatestamp or lastModified fields.

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/Collection.java

    r30838 r31915  
    7373    /** time when this collection was built Used by RSS */
    7474    protected long lastmodified = 0;
    75     /** earliestDatestamp of this collection. Used by OAI/RSS */
     75    /** earliestDatestamp of this collection. Used by RSS and as fallback by OAI */
    7676        protected long earliestDatestamp = 0;
    7777
     
    187187    }
    188188
    189     // Used by OAI Receptionist and RSSRetrieve
     189    // Used by OAI Receptionist (as second fallback) and RSSRetrieve
    190190    public long getLastmodified()
    191191    {
     
    193193    }
    194194
    195     // used by the OAIReceptionist and RSSRetrieve
     195    // used by the OAIReceptionist (as fallback) and RSSRetrieve
    196196    public long getEarliestDatestamp()
    197197    {
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/OAICollection.java

    r31912 r31915  
    6161    protected boolean has_oai = false;
    6262
    63   /** a reference to the OAIPMH service rack */
    64   protected OAIPMH oai_service_rack = null;
     63    /** earliest datestamp of an OAI collection. Also used to work out the earliest datetimestamp of the entire OAI repository */
     64    protected long earliestOAIDatestamp = 0;
     65
     66    /** a reference to the OAIPMH service rack */
     67    protected OAIPMH oai_service_rack = null;
    6568
    6669    /**
     
    120123    }
    121124
     125    /**
     126     * The earliesttimestamp entry in the oai-inf.db representing when the collection was created.
     127     * Used by the OAIReceptionist
     128    */   
     129    public long getEarliestOAIDatestamp()
     130    {
     131        return earliestOAIDatestamp;
     132    }
     133   
    122134  /** add any extra info for collection from OAIConfig.xml */
    123135  public boolean configureOAI(Element oai_config) {
     
    152164
    153165          // once we've configured the OAIPMH service, we can use the OAIPMH service to
    154           // retrieve the earliest timestamp of the collection from the oai-inf db and
    155           // overwrite Collection.earliestDatestamp with it.
     166          // retrieve the earliest timestamp of this OAI collection from the oai-inf db
    156167          long earliestTimestamp = this.oai_service_rack.getEarliestTimestamp();
    157168          if(earliestTimestamp == -1) {
    158           //this.earliestDatestamp = -1;
    159           logger.warn("No OAI timestamp for collection " + this.cluster_name
    160                   + ". Falling back to using its earliestDatestamp from build config: " + this.earliestDatestamp);
     169          this.earliestOAIDatestamp = -1;
     170          logger.warn("No OAI timestamp for collection " + this.cluster_name);
     171          //logger.warn("No OAI timestamp for collection " + this.cluster_name
     172          //+ ". Falling back to using its earliestDatestamp from build config: " + this.earliestDatestamp);
    161173          } else {
    162           this.earliestDatestamp = earliestTimestamp; // milliseconds
     174          this.earliestOAIDatestamp = earliestTimestamp; // milliseconds
    163175          }
    164176         
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/OAIMessageRouter.java

    r29065 r31915  
    149149        e.setAttribute(OAIXML.LASTMODIFIED, "" + c.getLastmodified());
    150150        e.setAttribute(OAIXML.EARLIEST_DATESTAMP, "" + c.getEarliestDatestamp());
     151        e.setAttribute(OAIXML.EARLIEST_OAI_DATESTAMP, "" + c.getEarliestOAIDatestamp());
    151152        this.collection_list.appendChild(e);
    152153        return true;
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/OAIReceptionist.java

    r31913 r31915  
    10381038    for(int i=0; i<oai_coll_size; i++) {
    10391039    String collName = collection_name_list.get(i);
    1040     long coll_earliestDatestamp = Long.parseLong(((Element)oai_coll.item(i)).getAttribute(OAIXML.EARLIEST_DATESTAMP)); // Taken from oai-inf db's OAI_EARLIEST_TIMESTAMP_OID entry, else falls back to earliest datestamp field in buildcfg
    1041       if (coll_earliestDatestamp == 0) {
    1042     // try last modified
    1043     coll_earliestDatestamp = Long.parseLong(((Element)oai_coll.item(i)).getAttribute(OAIXML.LAST_MODIFIED));
    1044     //logger.info("@@@ Falling back to using collection " + collName + "'s lastmodified date as its earliest timestamp: " + coll_earliestDatestamp);
    1045       }
    1046       if (coll_earliestDatestamp > 0) {
    1047     earliestDatestamp = (earliestDatestamp > coll_earliestDatestamp)? coll_earliestDatestamp : earliestDatestamp;
    1048       }
    1049     }
     1040    long coll_earliestDatestamp = Long.parseLong(((Element)oai_coll.item(i)).getAttribute(OAIXML.EARLIEST_OAI_DATESTAMP)); // Taken from oai-inf db's OAI_EARLIEST_TIMESTAMP_OID entry, -1 if not found
     1041
     1042    if (coll_earliestDatestamp > 0 && earliestDatestamp > coll_earliestDatestamp) {
     1043        earliestDatestamp = coll_earliestDatestamp;
     1044        //logger.info("@@@ Found earlier timestamp: " + earliestDatestamp + " ms");
     1045    }
     1046    }
     1047
     1048    // we're no longer trying fallbacks for earliestDatestamp (other than the extreme fallback of
     1049    // unix epoch time) because, going forward, all collections will have oai-inf db containing
     1050    // an entry for earliesttimestamp. And all OAICollections will moreover have them stored and
     1051    // will return them upon calling getEarliestOAIDatestamp().
     1052    /*   
     1053    if(earliestDatestamp == current_time) {
     1054    logger.info("Can't determine earliesttimestamp from oai-inf.db for any OAI collection. Trying timestamps in build config...");
     1055    for(int i=0; i<oai_coll_size; i++) {
     1056        String collName = collection_name_list.get(i);
     1057        long coll_earliestDatestamp = Long.parseLong(((Element)oai_coll.item(i)).getAttribute(OAIXML.EARLIEST_DATESTAMP)); // Taken from the earliest datestamp field in buildcfg
     1058        if (coll_earliestDatestamp == 0) {
     1059        // try last modified
     1060        coll_earliestDatestamp = Long.parseLong(((Element)oai_coll.item(i)).getAttribute(OAIXML.LAST_MODIFIED));
     1061        //logger.info("@@@ Falling back to using collection " + collName + "'s lastmodified date as its earliest timestamp: " + coll_earliestDatestamp);
     1062        }
     1063        if (coll_earliestDatestamp > 0) {
     1064        earliestDatestamp = (earliestDatestamp > coll_earliestDatestamp)? coll_earliestDatestamp : earliestDatestamp;
     1065        }
     1066    }
     1067    }
     1068    */
     1069   
    10501070    if (earliestDatestamp == current_time) {
    10511071      logger.info("no collection had a real datestamp, using value from OAIConfig");
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/OAIXML.java

    r31911 r31915  
    8989  public static final String DELETED_RECORD = "deletedRecord";
    9090  public static final String DESCRIPTION = "description";
    91   public static final String EARLIEST_DATESTAMP = "earliestDatestamp";
     91  public static final String EARLIEST_DATESTAMP = "earliestDatestamp"; // taken from buildconfig used as publishing date by RSS service
     92  public static final String EARLIEST_OAI_DATESTAMP = "earliestOAIDatestamp"; // earliest timestamp of an OAI collection stored in oai-inf db
    9293  public static final String GRANULARITY = "granularity";
    9394  public static final String LAST_MODIFIED = "lastmodified";
Note: See TracChangeset for help on using the changeset viewer.