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/collection/Collection.java

    r23901 r23938  
    6868    /** time when this collection was built */
    6969    protected long lastmodified = 0;
    70    
     70    /** earliestDatestamp of this collection. Necessary for OAI */
     71    protected long earliestDatestamp = 0;
     72
     73
    7174    /** An element containing the serviceRackList element of buildConfig.xml, used to determine whether it contains
    7275     *  the OAIPMH serviceRack
     
    133136    return is_public;
    134137    }
    135     //used by the OAIReceptionist to find out the earliest datestamp amongst all oai collections in the repository
     138    // Not used anymore by the OAIReceptionist to find out the earliest datestamp
     139    // amongst all oai collections in the repository. May be useful generally.
    136140    public long getLastmodified() {
    137141      return lastmodified;
    138142    }
     143    //used by the OAIReceptionist to find out the earliest datestamp amongst all oai collections in the repository
     144    public long getEarliestDatestamp() {
     145    return earliestDatestamp;
     146    }
     147
    139148    /** whether the service_map in ServiceCluster.java contains the service 'OAIPMH'
    140149     *  11/06/2007 xiao
     
    179188        build_config_elem = build_config_doc.getDocumentElement();
    180189    }
    181  
     190
    182191    lastmodified = build_config_file.lastModified();
    183192 
     
    264273      } else {
    265274    has_oai = true;
     275   
     276    // extract earliestDatestamp from the buildconfig.xml for OAI
     277    Element metadata_list = (Element)GSXML.getChildByTagName(build_config_xml, GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER);
     278
     279    if(metadata_list != null) {
     280        NodeList children = metadata_list.getElementsByTagName(GSXML.METADATA_ELEM);
     281               // can't do getChildNodes(), because whitespace, such as newlines, creates Text nodes
     282        for (int i = 0; i < children.getLength(); i++) {
     283        Element metadata = (Element)children.item(i);
     284        if(metadata.getAttribute(GSXML.NAME_ATT).equals(OAIXML.EARLIEST_DATESTAMP)) {
     285            String earliestDatestampStr = GSXML.getValue(metadata);
     286            if(!earliestDatestampStr.equals("")) {
     287            earliestDatestamp = Long.parseLong(earliestDatestampStr);
     288            }
     289            break; // found a metadata element with name=earliestDatestamp in buildconfig
     290        }
     291        }
     292    }
     293   
     294    // If at the end of this, there is no value for earliestDatestamp, print out a warning
     295    logger.warn("No earliestDatestamp in buildConfig.xml for collection: " + this.cluster_name + ". Defaulting to 0.");
     296
    266297      }
    267298    } else { // no list of services (no ServiceRackList), so no oai_service_rack either
Note: See TracChangeset for help on using the changeset viewer.