Changeset 31915
- Timestamp:
- 2017-08-23T18:58:38+12:00 (6 years ago)
- 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 73 73 /** time when this collection was built Used by RSS */ 74 74 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 */ 76 76 protected long earliestDatestamp = 0; 77 77 … … 187 187 } 188 188 189 // Used by OAI Receptionist and RSSRetrieve189 // Used by OAI Receptionist (as second fallback) and RSSRetrieve 190 190 public long getLastmodified() 191 191 { … … 193 193 } 194 194 195 // used by the OAIReceptionist and RSSRetrieve195 // used by the OAIReceptionist (as fallback) and RSSRetrieve 196 196 public long getEarliestDatestamp() 197 197 { -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/OAICollection.java
r31912 r31915 61 61 protected boolean has_oai = false; 62 62 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; 65 68 66 69 /** … … 120 123 } 121 124 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 122 134 /** add any extra info for collection from OAIConfig.xml */ 123 135 public boolean configureOAI(Element oai_config) { … … 152 164 153 165 // 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 156 167 long earliestTimestamp = this.oai_service_rack.getEarliestTimestamp(); 157 168 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); 161 173 } else { 162 this.earliest Datestamp = earliestTimestamp; // milliseconds174 this.earliestOAIDatestamp = earliestTimestamp; // milliseconds 163 175 } 164 176 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/OAIMessageRouter.java
r29065 r31915 149 149 e.setAttribute(OAIXML.LASTMODIFIED, "" + c.getLastmodified()); 150 150 e.setAttribute(OAIXML.EARLIEST_DATESTAMP, "" + c.getEarliestDatestamp()); 151 e.setAttribute(OAIXML.EARLIEST_OAI_DATESTAMP, "" + c.getEarliestOAIDatestamp()); 151 152 this.collection_list.appendChild(e); 152 153 return true; -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/OAIReceptionist.java
r31913 r31915 1038 1038 for(int i=0; i<oai_coll_size; i++) { 1039 1039 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 1050 1070 if (earliestDatestamp == current_time) { 1051 1071 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 89 89 public static final String DELETED_RECORD = "deletedRecord"; 90 90 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 92 93 public static final String GRANULARITY = "granularity"; 93 94 public static final String LAST_MODIFIED = "lastmodified";
Note:
See TracChangeset
for help on using the changeset viewer.