Changeset 28885
- Timestamp:
- 2014-03-10T13:52:30+13:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/OAIReceptionist.java
r28882 r28885 76 76 /** a hash of super set-> collection list */ 77 77 protected HashMap<String, Vector<String>> super_coll_map = null; 78 /** store the super coll elements for convenience */ 79 HashMap<String, Element> super_coll_data = null; 78 80 /** The identify response */ 79 81 protected Element identify_response = null; … … 119 121 120 122 repository_id = getRepositoryIdentifier(); 123 configureSuperSetInfo(); 121 124 if (!configureSetInfo()) { 122 125 // there are no sets … … 134 137 // assuming that sets are static. If collections change then the servlet 135 138 // should be restarted. 136 private boolean configureS etInfo() {139 private boolean configureSuperSetInfo() { 137 140 // do we have any super colls listed in web/WEB-INF/classes/OAIConfig.xml? 138 141 // Will be like … … 145 148 // whether they are part of the super set or not. 146 149 NodeList super_coll_list = this.oai_config.getElementsByTagName(OAIXML.OAI_SUPER_SET); 147 HashMap<String, Element>super_coll_data = new HashMap<String, Element>();150 this.super_coll_data = new HashMap<String, Element>(); 148 151 if (super_coll_list.getLength() > 0) { 149 152 this.has_super_colls = true; … … 154 157 String name = GSXML.getNodeText(set_spec); 155 158 if (!name.equals("")) { 156 super_coll_data.put(name, super_coll);159 this.super_coll_data.put(name, super_coll); 157 160 logger.error("adding in super coll "+name); 158 161 } … … 160 163 } 161 164 162 if ( super_coll_data.size()==0) {165 if (this.super_coll_data.size()==0) { 163 166 this.has_super_colls = false; 164 167 } … … 167 170 this.super_coll_map = new HashMap<String, Vector<String>>(); 168 171 } 172 return true; 173 174 } 175 private boolean configureSetInfo() { 169 176 this.set_set = new HashSet<String>(); 170 177 171 // next, we get a list of all the OAI enabled collections178 // First, we get a list of all the OAI enabled collections 172 179 // We get this by sending a listSets request to the MR 173 180 Document doc = this.converter.newDOM(); … … 251 258 logger.error("found super coll, "+set_spec); 252 259 // check that it is a valid one from config 253 if (this.has_super_colls == true && super_coll_data.containsKey(set_spec)) {260 if (this.has_super_colls == true && this.super_coll_data.containsKey(set_spec)) { 254 261 Vector <String> subcolls = this.super_coll_map.get(set_spec); 255 262 if (subcolls == null) { … … 260 267 this.super_coll_map.put(set_spec, subcolls); 261 268 // the first time a supercoll is mentioned, add into the set list 262 logger.error("finding the set info "+this.converter.getPrettyString( super_coll_data.get(set_spec)));263 listsets_element.appendChild(GSXML.duplicateWithNewName(listsets_doc, super_coll_data.get(set_spec), OAIXML.SET, true));269 logger.error("finding the set info "+this.converter.getPrettyString(this.super_coll_data.get(set_spec))); 270 listsets_element.appendChild(GSXML.duplicateWithNewName(listsets_doc, this.super_coll_data.get(set_spec), OAIXML.SET, true)); 264 271 } 265 272 // add this collection to the list for the super coll … … 276 283 } 277 284 285 protected void resetMessageRouter() { 286 // we just need to send a configure request to MR 287 Document doc = this.converter.newDOM(); 288 Element mr_request_message = doc.createElement(GSXML.MESSAGE_ELEM); 289 Element mr_request = GSXML.createBasicRequest(doc, GSXML.REQUEST_TYPE_SYSTEM, "", null); 290 mr_request_message.appendChild(mr_request); 291 292 Element system = doc.createElement(GSXML.SYSTEM_ELEM); 293 mr_request.appendChild(system); 294 system.setAttribute(GSXML.TYPE_ATT, GSXML.SYSTEM_TYPE_CONFIGURE); 295 296 Element response = (Element) this.mr.process(mr_request_message); 297 logger.error("configure response = "+this.converter.getPrettyString(response)); 298 } 278 299 /** process using strings - just calls process using Elements */ 279 300 public String process(String xml_in) { … … 315 336 return OAIXML.createErrorMessage(OAIXML.BAD_ARGUMENT, "Internal messaging error"); 316 337 } 338 339 // special case, reset=true for reloading the MR and recept data 340 String reset = request.getAttribute("reset"); 341 if (!reset.equals("")) { 342 resetMessageRouter(); 343 configureSetInfo(); 344 return OAIXML.createResetResponse(true); 345 } 346 347 317 348 //At this stage, the value of 'to' attribute of the request must be the 'verb' 318 349 //The only thing that the oai receptionist can be sure is that these verbs are valid, nothing else. … … 844 875 if (this.identify_response != null) { 845 876 // we have already created it 846 return this.identify_response;877 return getMessage(this.identify_response.getOwnerDocument(), this.identify_response); 847 878 } 848 879 Document doc = this.converter.newDOM();
Note:
See TracChangeset
for help on using the changeset viewer.