Exemplo n.º 1
0
 public SqlServerConnection(TflConnection element, AbstractConnectionDependencies dependencies)
     : base(element, dependencies)
 {
     Type               = ProviderType.SqlServer;
     L                  = "[";
     R                  = "]";
     TextQualifier      = "'";
     IsDatabase         = true;
     InsertMultipleRows = true;
     Top                = true;
     NoLock             = true;
     TableVariable      = true;
     NoCount            = true;
     IndexInclude       = true;
     Views              = true;
     Schemas            = true;
     MaxDop             = true;
     TableSample        = true;
     DefaultSchema      = "dbo";
     ConnectionStringProperties.UserProperty                = "User Id";
     ConnectionStringProperties.PasswordProperty            = "Password";
     ConnectionStringProperties.DatabaseProperty            = "Database";
     ConnectionStringProperties.ServerProperty              = "Server";
     ConnectionStringProperties.TrustedProperty             = "Trusted_Connection";
     ConnectionStringProperties.PersistSecurityInfoProperty = "Persist Security Info";
 }
Exemplo n.º 2
0
 public AnalysisServicesConnection(TflConnection element, AbstractConnectionDependencies dependencies)
     : base(element, dependencies)
 {
     Type = ProviderType.AnalysisServices;
     ConnectionStringProperties.DatabaseProperty = "Catalog";
     ConnectionStringProperties.ServerProperty   = "Data Source";
 }
 public ElasticSearchConnection(TflConnection element, AbstractConnectionDependencies dependencies)
     : base(element, dependencies)
 {
     Type          = ProviderType.ElasticSearch;
     IsDatabase    = true;
     TextQualifier = string.Empty;
 }
Exemplo n.º 4
0
 public LuceneConnection(TflConnection element, AbstractConnectionDependencies dependencies)
     : base(element, dependencies)
 {
     Type          = ProviderType.Lucene;
     IsDatabase    = true;
     TextQualifier = string.Empty;
 }
Exemplo n.º 5
0
        public MailConnection(TflConnection element, AbstractConnectionDependencies dependencies)
            : base(element, dependencies)
        {
            Type = ProviderType.Mail;

            var port = Port > 0 ? Port : 25;

            if (string.IsNullOrEmpty(User))
            {
                _smtpClient = new SmtpClient {
                    Port      = port,
                    EnableSsl = EnableSsl,
                    Host      = Server
                };
            }
            else
            {
                _smtpClient = new SmtpClient {
                    Port                  = port,
                    EnableSsl             = EnableSsl,
                    DeliveryMethod        = SmtpDeliveryMethod.Network,
                    UseDefaultCredentials = false,
                    Credentials           = new NetworkCredential(User, Password),
                    Host                  = Server
                };
            }
        }
Exemplo n.º 6
0
        public FileImportResult Import(FileInspectionRequest request, TflConnection output)
        {
            var fileInformation = FileInformationFactory.Create(request, _logger);

            var cfg = BuildProcess(fileInformation, request, output, _logger);

            if (cfg.Connections.First(c => c.Name == "output").Provider == "internal")
            {
                // nothing to init, so just run in default mode
                return(new FileImportResult {
                    Information = fileInformation,
                    Rows = ProcessFactory.CreateSingle(cfg, _logger).Execute()
                });
            }

            // first run in init mode
            cfg.Mode = "init";
            var process = ProcessFactory.CreateSingle(cfg, _logger, new Options {
                Mode = "init"
            });

            process.ExecuteScaler();

            // now run in default mode
            cfg.Mode = "default";
            process  = ProcessFactory.CreateSingle(cfg, _logger, new Options()
            {
                Mode = "default"
            });
            return(new FileImportResult {
                Information = fileInformation,
                Rows = process.Execute(),
                RowCount = process.Entities[0].Inserts
            });
        }
Exemplo n.º 7
0
 public ConnectionBuilder Connection(string name) {
     if (_process.Connections.Any(c => c.Name == name)) {
         return new ConnectionBuilder(this, _process.Connections.First(c => c.Name == name));
     }
     var connection = new TflConnection { Name = name }.WithDefaults();
     _process.Connections.Add(connection);
     return new ConnectionBuilder(this, connection);
 }
Exemplo n.º 8
0
 public SqlCeConnection(TflConnection element, AbstractConnectionDependencies dependencies)
     : base(element, dependencies)
 {
     Type       = ProviderType.SqlCe4;
     L          = "[";
     R          = "]";
     IsDatabase = true;
     ConnectionStringProperties.ServerProperty = "Data Source";
     ConnectionStringProperties.PersistSecurityInfoProperty = "Persist Security Info";
 }
Exemplo n.º 9
0
        public ConnectionBuilder Connection(TflConnection connection) {
            var name = connection.Name;
            if (_process.Connections.Any(c => c.Name == name)) {
                var cn = _process.Connections.First(c => c.Name == name);
                _process.Connections.Remove(cn);
                _process.Connections.Add(connection);
                return new ConnectionBuilder(this, connection);
            }

            _process.Connections.Add(connection);
            return new ConnectionBuilder(this, connection);
        }
Exemplo n.º 10
0
        public SolrConnection(TflConnection element, AbstractConnectionDependencies dependencies)
            : base(element, dependencies)
        {
            Type          = ProviderType.Solr;
            IsDatabase    = true;
            TextQualifier = string.Empty;
            _solrUrl      = element.NormalizeUrl(DEFAULT_PORT);

            if (!element.File.Equals(string.Empty))
            {
                _schemaFile = element.File;
            }
        }
Exemplo n.º 11
0
 public MySqlConnection(TflConnection element, AbstractConnectionDependencies dependencies)
     : base(element, dependencies)
 {
     Type          = ProviderType.MySql;
     L             = "`";
     R             = "`";
     TextQualifier = "'";
     IsDatabase    = true;
     Views         = true;
     ConnectionStringProperties.UserProperty     = "Uid";
     ConnectionStringProperties.PasswordProperty = "Pwd";
     ConnectionStringProperties.PortProperty     = "Port";
     ConnectionStringProperties.DatabaseProperty = "Database";
     ConnectionStringProperties.ServerProperty   = "Server";
 }
Exemplo n.º 12
0
        public ConnectionBuilder Connection(TflConnection connection)
        {
            var name = connection.Name;

            if (_process.Connections.Any(c => c.Name == name))
            {
                var cn = _process.Connections.First(c => c.Name == name);
                _process.Connections.Remove(cn);
                _process.Connections.Add(connection);
                return(new ConnectionBuilder(this, connection));
            }

            _process.Connections.Add(connection);
            return(new ConnectionBuilder(this, connection));
        }
Exemplo n.º 13
0
 private void ProcessConnectionString(TflConnection element)
 {
     if (element.ConnectionString != string.Empty)
     {
         Database            = ConnectionStringParser.GetDatabaseName(element.ConnectionString);
         Server              = ConnectionStringParser.GetServerName(element.ConnectionString);
         User                = ConnectionStringParser.GetUsername(element.ConnectionString);
         Password            = ConnectionStringParser.GetPassword(element.ConnectionString);
         PersistSecurityInfo = ConnectionStringParser.GetPersistSecurityInfo(element.ConnectionString);
     }
     else
     {
         Server   = element.Server;
         Database = element.Database;
         User     = element.User;
         Password = element.Password;
         Port     = element.Port;
     }
 }
Exemplo n.º 14
0
        /* Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0; */

        public PostgreSqlConnection(TflConnection element, AbstractConnectionDependencies dependencies)
            : base(element, dependencies)
        {
            Type               = ProviderType.PostgreSql;
            L                  = "\"";
            R                  = "\"";
            TextQualifier      = "'";
            IsDatabase         = true;
            InsertMultipleRows = true;
            Views              = true;
            Schemas            = true;
            DefaultSchema      = "public";
            ConnectionStringProperties.UserProperty     = "User ID";
            ConnectionStringProperties.PasswordProperty = "Password";
            ConnectionStringProperties.PortProperty     = "Port";
            ConnectionStringProperties.DatabaseProperty = "Database";
            ConnectionStringProperties.ServerProperty   = "Host";
            NoLock = false;
        }
Exemplo n.º 15
0
        protected AbstractConnection(TflConnection element, AbstractConnectionDependencies dependencies)
        {
            Source        = element;
            BatchSize     = element.BatchSize;
            Name          = element.Name;
            Start         = element.Start;
            End           = element.End;
            File          = element.File;
            Folder        = element.Folder;
            Delimiter     = element.Delimiter == string.Empty ? default(char) : element.Delimiter[0];
            DateFormat    = element.DateFormat;
            Header        = element.Header;
            Footer        = element.Footer;
            EnableSsl     = element.EnableSsl;
            Direct        = element.Direct;
            Encoding      = element.Encoding;
            Version       = element.Version;
            CheckMe       = element.Check;
            Path          = element.Path;
            ErrorMode     = (ErrorMode)Enum.Parse(typeof(ErrorMode), element.ErrorMode, true);
            SearchOption  = (SearchOption)Enum.Parse(typeof(SearchOption), element.SearchOption, true);
            SearchPattern = element.SearchPattern;

            ProcessConnectionString(element);

            TableQueryWriter   = dependencies.TableQueryWriter;
            ConnectionChecker  = dependencies.ConnectionChecker;
            EntityRecordsExist = dependencies.EntityRecordsExist;
            EntityDropper      = dependencies.EntityDropper;
            EntityCreator      = dependencies.EntityCreator;
            ViewWriters        = dependencies.ViewWriters;
            TflWriter          = dependencies.TflWriter;
            ScriptRunner       = dependencies.ScriptRunner;
            DataTypeService    = dependencies.DataTypeService;
            Logger             = dependencies.Logger;

            Is = new ConnectionIs(this);
        }
Exemplo n.º 16
0
        private static TflProcess BuildProcess(
            FileInformation fileInformation,
            FileInspectionRequest request,
            TflConnection output,
            ILogger logger)
        {
            var process = new TflRoot().GetDefaultOf <TflProcess>(p => {
                p.Name              = request.EntityName;
                p.Star              = request.ProcessName;
                p.StarEnabled       = false;
                p.ViewEnabled       = false;
                p.PipelineThreading = "MultiThreaded";
                p.Connections       = new List <TflConnection> {
                    p.GetDefaultOf <TflConnection>(c => {
                        c.Name      = "input";
                        c.Provider  = "file";
                        c.File      = fileInformation.FileInfo.FullName;
                        c.Delimiter = fileInformation.Delimiter == default(char)
                            ? "|"
                            : fileInformation.Delimiter.ToString(CultureInfo.InvariantCulture);
                        c.Start = fileInformation.FirstRowIsHeader ? 2 : 1;
                    }),
                    output
                };
                p.Entities = new List <TflEntity> {
                    p.GetDefaultOf <TflEntity>(e => {
                        e.Name       = request.EntityName;
                        e.Connection = "input";
                        e.PrependProcessNameToOutputName = false;
                        e.DetectChanges = false;
                        e.Fields        = GetFields(p, new FieldInspector(logger).Inspect(fileInformation, request), logger, request.EntityName);
                    })
                };
            });

            return(process);
        }
Exemplo n.º 17
0
 public FolderConnection(TflConnection element, AbstractConnectionDependencies dependencies)
     : base(element, dependencies)
 {
     Type = ProviderType.Folder;
 }
Exemplo n.º 18
0
 public WebConnection(TflConnection element, AbstractConnectionDependencies dependencies)
     : base(element, dependencies)
 {
     _element = element;
     Type     = ProviderType.Web;
 }
Exemplo n.º 19
0
 public LogConnection(TflConnection element, AbstractConnectionDependencies dependencies)
     : base(element, dependencies)
 {
     Type = ProviderType.Log;
 }
Exemplo n.º 20
0
 public ConnectionBuilder(ProcessBuilder processBuilder, TflConnection connection)
 {
     _processBuilder = processBuilder;
     _connection     = connection;
 }
Exemplo n.º 21
0
 public ConsoleConnection(TflConnection element, AbstractConnectionDependencies dependencies)
     : base(element, dependencies)
 {
     Type = ProviderType.Console;
 }
Exemplo n.º 22
0
 public ConnectionBuilder(ProcessBuilder processBuilder, TflConnection connection) {
     _processBuilder = processBuilder;
     _connection = connection;
 }
Exemplo n.º 23
0
 public InternalConnection(TflConnection element, AbstractConnectionDependencies dependencies)
     : base(element, dependencies)
 {
     Type = ProviderType.Internal;
 }
Exemplo n.º 24
0
 public ConnectionBuilder Connection(TflConnection element)
 {
     return(_processBuilder.Connection(element));
 }
Exemplo n.º 25
0
 public ConnectionBuilder Connection(TflConnection element) {
     return _processBuilder.Connection(element);
 }
Exemplo n.º 26
0
 /// <summary>
 /// Imports a file to an output with default file inspection settings
 /// </summary>
 /// <param name="fileName"></param>
 /// <param name="output"></param>
 /// <returns></returns>
 public long ImportScaler(string fileName, TflConnection output)
 {
     return(ImportScaler(new FileInspectionRequest(fileName), output));
 }
Exemplo n.º 27
0
 /// <summary>
 /// Imports a file to an output with provided file inpections settings
 /// </summary>
 /// <param name="request"></param>
 /// <param name="output"></param>
 /// <returns></returns>
 public long ImportScaler(FileInspectionRequest request, TflConnection output)
 {
     return(Import(request, output).RowCount);
 }
Exemplo n.º 28
0
 public FileImportResult Import(string fileName, TflConnection output)
 {
     return(Import(new FileInspectionRequest(fileName), output));
 }