Ejemplo n.º 1
0
 protected Task(Packages.VulcanPackage vulcanPackage, string taskName, string taskDescription, DTS.IDTSSequence parentContainer)
 {
     _vulcanPackage   = vulcanPackage;
     _name            = taskName;
     _description     = taskDescription;
     _parentContainer = parentContainer;
 }
Ejemplo n.º 2
0
        public DerivedColumns(Packages.VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description)
            :
            base(
                vulcanPackage,
                dataFlowTask,
                parentComponent,
                name,
                description
                )
        {
            _dcCom = dataFlowTask.ComponentMetaDataCollection.New();
            _dcCom.ComponentClassID = "DTSTransform.DerivedColumn";

            //IMPORTANT! If you do not Instantiate() first, the component names do not get set... this is bad.

            _dci = _dcCom.Instantiate();
            _dci.ProvideComponentProperties();

            _dcCom.Name        = Name;
            _dcCom.Description = Description;

            dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications(
                parentComponent.OutputCollection[0],
                _dcCom.InputCollection[0]
                );

            _dci.AcquireConnections(null);
            _dci.ReinitializeMetaData();
            _dci.ReleaseConnections();
        }
Ejemplo n.º 3
0
        public FileSystemTask(
            Packages.VulcanPackage vulcanPackage,
            string name,
            string taskDescription,
            DTS.IDTSSequence parentContainer,
            string sourceConnection,
            string destConnection,
            Microsoft.SqlServer.Dts.Tasks.FileSystemTask.DTSFileSystemOperation operation
            )
            :
            base(
                vulcanPackage,
                name,
                taskDescription,
                parentContainer
                )
        {
            Connection source = new Connection(vulcanPackage, sourceConnection, sourceConnection, "FILE", String.Format("\"{0}\"", ExpressionPathBuilder.EscapeBackslashes(sourceConnection)));
            Connection dest   = new Connection(vulcanPackage, destConnection, destConnection, "FILE", String.Format("\"{0}\"", ExpressionPathBuilder.EscapeBackslashes(destConnection)));

            source.SetProperty("FileUsageType", 2);
            dest.SetProperty("FileUsageType", 2);
            fileSystemTask        = (DTS.TaskHost)parentContainer.Executables.Add("STOCK:FileSystemTask");
            fileSystemTask.Name   = name;
            this.Task.Operation   = operation;
            this.Task.Source      = source.ConnectionManager.ID;
            this.Task.Destination = dest.ConnectionManager.ID;
        }
Ejemplo n.º 4
0
        public static OLEDBCommand CreateOLEDBCommandFromXml(Packages.VulcanPackage vulcanPackage, IDTSComponentMetaData90 parentComponent, MainPipe dataFlowTask, XPathNavigator commandNav)
        {
            if (commandNav == null || commandNav.Name.ToUpperInvariant() != "OLEDBCommand".ToUpperInvariant())
            {
                return(null);
            }

            string commandName = commandNav.SelectSingleNode("@Name", vulcanPackage.VulcanConfig.NamespaceManager).Value;

            Message.Trace(Severity.Debug, "Begin: OLEDB Transformation {0}", commandName);
            Connection destConnection =
                Connection.GetExistingConnection(
                    vulcanPackage,
                    commandNav.SelectSingleNode("rc:DestinationConnection/@Name", vulcanPackage.VulcanConfig.NamespaceManager).Value
                    );

            string command = commandNav.SelectSingleNode("rc:Command", vulcanPackage.VulcanConfig.NamespaceManager).Value;

            OLEDBCommand dbc = new OLEDBCommand(vulcanPackage, dataFlowTask, parentComponent, commandName, commandName, destConnection, command);

            foreach (XPathNavigator nav in commandNav.Select("rc:Map", vulcanPackage.VulcanConfig.NamespaceManager))
            {
                string source      = nav.SelectSingleNode("@Source").Value;
                string destination = nav.SelectSingleNode("@Destination") == null
                                     ? "@" + source
                                     : nav.SelectSingleNode("@Destination").Value;
                dbc.Map(source, destination, false);
            }
            return(dbc);
        }
Ejemplo n.º 5
0
Archivo: Task.cs Proyecto: japj/vulcan
 protected Task(Packages.VulcanPackage vulcanPackage ,string taskName, string taskDescription, DTS.IDTSSequence parentContainer)
 {
     _vulcanPackage = vulcanPackage;
     _name = taskName;
     _description = taskDescription;
     _parentContainer = parentContainer;
 }
Ejemplo n.º 6
0
        public static DerivedColumns CreateDerivedColumnsFromXml(Packages.VulcanPackage vulcanPackage, IDTSComponentMetaData90 parentComponent, MainPipe dataFlowTask, XPathNavigator derivedNav)
        {
            if (derivedNav == null || derivedNav.Name.ToUpperInvariant() != "DerivedColumns".ToUpperInvariant())
            {
                //We don't handle this.
                return(null);
            }

            string componentName = derivedNav.SelectSingleNode("@Name", vulcanPackage.VulcanConfig.NamespaceManager).Value;

            Message.Trace(Severity.Debug, "Begin: DerivedColumns Transformation {0}", componentName);

            DerivedColumns dc = new DerivedColumns(vulcanPackage, dataFlowTask, parentComponent, componentName, componentName);

            foreach (XPathNavigator nav in derivedNav.Select("rc:Column", vulcanPackage.VulcanConfig.NamespaceManager))
            {
                string colName      = nav.SelectSingleNode("@Name").Value;
                string typeAsString = nav.SelectSingleNode("@Type").Value;
                int    length       = nav.SelectSingleNode("@Length").ValueAsInt;
                int    precision    = nav.SelectSingleNode("@Precision").ValueAsInt;
                int    scale        = nav.SelectSingleNode("@Scale").ValueAsInt;
                int    codepage     = nav.SelectSingleNode("@Codepage").ValueAsInt;

                string expression = nav.Value;

                DataType type = TransformationFactory.GetDataTypeFromString(typeAsString);

                dc.AddOutputColumn(colName, type, expression, length, precision, scale, codepage);
            }
            return(dc);
        }
Ejemplo n.º 7
0
 public ConstraintEmitter(Packages.VulcanPackage vulcanPackage, Constraint constraint, TableHelper tableHelper)
     : base(vulcanPackage)
 {
     this._tableHelper = tableHelper;
     this._constraint  = constraint;
     this._tableHelper = tableHelper;
 }
Ejemplo n.º 8
0
 public TemplateEmitter(String templateName, Packages.VulcanPackage vulcanPackage, params string[] parameters)
     : base(
         vulcanPackage
         )
 {
     this._template = vulcanPackage.TemplateManager[templateName];
     this.SetParameters(parameters);
 }
Ejemplo n.º 9
0
 public IndexEmitter(string tableName, XPathNavigator tableNavigator, Packages.VulcanPackage vulcanPackage)
     : base(
         tableName,
         tableNavigator,
         vulcanPackage
         )
 {
 }
Ejemplo n.º 10
0
 public static Connection GetExistingConnection(Packages.VulcanPackage vulcanPackage, string name)
 {
     if (vulcanPackage.DTSPackage.Connections.Contains(name))
     {
         return(new Connection(vulcanPackage, name, name, null, null));
     }
     return(null);
 }
Ejemplo n.º 11
0
 public ETLPattern(Packages.VulcanPackage vulcanPackage, DTS.IDTSSequence parentContainer)
     :
     base(
         vulcanPackage,
         parentContainer
         )
 {
 }
Ejemplo n.º 12
0
 public TableModifierEmitter(string tableName, XPathNavigator tableNavigator, Packages.VulcanPackage vulcanPackage)
     :
     base(
         vulcanPackage
         )
 {
     this._tableName      = tableName;
     this._tableNavigator = tableNavigator;
 }
Ejemplo n.º 13
0
 public StoredProcEmitter(string procName, string body, Packages.VulcanPackage vulcanPackage)
     : base(
         vulcanPackage
         )
 {
     this._procName   = procName;
     this._body       = body;
     this._columnList = new List <string>();
 }
Ejemplo n.º 14
0
        public static Transformation ProcessTransformation(Packages.VulcanPackage vulcanPackage, IDTSComponentMetaData90 parentComponent, MainPipe dataFlowTask, XPathNavigator transformationsNav)
        {
            Transformation t = null;

            if (transformationsNav != null)
            {
                try
                {
                    switch (transformationsNav.Name)
                    {
                    case "OLEDBCommand":
                        t = CreateOLEDBCommandFromXml(vulcanPackage, parentComponent, dataFlowTask, transformationsNav);
                        break;

                    case "Lookup":
                        t = CreateLookupFromXml(vulcanPackage, parentComponent, dataFlowTask, transformationsNav);
                        break;

                    case "DerivedColumns":
                        t = CreateDerivedColumnsFromXml(vulcanPackage, parentComponent, dataFlowTask, transformationsNav);
                        break;

                    case "IsNullPatcher":
                        t = CreateIsNullPatcherFromXml(vulcanPackage, parentComponent, dataFlowTask, transformationsNav);
                        break;

                    case "TermLookup":
                        t = CreateTermLookupFromXml(vulcanPackage, parentComponent, dataFlowTask, transformationsNav);
                        break;

                    case "ConditionalSplit":
                        t = CreateConditionalSplitFromXml(vulcanPackage, parentComponent, dataFlowTask, transformationsNav);
                        break;

                    case "UnionAll":
                        t = CreateUnionAllFromXml(vulcanPackage, parentComponent, dataFlowTask, transformationsNav);
                        break;

                    case "Sort":
                        t = CreateSortFromXml(vulcanPackage, parentComponent, dataFlowTask, transformationsNav);
                        break;

                    default:
                        break;
                    }
                }
                catch (System.Runtime.InteropServices.COMException ce)
                {
                    Message.Trace(Severity.Error, ce, "COMException in transformation {0}\n {1}\n", transformationsNav.Name, ce.Message);
                }
                catch (Exception e)
                {
                    Message.Trace(Severity.Error, e, "Exception in transformation {0}\n {1}\n", transformationsNav.Name, e.Message);
                }
            }
            return(t);
        }
Ejemplo n.º 15
0
 public SelectEmitter(Packages.VulcanPackage vulcanPackage, string tableName, string columns, string where)
     :
     base(
         vulcanPackage
         )
 {
     this.tableName = tableName;
     this.columns   = columns;
     this.where     = where;
 }
Ejemplo n.º 16
0
        public static Connection GetExistingConnection(Packages.VulcanPackage vulcanPackage, XPathNavigator parentNavigator)
        {
            XPathNavigator connectionNav =
                parentNavigator.SelectSingleNode("rc:Connection/@Name", vulcanPackage.VulcanConfig.NamespaceManager);

            if (connectionNav != null)
            {
                return(Connection.GetExistingConnection(vulcanPackage, connectionNav.Value));
            }
            return(null);
        }
Ejemplo n.º 17
0
 public PrecedenceConstraint(Packages.VulcanPackage vulcanPackage, string from, string to, DTS.IDTSSequence parentContainer)
     :
     base(
         vulcanPackage,
         from + "_" + to,
         "",
         parentContainer
         )
 {
     this.from = from;
     this.to   = to;
 }
Ejemplo n.º 18
0
 public SQLTask(Packages.VulcanPackage package, string name, string description, DTS.IDTSSequence parentContainer, Connection destinationConnection)
     :
     this(
         package,
         name,
         description,
         parentContainer,
         destinationConnection,
         null
         )
 {
 }
Ejemplo n.º 19
0
        public LogtainerLog(Packages.VulcanPackage vulcanPackage, string logName, string sourceColumn, string destinationColumn, string table, string tableConnectionName)
        {
            _sourceColumn        = sourceColumn;
            _destinationColumn   = destinationColumn;
            _table               = table;
            _tableConnectionName = tableConnectionName;

            _vulcanPackage            = vulcanPackage;
            _logName                  = logName;
            _columnVariableDictionary = new Dictionary <string, Microsoft.SqlServer.Dts.Runtime.Variable>();
            _logVariable              = vulcanPackage.AddVariable(logName, (System.Int32)(-1));
            _lastRecordLogVariable    = vulcanPackage.AddVariable(logName + Resources.LastSuccessfulRunLogID, (System.Int32)(-1));
            _isAnotherInstanceCurrentlyRunningLogVariable = vulcanPackage.AddVariable(logName + Resources.IsAnotherInstanceCurrentlyRunningLogID, (System.Int32) 0);
        }
Ejemplo n.º 20
0
 protected Transformation(
     Packages.VulcanPackage vulcanPackage,
     MainPipe dataFlowTask,
     IDTSComponentMetaData90 parentComponent,
     string name,
     string description
     )
 {
     this._vulcanPackage   = vulcanPackage;
     this._dataFlowTask    = dataFlowTask;
     this._parentComponent = parentComponent;
     this._name            = name;
     this._description     = description;
 }
Ejemplo n.º 21
0
        public Connection(Packages.VulcanPackage vulcanPackage, string name, string description, string connectionType, string connectionString)
            :
            base(
                vulcanPackage,
                name,
                description,
                vulcanPackage.DTSPackage
                )
        {
            if (vulcanPackage.DTSPackage.Connections.Contains(name))
            {
                this._connectionManager = vulcanPackage.DTSPackage.Connections[name];
                return;
            }
            else
            {
                switch (connectionType.ToUpperInvariant())
                {
                case "FILE":
                    _connectionManager = vulcanPackage.DTSPackage.Connections.Add("FILE");
                    SetExpression("ConnectionString", connectionString);
                    break;

                case "FTP":
                    _connectionManager = vulcanPackage.DTSPackage.Connections.Add("FTP");
                    SetExpression("ConnectionString", connectionString);
                    break;

                case "OLEDB":
                    _connectionManager = vulcanPackage.DTSPackage.Connections.Add("OLEDB");
                    SetProperty("ConnectionString", connectionString);
                    SetProperty("RetainSameConnection", "True");
                    SetExpression("RetainSameConnection", @"true");

                    break;

                default:
                    Message.Trace(Severity.Error, "Only FILE and OLEDB connection types are implemented.");
                    break;
                }
                _connectionManager.Name        = name;
                _connectionManager.Description = description;
            }
        }
Ejemplo n.º 22
0
 public ExecutePackageTask(
     Packages.VulcanPackage vulcanPackage,
     string name,
     string taskDescription,
     DTS.IDTSSequence parentContainer,
     Connection packageConnection
     )
     :
     base(
         vulcanPackage,
         name,
         taskDescription,
         parentContainer
         )
 {
     executePackageTaskHost      = (DTS.TaskHost)parentContainer.Executables.Add("STOCK:ExecutePackageTask");
     executePackageTaskHost.Name = name;
     Task.Connection             = packageConnection.ConnectionManager.ID;
 }
Ejemplo n.º 23
0
        public SQLTask(Packages.VulcanPackage package, string name, string description, DTS.IDTSSequence parentContainer, Connection destinationConnection, Dictionary <string, object> propertiesDictionary)
            :
            base(
                package,
                name,
                description,
                parentContainer
                )
        {
            this._expressionBuilder = new Vulcan.Common.Helpers.ExpressionPathBuilder(package);

            _sqlTask             = (DTS.TaskHost)parentContainer.Executables.Add("STOCK:SQLTask");
            _sqlTask.Name        = name;
            _sqlTask.Description = description;

            SetProperties(propertiesDictionary);
            if (destinationConnection != null)
            {
                SetProperty("Connection", destinationConnection.ConnectionManager.Name);
            }
        }
Ejemplo n.º 24
0
        public OLEDBDestination(
            Packages.VulcanPackage vulcanPackage,
            MainPipe dataFlowTask,
            IDTSComponentMetaData90 parentComponent,
            string name,
            string description,
            Connection connection,
            string tableName
            )
            :
            base(
                vulcanPackage,
                dataFlowTask,
                parentComponent,
                name,
                description
                )
        {
            //remove duplicates if you happen to enclose the table in brackets :)

            _oledbDest = dataFlowTask.ComponentMetaDataCollection.New();
            _oledbDest.ComponentClassID = "DTSAdapter.OleDbDestination.1";

            _oledbDestI = _oledbDest.Instantiate();
            _oledbDestI.ProvideComponentProperties();

            _oledbDest.Name = Resources.OLEDBDestinationNamePrefix + (tableName.Replace("[", "").Replace("]", "").Replace("dbo", "").Replace(".", ""));
            _oledbDest.ValidateExternalMetadata = true;

            _oledbDest.RuntimeConnectionCollection[0].ConnectionManager =
                DTS.DtsConvert.ToConnectionManager90(
                    connection.ConnectionManager
                    );
            _oledbDest.RuntimeConnectionCollection[0].ConnectionManagerID = connection.ConnectionManager.ID;
            dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications(
                parentComponent.OutputCollection[0],
                _oledbDest.InputCollection[0]
                );
        } // End Constructor
Ejemplo n.º 25
0
        public ConditionalSplit(Packages.VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description)
            :
            base(
                vulcanPackage,
                dataFlowTask,
                parentComponent,
                name,
                description
                )
        {
            _csCom = dataFlowTask.ComponentMetaDataCollection.New();
            _csCom.ComponentClassID = "DTSTransform.ConditionalSplit";

            //IMPORTANT! If you do not Instantiate() first, the component names do not get set... this is bad.

            _csi = _csCom.Instantiate();
            _csi.ProvideComponentProperties();

            _csCom.Name        = Name;
            _csCom.Description = Description;
            _csCom.ValidateExternalMetadata = true;


            _csi.AcquireConnections(null);
            _csi.ReinitializeMetaData();
            _csi.ReleaseConnections();
            dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications(
                parentComponent.OutputCollection[0],
                _csCom.InputCollection[0]
                );

            IDTSVirtualInput90 vi = _csCom.InputCollection[0].GetVirtualInput();

            foreach (IDTSVirtualInputColumn90 vic in vi.VirtualInputColumnCollection)
            {
                this.SetInputUsageType(vi, vic, DTSUsageType.UT_READONLY);
            }
        }
Ejemplo n.º 26
0
        public static DerivedColumns CreateIsNullPatcherFromXml(Packages.VulcanPackage vulcanPackage, IDTSComponentMetaData90 parentComponent, MainPipe dataFlowTask, XPathNavigator nullNav)
        {
            if (nullNav == null || nullNav.Name.ToUpperInvariant() != "IsNullPatcher".ToUpperInvariant())
            {
                return(null);
            }

            string componentName = nullNav.SelectSingleNode("@Name", vulcanPackage.VulcanConfig.NamespaceManager).Value;

            Message.Trace(Severity.Debug, "Begin: IsNullPatcher variant DerivedColumns Transformation {0}", componentName);
            DerivedColumns dc = new DerivedColumns(vulcanPackage, dataFlowTask, parentComponent, componentName, componentName);

            IDTSVirtualInput90 vi = dc.Component.InputCollection[0].GetVirtualInput();

            TemplateEmitter te = new TemplateEmitter("NullPatcherIsnullTemplate", vulcanPackage, null);

            foreach (XPathNavigator nav in nullNav.Select("rc:Column", vulcanPackage.VulcanConfig.NamespaceManager))
            {
                string name         = nav.SelectSingleNode("@Name").Value;
                string defaultValue = nav.SelectSingleNode("@DefaultValue").Value;

                dc.SetInputUsageType(vi, vi.VirtualInputColumnCollection[name], DTSUsageType.UT_READWRITE);
                IDTSInputColumn90 inputCol = dc.Component.InputCollection[0].InputColumnCollection[name];

                string expression;
                te.SetParameters("#" + vi.VirtualInputColumnCollection[name].LineageID.ToString(), defaultValue);
                te.Emit(out expression);

                string friendlyExpression;
                te.SetParameters(name, defaultValue);
                te.Emit(out friendlyExpression);

                inputCol.CustomPropertyCollection["Expression"].Value         = expression;
                inputCol.CustomPropertyCollection["FriendlyExpression"].Value = friendlyExpression;
            }
            return(dc);
        }
Ejemplo n.º 27
0
 public SelectEmitter(Packages.VulcanPackage vulcanPackage, string tableName, string columns)
     :
     this(vulcanPackage, tableName, columns, null)
 {
 }
Ejemplo n.º 28
0
 public InsertSPEmitter(string tableName, XPathNavigator tableNavigator, TableHelper tableHelper, Packages.VulcanPackage vulcanPackage)
     : base(
         vulcanPackage
         )
 {
     this._tableName      = tableName;
     this._tableNavigator = tableNavigator;
     this._tableHelper    = tableHelper;
 }
Ejemplo n.º 29
0
 public InsertDefaultValuesEmitter(string tableName, XPathNavigator tableNavigator, TableHelper tableHelper, Packages.VulcanPackage vulcanPackage)
     : base(
         tableName,
         tableNavigator,
         vulcanPackage
         )
 {
     _tableHelper = tableHelper;
 }
Ejemplo n.º 30
0
 protected Emitter(Packages.VulcanPackage vulcanPackage)
 {
     _vulcanPackage = vulcanPackage;
 }
Ejemplo n.º 31
0
 protected Emitter(Packages.VulcanPackage vulcanPackage)
 {
     _vulcanPackage = vulcanPackage;
 }
Ejemplo n.º 32
0
        public FTPTask(
            Packages.VulcanPackage vulcanPackage,
            string name,
            string taskDescription,
            DTS.IDTSSequence parentContainer,
            string serverName,
            string port,
            string userName,
            string password,
            string remotePath,
            bool isRemotePathVariable,
            string localPath,
            bool isLocalPathVariable,
            Microsoft.SqlServer.Dts.Tasks.FtpTask.DTSFTPOp operation
            )
            :
            base(
                vulcanPackage,
                name,
                taskDescription,
                parentContainer
                )
        {
            fTPTask             = (DTS.TaskHost)parentContainer.Executables.Add("STOCK:FTPTask");
            fTPTask.Name        = name;
            fTPTask.Description = taskDescription;
            this.Task.Operation = operation;

            this.Task.IsRemotePathVariable = isRemotePathVariable;
            this.Task.IsLocalPathVariable  = isLocalPathVariable;

            Connection fTPServerConnection = new Connection(vulcanPackage, serverName, serverName, "FTP", String.Format("\"{0}:{1}\"", serverName, port));

            fTPServerConnection.SetProperty("ServerUserName", userName);
            fTPServerConnection.SetProperty("ServerPassword", password);
            this.Task.Connection = fTPServerConnection.ConnectionManager.ID;

            if (this.Task.IsRemotePathVariable == true)
            {
                this.Task.RemotePath = remotePath;
            }
            else
            {
                this.Task.RemotePath = remotePath;
            }

            if (this.Task.IsLocalPathVariable == true)
            {
                this.Task.LocalPath = localPath;
            }
            else
            {
                Connection localConnection  = new Connection(vulcanPackage, localPath, localPath, "File", String.Format("\"{0}\"", ExpressionPathBuilder.EscapeBackslashes(localPath)));
                int        intFileUsageType = 2;
                switch (operation)
                {
                case Microsoft.SqlServer.Dts.Tasks.FtpTask.DTSFTPOp.Send:
                    intFileUsageType = 0;
                    break;

                case Microsoft.SqlServer.Dts.Tasks.FtpTask.DTSFTPOp.Receive:
                    intFileUsageType = 2;
                    break;

                default:
                    intFileUsageType = 2;
                    break;
                }
                localConnection.SetProperty("FileUsageType", intFileUsageType);

                this.Task.LocalPath = localPath;
            }
        }