public virtual ITableDataExporter CreateExporter(string tempPath)
        {
            var cultureName = "en-US";
            var delim       = "\t";
            var format      = DefaultFormat;

            var csvConfig = RootState.Select("export");

            if (csvConfig != null)
            {
                cultureName = csvConfig.TryGet("culture", cultureName);
                delim       = csvConfig.TryGet("delim", delim);
                format      = csvConfig.TryGet("format", format);
            }

            return(new CsvExporter(tempPath, delim, CultureInfo.GetCultureInfo(cultureName),
                                   binaryPartitions: format.HasFlag(OutputFormat.BinaryPartitions), binaryOutput: format.HasFlag(OutputFormat.Binary),
                                   keepOutput: !format.HasFlag(OutputFormat.Binary)));
        }
        public IList <TableData> Load(string tempPath)
        {
            var cultureName = "en-US";
            var delim       = "\t";

            var csvConfig = RootState.Select("export");

            if (csvConfig != null)
            {
                cultureName = csvConfig.TryGet("culture", cultureName);
                delim       = csvConfig.TryGet("delim", delim);
            }

            var schemas = TableDataHelpers.Deserialize(File.ReadAllText(Path.Combine(tempPath, "Schema.json")));

            return
                (schemas.Select(
                     s =>
                     (TableData) new CsvTableData(s, Path.Combine(tempPath, s.Name + ".txt"), delim,
                                                  CultureInfo.GetCultureInfo(cultureName))).ToList());
        }
        public virtual void Initialize(Job job)
        {
            try
            {
                Database = Database.GetDatabase(job.ExecutionSettings.DatabaseName);
            }
            catch (Exception ex) { Log.Error("Error initializing database", ex, this); }

            job.JobEnded += (sender, args) =>
            {
                var export = RootState.Select("export");
                if (export != null)
                {
                    var ping = export.TryGet <string>("ping");
                    if (!string.IsNullOrEmpty(ping))
                    {
                        new WebClient().DownloadString(
                            ping.Replace("{id}", job.Id.ToString("D"))
                            .Replace("{status}", Enum.GetName(typeof(JobStatus), job.Status)));
                    }
                }
            };
        }
        public virtual ITableMapper CreateRootMapper()
        {
            var mapper = RootState.Select("Mapper");

            return(mapper != null?ParseTableMapper(mapper) : null);
        }
 public virtual IDataSource CreateDataSource()
 {
     return(ParseDataSource(RootState.Select("Source", true)));
 }