// Path: src/main/java/com/presidentio/testdatagenerator/cons/DelimiterConst.java
// public class DelimiterConst {
// 
//     public static final String COMMA = ",";
//     public static final String TAB = "\t";
//     public static final String NEW_LINE = "\n";
//     public static final String SPACE = " ";
// 
// }
// 
// Path: src/main/java/com/presidentio/testdatagenerator/cons/FileFormatConst.java
// public class FileFormatConst {
// 
//     public static final String CSV = "csv";
//     public static final String TSV = "tsv";
//     public static final String JSON = "json";
//     public static final String SQL = "sql";
//     public static final String ES = "es";
// 
//     public static final List<String> ALL = Arrays.asList(CSV, TSV, JSON, SQL, ES);
// 
// }
// 
// Path: src/main/java/com/presidentio/testdatagenerator/cons/PropConst.java
// public class PropConst {
// 
//     public static final String TYPE = "type";
//     public static final String VALUE = "value";
//     public static final String SIZE = "size";
//     public static final String DOMAIN = "domain";
//     public static final String EXPR = "expr";
//     public static final String FILE = "file";
//     public static final String DELIMITER = "delimiter";
//     public static final String ITEMS = "items";
//     public static final String INDEX = "index";
//     public static final String HOST = "host";
//     public static final String PORT = "port";
//     public static final String CLUSTER_NAME = "clusterName";
//     public static final String CONNECTION_URL = "connectionUrl";
//     public static final String JDBC_DRIVER = "jdbcDriver";
//     public static final String DEPTH = "depth";
//     public static final String FIELD = "field";
//     public static final String VAR = "var";
//     public static final String OP = "op";
//     public static final String FORMAT = "format";
//     public static final String HEADER = "header";
//     public static final String SUFFIX = "suffix";
//     public static final String PREFIX = "prefix";
//     public static final String PATH_PROVIDER = "pathProvider";
//     public static final String BROKER_LIST = "brokerList";
//     public static final String GENDER = "gender";
// 
// }


import com.presidentio.testdatagenerator.cons.DelimiterConst;
import com.presidentio.testdatagenerator.cons.FileFormatConst;
import com.presidentio.testdatagenerator.cons.PropConst;
import java.util.Map;
package com.presidentio.testdatagenerator.output.formatter;



/**
 * Created by presidentio on 24.04.15.
 */
public class DefaultFormatterFactory implements FormatterFactory {

    @Override
    public Formatter buildFormatter(Map<String, String> props) {
        String format = props.get(PropConst.FORMAT);
        if (format == null) {
            format = FileFormatConst.CSV;
        }
        if (!FileFormatConst.ALL.contains(format)) {
            throw new IllegalArgumentException(PropConst.FORMAT + " is incorrect. Must be one of: "
                    + FileFormatConst.ALL);
        }
        Formatter formatter = getFormatter(format);
        formatter.init(props);
        return formatter;
    }

    private Formatter getFormatter(String format) {
        switch (format) {
            case FileFormatConst.CSV:
                return new SvFormatter(DelimiterConst.COMMA);
            case FileFormatConst.TSV:
                return new SvFormatter(DelimiterConst.TAB);
            case FileFormatConst.JSON:
                throw new UnsupportedOperationException("json hasn't implemented yet");
            case FileFormatConst.SQL:
                return new SqlFormatter();
// Path: src/main/java/com/presidentio/testdatagenerator/cons/DelimiterConst.java
// public class DelimiterConst {
// 
//     public static final String COMMA = ",";
//     public static final String TAB = "\t";
//     public static final String NEW_LINE = "\n";
//     public static final String SPACE = " ";
// 
// }
// 
// Path: src/main/java/com/presidentio/testdatagenerator/cons/FileFormatConst.java
// public class FileFormatConst {
// 
//     public static final String CSV = "csv";
//     public static final String TSV = "tsv";
//     public static final String JSON = "json";
//     public static final String SQL = "sql";
//     public static final String ES = "es";
// 
//     public static final List<String> ALL = Arrays.asList(CSV, TSV, JSON, SQL, ES);
// 
// }
// 
// Path: src/main/java/com/presidentio/testdatagenerator/cons/PropConst.java
// public class PropConst {
// 
//     public static final String TYPE = "type";
//     public static final String VALUE = "value";
//     public static final String SIZE = "size";
//     public static final String DOMAIN = "domain";
//     public static final String EXPR = "expr";
//     public static final String FILE = "file";
//     public static final String DELIMITER = "delimiter";
//     public static final String ITEMS = "items";
//     public static final String INDEX = "index";
//     public static final String HOST = "host";
//     public static final String PORT = "port";
//     public static final String CLUSTER_NAME = "clusterName";
//     public static final String CONNECTION_URL = "connectionUrl";
//     public static final String JDBC_DRIVER = "jdbcDriver";
//     public static final String DEPTH = "depth";
//     public static final String FIELD = "field";
//     public static final String VAR = "var";
//     public static final String OP = "op";
//     public static final String FORMAT = "format";
//     public static final String HEADER = "header";
//     public static final String SUFFIX = "suffix";
//     public static final String PREFIX = "prefix";
//     public static final String PATH_PROVIDER = "pathProvider";
//     public static final String BROKER_LIST = "brokerList";
//     public static final String GENDER = "gender";
// 
// }


// Path: src/main/java/com/presidentio/testdatagenerator/output/formatter/DefaultFormatterFactory.java
import com.presidentio.testdatagenerator.cons.DelimiterConst;
import com.presidentio.testdatagenerator.cons.FileFormatConst;
import com.presidentio.testdatagenerator.cons.PropConst;
import java.util.Map;

package com.presidentio.testdatagenerator.output.formatter;



/**
 * Created by presidentio on 24.04.15.
 */
public class DefaultFormatterFactory implements FormatterFactory {

    @Override
    public Formatter buildFormatter(Map<String, String> props) {
        String format = props.get(PropConst.FORMAT);
        if (format == null) {
            format = FileFormatConst.CSV;
        }
        if (!FileFormatConst.ALL.contains(format)) {
            throw new IllegalArgumentException(PropConst.FORMAT + " is incorrect. Must be one of: "
                    + FileFormatConst.ALL);
        }
        Formatter formatter = getFormatter(format);
        formatter.init(props);
        return formatter;
    }

    private Formatter getFormatter(String format) {
        switch (format) {
            case FileFormatConst.CSV:
                return new SvFormatter(DelimiterConst.COMMA);
            case FileFormatConst.TSV:
                return new SvFormatter(DelimiterConst.TAB);
            case FileFormatConst.JSON:
                throw new UnsupportedOperationException("json hasn't implemented yet");
            case FileFormatConst.SQL:
                return new SqlFormatter();
            case FileFormatConst.ES: