1,
maxListSize,
"xml");
} catch (IOException e) {
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
} catch (SAXException e) {
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
} catch (ParserConfigurationException e) {
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
}
try {
NodeList nodeList = getRecords(srResponse);
if (nodeList != null) {
RecordFactory recordFactory = getRecordFactory();
for (int i = 0; i < nodeList.getLength(); ++i) {
Object rec = getRecordData(nodeList.item(i));
HashMap hashMap = new HashMap();
hashMap.put("header", rec);
String localIdentifier = getRecordFactory().getLocalIdentifier(hashMap);
try {
hashMap.put("metadata", getNativeMetadata(localIdentifier,
metadataPrefix));
} catch (IOException e) {
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
} catch (TransformerException e) {
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
} catch (ParserConfigurationException e) {
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
} catch (SAXException e) {
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
}
String[] header = recordFactory.createHeader(hashMap);
headers.add(header[0]);
identifiers.add(header[1]);
// MessageElement[] elems = rec.get_any();
// if (elems.length > 0) {
// String[] header = recordFactory.createHeader(elems[0]);
// headers.add(header[0]);
// identifiers.add(header[1]);
// }
}
try {
String resultSetId = XPathAPI.eval(srResponse, "/srw:searchRetrieveResponse/srw:resultSetId", xmlnsEl).str();
String nextRecordPosition = XPathAPI.eval(srResponse, "/srw:searchRetrieveResponse/srw:nextRecordPosition", xmlnsEl).str();
if (nextRecordPosition != null && nextRecordPosition.length() > 0) {
StringBuffer resumptionToken = new StringBuffer();
resumptionToken.append(resultSetId);
resumptionToken.append(":");
resumptionToken.append(nextRecordPosition);
resumptionToken.append(":");
resumptionToken.append(metadataPrefix);
listIdentifiersMap.put(
"resumptionMap",
getResumptionMap(resumptionToken.toString()));
}
} catch (TransformerException e) {
// logger.warn("failure", e);
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
}
} else {
throw new NoItemsMatchException();
}
listIdentifiersMap.put("headers", headers.iterator());
listIdentifiersMap.put("identifiers", identifiers.iterator());
return listIdentifiersMap;
} catch (TransformerException e) {
// logger.warn("failure", e);
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
} catch (SAXException e) {
// logger.warn("failure", e);
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
} catch (IOException e) {
// logger.warn("failure", e);
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
} catch (ParserConfigurationException e) {
// logger.warn("failure", e);
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
}
}