- Timestamp:
- 2014-05-19T13:22:12+12:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/OAICollection.java
r28984 r29064 1 1 /* 2 * Collection.java2 * OAICollection.java 3 3 * Copyright (C) 2002 New Zealand Digital Library, http://www.nzdl.org 4 4 * … … 34 34 import org.greenstone.gsdl3.core.ModuleInterface; 35 35 import org.greenstone.gsdl3.service.ServiceRack; 36 import org.greenstone.gsdl3.service.OAIPMH; 36 37 import org.greenstone.gsdl3.util.GSFile; 37 38 import org.greenstone.gsdl3.util.GSXML; … … 51 52 * only want to load the OAIPMH service rack, not any of the others 52 53 * 53 * @author Katherine Don54 * @see ModuleInterface55 54 */ 56 55 public class OAICollection extends Collection … … 61 60 /** does this collection provide the OAI service */ 62 61 protected boolean has_oai = false; 62 63 /** a reference to the OAIPMH service rack */ 64 protected OAIPMH oai_service_rack = null; 63 65 64 66 /** … … 112 114 } 113 115 114 116 /** add any extra info for collection from OAIConfig.xml */ 117 public boolean configureOAI(Element oai_config) { 118 // just pass the element to each service - should only be one 119 return this.oai_service_rack.configureOAI(oai_config); 120 } 115 121 116 122 /** override this to only load up OAIPMH serviceRack - don't need all the rest of them for oai*/ … … 119 125 120 126 // find the OAIPMH service 121 Element oai_service_xml = GSXML.getNamedElement(service_rack_list, GSXML.SERVICE_CLASS_ELEM, GSXML.NAME_ATT, OAIXML.OAI_SERVICE_RACK);127 Element oai_service_xml = GSXML.getNamedElement(service_rack_list, GSXML.SERVICE_CLASS_ELEM, GSXML.NAME_ATT, "OAIPMH"); 122 128 if (oai_service_xml == null) { 123 129 return false; … … 130 136 message.appendChild(request); 131 137 132 ServiceRack s = null; 133 134 try { 135 136 // try for a default service in standard package 137 s = (ServiceRack) Class.forName("org.greenstone.gsdl3.service." + OAIXML.OAI_SERVICE_RACK).newInstance(); 138 139 } catch (Exception e) {} 140 141 if (s == null) { 142 143 try { 144 // name as is, in case package is already specified 145 s = (ServiceRack) Class.forName(OAIXML.OAI_SERVICE_RACK).newInstance(); 146 } catch (Exception e) {} 147 } 148 149 if (s == null) { 150 151 logger.error("Couldn't get an instance of class " + OAIXML.OAI_SERVICE_RACK + ", or org.greenstone.gsdl3.service." + OAIXML.OAI_SERVICE_RACK); 152 return false; 153 } 154 155 156 s.setSiteHome(this.site_home); 157 s.setSiteAddress(this.site_http_address); 158 s.setClusterName(this.cluster_name); 159 s.setServiceCluster(this); 160 s.setMessageRouter(this.router); 138 this.oai_service_rack = new OAIPMH(); 139 this.oai_service_rack.setSiteHome(this.site_home); 140 this.oai_service_rack.setSiteAddress(this.site_http_address); 141 this.oai_service_rack.setClusterName(this.cluster_name); 142 this.oai_service_rack.setServiceCluster(this); 143 this.oai_service_rack.setMessageRouter(this.router); 161 144 // pass the xml node to the service for configuration 162 if ( s.configure(oai_service_xml, extra_info)) {145 if (this.oai_service_rack.configure(oai_service_xml, extra_info)) { 163 146 164 147 // find out the supported service types for this service module 165 Node types = s.process(message);148 Node types = this.oai_service_rack.process(message); 166 149 NodeList typenodes = ((Element) types).getElementsByTagName(GSXML.SERVICE_ELEM); 167 150 … … 184 167 ((Element) typenodes.item(j)).setAttribute(GSXML.NAME_ATT, service); 185 168 } 186 this.service_map.put(service, s);169 this.service_map.put(service, this.oai_service_rack); 187 170 // also add info to the ServiceInfo XML element 188 171 this.service_list.appendChild(this.desc_doc.importNode(typenodes.item(j), true));
Note:
See TracChangeset
for help on using the changeset viewer.