source: FCSSimpleClient/trunk/src/main/java/eu/clarin/sru/client/fcs/LegacyClarinFCSRecordDataParser.java @ 7274

Last change on this file since 7274 was 7274, checked in by Oliver Schonefeld, 2 years ago
  • update copyright
  • Property svn:eol-style set to native
File size: 2.6 KB
Line 
1/**
2 * This software is copyright (c) 2012-2022 by
3 *  - Leibniz-Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
4 * This is free software. You can redistribute it
5 * and/or modify it under the terms described in
6 * the GNU General Public License v3 of which you
7 * should have received a copy. Otherwise you can download
8 * it from
9 *
10 *   http://www.gnu.org/licenses/gpl-3.0.txt
11 *
12 * @copyright Leibniz-Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
13 *
14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
15 *  GNU General Public License v3
16 */
17package eu.clarin.sru.client.fcs;
18
19import java.util.List;
20
21import javax.xml.stream.XMLStreamException;
22import javax.xml.stream.XMLStreamReader;
23
24import eu.clarin.sru.client.SRUClientException;
25import eu.clarin.sru.client.SRURecordData;
26
27
28/**
29 * A record data parse to parse legacy records.
30 *
31 * @deprecated Use only to talk to legacy clients. Endpoints should upgrade to
32 *             recent CLARIN-FCS specification.
33 */
34@Deprecated
35public class LegacyClarinFCSRecordDataParser extends
36        AbstractClarinFCSRecordDataParser {
37    private final boolean fullLegacyCompatMode;
38
39   
40    /**
41     * Constructor.
42     *
43     * @param parsers
44     *            the list of data view parsers to be used by this record data
45     *            parser. This list should contain one
46     *            {@link DataViewParserGenericDOM} or
47     *            {@link DataViewParserGenericString} instance.
48     * @param fullLegacyCompatMode
49     *            enable full legacy CLARIN-FCS compat mode
50     * @throws NullPointerException
51     *             if parsers is <code>null</code>
52     * @throws IllegalArgumentException
53     *             if parsers is empty or contains duplicate entries
54     */
55    public LegacyClarinFCSRecordDataParser(List<DataViewParser> parsers,
56            boolean fullLegacyCompatMode) {
57        super(parsers);
58        this.fullLegacyCompatMode = fullLegacyCompatMode;
59    }
60
61
62    @Override
63    public String getRecordSchema() {
64        return LegacyClarinFCSRecordData.RECORD_SCHEMA;
65    }
66
67
68    @Override
69    public SRURecordData parse(XMLStreamReader reader)
70            throws XMLStreamException, SRUClientException {
71        if (!fullLegacyCompatMode) {
72            logger.warn("The endpoint supplied data in the deprecated " +
73                    "CLARIN-FCS record data format. Please upgrade to the " +
74                    "new CLARIN-FCS specification as soon as possible.");
75        }
76        return parse(reader, LegacyClarinFCSRecordData.RECORD_SCHEMA,
77                fullLegacyCompatMode);
78    }
79
80} // class LegacyClarinFCSRecordDataParser
Note: See TracBrowser for help on using the repository browser.