// Path: bte-core/src/main/java/gr/ekt/bte/exceptions/BadTransformationSpec.java
// public class BadTransformationSpec extends Exception {
//     public BadTransformationSpec() {
//         super();
//     }
// 
//     public BadTransformationSpec(String message) {
//         super(message);
//     }
// 
//     private static final long serialVersionUID = 2L;
// }
// 
// Path: bte-core/src/main/java/gr/ekt/bte/exceptions/MalformedSourceException.java
// public class MalformedSourceException extends Exception {
// 
//     public MalformedSourceException(String message) {
//         super(message);
//     }
// 
//     private static final long serialVersionUID = 1L;
// }


import gr.ekt.bte.exceptions.BadTransformationSpec;
import gr.ekt.bte.exceptions.MalformedSourceException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Iterator;
import java.util.List;
import org.apache.log4j.Logger;
    }

    public TransformationEngine(DataLoader dataLoader, OutputGenerator outputGenerator, Workflow workflow) {
        this.dataLoader = dataLoader;
        this.outputGenerator = outputGenerator;
        this.workflow = workflow;
    }

    public TransformationResult transform(TransformationSpec spec) throws BadTransformationSpec, MalformedSourceException {
        if (!checkSpec(spec)) {
            throw new BadTransformationSpec("Bad Spec: " + spec.toString());
        }
        TransformationLog log = new TransformationLog();
        List<DataLoadingSpec> loading_spec_list = new ArrayList<DataLoadingSpec>();

        long start_time = Calendar.getInstance().getTimeInMillis();
        logger.info("Loading records");

        int n_records = 0;
        int kept_records = 0;
        List<String> output = new ArrayList<String>();
        boolean end_of_input = false;

        current_offset = 0;
        while((output.size() < spec.getNumberOfRecords() || spec.getNumberOfRecords() == 0) && !end_of_input) {
            RecordSet tmp_recs = null;
            DataLoadingSpec dl_spec = generateNextLoadingSpec(spec, output.size());
            loading_spec_list.add(dl_spec);
            try {
                tmp_recs = dataLoader.getRecords(dl_spec);
// Path: bte-core/src/main/java/gr/ekt/bte/exceptions/BadTransformationSpec.java
// public class BadTransformationSpec extends Exception {
//     public BadTransformationSpec() {
//         super();
//     }
// 
//     public BadTransformationSpec(String message) {
//         super(message);
//     }
// 
//     private static final long serialVersionUID = 2L;
// }
// 
// Path: bte-core/src/main/java/gr/ekt/bte/exceptions/MalformedSourceException.java
// public class MalformedSourceException extends Exception {
// 
//     public MalformedSourceException(String message) {
//         super(message);
//     }
// 
//     private static final long serialVersionUID = 1L;
// }


// Path: bte-core/src/main/java/gr/ekt/bte/core/TransformationEngine.java
import gr.ekt.bte.exceptions.BadTransformationSpec;
import gr.ekt.bte.exceptions.MalformedSourceException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Iterator;
import java.util.List;
import org.apache.log4j.Logger;

    }

    public TransformationEngine(DataLoader dataLoader, OutputGenerator outputGenerator, Workflow workflow) {
        this.dataLoader = dataLoader;
        this.outputGenerator = outputGenerator;
        this.workflow = workflow;
    }

    public TransformationResult transform(TransformationSpec spec) throws BadTransformationSpec, MalformedSourceException {
        if (!checkSpec(spec)) {
            throw new BadTransformationSpec("Bad Spec: " + spec.toString());
        }
        TransformationLog log = new TransformationLog();
        List<DataLoadingSpec> loading_spec_list = new ArrayList<DataLoadingSpec>();

        long start_time = Calendar.getInstance().getTimeInMillis();
        logger.info("Loading records");

        int n_records = 0;
        int kept_records = 0;
        List<String> output = new ArrayList<String>();
        boolean end_of_input = false;

        current_offset = 0;
        while((output.size() < spec.getNumberOfRecords() || spec.getNumberOfRecords() == 0) && !end_of_input) {
            RecordSet tmp_recs = null;
            DataLoadingSpec dl_spec = generateNextLoadingSpec(spec, output.size());
            loading_spec_list.add(dl_spec);
            try {
                tmp_recs = dataLoader.getRecords(dl_spec);
            } catch (MalformedSourceException e) {