예제 #1
0
        public SSISAdoNetSource(AdoNetSource dbsrc, MainPipe pipe, ConnectionManager cm)
            : base(pipe, "ADO NET Source")
        {
            // create the adonet source
            //set connection properies
            cm.Name             = "AdoNet Source Connection Manager";
            cm.ConnectionString = dbsrc.ConnectionString;
            cm.Description      = dbsrc.Description;
            //cm.Qualifier = "System.Data.SqlClient.SqlConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
            cm.Qualifier = dbsrc.DBConnection.Qualifier;

            IDTSComponentMetaData100 comp  = this.MetadataCollection;
            CManagedComponentWrapper dcomp = comp.Instantiate();

            //set Component Custom Properties
            foreach (KeyValuePair <string, object> prop in dbsrc.CustomProperties.CustomPropertyCollection.InnerArrayList)
            {
                dcomp.SetComponentProperty(prop.Key, prop.Value);
            }

            if (comp.RuntimeConnectionCollection.Count > 0)
            {
                comp.RuntimeConnectionCollection[0].ConnectionManagerID = cm.ID;
                comp.RuntimeConnectionCollection[0].ConnectionManager   = DtsConvert.GetExtendedInterface(cm);
            }

            // Finalize
            this.Reinitialize(dcomp);
        }
        public void TestChangeRowsProcessedOutputTypeToData()
        {
            Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package();
            Executable exec = package.Executables.Add("STOCK:PipelineTask");

            Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost;
            MainPipe dataFlowTask        = thMainPipe.InnerObject as MainPipe;
            ComponentEventHandler events = new ComponentEventHandler();

            dataFlowTask.Events = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents);

            IDTSComponentMetaData100 textFileSplitter = dataFlowTask.ComponentMetaDataCollection.New();

            textFileSplitter.Name             = "Row Splitter Test";
            textFileSplitter.ComponentClassID = typeof(Martin.SQLServer.Dts.TextFileSplitter).AssemblyQualifiedName;
            CManagedComponentWrapper instance = textFileSplitter.Instantiate();

            instance.ProvideComponentProperties();

            Boolean exceptionThrown = false;

            try
            {
                instance.SetOutputProperty(textFileSplitter.OutputCollection[3].ID, ManageProperties.typeOfOutput, Utilities.typeOfOutputEnum.DataRecords);
            }
            catch (COMException ex)
            {
                Assert.AreEqual(MessageStrings.CantChangeOutputProperties("RowsProcessed"), ex.Message, "Exception Message Wrong");
                exceptionThrown = true;
            }

            Assert.IsTrue(exceptionThrown, "Exception Not Thrown");
        }
        public IDTSComponentMetaData100 AddComp_RowCount(string ComponentName,
                                                         string VarName,
                                                         IDTSOutput100 outCols
                                                         )
        {
            //  Create

            IDTSComponentMetaData100 Comp = dmp.ComponentMetaDataCollection.New();

            Comp.ComponentClassID = "Microsoft.RowCount";

            //  Instantiate

            CManagedComponentWrapper Inst = Comp.Instantiate();

            Inst.ProvideComponentProperties();

            Comp.Name        = ComponentName;
            Comp.Description = "zliczanie wierszy";

            //  Parametrize

            Inst.SetComponentProperty("VariableName", VarName);

            //  Connect

            IDTSPath100 pth = dmp.PathCollection.New();

            pth.AttachPathAndPropagateNotifications(outCols, Comp.InputCollection[0]);

            //  Return

            return(Comp);
        }
예제 #4
0
        public CouchbaseSourceAdapterUIForm(Connections cons, Variables vars, IDTSComponentMetaData100 md)
        {
            InitializeComponent();

            variables   = vars;
            connections = cons;
            metaData    = md;

            this.Text = metaData.Name + " Configuration";

            if (designTimeInstance == null)
            {
                designTimeInstance = metaData.Instantiate();
            }

            txtURL.Text            = metaData.CustomPropertyCollection["url"].Value.ToString();
            txtBucket.Text         = metaData.CustomPropertyCollection["bucket"].Value.ToString();
            txtPassword.Text       = metaData.CustomPropertyCollection["password"].Value.ToString();
            txtDesignDoc.Text      = metaData.CustomPropertyCollection["designDoc"].Value.ToString();
            txtView.Text           = metaData.CustomPropertyCollection["view"].Value.ToString();
            cbForceReindex.Checked = metaData.CustomPropertyCollection["forceReindex"].Value;
            cbDescending.Checked   = metaData.CustomPropertyCollection["descending"].Value;
            txtStartKey.Text       = metaData.CustomPropertyCollection["startKey"].Value.ToString();
            txtEndKey.Text         = metaData.CustomPropertyCollection["endKey"].Value.ToString();

            string modelXML = metaData.CustomPropertyCollection["modelXML"].Value.ToString();

            model = new JSONDataModel();
            if (!modelXML.Trim().Equals(""))
            {
                model = new JSONDataModel(modelXML);
            }
        }
예제 #5
0
        public void TestSetOutputColumnDefaults()
        {
            Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package();
            Executable exec = package.Executables.Add("STOCK:PipelineTask");

            Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost;
            MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe;

            IDTSComponentMetaData100 textFileSplitter = dataFlowTask.ComponentMetaDataCollection.New();
            ComponentEventHandler    events           = new ComponentEventHandler();

            dataFlowTask.Events               = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents);
            textFileSplitter.Name             = "Row Splitter Test";
            textFileSplitter.ComponentClassID = typeof(Martin.SQLServer.Dts.TextFileSplitter).AssemblyQualifiedName;
            CManagedComponentWrapper instance = textFileSplitter.Instantiate();

            instance.ProvideComponentProperties();
            IDTSOutput100       output = textFileSplitter.OutputCollection.New();
            IDTSOutputColumn100 actual = output.OutputColumnCollection.New();

            ManageColumns.SetOutputColumnDefaults(actual, 1252);

            Assert.AreEqual(DataType.DT_STR, actual.DataType, "DataType is wrong");
            Assert.AreEqual(255, actual.Length, "Length is wrong");
            Assert.AreEqual(DTSRowDisposition.RD_NotUsed, actual.ErrorRowDisposition, "Row Disposition is wrong");
            Assert.AreEqual(DTSRowDisposition.RD_NotUsed, actual.TruncationRowDisposition, "Truncate Disposition is wrong");
        }
        public void TestValidateExtraCustomProperty()
        {
            Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package();
            Executable exec = package.Executables.Add("STOCK:PipelineTask");

            Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost;
            MainPipe dataFlowTask        = thMainPipe.InnerObject as MainPipe;
            ComponentEventHandler events = new ComponentEventHandler();

            dataFlowTask.Events = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents);

            IDTSComponentMetaData100 speechToText = dataFlowTask.ComponentMetaDataCollection.New();

            speechToText.ComponentClassID = typeof(Martin.SQLServer.Dts.SSISSpeechToText).AssemblyQualifiedName;
            CManagedComponentWrapper speechToTextInstance = speechToText.Instantiate();

            speechToTextInstance.ProvideComponentProperties();

            speechToText.CustomPropertyCollection.New();

            DTSValidationStatus actual   = speechToTextInstance.Validate();
            DTSValidationStatus expected = DTSValidationStatus.VS_ISCORRUPT;

            Assert.AreEqual(expected, actual);
            Assert.AreEqual("[Error] SSIS Speech To Text: There is either to many or not enough custom properties.", events.errorMessages[0]);
        }
        public SSISOdbcSource(OdbcSource dbsrc, MainPipe pipe, ConnectionManager cm)
            : base(pipe, "ODBC Source")
        {
            // create the odbc source
            //set connection properies
            cm.Name             = "ODBC Source Connection Manager";
            cm.ConnectionString = dbsrc.ConnectionString;
            cm.Description      = dbsrc.Description;
            //do not require Qualifier
            //cm.Qualifier = dbsrc.DBConnection.Qualifier;

            IDTSComponentMetaData100 comp  = this.MetadataCollection;
            CManagedComponentWrapper dcomp = comp.Instantiate();

            //set Component Custom Properties
            foreach (KeyValuePair <string, object> prop in dbsrc.CustomProperties.CustomPropertyCollection.InnerArrayList)
            {
                dcomp.SetComponentProperty(prop.Key, prop.Value);
            }

            if (comp.RuntimeConnectionCollection.Count > 0)
            {
                comp.RuntimeConnectionCollection[0].ConnectionManagerID = cm.ID;
                comp.RuntimeConnectionCollection[0].ConnectionManager   = DtsConvert.GetExtendedInterface(cm);
            }

            // Finalize
            this.Reinitialize(dcomp);
        }
        protected virtual void MatchInputColumns(Dictionary <string, int> converted, bool needschema)
        {
            IDTSComponentMetaData100 comp  = this.MetadataCollection;
            CManagedComponentWrapper dcomp = comp.Instantiate();

            IDTSInput100        input  = comp.InputCollection[0];
            IDTSVirtualInput100 vInput = input.GetVirtualInput();
            IDTSVirtualInputColumnCollection100     vColumns  = vInput.VirtualInputColumnCollection;
            IDTSExternalMetadataColumnCollection100 exColumns = input.ExternalMetadataColumnCollection;

            if (exColumns != null && exColumns.Count > 0)
            {
                bool hasMatch = false;
                foreach (IDTSExternalMetadataColumn100 exColumn in exColumns)
                {
                    int inputColId;
                    if (converted.ContainsKey(exColumn.Name.ToLower()))
                    {
                        inputColId = (int)converted[exColumn.Name.ToLower()];
                    }
                    else
                    {
                        inputColId = FindVirtualInputColumnId(vColumns, exColumn.Name);
                    }

                    if (inputColId == 0)
                    {
                        //the column wasn't found if the Id is 0, so we'll print out a message and skip this row.
                        PrintOutput.PrintToOutput("DE could not map external column " + exColumn.Name + ". Skipping column.", DERun.Debug);
                    }
                    else
                    {
                        // create input column
                        IDTSInputColumn100 vCol = dcomp.SetUsageType(input.ID, vInput, inputColId, DTSUsageType.UT_READONLY);
                        // and then we'll map it to the input row.
                        dcomp.MapInputColumn(input.ID, vCol.ID, exColumn.ID);
                        hasMatch = true;
                    }
                }
                if (!hasMatch)
                {
                    throw new InvalidArgumentException("Unable to map input to destination");
                }
            }
            //if output schema is required and not provided
            else if (needschema)
            {
                //PrintOutput.PrintToError("No destination columns available");
                throw new InvalidArgumentException("No destination columns available");
            }
            //otherwise use virtual inputs
            else
            {
                foreach (IDTSVirtualInputColumn100 vColumn in vColumns)
                {
                    // create input column for all virtual input columns
                    dcomp.SetUsageType(input.ID, vInput, vColumn.LineageID, DTSUsageType.UT_READONLY);
                }
            }
        }
        protected SSISModule(MainPipe pipe, string module_name, int module_id, string module_clsid)
        {
            //create SSIS component

            m_pipe = pipe;

            IDTSComponentMetaData100 comp = pipe.ComponentMetaDataCollection.New();

            m_ID = comp.ID;
            Application app = new Application();

            comp.ComponentClassID = (String.IsNullOrEmpty(module_clsid)) ? app.PipelineComponentInfos[module_name].CreationName : module_clsid;
            CManagedComponentWrapper dcomp = comp.Instantiate();

            dcomp.ProvideComponentProperties();

            //set common SSIS module properties
            if (module_id == 0)
            {
                comp.Name = String.Format(CultureInfo.InvariantCulture, "{0}", module_name);
            }
            else
            {
                comp.Name = String.Format(CultureInfo.InvariantCulture, "{0} - {1}", module_name, module_id);
            }

            PrintOutput.PrintToOutput(String.Format(CultureInfo.InvariantCulture, "DE added {0}", comp.Name), DERun.Debug);
        }
예제 #10
0
        public override IDTSComponentMetaData100 AddDestAdapter(IDTSPipeline100 pipeline, ConnectionManager destConnMgr, out IDTSDesigntimeComponent100 destDesignTimeComp)
        {
            if (String.IsNullOrEmpty(quotedTableName))
            {
                throw new ArgumentException("Destination table name is empty");
            }
            IDTSComponentMetaData100 destComp = pipeline.ComponentMetaDataCollection.New();

            destComp.ComponentClassID         = OLEDB_DEST_GUID;
            destComp.ValidateExternalMetadata = true;
            destDesignTimeComp = destComp.Instantiate();
            destDesignTimeComp.ProvideComponentProperties();
            destComp.Name = "OleDB Destination - Sql Server";
            destDesignTimeComp.SetComponentProperty("AccessMode", 0);
            destDesignTimeComp.SetComponentProperty("OpenRowset", quotedTableName);

            // set connection
            destComp.RuntimeConnectionCollection[0].ConnectionManager   = DtsConvert.GetExtendedInterface(destConnMgr);
            destComp.RuntimeConnectionCollection[0].ConnectionManagerID = destConnMgr.ID;

            // get metadata
            destDesignTimeComp.AcquireConnections(null);
            destDesignTimeComp.ReinitializeMetaData();
            destDesignTimeComp.ReleaseConnections();

            extCols = destComp.InputCollection[0].ExternalMetadataColumnCollection;

            return(destComp);
        }
        public override IDTSComponentMetaData100 Initialize()
        {
            // create the odbc source
            IDTSComponentMetaData100 comp = base.Initialize();

            //set connection properies
            _cm.Name             = "ODBC Source Connection Manager";
            _cm.ConnectionString = _src.ConnectionString;
            _cm.Description      = _src.Description;
            //do not require Qualifier
            //cm.Qualifier = dbsrc.DBConnection.Qualifier;

            CManagedComponentWrapper dcomp = comp.Instantiate();

            //set Component Custom Properties
            foreach (KeyValuePair <string, object> prop in _src.CustomProperties.CustomPropertyCollection.InnerArrayList)
            {
                dcomp.SetComponentProperty(prop.Key, prop.Value);
            }

            if (comp.RuntimeConnectionCollection.Count > 0)
            {
                comp.RuntimeConnectionCollection[0].ConnectionManagerID = _cm.ID;
                comp.RuntimeConnectionCollection[0].ConnectionManager   = DtsConvert.GetExtendedInterface(_cm);
            }

            // Finalize
            Reinitialize(dcomp);
            return(comp);
        }
예제 #12
0
        public override IDTSComponentMetaData100 Initialize()
        {
            //create flat file destination component
            IDTSComponentMetaData100 comp = base.Initialize();

            _cm.Name = $"FlatFile Destination Connection Manager {comp.ID}";

            //Create a new FlatFileDestination component

            CManagedComponentWrapper dcomp = comp.Instantiate();

            foreach (KeyValuePair <string, object> prop in _dst.CustomProperties.CustomPropertyCollection.InnerArrayList)
            {
                dcomp.SetComponentProperty(prop.Key, prop.Value);
            }

            /*Specify the connection manager for Src.The Connections class is a collection of the connection managers that have been added to that package and are available for use at run time*/
            if (comp.RuntimeConnectionCollection.Count > 0)
            {
                comp.RuntimeConnectionCollection[0].ConnectionManagerID = _cm.ID;
                comp.RuntimeConnectionCollection[0].ConnectionManager   = DtsConvert.GetExtendedInterface(_cm);
            }

            this.Reinitialize(dcomp);
            return(comp);
        }
예제 #13
0
        public void TestAddNumberOfRowsOutputColumns()
        {
            Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package();
            Executable exec = package.Executables.Add("STOCK:PipelineTask");

            Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost;
            MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe;

            IDTSComponentMetaData100 textFileSplitter = dataFlowTask.ComponentMetaDataCollection.New();
            ComponentEventHandler    events           = new ComponentEventHandler();

            dataFlowTask.Events               = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents);
            textFileSplitter.Name             = "Row Splitter Test";
            textFileSplitter.ComponentClassID = typeof(Martin.SQLServer.Dts.TextFileSplitter).AssemblyQualifiedName;
            CManagedComponentWrapper instance = textFileSplitter.Instantiate();

            instance.ProvideComponentProperties();
            IDTSOutput100 actual = textFileSplitter.OutputCollection.New();

            ManageColumns.AddNumberOfRowsOutputColumns(actual);

            Assert.AreEqual(3, actual.OutputColumnCollection.Count, "Number of Columns is wrong");
            Assert.AreEqual(MessageStrings.KeyValueColumnName, actual.OutputColumnCollection[0].Name, "Column Name is wrong");
            Assert.AreEqual(DataType.DT_STR, actual.OutputColumnCollection[0].DataType, "DataType is wrong");
            Assert.AreEqual(255, actual.OutputColumnCollection[0].Length, "Length is wrong");
            Assert.AreEqual(MessageStrings.KeyValueColumnDescription, actual.OutputColumnCollection[0].Description, "Description is wrong");
            Assert.AreEqual(MessageStrings.NumberOfRowsColumnName, actual.OutputColumnCollection[1].Name, "Column Name is wrong");
            Assert.AreEqual(DataType.DT_I8, actual.OutputColumnCollection[1].DataType, "DataType is wrong");
            Assert.AreEqual(0, actual.OutputColumnCollection[1].Length, "Length is wrong");
            Assert.AreEqual(MessageStrings.NumberOfRowsColumnDescription, actual.OutputColumnCollection[1].Description, "Description is wrong");
            Assert.AreEqual(MessageStrings.KeyValueStatusColumnName, actual.OutputColumnCollection[2].Name, "Column Name is wrong");
            Assert.AreEqual(DataType.DT_STR, actual.OutputColumnCollection[2].DataType, "DataType is wrong");
            Assert.AreEqual(255, actual.OutputColumnCollection[2].Length, "Length is wrong");
            Assert.AreEqual(MessageStrings.KeyValueStatusColumnDescription, actual.OutputColumnCollection[2].Description, "Description is wrong");
        }
        public SSISExcelSource(ExcelSource dbsrc, MainPipe pipe, ConnectionManager cm)
            : base(pipe, "Excel Source")
        {
            // create the oledb source
            //set connection properies
            cm.Name             = "Excel Source Connection Manager";
            cm.ConnectionString = dbsrc.ConnectionString;
            cm.Description      = dbsrc.Description;

            //set connection properties
            //mwrt.IDTSConnectionManagerExcel100 ecm = cm.InnerObject as mwrt.IDTSConnectionManagerExcel100;
            //ecm.ExcelFilePath = dbsrc.FilePath;
            //ecm.FirstRowHasColumnName = dbsrc.Header;
            //ecm.ExcelVersionNumber = mwrt.DTSExcelVersion.DTSExcelVer_2007;

            IDTSComponentMetaData100 comp  = this.MetadataCollection;
            CManagedComponentWrapper dcomp = comp.Instantiate();

            foreach (KeyValuePair <string, object> prop in dbsrc.CustomProperties.CustomPropertyCollection.InnerArrayList)
            {
                dcomp.SetComponentProperty(prop.Key, prop.Value);
            }

            /*Specify the connection manager for Src.The Connections class is a collection of the connection managers that have been added to that package and are available for use at run time*/
            if (comp.RuntimeConnectionCollection.Count > 0)
            {
                comp.RuntimeConnectionCollection[0].ConnectionManagerID = cm.ID;
                comp.RuntimeConnectionCollection[0].ConnectionManager   = DtsConvert.GetExtendedInterface(cm);
            }

            // Finalize
            this.Reinitialize(dcomp);
        }
예제 #15
0
        public IDTSComponentMetaData100 AddComp_DerivedCol(string ComponentName,
                                                           IDTSOutput100 outCols
                                                           )
        {
            //  Create

            IDTSComponentMetaData100 Comp = dmp.ComponentMetaDataCollection.New();

            Comp.ComponentClassID = "Microsoft.DerivedColumn";

            //  Instantiate

            CManagedComponentWrapper Inst = Comp.Instantiate();

            Inst.ProvideComponentProperties();

            Comp.Name        = ComponentName;
            Comp.Description = "Derajw kolumn";

            //  Parametrize

            Comp.OutputCollection[0].TruncationRowDisposition = DTSRowDisposition.RD_NotUsed;
            Comp.OutputCollection[0].ErrorRowDisposition      = DTSRowDisposition.RD_NotUsed;

            //  Connect

            IDTSPath100 pth = dmp.PathCollection.New();

            pth.AttachPathAndPropagateNotifications(outCols, Comp.InputCollection[0]);

            //  Return

            return(Comp);
        }
예제 #16
0
        private void AddInputColumns(IEnumerable <string> inputColNames)
        {
            var input = _md.InputCollection[ComponentConstants.NAME_INPUT_LANE_PARAMS];


            // Only add them if the inputlan is connected.
            if (!input.IsAttached)
            {
                _md.FireWarning(0, _md.Name, "Cannot add inputs because input lane is not attached.", null, 0);
                return;
            }

            // Clear inputs
            input.InputColumnCollection.RemoveAll();
            var component = _md.Instantiate();

            // Set all virtualinputs as READONLY
            foreach (IDTSVirtualInputColumn100 vcol in _virtualInputLane.VirtualInputColumnCollection)
            {
                component.SetUsageType(input.ID, _virtualInputLane, vcol.LineageID, DTSUsageType.UT_READONLY);
            }

            // For each virtual input selected, add a physical input
            foreach (var colname in inputColNames)
            {
                var incol = input.InputColumnCollection.New();
                incol.LineageID = _virtualInputLane.VirtualInputColumnCollection[colname].LineageID;
            }
        }
        public IDTSComponentMetaData100 AddComp_Multicast(string ComponentName,
                                                          IDTSOutput100 outCols
                                                          )
        {
            //  Create

            IDTSComponentMetaData100 Comp = dmp.ComponentMetaDataCollection.New();

            Comp.ComponentClassID = "Microsoft.Multicast";

            //  Instantiate

            CManagedComponentWrapper Inst = Comp.Instantiate();

            Inst.ProvideComponentProperties();

            Comp.Name        = ComponentName;
            Comp.Description = "Dodany Sort";

            //  Connect

            IDTSPath100 pth = dmp.PathCollection.New();

            pth.AttachPathAndPropagateNotifications(outCols, Comp.InputCollection[0]);

            //  Return

            return(Comp);
        }
예제 #18
0
        public void TestExecuteRecogniseAsyncBasic()
        {
            Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package();
            Executable exec = package.Executables.Add("STOCK:PipelineTask");

            Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost;
            MainPipe dataFlowTask        = thMainPipe.InnerObject as MainPipe;
            ComponentEventHandler events = new ComponentEventHandler();

            dataFlowTask.Events = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents);

            IDTSComponentMetaData100 speechToText = dataFlowTask.ComponentMetaDataCollection.New();

            speechToText.ComponentClassID = typeof(Martin.SQLServer.Dts.SSISSpeechToText).AssemblyQualifiedName;
            CManagedComponentWrapper speechToTextInstance = speechToText.Instantiate();

            speechToTextInstance.ProvideComponentProperties();
            speechToText.CustomPropertyCollection[Utility.SubscriptionKeyPropName].Value = config.AppSettings.Settings["subscriptionKey"].Value;

            Uri targetURI = new Uri(@"wss://speech.platform.bing.com/api/service/recognition/continuous");
            SpeechToTextImplement testMe = new SpeechToTextImplement(speechToText, "en-us", targetURI, config.AppSettings.Settings["subscriptionKey"].Value);
            string filename = "Ex_Pro_1.mp3";

            testMe.ExecuteRecogniseAsync(filename).Wait();
            Assert.IsTrue(testMe.Results.Count > 0);
        }
예제 #19
0
        /// <summary>
        /// This method is ivoked once, when the user double clicks on it at design time.
        /// </summary>
        /// <param name="dtsComponentMetadata"></param>
        /// <param name="serviceProvider"></param>
        public void Initialize(IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
        {
            // Save a reference to the components metadata and service provider
            _sp = serviceProvider;
            _md = dtsComponentMetadata;

            // Check model: if no model was specified, add it one now.
            IDTSCustomProperty100 model = null;

            try
            {
                model  = dtsComponentMetadata.CustomPropertyCollection[ComponentConstants.PROPERTY_KEY_MODEL];
                _model = JSONSourceComponentModel.LoadFromJson(model.Value.ToString());
            }
            catch (Exception e) {
                // No model found. Add a new now.
                _model      = new JSONSourceComponentModel();
                model       = dtsComponentMetadata.CustomPropertyCollection.New();
                model.Name  = ComponentConstants.PROPERTY_KEY_MODEL;
                model.Value = _model.ToJsonConfig();
            }

            if (_md == null)
            {
                _md = (IDTSComponentMetaData100)_md.Instantiate();
            }

            _virtualInputLane = dtsComponentMetadata.InputCollection[ComponentConstants.NAME_INPUT_LANE_PARAMS].GetVirtualInput();
        }
        public void TestOutputColumn_InvalidCustomProperty()
        {
            Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package();
            Executable exec = package.Executables.Add("STOCK:PipelineTask");

            Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost;
            MainPipe dataFlowTask        = thMainPipe.InnerObject as MainPipe;
            ComponentEventHandler events = new ComponentEventHandler();

            dataFlowTask.Events = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents);

            IDTSComponentMetaData100 speechToText = dataFlowTask.ComponentMetaDataCollection.New();

            speechToText.ComponentClassID = typeof(Martin.SQLServer.Dts.SSISSpeechToText).AssemblyQualifiedName;
            CManagedComponentWrapper speechToTextInstance = speechToText.Instantiate();

            speechToTextInstance.ProvideComponentProperties();
            speechToText.CustomPropertyCollection[Utility.SubscriptionKeyPropName].Value = "NotTheDefault";
            // Before this is default setup for a clean component

            IDTSCustomProperty100 cp = speechToText.OutputCollection[0].OutputColumnCollection[0].CustomPropertyCollection.New();

            cp.Name  = "IAmInvalid";
            cp.Value = "IAmInvalid";
            DTSValidationStatus actual   = speechToTextInstance.Validate();
            DTSValidationStatus expected = DTSValidationStatus.VS_ISCORRUPT;

            Assert.AreEqual(expected, actual);
            Assert.AreEqual("[Error] SSIS Speech To Text: Output Column InputChannel has invalid property IAmInvalid.", events.errorMessages[0]);
        }
        public override IDTSComponentMetaData100 Initialize()
        {
            IDTSComponentMetaData100 comp = base.Initialize();

            // create the adonet source
            //set connection properies
            _cm.Name             = "AdoNet Source Connection Manager";
            _cm.ConnectionString = _src.ConnectionString;
            _cm.Description      = _src.Description;
            //cm.Qualifier = "System.Data.SqlClient.SqlConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
            if (!String.IsNullOrEmpty(_src.DBConnection.Qualifier))
            {
                _cm.Qualifier = _src.DBConnection.Qualifier;
            }

            CManagedComponentWrapper dcomp = comp.Instantiate();

            //set Component Custom Properties
            foreach (KeyValuePair <string, object> prop in _src.CustomProperties.CustomPropertyCollection.InnerArrayList)
            {
                dcomp.SetComponentProperty(prop.Key, prop.Value);
            }

            if (comp.RuntimeConnectionCollection.Count > 0)
            {
                comp.RuntimeConnectionCollection[0].ConnectionManagerID = _cm.ID;
                comp.RuntimeConnectionCollection[0].ConnectionManager   = DtsConvert.GetExtendedInterface(_cm);
            }

            // Finalize
            Reinitialize(dcomp);
            return(comp);
        }
        public void TestOutputColumn_Timecode_Missing()
        {
            Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package();
            Executable exec = package.Executables.Add("STOCK:PipelineTask");

            Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost;
            MainPipe dataFlowTask        = thMainPipe.InnerObject as MainPipe;
            ComponentEventHandler events = new ComponentEventHandler();

            dataFlowTask.Events = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents);

            IDTSComponentMetaData100 speechToText = dataFlowTask.ComponentMetaDataCollection.New();

            speechToText.ComponentClassID = typeof(Martin.SQLServer.Dts.SSISSpeechToText).AssemblyQualifiedName;
            CManagedComponentWrapper speechToTextInstance = speechToText.Instantiate();

            speechToTextInstance.ProvideComponentProperties();
            speechToText.CustomPropertyCollection[Utility.SubscriptionKeyPropName].Value = "NotTheDefault";
            // Before this is default setup for a clean component

            speechToText.OutputCollection[0].OutputColumnCollection.RemoveObjectByID(speechToText.OutputCollection[0].OutputColumnCollection[Utility.OutputTimecodeColumnName].ID);
            IDTSOutputColumn100 tempCol = speechToText.OutputCollection[0].OutputColumnCollection.New();

            tempCol.Name = "TempCol";
            tempCol.SetDataTypeProperties(DataType.DT_STR, 10, 0, 0, 1252);
            DTSValidationStatus actual   = speechToTextInstance.Validate();
            DTSValidationStatus expected = DTSValidationStatus.VS_ISCORRUPT;

            Assert.AreEqual(expected, actual);
            Assert.AreEqual("[Error] SSIS Speech To Text: Required Output Column Timecode is missing.", events.errorMessages[0]);
        }
        public void TestValidateOK()
        {
            Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package();
            Executable exec = package.Executables.Add("STOCK:PipelineTask");

            Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost;
            MainPipe dataFlowTask        = thMainPipe.InnerObject as MainPipe;
            ComponentEventHandler events = new ComponentEventHandler();

            dataFlowTask.Events = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents);

            IDTSComponentMetaData100 speechToText = dataFlowTask.ComponentMetaDataCollection.New();

            speechToText.ComponentClassID = typeof(Martin.SQLServer.Dts.SSISSpeechToText).AssemblyQualifiedName;
            CManagedComponentWrapper speechToTextInstance = speechToText.Instantiate();

            speechToTextInstance.ProvideComponentProperties();

            speechToText.CustomPropertyCollection[Utility.SubscriptionKeyPropName].Value = "NotTheDefault";

            DTSValidationStatus actual   = speechToTextInstance.Validate();
            DTSValidationStatus expected = DTSValidationStatus.VS_ISVALID;

            Assert.AreEqual(expected, actual);
            Assert.AreEqual(0, events.errorMessages.Count, "There are error messages");
        }
예제 #24
0
 public HDFSDestinationFormUI(IDTSComponentMetaData100 metaData, IServiceProvider serviceProvider)
     : this()
 {
     this.metaData = metaData;
       this.serviceProvider = serviceProvider;
       this.connectionService = (IDtsConnectionService)serviceProvider.GetService(typeof(IDtsConnectionService));
       this.designTimeInstance = metaData.Instantiate();
 }
예제 #25
0
 public RabbitMQSourceUIForm(IDTSComponentMetaData100 metaData, IServiceProvider serviceProvider)
     : this()
 {
     this.metaData           = metaData;
     this.serviceProvider    = serviceProvider;
     this.connectionService  = (IDtsConnectionService)serviceProvider.GetService(typeof(IDtsConnectionService));
     this.designTimeInstance = metaData.Instantiate();
 }
예제 #26
0
 public HDFSDestinationFormUI(IDTSComponentMetaData100 metaData, IServiceProvider serviceProvider)
     : this()
 {
     this.metaData           = metaData;
     this.serviceProvider    = serviceProvider;
     this.connectionService  = (IDtsConnectionService)serviceProvider.GetService(typeof(IDtsConnectionService));
     this.designTimeInstance = metaData.Instantiate();
 }
예제 #27
0
        public IDTSComponentMetaData100 AddComp_Sort(string ComponentName,
                                                     IDTSOutput100 outCols,
                                                     Dictionary <string, bool> sortColumns
                                                     )
        {
            //  Create

            IDTSComponentMetaData100 Comp = dmp.ComponentMetaDataCollection.New();

            Comp.ComponentClassID = "Microsoft.Sort";

            //  Instantiate

            CManagedComponentWrapper Inst = Comp.Instantiate();

            Inst.ProvideComponentProperties();

            Comp.Name        = ComponentName;
            Comp.Description = "Dodany Sort";

            //  Connect

            IDTSPath100 pth = dmp.PathCollection.New();

            pth.AttachPathAndPropagateNotifications(outCols, Comp.InputCollection[0]);

            //  Parametrize

            IDTSInput100 lkpInput = Comp.InputCollection[0];
            IDTSInputColumnCollection100 lkpInputCols = lkpInput.InputColumnCollection;

            IDTSVirtualInput100 lkpVirtInput = lkpInput.GetVirtualInput();
            IDTSVirtualInputColumnCollection100 lkpVirtInputCols = lkpVirtInput.VirtualInputColumnCollection;

            //  Parametrize #2 - Join Columns

            int i = 1;

            foreach (IDTSVirtualInputColumn100 vColumn in lkpVirtInputCols)
            {
                IDTSInputColumn100 inputColumn = Inst.SetUsageType(lkpInput.ID, lkpVirtInput, vColumn.LineageID, DTSUsageType.UT_READONLY);

                foreach (var colKVP in sortColumns)
                {
                    if (vColumn.Name == colKVP.Key)
                    {
                        Inst.SetInputColumnProperty(lkpInput.ID, inputColumn.ID, "NewComparisonFlags", 0);
                        Inst.SetInputColumnProperty(lkpInput.ID, inputColumn.ID, "NewSortKeyPosition", colKVP.Value ? i: -i);
                        i++;
                    }
                }
            }

            //  Return

            return(Comp);
        }
        public override IDTSComponentMetaData100 Initialize()
        {
            // Create rowcount component
            IDTSComponentMetaData100 comp  = base.Initialize();
            CManagedComponentWrapper dcomp = comp.Instantiate();

            dcomp.SetComponentProperty("VariableName", "RowCount");
            this.Reinitialize(dcomp);
            return(comp);
        }
예제 #29
0
        public static CManagedComponentWrapper InitializeTask(this IDTSComponentMetaData100 task)
        {
            // Get the design time instance of the component.
            CManagedComponentWrapper InstanceSource = task.Instantiate();

            // Initialize the component
            InstanceSource.ProvideComponentProperties();

            return(InstanceSource);
        }
        private void PropagateInputColumns(Dictionary <string, MyColumn> exColumns)
        {
            IDTSComponentMetaData100 comp  = this.MetadataCollection;
            CManagedComponentWrapper dcomp = comp.Instantiate();

            IDTSInput100        input  = comp.InputCollection[0];
            IDTSVirtualInput100 vInput = input.GetVirtualInput();
            IDTSVirtualInputColumnCollection100 vColumns = vInput.VirtualInputColumnCollection;

            IDTSOutput100 output = comp.OutputCollection[0];

            output.TruncationRowDisposition = DTSRowDisposition.RD_NotUsed;
            output.ErrorRowDisposition      = DTSRowDisposition.RD_NotUsed;

            //create input columns for destination external
            foreach (KeyValuePair <string, MyColumn> exColumn in exColumns)
            {
                int vColumnID = FindVirtualInputColumnId(vColumns, exColumn.Key);
                if (vColumnID != 0)
                {
                    //do type conversion
                    IDTSVirtualInputColumn100 vColumn = vInput.VirtualInputColumnCollection.GetVirtualInputColumnByLineageID(vColumnID);
                    if (vColumn.DataType != exColumn.Value.DataType)
                    {
                        dcomp.SetUsageType(input.ID, vInput, vColumnID, DTSUsageType.UT_READONLY);

                        IDTSOutputColumn100 oColumn = output.OutputColumnCollection.New();
                        oColumn.Name = exColumn.Key;
                        oColumn.SetDataTypeProperties(exColumn.Value.DataType, exColumn.Value.Length, exColumn.Value.Precision, exColumn.Value.Scale, exColumn.Value.CodePage);
                        oColumn.ExternalMetadataColumnID = 0;
                        oColumn.ErrorRowDisposition      = DTSRowDisposition.RD_FailComponent;
                        oColumn.TruncationRowDisposition = DTSRowDisposition.RD_FailComponent;
                        IDTSCustomProperty100 property = oColumn.CustomPropertyCollection.New();
                        property.Name  = "SourceInputColumnLineageID";
                        property.Value = vColumnID;
                        property       = oColumn.CustomPropertyCollection.New();
                        property.Name  = "FastParse";
                        property.Value = false;
                        //set of derived columns
                        m_converted.Add(oColumn.Name.ToLower(), oColumn.LineageID);
                    }
                    else
                    {
                        m_converted.Add(exColumn.Key.ToLower(), vColumnID);
                    }
                }
                else
                {
                    //the column wasn't found if the Id is 0, so we'll print out a message and skip this row.
                    //PrintOutput.PrintToOutput("Converter: Could not map external column " + exColumn.Key + ". Skipping column.");
                }
            }
        }
예제 #31
0
        public SSISFlatFileDestination(FlatFileDestination fdst, MainPipe pipe, IDTSComponentMetaData100 src, int outputID, ConnectionManager cm)
            : base(pipe, "Flat File Destination", outputID)
        {
            cm.Name = String.Format(CultureInfo.InvariantCulture, "FlatFile Destination Connection Manager {0}", outputID);

            //Create a new FlatFileDestination component

            IDTSComponentMetaData100 comp  = this.MetadataCollection;
            CManagedComponentWrapper dcomp = comp.Instantiate();

            foreach (KeyValuePair <string, object> prop in fdst.CustomProperties.CustomPropertyCollection.InnerArrayList)
            {
                dcomp.SetComponentProperty(prop.Key, prop.Value);
            }

            /*Specify the connection manager for Src.The Connections class is a collection of the connection managers that have been added to that package and are available for use at run time*/
            if (comp.RuntimeConnectionCollection.Count > 0)
            {
                comp.RuntimeConnectionCollection[0].ConnectionManagerID = cm.ID;
                comp.RuntimeConnectionCollection[0].ConnectionManager   = DtsConvert.GetExtendedInterface(cm);
            }

            this.Reinitialize(dcomp);

            //Create datatype converter if needed
            Dictionary <string, int> converted = new Dictionary <string, int>();
            IDTSVirtualInput100      vInput    = src.InputCollection[0].GetVirtualInput();

            if (this.needDataTypeChange(vInput, comp.InputCollection[0]))
            {
                //create the destination column collection
                Dictionary <string, MyColumn> exColumns = new Dictionary <string, MyColumn>();
                foreach (IDTSExternalMetadataColumn100 exColumn in comp.InputCollection[0].ExternalMetadataColumnCollection)
                {
                    MyColumn col = new MyColumn();
                    col.Name      = exColumn.Name;
                    col.DataType  = exColumn.DataType;
                    col.Length    = exColumn.Length;
                    col.Precision = exColumn.Precision;
                    col.Scale     = exColumn.Scale;
                    col.CodePage  = exColumn.CodePage;
                    exColumns.Add(exColumn.Name, col);
                }
                SSISDataConverter ssisdc = new SSISDataConverter(pipe, src, outputID, exColumns);
                src       = ssisdc.MetadataCollection;
                converted = ssisdc.ConvertedColumns;
                outputID  = 0;
            }

            this.ConnectComponents(src, outputID);
            this.MatchInputColumns(converted, false);
        }
예제 #32
0
        public ReverseStringUIForm(IDTSComponentMetaData100 dtsComponentMetaData, IServiceProvider serviceProvider, Connections connections)
        {
            InitializeComponent();

            // Store constructor parameters for later
            _dtsComponentMetaData = dtsComponentMetaData;

            // Get design-time interface for changes and validation
            _designTimeComponent = _dtsComponentMetaData.Instantiate();

            // Get Input
            _input = _dtsComponentMetaData.InputCollection[0];

            // Set any form controls that host component properties here
            // None required for ReverseString component

            // Populate DataGridView with columns
            SetInputVirtualInputColumns();

            _connections = connections;
            // Get IDtsConnectionService and store.
            IDtsConnectionService dtsConnectionService = serviceProvider.GetService(typeof(IDtsConnectionService)) as IDtsConnectionService;
            _dtsConnectionService = dtsConnectionService;

            // Get Connections collection, and get name of currently selected connection.
            string connectionName = "";
            if (_dtsComponentMetaData.RuntimeConnectionCollection[0] != null)
            {
                IDTSRuntimeConnection100 runtimeConnection =
                      _dtsComponentMetaData.RuntimeConnectionCollection[0];
                if (runtimeConnection != null
                   && runtimeConnection.ConnectionManagerID.Length > 0
                   && _connections.Contains(runtimeConnection.ConnectionManagerID))
                {
                    connectionName = _connections[runtimeConnection.ConnectionManagerID].Name;
                }
            }

            // Populate connections combo.
            PopulateConnectionsCombo(this.cmbSqlConnections, Connection_Type,
               connectionName);
        }
예제 #33
0
        public SsisComponent(Transformation transformation, SSISEmitterContext context)
        {
            if (!context.HasSSISDataFlowTask)
            {
                // TODO: Message.Trace(Severity.Error)
            }

            _transformation = transformation;
            _dataFlowTask = context.SSISDataFlowTask;
            _context = context;

            _component = _dataFlowTask.NewComponentMetaData();
            _component.ComponentClassID = ClassID;

            _instance = _component.Instantiate();
            _instance.ProvideComponentProperties();

            _component.Name = _transformation.Name;
            _component.ValidateExternalMetadata = transformation.ValidateExternalMetadata;
        }
예제 #34
0
        private void AddConvertComponent(Hashtable colConvertTable, Hashtable colConnectTable)
		{
			convertComp = pipeline.ComponentMetaDataCollection.New();
			convertComp.ComponentClassID = DATACONVERT_GUID;
			convertComp.Name = "Data Conversion";
			convertComp.ValidateExternalMetadata = true;
			convertDesignTimeComp = convertComp.Instantiate();
			convertDesignTimeComp.ProvideComponentProperties();
			IDTSInput100 cvtInput = convertComp.InputCollection[0];
			IDTSOutput100 cvtOutput = convertComp.OutputCollection[0];
			IDTSInputColumnCollection100 cvtInputCols = cvtInput.InputColumnCollection;
			IDTSOutput100 srcOutput = srcComp.OutputCollection[0];

			pipeline.PathCollection.New().AttachPathAndPropagateNotifications(srcOutput, cvtInput);
			IDTSVirtualInput100 cvtVirInput = cvtInput.GetVirtualInput();

			int i = 0;
			foreach (object key in colConvertTable.Keys)
			{
				int srcColID = (int)key;
				cvtVirInput.SetUsageType(srcColID, DTSUsageType.UT_READONLY);
				IDTSInputColumn100 cvtInputCol = cvtInputCols.GetInputColumnByLineageID(srcColID);
				if (cvtInputCol != null)
				{
					IDTSOutputColumn100 cvtOutputCol = convertDesignTimeComp.InsertOutputColumnAt(cvtOutput.ID, i++, "Convert_" + cvtInputCol.Name, "");
					IDTSExternalMetadataColumn100 destCol = (IDTSExternalMetadataColumn100)colConvertTable[key];
					convertDesignTimeComp.SetOutputColumnDataTypeProperties(cvtOutput.ID,
						cvtOutputCol.ID, destCol.DataType, destCol.Length, destCol.Precision, destCol.Scale, destCol.CodePage);
					// map output column and input column
					convertDesignTimeComp.SetOutputColumnProperty(cvtOutput.ID,
					cvtOutputCol.ID, "SourceInputColumnLineageID", srcColID);
					// add match table entry.
					colConnectTable.Add(cvtOutputCol.ID, destCol);
				}
			}
		}
예제 #35
0
파일: Program.cs 프로젝트: koooee/PIP
 private static void InitializeComponent(IDTSComponentMetaData100 cmd, ConnectionManager cm)
 {
     try
     {
         CManagedComponentWrapper cmcw = cmd.Instantiate();
         cmd.RuntimeConnectionCollection[0].ConnectionManager = Microsoft.SqlServer.Dts.Runtime.DtsConvert.GetExtendedInterface(cm);
         cmd.RuntimeConnectionCollection[0].ConnectionManagerID = cm.ID;
         // aquire the runtime connection to the designtime instance of the component.
         cmcw.AcquireConnections(null);
         cmcw.ReinitializeMetaData();
         cmd.RemoveInvalidInputColumns();
         cmcw.ReleaseConnections();
     }
     catch (Exception e)
     {
         Console.WriteLine("There is a problem with the connection manager {0}", cm.Name);
         Console.WriteLine("More than likely it could not connect to the database and reinitialize the correct columns");
         Console.WriteLine("Make sure you have the ability to connect and that the connection managers in the template package are correct");
         Console.WriteLine("Error message is below:");
         Console.WriteLine(e.Message);
         System.Environment.Exit(0);
     }
 }