protected Task(Packages.VulcanPackage vulcanPackage, string taskName, string taskDescription, DTS.IDTSSequence parentContainer) { _vulcanPackage = vulcanPackage; _name = taskName; _description = taskDescription; _parentContainer = parentContainer; }
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(); }
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; }
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); }
protected Task(Packages.VulcanPackage vulcanPackage ,string taskName, string taskDescription, DTS.IDTSSequence parentContainer) { _vulcanPackage = vulcanPackage; _name = taskName; _description = taskDescription; _parentContainer = parentContainer; }
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); }
public ConstraintEmitter(Packages.VulcanPackage vulcanPackage, Constraint constraint, TableHelper tableHelper) : base(vulcanPackage) { this._tableHelper = tableHelper; this._constraint = constraint; this._tableHelper = tableHelper; }
public TemplateEmitter(String templateName, Packages.VulcanPackage vulcanPackage, params string[] parameters) : base( vulcanPackage ) { this._template = vulcanPackage.TemplateManager[templateName]; this.SetParameters(parameters); }
public IndexEmitter(string tableName, XPathNavigator tableNavigator, Packages.VulcanPackage vulcanPackage) : base( tableName, tableNavigator, vulcanPackage ) { }
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); }
public ETLPattern(Packages.VulcanPackage vulcanPackage, DTS.IDTSSequence parentContainer) : base( vulcanPackage, parentContainer ) { }
public TableModifierEmitter(string tableName, XPathNavigator tableNavigator, Packages.VulcanPackage vulcanPackage) : base( vulcanPackage ) { this._tableName = tableName; this._tableNavigator = tableNavigator; }
public StoredProcEmitter(string procName, string body, Packages.VulcanPackage vulcanPackage) : base( vulcanPackage ) { this._procName = procName; this._body = body; this._columnList = new List <string>(); }
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); }
public SelectEmitter(Packages.VulcanPackage vulcanPackage, string tableName, string columns, string where) : base( vulcanPackage ) { this.tableName = tableName; this.columns = columns; this.where = where; }
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); }
public PrecedenceConstraint(Packages.VulcanPackage vulcanPackage, string from, string to, DTS.IDTSSequence parentContainer) : base( vulcanPackage, from + "_" + to, "", parentContainer ) { this.from = from; this.to = to; }
public SQLTask(Packages.VulcanPackage package, string name, string description, DTS.IDTSSequence parentContainer, Connection destinationConnection) : this( package, name, description, parentContainer, destinationConnection, null ) { }
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); }
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; }
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; } }
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; }
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); } }
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
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); } }
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); }
public SelectEmitter(Packages.VulcanPackage vulcanPackage, string tableName, string columns) : this(vulcanPackage, tableName, columns, null) { }
public InsertSPEmitter(string tableName, XPathNavigator tableNavigator, TableHelper tableHelper, Packages.VulcanPackage vulcanPackage) : base( vulcanPackage ) { this._tableName = tableName; this._tableNavigator = tableNavigator; this._tableHelper = tableHelper; }
public InsertDefaultValuesEmitter(string tableName, XPathNavigator tableNavigator, TableHelper tableHelper, Packages.VulcanPackage vulcanPackage) : base( tableName, tableNavigator, vulcanPackage ) { _tableHelper = tableHelper; }
protected Emitter(Packages.VulcanPackage vulcanPackage) { _vulcanPackage = vulcanPackage; }
protected Emitter(Packages.VulcanPackage vulcanPackage) { _vulcanPackage = vulcanPackage; }
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; } }