001package org.kuali.ole.batch.marc;
002
003import org.marc4j.*;
004import org.xml.sax.InputSource;
005
006/**
007 * Created with IntelliJ IDEA.
008 * User: meenrajd
009 * Date: 9/2/13
010 * Time: 11:56 AM
011 * To change this template use File | Settings | File Templates.
012 */
013public class OLEMarcXmlParserThread extends Thread {
014
015    private RecordStack queue;
016    private InputSource input;
017    private ErrorHandler errors;
018
019    public OLEMarcXmlParserThread(RecordStack queue, InputSource input, ErrorHandler errors) {
020        this.queue = queue;
021        this.input = input;
022        this.errors = errors;
023    }
024
025    public void run() {
026        try {
027            MarcXmlHandler handler = new OLEMarcXmlHandler(queue, errors);
028            MarcXmlParser parser = new MarcXmlParser(handler);
029            parser.parse(input);
030        } catch (MarcException me) {
031            queue.passException(me);
032        } finally {
033            queue.end();
034        }
035    }
036
037}