Changeset 26096 for main/trunk/greenstone3
- Timestamp:
- 2012-08-10T20:31:34+12:00 (12 years ago)
- Location:
- main/trunk/greenstone3/src/java/org/greenstone/gsdl3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/OAIPMH.java
r25635 r26096 483 483 String[] metadata_names = getMetadataNameMapping(metadata_format); 484 484 HashMap meta_map = getInfoByNames(info, metadata_names); 485 486 // if there's no dc:identifier already after the mapping, we'll add it in 487 if(!meta_map.containsKey(OAIXML.DC+":identifier")) { // dc:identifier OAIXML.IDENTIFIER 488 outputCustomMetadata(meta_map, info, OAIXML.DC+":identifier"); 489 } 490 491 485 492 if (meta_map == null) { 486 493 return metadata; … … 701 708 return (empty_map == true) ? null : map; 702 709 } 710 711 // GS3 version of GS2's runtime-src/src/oaiservr/dublincore.cpp function output_custom_metadata 712 protected void outputCustomMetadata(HashMap meta_map, DBInfo info, String dc_identifier) { 713 714 // try gs.OAIResourceURL, else srclinkFile, else the GS version of the document 715 String identifier_value = info.getInfo(OAIXML.GS_OAI_RESOURCE_URL); 716 717 if(identifier_value.equals("")) { 718 String url = OAIXML.getBaseURL(); // e.g. e.g. http://host:port/greenstone3/library/oaiserver 719 720 identifier_value = info.getInfo("srclinkFile"); 721 if(identifier_value.equals("")) 722 { 723 // no source file to link to, so link to the GS version of the document (need to use URL-style slashes) 724 // e.g. http://host:port/greenstone3/library/collection/lucene-jdbm-demo/document/HASH014602ec89e16b7d431c7627 725 726 identifier_value = url.replace("oaiserver", "library") + "collection/" + this.coll_name + "/document/" + info.getInfo("identifier"); // OID 727 } 728 else // use srclinkFile 729 { 730 // e.g. http://host:port/greenstone3/sites/localsite/collect/backdrop/index/assoc/D0.dir/Cat.jpg 731 identifier_value = url.replace("oaiserver", "") + "sites/" + this.site_name 732 + "/collect/" + this.coll_name + "/index/assoc/" 733 + info.getInfo("assocfilepath") + "/" + identifier_value; // srclinkFile 734 } 735 } // else use gs.OAIResourceURL as-is 736 737 //logger.info("**** dc:identifier: " + identifier_value); 738 739 meta_map.put(dc_identifier, identifier_value); 740 } 703 741 } 704 742 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/OAIXML.java
r25635 r26096 99 99 public static final String GRANULARITY = "granularity"; 100 100 public static final String GS3OAI = "GS3OAI"; 101 public static final String GS_OAI_RESOURCE_URL = "gs.OAIResourceURL"; 101 102 public static final String HAS_OAI = "hasOAI"; 102 103 public static final String HEADER = "header"; … … 177 178 */ 178 179 public static String oai_version = "2.0"; 180 public static String baseURL = ""; 179 181 180 182 /**response owner document */ … … 194 196 return oai_version; 195 197 } 198 199 public static String getBaseURL() { 200 return baseURL; 201 } 202 196 203 public static Element createElement(String tag_name) { 197 204 return response_doc.createElement(tag_name); … … 286 293 } 287 294 /** Read in OAIConfig.xml (residing web/WEB-INF/classes/) and use it to configure the receptionist etc. 288 * the oai_version variable isalso set in here.295 * the oai_version and baseURL variables are also set in here. 289 296 * The init() method is also called in here. */ 290 297 public static Element getOAIConfigXML() { … … 310 317 oai_version = GSXML.getNodeText(protocol_version).trim(); 311 318 319 // initialize baseURL 320 Element base_url_elem = (Element)GSXML.getChildByTagName(oai_config_elem, BASE_URL); 321 baseURL = GSXML.getNodeText(base_url_elem); 322 312 323 //initialize token_expiration 313 324 Element expiration = (Element)GSXML.getChildByTagName(oai_config_elem, RESUMPTION_TOKEN_EXPIRATION); … … 387 398 } 388 399 }//end of for() 389 Element base_url_elem = (Element)GSXML.getChildByTagName(oai_config_elem, BASE_URL); 390 String base_url = GSXML.getNodeText(base_url_elem); 391 GSXML.setNodeText(request_elem, base_url); 400 401 GSXML.setNodeText(request_elem, baseURL); 392 402 393 403 Node resp_date = GSXML.getChildByTagName(response, RESPONSE_DATE);
Note:
See TracChangeset
for help on using the changeset viewer.