- Timestamp:
- 05/28/13 13:39:34 (11 years ago)
- Location:
- SRUClient/trunk/src/main/java/eu/clarin/sru/client
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUExplainRecordDataParser.java
r2940 r2946 35 35 * @see <a href="http://zeerex.z3950.org/dtd/">The ZeeRex DTD</a> 36 36 */ 37 public class SRUExplainRecordDataParser implements SRURecordDataParser { 38 static final String ZEEREX_NS = SRUExplainRecordData.RECORD_SCHEMA; 39 static final String ZEEREX_NS_QUIRK = "http://explain.z3950.org/dtd/2.1/"; 37 class SRUExplainRecordDataParser { 38 private static final String ZEEREX_NS = 39 SRUExplainRecordData.RECORD_SCHEMA; 40 private static final String ZEEREX_NS_QUIRK = 41 "http://explain.z3950.org/dtd/2.1/"; 40 42 private static final String VERSION_1_1 = "1.1"; 41 43 private static final String VERSION_1_2 = "1.2"; … … 45 47 LoggerFactory.getLogger(SRUExplainRecordDataParser.class); 46 48 47 @Override 48 public String getRecordSchema() { 49 return SRUExplainRecordData.RECORD_SCHEMA; 50 } 51 52 53 @Override 54 public SRURecordData parse(final XMLStreamReader reader, SRUVersion version) 55 throws XMLStreamException, SRUClientException { 56 logger.debug("parsing explain record data for version {}", version); 49 50 public SRURecordData parse(XMLStreamReader reader, 51 SRUVersion version, String recordSchema) throws XMLStreamException, 52 SRUClientException { 53 // sanity check, if we are dealing with the expected record schema 54 if (!(ZEEREX_NS.equals(recordSchema) || 55 ZEEREX_NS_QUIRK.equals(recordSchema))) { 56 throw new SRUClientException("record schema '" + recordSchema + 57 "' not supported in explain response record data"); 58 } 59 60 logger.debug("parsing explain record data (version={} schema={})", 61 version, recordSchema); 57 62 58 63 // explain -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRURecordDataParser.java
r2936 r2946 39 39 * @param reader 40 40 * a {@link XMLStreamReader} to parse the record data 41 * @param version42 * the {@link SRUVersion} that was used to encode the record43 41 * @return the parsed record 44 42 * @throws XMLStreamException … … 48 46 * @see SRURecordData 49 47 */ 50 public SRURecordData parse(XMLStreamReader reader , SRUVersion version)48 public SRURecordData parse(XMLStreamReader reader) 51 49 throws XMLStreamException, SRUClientException; 52 50 -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUSimpleClient.java
r2945 r2946 496 496 497 497 // FIXME: ship explain record data for now 498 //doParseExplainResponse(reader, request, handler, true);499 doParseExplainResponse(reader, request, handler, false);498 doParseExplainResponse(reader, request, handler, true); 499 // doParseExplainResponse(reader, request, handler, false); 500 500 } 501 501 … … 556 556 } 557 557 558 /*559 * Hard-coded record schema identifiers for explain560 */561 if (!(SRUExplainRecordDataParser.ZEEREX_NS.equals(schema) ||562 SRUExplainRecordDataParser.ZEEREX_NS_QUIRK.equals(schema))) {563 throw new SRUClientException("record schema '" + schema +564 "' not supported in explain response");565 }566 567 558 try { 568 559 proxy.reset(recordReader); 569 recordData = explainRecordParser.parse(proxy, version); 560 /* 561 * Try to parse explain record data with explain record 562 * parser. It will throw an exception, if it cannot handle 563 * the data. 564 */ 565 recordData = 566 explainRecordParser.parse(proxy, version, schema); 570 567 } catch (XMLStreamException e) { 571 568 throw new SRUClientException( … … 1024 1021 try { 1025 1022 proxy.reset(recordReader); 1026 recordData = 1027 parser.parse(proxy, version); 1023 recordData = parser.parse(proxy); 1028 1024 } catch (XMLStreamException e) { 1029 1025 throw new SRUClientException( -
SRUClient/trunk/src/main/java/eu/clarin/sru/client/fcs/ClarinFCSRecordParser.java
r2936 r2946 27 27 import eu.clarin.sru.client.SRURecordData; 28 28 import eu.clarin.sru.client.SRURecordDataParser; 29 import eu.clarin.sru.client.SRUVersion;30 29 import eu.clarin.sru.client.XmlStreamReaderUtils; 31 30 … … 54 53 55 54 @Override 56 public SRURecordData parse(XMLStreamReader reader , SRUVersion version)55 public SRURecordData parse(XMLStreamReader reader) 57 56 throws XMLStreamException, SRUClientException { 58 57 logger.debug("parsing CLARIN-FCS record");
Note: See TracChangeset
for help on using the changeset viewer.