package com.github.bfh.study.slb.imports.job;

import com.github.bfh.study.slb.ImportContext;
import com.github.bfh.study.slb.imports.parser.PartialXmlParser;
import com.github.bfh.study.slb.imports.SecoProvider;

import java.io.Serializable;
import javax.batch.api.chunk.ItemReader;

/**
 * parse a defined xml and get the elements back
 *
 * @author Samuel Ackermann
 */
public class XmlReader extends ReaderWriterBase implements ItemReader {

    private PartialXmlParser parser;

    @Override
    public void open(Serializable checkpoint) throws Exception {
        this.checkpoint = checkpoint;
        ImportContext context = new ImportContext(new SecoProvider());
        parser = new PartialXmlParser(context.getProcessingElements());
        parser.open("");
    }

    @Override
    public void close() throws Exception {
        parser.close();
    }

    @Override
    public Object readItem() throws Exception {
        return parser.parse();
    }

    @Override
    public Serializable checkpointInfo() throws Exception {
        return checkpoint;
    }
}

@@ -72,16 +72,24 @@
 udy.slb.
+imports.
 ImportCo
@@ -164,63 +164,8 @@
 er;%0A
-import com.github.bfh.study.slb.imports.SecoProvider;%0A%0A
 impo
@@ -578,20 +578,16 @@
 ontext =
- new
  ImportC
@@ -596,27 +596,36 @@
 text
-(new SecoProvider()
+.importContextFactory(%22SECO%22
 );%0A 

fix compile error