Changeset 28984
- Timestamp:
- 2014-04-17T13:13:28+12:00 (10 years ago)
- Location:
- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/Collection.java
r28966 r28984 69 69 /** database type : gdbm, jdbm or sqlite */ 70 70 protected String db_type = ""; 71 72 /** does this collection provide the OAI service */ 73 protected boolean has_oai = false; 74 /** time when this collection was built */ 71 /** time when this collection was built Used by RSS */ 75 72 protected long lastmodified = 0; 76 /** earliestDatestamp of this collection. Necessary for OAI*/77 73 /** earliestDatestamp of this collection. Used by OAI/RSS */ 74 protected long earliestDatestamp = 0; 78 75 79 76 /** Stores the default accessibility of guest users */ … … 174 171 } 175 172 176 // Used by OAI Receptionist to determine whether to expire a resumption token - if a token was issued before a collection is rebuilt, then the token must be expired.173 // Used by OAI Receptionist and RSSRetrieve 177 174 public long getLastmodified() 178 175 { … … 180 177 } 181 178 182 // used by the OAIReceptionist to find out the earliest datestamp amongst all oai collections in the repository179 // used by the OAIReceptionist and RSSRetrieve 183 180 public long getEarliestDatestamp() 184 181 { 185 182 return earliestDatestamp; 186 }187 188 /**189 * whether the service_map in ServiceCluster.java contains the service190 * 'OAIPMH' 11/06/2007 xiao191 */192 public boolean hasOAI()193 {194 return has_oai;195 183 } 196 184 … … 248 236 protected boolean findAndLoadInfo(Element coll_config_xml, Element build_config_xml) 249 237 { 250 // Element meta_list = (Element) GSXML.getChildByTagName(coll_config_xml, GSXML.METADATA_ELEM + GSXML.LIST_MODIFIER); 251 // addMetadata(meta_list); 252 // meta_list = (Element) GSXML.getChildByTagName(build_config_xml, GSXML.METADATA_ELEM + GSXML.LIST_MODIFIER); 253 // addMetadata(meta_list); 254 addMetadata("httpPath", this.site_http_address + "/collect/" + this.cluster_name); 255 256 // display stuff 257 // Element display_list = (Element) GSXML.getChildByTagName(coll_config_xml, GSXML.DISPLAY_TEXT_ELEM + GSXML.LIST_MODIFIER); 258 // if (display_list != null) 259 // { 260 // resolveMacros(display_list); 261 // addDisplayItems(display_list); 262 // } 238 addMetadata("httpPath", this.site_http_address + "/collect/" + this.cluster_name); 239 263 240 264 241 //check whether the html are tidy or not … … 285 262 addMetadata("tidyoption", tidy); 286 263 287 // check whether we are public or not264 288 265 if (this.metadata_list != null) 289 266 { 267 // check whether we are public or not 290 268 Element meta_elem = (Element) GSXML.getNamedElement(this.metadata_list, GSXML.METADATA_ELEM, GSXML.NAME_ATT, "public"); 291 269 if (meta_elem != null) … … 297 275 } 298 276 } 277 // earliest datestamp is the time the collection was created. 278 meta_elem = (Element) GSXML.getNamedElement(this.metadata_list, GSXML.METADATA_ELEM, GSXML.NAME_ATT, OAIXML.EARLIEST_DATESTAMP); 279 if (meta_elem != null) { 280 String earliestDatestampStr = GSXML.getValue(meta_elem); 281 if (!earliestDatestampStr.equals("")) { 282 earliestDatestamp = Long.parseLong(earliestDatestampStr) * 1000; // stored in seconds, convert to milliseconds 283 } 284 } 285 299 286 } 300 287 return true; … … 393 380 clearServices(); 394 381 Element service_list = (Element) GSXML.getChildByTagName(build_config_xml, GSXML.SERVICE_CLASS_ELEM + GSXML.LIST_MODIFIER); 395 Element oai_service_rack = null;396 382 if (service_list != null) 397 383 { 398 384 configureServiceRackList(service_list, coll_config_xml); 399 oai_service_rack = GSXML.getNamedElement(service_list, GSXML.SERVICE_CLASS_ELEM, GSXML.NAME_ATT, OAIXML.OAIPMH);400 385 } 401 386 // collection Config may also contain manually added service racks … … 404 389 { 405 390 configureServiceRackList(service_list, build_config_xml); 406 // this oai used in preference to one in buildConfig.xml 407 oai_service_rack = GSXML.getNamedElement(service_list, GSXML.SERVICE_CLASS_ELEM, GSXML.NAME_ATT, OAIXML.OAIPMH); 408 } 409 // Check for oai 410 411 if (oai_service_rack != null) 412 { 413 has_oai = true; 414 logger.info(this.cluster_name + " has OAI services"); 415 // extract earliestDatestamp from the buildconfig.xml for OAI 416 Element metadata_list = (Element) GSXML.getChildByTagName(build_config_xml, GSXML.METADATA_ELEM + GSXML.LIST_MODIFIER); 417 418 if (metadata_list != null) 419 { 420 NodeList children = metadata_list.getElementsByTagName(GSXML.METADATA_ELEM); 421 // can't do getChildNodes(), because whitespace, such as newlines, creates Text nodes 422 for (int i = 0; i < children.getLength(); i++) 423 { 424 Element metadata = (Element) children.item(i); 425 if (metadata.getAttribute(GSXML.NAME_ATT).equals(OAIXML.EARLIEST_DATESTAMP)) 426 { 427 String earliestDatestampStr = GSXML.getValue(metadata); 428 if (!earliestDatestampStr.equals("")) 429 { 430 earliestDatestamp = Long.parseLong(earliestDatestampStr) * 1000; // stored in seconds, convert to milliseconds 431 432 } 433 break; // found a metadata element with name=earliestDatestamp in buildconfig 434 } 435 } 436 } 437 438 // If at the end of this, there is no value for earliestDatestamp, print out a warning 439 logger.warn("No earliestDatestamp in buildConfig.xml for collection: " + this.cluster_name + ". Defaulting to 0."); 440 441 } // if oai_service_rack != null 442 391 } 443 392 return true; 444 393 }
Note:
See TracChangeset
for help on using the changeset viewer.