Changeset 2151


Ignore:
Timestamp:
08/24/12 13:01:23 (12 years ago)
Author:
oschonef
Message:
  • add preliminary multithreaded handler based client (WIP)
Location:
SRUClient/trunk/src/main/java/eu/clarin/sru/client
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUClient.java

    r2141 r2151  
    6767            LoggerFactory.getLogger(SRUClient.class);
    6868    private final SRUVersion defaultVersion;
     69    private boolean strictMode;
     70    private final Map<String, SRURecordDataParser> parsers;
    6971    private final HttpClient httpClient;
    70     private final Map<String, SRURecordDataParser> parsers =
    71             new HashMap<String, SRURecordDataParser>();
    7272    private final XmlStreamReaderProxy proxy = new XmlStreamReaderProxy();
    73     private boolean strictMode;
    7473
    7574
     
    110109     *            <code>false</code> it will act more forgiving and ignore
    111110     *            certain violations
    112      *
    113111     */
    114112    public SRUClient(SRUVersion defaultVersion, boolean strictMode) {
     113        this(defaultVersion, strictMode,
     114                new HashMap<String, SRURecordDataParser>());
     115    }
     116
     117
     118    /**
     119     * Constructor.
     120     *
     121     * <p>
     122     * For internal use only.
     123     * </p>
     124     *
     125     * @param defaultVersion
     126     *            the default version to use for SRU requests; may be overridden
     127     *            by individual requests
     128     * @param strictMode
     129     *            if <code>true</code> the client will strictly adhere to the
     130     *            SRU standard and raise fatal errors on violations, if
     131     *            <code>false</code> it will act more forgiving and ignore
     132     *            certain violations
     133     * @param parsers
     134     *            a <code>Map</code> to store record schema to record data
     135     *            parser mappings
     136     */
     137    SRUClient(SRUVersion defaultVersion, boolean strictMode,
     138            Map<String, SRURecordDataParser> parsers) {
    115139        if (defaultVersion == null) {
    116140            throw new NullPointerException("version == null");
    117141        }
     142        if (parsers == null) {
     143            throw new NullPointerException("parsers == null");
     144        }
    118145        this.defaultVersion = defaultVersion;
    119         this.strictMode = strictMode;
     146        this.strictMode     = strictMode;
     147        this.parsers        = parsers;
    120148        this.httpClient = new DefaultHttpClient();
    121149        this.httpClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT,
     
    145173        this.strictMode = strictMode;
    146174    }
     175
    147176
    148177    /**
Note: See TracChangeset for help on using the changeset viewer.