public override DTSExecResult Validate(IDTSInfoEvents infoEvents)
        {
            if (string.IsNullOrWhiteSpace(UserName))
              {
            infoEvents.FireError(0, "HDFS", "No UserName specified", string.Empty, 0);
            return DTSExecResult.Failure;
              }
              if (string.IsNullOrWhiteSpace(Host))
              {
            infoEvents.FireError(0, "HDFS", "No Host specified", string.Empty, 0);
            return DTSExecResult.Failure;
              }
              if (Port <= 0)
              {
            infoEvents.FireError(0, "HDFS", "No Port specified", string.Empty, 0);
            return DTSExecResult.Failure;
              }
              if (string.IsNullOrWhiteSpace(ConnectionString))
              {
            infoEvents.FireError(0, "HDFS", "Invalid ConnectionString", string.Empty, 0);
            return DTSExecResult.Failure;
              }

              return DTSExecResult.Success;
        }
        public override DTSExecResult Validate(IDTSInfoEvents infoEvents)
        {
            // プロパティが一つでも空だったらエラーとする
            if (!PropertiesValidate(infoEvents, URL, Domain, UserName, Password))
            {
                return DTSExecResult.Failure;
            }

            // 接続テスト
            try
            {
                var con = CrmConnection.Parse(ConnectionString);
                con.Timeout = TimeSpan.FromSeconds(30);
                using (var service = new OrganizationService(con))
                {
                    service.Execute<WhoAmIResponse>(new WhoAmIRequest());
                }
            }
            catch (Exception e)
            {
                infoEvents.FireError(0, "Dynamics CRM 2011 接続マネージャー", e.Message, string.Empty, 0);
                return DTSExecResult.Failure;
            }


            return DTSExecResult.Success;
        }
示例#3
0
        public void SaveToXML(XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            var data = doc.CreateElement("SleepTaskData");

            data.SetAttribute("SleepInterval", SleepInterval.ToString());
            doc.AppendChild(data);
        }
示例#4
0
 /// <summary>
 /// Saves settings to XML.
 /// </summary>
 /// <param name="doc">The doc.</param>
 /// <param name="infoEvents">The info events.</param>
 void IDTSComponentPersist.SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents)
 {
     try
     {
         //create node in the package xml document
         XmlElement taskElement = doc.CreateElement(string.Empty, "SFTPTask", string.Empty);
         doc.AppendChild(taskElement);
         taskElement.SetAttribute(CONSTANTS.SFTPLOCALFILE, null, this.localFile);
         taskElement.SetAttribute(CONSTANTS.SFTPREMOTEFILE, null, this.remoteFile);
         taskElement.SetAttribute(CONSTANTS.SFTPFILEACTION, null, this.fileAction.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPFILEINFO, null, this.fileInfo);
         taskElement.SetAttribute(CONSTANTS.SFTPOVERWRITEDEST, null, this.overwriteDest.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPREMOVESOURCE, null, this.removeSource.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPISRECURSIVE, null, this.isRecursive.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPFILEFILTER, null, this.fileFilter);
         //taskElement.SetAttribute(CONSTANTS.SFTPRETRIES, null, this.reTries.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPHOST, null, this.hostName);
         taskElement.SetAttribute(CONSTANTS.SFTPPORT, null, this.portNumber);
         taskElement.SetAttribute(CONSTANTS.SFTPUSER, null, this.userName);
         taskElement.SetAttribute(CONSTANTS.SFTPPASSWORD, null, this.passWord);
         taskElement.SetAttribute(CONSTANTS.SFTPSTOPONFAILURE, null, this.stopOnFailure.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPREMOTEFILELISTVAR, null, this.remoteFileListVariable);
         taskElement.SetAttribute(CONSTANTS.SFTPLOGLEVEL, null, this.logLevel.ToString());
     }
     catch (Exception ex)
     {
         infoEvents.FireError(0, "Save To XML: ", ex.Message + Environment.NewLine + ex.StackTrace, "", 0);
     }
 }
示例#5
0
 public void LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
 {
     if (node.Name != "SSHFTPTask")
     {
         throw new Exception("Unexpected task element when loading task.");
     }
     else
     {
         try
         {
             _SSHconnMgrName = node.Attributes.GetNamedItem("SSHconnMgrName").Value;
             _sendFilesSourceConnectionManagerName         = node.Attributes.GetNamedItem("sendFilesSourceConnectionManagerName").Value;
             _sendFilesDestinationDirectory                = node.Attributes.GetNamedItem("sendFilesDestinationDirectory").Value;
             _receiveFilesDestinationConnectionManagerName = node.Attributes.GetNamedItem("receiveFilesDestinationConnectionManagerName").Value;
             _receiveFilesSourceFile = node.Attributes.GetNamedItem("receiveFilesSourceFile").Value;
             if (node.Attributes.GetNamedItem("operation").Value == string.Empty)
             {
                 _operation = SSHFTPOperation.SendFiles;
             }
             if (node.Attributes.GetNamedItem("operation").Value == "SendFiles")
             {
                 _operation = SSHFTPOperation.SendFiles;
             }
             if (node.Attributes.GetNamedItem("operation").Value == "ReceiveFiles")
             {
                 _operation = SSHFTPOperation.ReceiveFiles;
             }
         }
         catch
         {
             throw;
         }
     }
 }
示例#6
0
        public void LoadFromXML(XmlElement node, IDTSInfoEvents infoEvents)
        {
            if (node.Name == "InnerObject") //OldFormat
            {
                foreach (XmlElement child in node.ChildNodes)
                {
                    string val = child.GetAttribute("Value");

                    switch (child.Name)
                    {
                    case "SleepInterval":
                        SleepInterval = int.Parse(val);
                        break;

                    default:
                        break;
                    }
                }
            }
            else if (node.Name == "SleepTaskData") //NewFormat
            {
                if (!int.TryParse(node.GetAttribute("SleepInterval"), out sleepInterval))
                {
                    infoEvents.FireError(0, Resources.SleepTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "SleepInterval", node.GetAttribute("SleepInterval")), string.Empty, 0);
                }
            }
        }
示例#7
0
 /// <summary>
 /// Loads settings from XML.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <param name="infoEvents">The info events.</param>
 /// <exception cref="System.Exception"></exception>
 void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
 {
     try
     {
         //    This might occur if the task's XML has been modified outside of the Business Intelligence
         //    Or SQL Server Workbenches.
         if (node.Name != "PGPTask")
         {
             throw new Exception(string.Format("Unexpected task element when loading task - {0}.", "PGPTask"));
         }
         else
         {
             // let error bubble up
             // populate the private property variables with values from the DTS node.
             this.sourceFile      = node.Attributes.GetNamedItem(CONSTANTS.PGPSOURCEFILE).Value;
             this.targetFile      = node.Attributes.GetNamedItem(CONSTANTS.PGPTARGETFILE).Value;
             this.publicKey       = node.Attributes.GetNamedItem(CONSTANTS.PGPPUBLICKEY).Value;
             this.privateKey      = node.Attributes.GetNamedItem(CONSTANTS.PGPPRIVATEKEY).Value;
             this.passPhrase      = node.Attributes.GetNamedItem(CONSTANTS.PGPPASSPHRASE).Value;
             this.fileAction      = (PGPFileAction)Enum.Parse(typeof(PGPFileAction), node.Attributes.GetNamedItem(CONSTANTS.PGPFILEACTION).Value);
             this.overwriteTarget = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.PGPOVERWRITETARGET).Value);
             this.removeSource    = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.PGPREMOVESOURCE).Value);
             this.isArmored       = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.PGPARMORED).Value);
         }
     }
     catch (Exception ex)
     {
         infoEvents.FireError(0, "Load From XML: ", ex.Message, "", 0);
     }
 }
        void IDTSComponentPersist.LoadFromXML(XmlElement rootNode, IDTSInfoEvents infoEvents)
        {
            // Create an root node for the data
            if (rootNode.Name != PERSIST_XML_ELEMENT)
            {
                throw new ArgumentException("Unexpected element");
            }

            // Unpersist the connection string (excluding the password)
            XmlNode csAttr = rootNode.Attributes.GetNamedItem(PERSIST_XML_CONNECTIONSTRING);

            if (csAttr != null)
            {
                this.ConnectionString = csAttr.Value;
            }

            // Unpersist the password
            // The SSIS runtime will already have decrypted it for us
            foreach (XmlNode childNode in rootNode.ChildNodes)
            {
                if (childNode.Name == PERSIST_XML_PASSWORD)
                {
                    password = childNode.InnerText;
                }
            }

            // Unpersist the service URL
            XmlNode urlAttr = rootNode.Attributes.GetNamedItem(PERSIST_XML_URL);

            if (urlAttr != null)
            {
                this.url = urlAttr.Value;
            }
        }
        public void LoadFromXML(XmlElement node, IDTSInfoEvents infoEvents)
        {
            if (node.Name != "SSISEncodeFileTask")
            {
                throw new Exception("Unexpected task element when loading task.");
            }

            try
            {
                FileConnector            = node.Attributes.GetNamedItem(Keys.FILE_CONNECTOR).Value;
                FileSourcePathInVariable = node.Attributes.GetNamedItem(Keys.FileSourcePathInVariable).Value;
                SourceType   = node.Attributes.GetNamedItem(Keys.SourceType).Value;
                EncodingType = Convert.ToInt32(node.Attributes.GetNamedItem(Keys.EncodingType).Value);

                bool autoDetect = false;
                bool.TryParse(node.Attributes.GetNamedItem(Keys.AutodetectSourceEncodingType).Value, out autoDetect);
                AutodetectSourceEncodingType = autoDetect;

                SourceEncodingType = Convert.ToInt32(node.Attributes.GetNamedItem(Keys.SourceEncodingType).Value);
                ReadWriteBuffer    = Convert.ToInt32(node.Attributes.GetNamedItem(Keys.ReadWriteBuffer).Value);
            }
            catch
            {
            }
        }
示例#10
0
        /// <summary>
        /// Saves settings to XML.
        /// </summary>
        /// <param name="doc">The doc.</param>
        /// <param name="infoEvents">The info events.</param>
        void IDTSComponentPersist.SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            try
            {
                XmlElement taskElement = doc.CreateElement(string.Empty, "ZipTask", string.Empty);
                doc.AppendChild(taskElement);

                taskElement.SetAttribute(CONSTANTS.ZIPFILEACTION, null, this.fileAction.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPCOMPRESSIONTYPE, null, this.compressionType.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPCOMPRESSIONLEVEL, null, this.zipCompressionLevel.ToString());
                taskElement.SetAttribute(CONSTANTS.TARCOMPRESSIONLEVEL, null, this.tarCompressionLevel.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPPASSWORD, null, this.zipPassword);
                taskElement.SetAttribute(CONSTANTS.ZIPSOURCE, null, this.sourceFile);
                taskElement.SetAttribute(CONSTANTS.ZIPTARGET, null, this.targetFile);
                taskElement.SetAttribute(CONSTANTS.ZIPREMOVESOURCE, null, this.removeSource.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPRECURSIVE, null, this.recursive.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPOVERWRITE, null, this.overwriteTarget.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPFILEFILTER, null, this.fileFilter);
                taskElement.SetAttribute(CONSTANTS.ZIPLOGLEVEL, null, this.logLevel.ToString());
            }
            catch (Exception ex)
            {
                infoEvents.FireError(0, "Save To XML: ", ex.Message + ex.StackTrace, "", 0);
            }
        }
示例#11
0
        public override DTSExecResult Validate(IDTSInfoEvents infoEvents)
        {
            if (string.IsNullOrWhiteSpace(UserName))
            {
                infoEvents.FireError(0, "HDFS", "No UserName specified", string.Empty, 0);
                return(DTSExecResult.Failure);
            }
            if (string.IsNullOrWhiteSpace(Host))
            {
                infoEvents.FireError(0, "HDFS", "No Host specified", string.Empty, 0);
                return(DTSExecResult.Failure);
            }
            if (Port <= 0)
            {
                infoEvents.FireError(0, "HDFS", "No Port specified", string.Empty, 0);
                return(DTSExecResult.Failure);
            }
            if (string.IsNullOrWhiteSpace(ConnectionString))
            {
                infoEvents.FireError(0, "HDFS", "Invalid ConnectionString", string.Empty, 0);
                return(DTSExecResult.Failure);
            }

            return(DTSExecResult.Success);
        }
示例#12
0
        public void LoadFromXML(XmlElement node, IDTSInfoEvents infoEvents)
        {
            if (node.Name == "InnerObject") //OldFormat
            {
                foreach (XmlElement child in node.ChildNodes)
                {
                    string val = child.GetAttribute("Value");

                    switch (child.Name)
                    {
                    case "CheckInterval":
                        CheckInterval = int.Parse(val);
                        break;

                    case "SignalVariable":
                        SignalVariable = val;
                        break;

                    default:
                        break;
                    }
                }
            }
            else if (node.Name == "WaitForSignalData") //NewFormat
            {
                CheckInterval  = int.Parse(node.GetAttribute("CheckInterval"));
                SignalVariable = node.GetAttribute("SignalVariable");
            }
        }
示例#13
0
        public override DTSExecResult Validate(IDTSInfoEvents infoEvents)
        {
            // プロパティが一つでも空だったらエラーとする
            if (!PropertiesValidate(infoEvents, URL, Domain, UserName, Password))
            {
                return(DTSExecResult.Failure);
            }

            // 接続テスト
            try
            {
                var con = CrmConnection.Parse(ConnectionString);
                con.Timeout = TimeSpan.FromSeconds(30);
                using (var service = new OrganizationService(con))
                {
                    service.Execute <WhoAmIResponse>(new WhoAmIRequest());
                }
            }
            catch (Exception e)
            {
                infoEvents.FireError(0, "Dynamics CRM 2011 接続マネージャー", e.Message, string.Empty, 0);
                return(DTSExecResult.Failure);
            }


            return(DTSExecResult.Success);
        }
        /// <summary>
        /// Loads from XML.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="infoEvents">The info events.</param>
        void IDTSComponentPersist.LoadFromXML(XmlElement node, IDTSInfoEvents infoEvents)
        {
            if (node.Name != "SSISReportGeneratorTask")
            {
                throw new Exception("Unexpected task element when loading task.");
            }

            try
            {
                ReportServer             = node.Attributes.GetNamedItem(Keys.REPORTSERVER).Value;
                ReportPath               = node.Attributes.GetNamedItem(Keys.REPORTPATH).Value;
                ReportName               = node.Attributes.GetNamedItem(Keys.REPORTNAME).Value;
                ReportNameFromExpression = node.Attributes.GetNamedItem(Keys.REPORTNAME_EXPRESSION).Value;
                MappingParams            = Serializer.DeSerializeFromXmlString(typeof(MappingParams), node.Attributes.GetNamedItem(Keys.MAPPING_PARAMS).Value);
                OutPutType               = node.Attributes.GetNamedItem(Keys.OUTPUT_TYPE).Value;
                FileSourceType           = node.Attributes.GetNamedItem(Keys.CONFIGURATION_TYPE).Value;
                DestinationFile          = node.Attributes.GetNamedItem(Keys.DESTINATION_FILE).Value;

                SendFileByEmail = node.Attributes.GetNamedItem(Keys.SEND_FILE_BY_EMAIL).Value;
                SmtpServer      = node.Attributes.GetNamedItem(Keys.SMTP_SERVER).Value;
                SmtpRecipients  = node.Attributes.GetNamedItem(Keys.RECIPIENTS).Value;

                SmtpFrom     = node.Attributes.GetNamedItem(Keys.FROM).Value;
                EmailSubject = node.Attributes.GetNamedItem(Keys.EMAIL_SUBJECT).Value;
                EmailBody    = node.Attributes.GetNamedItem(Keys.EMAIL_BODY).Value;
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message + " " + exception.StackTrace);
            }
        }
示例#15
0
        /// <summary>
        /// De-Serializes WaitForTime properties from XmlElement
        /// </summary>
        /// <param name="node"></param>
        /// <param name="infoEvents"></param>
        void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
        {
            if (node.Name == "WaitForTimeData")
            {
                if (node.HasAttributes) //new format
                {
                    TimeSpan ts;
                    if (TimeSpan.TryParse(node.GetAttribute("waitTime"), out ts))
                    {
                        WaitTime = ts;
                    }
                    else
                    {
                        infoEvents.FireError(0, Resources.WaitForTimeTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "WaitTime", node.GetAttribute("checkType")), string.Empty, 0);
                    }

                    bool wnd;
                    if (bool.TryParse(node.GetAttribute("waitNextDayIfTimePassed"), out wnd))
                    {
                        WaitNextDayIfTimePassed = wnd;
                    }
                    else
                    {
                        infoEvents.FireError(0, Resources.WaitForTimeTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "WaitNextDayIfTimePassed", node.GetAttribute("waitNextDayIfTimePassed")), string.Empty, 0);
                    }
                }
                else //old format
                {
                    foreach (XmlNode nd in node.ChildNodes)
                    {
                        switch (nd.Name)
                        {
                        case "waitTime":
                            TimeSpan ts;
                            if (TimeSpan.TryParse(nd.InnerText, out ts))
                            {
                                WaitTime = ts;
                            }
                            else
                            {
                                infoEvents.FireError(0, Resources.WaitForTimeTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "WaitTime", nd.InnerText), string.Empty, 0);
                            }
                            break;

                        case "waitNextDayIfTimePassed":
                            bool wnd;
                            if (bool.TryParse(nd.InnerText, out wnd))
                            {
                                WaitNextDayIfTimePassed = wnd;
                            }
                            else
                            {
                                infoEvents.FireError(0, Resources.WaitForTimeTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "WaitNextDayIfTimePassed", nd.InnerText), string.Empty, 0);
                            }
                            break;
                        }
                    }
                }
            }
        }
        void IDTSComponentPersist.SaveToXML(XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            // Create a root node for the data
            XmlElement rootElement = doc.CreateElement(String.Empty, PERSIST_XML_ELEMENT, String.Empty);

            doc.AppendChild(rootElement);

            // Persist the connection string (excluding the password)
            XmlAttribute csAttr = doc.CreateAttribute(PERSIST_XML_CONNECTIONSTRING);

            csAttr.Value = this.ConnectionString;
            rootElement.Attributes.Append(csAttr);

            // Persist the password separately
            if (!String.IsNullOrEmpty(password))
            {
                XmlNode    node        = doc.CreateNode(XmlNodeType.Element, PERSIST_XML_PASSWORD, String.Empty);
                XmlElement pswdElement = node as XmlElement;
                rootElement.AppendChild(node);

                // Adding the sensitive attribute tells the SSIS runtime that
                // this value should be protected according to the
                // ProtectionLevel of the package
                pswdElement.InnerText = password;
                XmlAttribute pwAttr = doc.CreateAttribute(PERSIST_XML_SENSITIVE);
                pwAttr.Value = "1";
                pswdElement.Attributes.Append(pwAttr);
            }

            // Persist the service URL
            XmlAttribute urlAttr = doc.CreateAttribute(PERSIST_XML_URL);

            urlAttr.Value = this.url;
            rootElement.Attributes.Append(urlAttr);
        }
示例#17
0
 /// <summary>
 /// Loads settings from XML.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <param name="infoEvents">The info events.</param>
 /// <exception cref="System.Exception"></exception>
 void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
 {
     try
     {
         //    This might occur if the task's XML has been modified outside of the Business Intelligence
         //    Or SQL Server Workbenches.
         if (node.Name != "ZipTask")
         {
             throw new Exception(string.Format("Unexpected task element when loading task - {0}.", "ZipTask"));
         }
         else
         {
             // let error bubble up
             // populate the private property variables with values from the DTS node.
             this.fileAction          = (ZipFileAction)Enum.Parse(typeof(ZipFileAction), node.Attributes.GetNamedItem(CONSTANTS.ZIPFILEACTION).Value);
             this.compressionType     = (CompressionType)Enum.Parse(typeof(CompressionType), node.Attributes.GetNamedItem(CONSTANTS.ZIPCOMPRESSIONTYPE).Value);
             this.zipCompressionLevel = (ZipCompressionLevel)Enum.Parse(typeof(ZipCompressionLevel), node.Attributes.GetNamedItem(CONSTANTS.ZIPCOMPRESSIONLEVEL).Value);
             this.tarCompressionLevel = (TarCompressionLevel)Enum.Parse(typeof(TarCompressionLevel), node.Attributes.GetNamedItem(CONSTANTS.TARCOMPRESSIONLEVEL).Value);
             this.sourceFile          = node.Attributes.GetNamedItem(CONSTANTS.ZIPSOURCE).Value;
             this.zipPassword         = node.Attributes.GetNamedItem(CONSTANTS.ZIPPASSWORD).Value;
             this.targetFile          = node.Attributes.GetNamedItem(CONSTANTS.ZIPTARGET).Value;
             this.removeSource        = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.ZIPREMOVESOURCE).Value);
             this.recursive           = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.ZIPRECURSIVE).Value);
             this.overwriteTarget     = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.ZIPOVERWRITE).Value);
             this.fileFilter          = node.Attributes.GetNamedItem(CONSTANTS.ZIPFILEFILTER).Value;
             this.logLevel            = (LogLevel)Enum.Parse(typeof(LogLevel), node.GetAttribute(CONSTANTS.SFTPLOGLEVEL, String.Empty));
         }
     }
     catch (Exception ex)
     {
         infoEvents.FireError(0, "Load From XML: ", ex.Message, "", 0);
     }
 }
示例#18
0
        /// <summary>Logs an error.</summary>
        /// <param name="source">The source.</param>
        /// <param name="action">The action to produce the message.</param>
        public static void LogError(this IDTSInfoEvents source, Action <LogInfoBuilder> action)
        {
            var builder = CreateLogInfoBuilder(LogType.Error);

            action(builder);

            LogCore(source, builder.GetInfo());
        }
示例#19
0
        public void SaveToXML(XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            var data = doc.CreateElement("WaitForSignalData");

            data.SetAttribute("CheckInterval", CheckInterval.ToString());
            data.SetAttribute("SignalVariable", SignalVariable);
            doc.AppendChild(data);
        }
示例#20
0
        /// <summary>
        /// Serializes the WaitForTime component into the DTSX package
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="infoEvents"></param>
        void IDTSComponentPersist.SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            XmlElement data = doc.CreateElement("WaitForTimeData");

            doc.AppendChild(data);

            data.SetAttribute("waitTime", waitTime.ToString());
            data.SetAttribute("waitNextDayIfTimePassed", WaitNextDayIfTimePassed.ToString());
        }
示例#21
0
        /// <summary>
        /// プロパティ値検証
        /// </summary>
        /// <param name="infoEvents"></param>
        /// <param name="properties"></param>
        /// <returns></returns>
        private static bool PropertiesValidate(IDTSInfoEvents infoEvents, params string[] properties)
        {
            if (properties.Any(x => string.IsNullOrEmpty(x)))
            {
                infoEvents.FireError(0, "Dynamics CRM 2011 接続マネージャー", "全てのプロパティに値を入力してください。", string.Empty, 0);
                return(false);
            }

            return(true);
        }
示例#22
0
        public override Microsoft.SqlServer.Dts.Runtime.DTSExecResult Validate(IDTSInfoEvents infoEvents)
        {
            if (string.IsNullOrEmpty(this._OGRConnectionString))
            {
                infoEvents.FireError(0, "OGR Connection Manager", "No connection information specified", string.Empty, 0);
                return DTSExecResult.Failure;
            }

            return DTSExecResult.Success;
        }
示例#23
0
        /// <summary>Logs an error.</summary>
        /// <param name="source">The source.</param>
        /// <param name="message">The message.</param>
        /// <param name="arguments">Optional message arguments.</param>
        public static void LogError(this IDTSInfoEvents source, string message, params object[] arguments)
        {
            if (arguments != null && arguments.Any())
            {
                message = String.Format(message, arguments);
            }

            LogCore(source, new LogInfo()
            {
                Type = LogType.Error, Message = message
            });
        }
        /// <summary>
        /// Saves a component to XML. Tasks and containers implement this method.
        /// </summary>
        /// <param name="doc">The XML document to which to save the information.</param>
        /// <param name="infoEvents">An object that implements the <see cref="T:Microsoft.SqlServer.Dts.Runtime.IDTSInfoEvents"/> interface for raising events (errors, warnings, and so on) during persistence.</param>
        void IDTSComponentPersist.SaveToXML(XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            XmlElement taskElement = doc.CreateElement(string.Empty, "SSISExecuteAssemblyTask", string.Empty);

            XmlAttribute assemblyConnector = doc.CreateAttribute(string.Empty, NamedStringMembers.ASSEMBLY_CONNECTOR, string.Empty);

            assemblyConnector.Value = AssemblyConnector;

            XmlAttribute assemblyPathAttribute = doc.CreateAttribute(string.Empty, NamedStringMembers.ASSEMBLY_PATH, string.Empty);

            assemblyPathAttribute.Value = AssemblyPath;

            XmlAttribute assemblyNamespaceAttribute = doc.CreateAttribute(string.Empty, NamedStringMembers.ASSEMBLY_NAMESPACE, string.Empty);

            assemblyNamespaceAttribute.Value = AssemblyNamespace;

            XmlAttribute assemblyClassAttribute = doc.CreateAttribute(string.Empty, NamedStringMembers.ASSEMBLY_CLASS, string.Empty);

            assemblyClassAttribute.Value = AssemblyClass;

            XmlAttribute assemblyMethodAttribute = doc.CreateAttribute(string.Empty, NamedStringMembers.ASSEMBLY_METHOD, string.Empty);

            assemblyMethodAttribute.Value = AssemblyMethod;

            XmlAttribute mappingParamsAttribute = doc.CreateAttribute(string.Empty, NamedStringMembers.MAPPING_PARAMS, string.Empty);

            mappingParamsAttribute.Value = MappingParams;

            XmlAttribute outPutVariableAttribute = doc.CreateAttribute(string.Empty, NamedStringMembers.OUTPUT_VARIABLE, string.Empty);

            outPutVariableAttribute.Value = OutPutVariable;

            XmlAttribute configurationFileAttribute = doc.CreateAttribute(string.Empty, NamedStringMembers.CONFIGURATION_FILE, string.Empty);

            configurationFileAttribute.Value = ConfigurationFile;

            XmlAttribute configurationTypeAttribute = doc.CreateAttribute(string.Empty, NamedStringMembers.CONFIGURATION_TYPE, string.Empty);

            configurationTypeAttribute.Value = ConfigurationType;

            taskElement.Attributes.Append(assemblyPathAttribute);
            taskElement.Attributes.Append(assemblyConnector);
            taskElement.Attributes.Append(assemblyNamespaceAttribute);
            taskElement.Attributes.Append(assemblyClassAttribute);
            taskElement.Attributes.Append(assemblyMethodAttribute);
            taskElement.Attributes.Append(mappingParamsAttribute);
            taskElement.Attributes.Append(outPutVariableAttribute);
            taskElement.Attributes.Append(configurationFileAttribute);
            taskElement.Attributes.Append(configurationTypeAttribute);

            doc.AppendChild(taskElement);
        }
示例#25
0
        public void SaveToXML(XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            XmlElement   taskElement          = doc.CreateElement(string.Empty, "SSHExecuteCommandTask", string.Empty);
            XmlAttribute commandTextAttribute = doc.CreateAttribute(string.Empty, "commandText", string.Empty);

            commandTextAttribute.Value = _commandText;
            XmlAttribute connMgrNameAttribute = doc.CreateAttribute(string.Empty, "connMgrName", string.Empty);

            connMgrNameAttribute.Value = _connMgrName;
            taskElement.Attributes.Append(commandTextAttribute);
            taskElement.Attributes.Append(connMgrNameAttribute);
            doc.AppendChild(taskElement);
        }
示例#26
0
        /// <summary>
        /// Loads from XML.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="infoEvents">The info events.</param>
        void IDTSComponentPersist.LoadFromXML(XmlElement node, IDTSInfoEvents infoEvents)
        {
            if (node.Name != "SSISBulkExportTask")
            {
                throw new Exception("Wrong node name");
            }

            try
            {
                SQLServerInstance = node.Attributes.GetNamedItem(Keys.SQL_SERVER).Value;
                DataSource        = node.Attributes.GetNamedItem(Keys.DATA_SOURCE).Value;
                MaxErrors         = node.Attributes.GetNamedItem(Keys.MAX_ERRORS).Value;
                Database          = node.Attributes.GetNamedItem(Keys.SQL_DATABASE).Value;
                SQLStatment       = node.Attributes.GetNamedItem(Keys.SQL_STATEMENT).Value;
                View                        = node.Attributes.GetNamedItem(Keys.SQL_VIEW).Value;
                StoredProcedure             = node.Attributes.GetNamedItem(Keys.SQL_StoredProcedure).Value;
                StoredProcedureParameters   = Serializer.DeSerializeFromXmlString(typeof(MappingParams), node.Attributes.GetNamedItem(Keys.SQL_STORED_PROCEDURE_PARAMS).Value);
                Tables                      = node.Attributes.GetNamedItem(Keys.SQL_TABLE).Value;
                FirstRow                    = node.Attributes.GetNamedItem(Keys.FIRSTROW).Value;
                LastRow                     = node.Attributes.GetNamedItem(Keys.LASTROW).Value;
                FieldTermiantor             = node.Attributes.GetNamedItem(Keys.FIELD_TERMINATOR).Value;
                RowTermiantor               = node.Attributes.GetNamedItem(Keys.ROW_TERMINATOR).Value;
                NativeDatabaseDataType      = node.Attributes.GetNamedItem(Keys.NATIVE_DB_DATATYPE).Value;
                TrustedConnection           = node.Attributes.GetNamedItem(Keys.TRUSTED_CONNECTION).Value;
                Login                       = node.Attributes.GetNamedItem(Keys.SRV_LOGIN).Value;
                Password                    = node.Attributes.GetNamedItem(Keys.SRV_PASSWORD).Value;
                DestinationPath             = node.Attributes.GetNamedItem(Keys.DESTINATION).Value;
                DestinationByFileConnection = node.Attributes.GetNamedItem(Keys.DESTINATION_FILE_CONNECTION).Value;
                FormatFile                  = node.Attributes.GetNamedItem(Keys.FORMAT_FILE).Value;
                FormatFileByFileConnection  = node.Attributes.GetNamedItem(Keys.FORMAT_FILE_CONNECTION).Value;
                ActivateCmdShell            = node.Attributes.GetNamedItem(Keys.ACTIVATE_CMDSHELL).Value;
                CodePage                    = node.Attributes.GetNamedItem(Keys.CODE_PAGE).Value;
                NetworkPacketSize           = node.Attributes.GetNamedItem(Keys.NETWORK_PACKET_SIZE).Value;
                UseRegionalSettings         = node.Attributes.GetNamedItem(Keys.USE_REGIONAL_SETTINGS).Value;
                UseCharacterDataType        = node.Attributes.GetNamedItem(Keys.CHARACTER_DATA_TYPE).Value;
                UseUnicodeCharacters        = node.Attributes.GetNamedItem(Keys.UNICODE_CHR).Value;
                SET_QUOTED_IDENTIFIERS_ON   = node.Attributes.GetNamedItem(Keys.SET_QUOTED_IDENTIFIERS_ON).Value;

                SendFileByEmail = node.Attributes.GetNamedItem(Keys.SEND_FILE_BY_EMAIL).Value;
                SmtpServer      = node.Attributes.GetNamedItem(Keys.SMTP_SERVER).Value;
                SmtpRecipients  = node.Attributes.GetNamedItem(Keys.RECIPIENTS).Value;

                SmtpFrom     = node.Attributes.GetNamedItem(Keys.FROM).Value;
                EmailSubject = node.Attributes.GetNamedItem(Keys.EMAIL_SUBJECT).Value;
                EmailBody    = node.Attributes.GetNamedItem(Keys.EMAIL_BODY).Value;
            }
            catch
            {
                throw new Exception("Unexpected task element when loading task.");
            }
        }
示例#27
0
        /// <summary>
        /// Saves settings to XML.
        /// </summary>
        /// <param name="doc">The doc.</param>
        /// <param name="infoEvents">The info events.</param>
        void IDTSComponentPersist.SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            try
            {
                //create node in the package xml document
                XmlElement taskElement = doc.CreateElement(string.Empty, "PGPTask", string.Empty);

                XmlAttribute sourceAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPSOURCEFILE, string.Empty);
                sourceAttr.Value = this.sourceFile;
                taskElement.Attributes.Append(sourceAttr);

                XmlAttribute targetAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPTARGETFILE, string.Empty);
                targetAttr.Value = this.targetFile;
                taskElement.Attributes.Append(targetAttr);

                XmlAttribute publicAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPPUBLICKEY, string.Empty);
                publicAttr.Value = this.publicKey;
                taskElement.Attributes.Append(publicAttr);

                XmlAttribute privateAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPPRIVATEKEY, string.Empty);
                privateAttr.Value = this.privateKey;
                taskElement.Attributes.Append(privateAttr);

                XmlAttribute passAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPPASSPHRASE, string.Empty);
                passAttr.Value = this.passPhrase;
                taskElement.Attributes.Append(passAttr);

                XmlAttribute fileActionAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPFILEACTION, string.Empty);
                fileActionAttr.Value = this.fileAction.ToString();
                taskElement.Attributes.Append(fileActionAttr);

                XmlAttribute overwriteRemoteAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPOVERWRITETARGET, string.Empty);
                overwriteRemoteAttr.Value = this.overwriteTarget.ToString();
                taskElement.Attributes.Append(overwriteRemoteAttr);

                XmlAttribute removeAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPREMOVESOURCE, string.Empty);
                removeAttr.Value = this.removeSource.ToString();
                taskElement.Attributes.Append(removeAttr);

                XmlAttribute armoredAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPARMORED, string.Empty);
                armoredAttr.Value = this.isArmored.ToString();
                taskElement.Attributes.Append(armoredAttr);

                //add the new element to the package document
                doc.AppendChild(taskElement);
            }
            catch (Exception ex)
            {
                infoEvents.FireError(0, "Save To XML: ", ex.Message + ex.StackTrace, "", 0);
            }
        }
示例#28
0
        public void LoadFromXML(XmlElement node, IDTSInfoEvents infoEvents)
        {
            var serializer = new XmlSerializer(typeof(TaskProperties));

            using (var sr = new StringReader(node.OuterXml))
            {
                var instance = serializer.Deserialize(sr) as TaskProperties;
                this.WebHookUrl  = instance.WebHookUrl;
                this.Text        = instance.SlackMessage.Text;
                this.User        = instance.SlackMessage.Username;
                this.Channel     = instance.Channel;
                this.Attachments = new List <Attachment>(instance.SlackMessage.Attachments);
            }
        }
        //save into package
        public void SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            XmlElement elementRoot;
            XmlNode    propertyNode;

            elementRoot = doc.CreateElement(string.Empty, "DtParameters", string.Empty);

            if (DtParameters != null)
            {
                if (DtParameters.Rows.Count > 0)
                {
                    //
                    foreach (DataRow row in DtParameters.Rows)
                    {
                        propertyNode           = doc.CreateNode(XmlNodeType.Element, "Parameter", string.Empty);
                        propertyNode.InnerText = row["ParameterValue"].ToString();

                        XmlAttribute attrParameterName = doc.CreateAttribute("ParameterName");
                        attrParameterName.Value = row["ParameterName"].ToString();
                        propertyNode.Attributes.Append(attrParameterName);

                        XmlAttribute attrRequired = doc.CreateAttribute("Required");
                        attrRequired.Value = row["Required"].ToString();
                        propertyNode.Attributes.Append(attrRequired);

                        elementRoot.AppendChild(propertyNode);
                    }
                }
            }


            propertyNode           = doc.CreateNode(XmlNodeType.Element, "Server", string.Empty);
            propertyNode.InnerText = Server;
            elementRoot.AppendChild(propertyNode);

            propertyNode           = doc.CreateNode(XmlNodeType.Element, "SelectedReport", string.Empty);
            propertyNode.InnerText = SelectedReport;
            elementRoot.AppendChild(propertyNode);

            propertyNode           = doc.CreateNode(XmlNodeType.Element, "FileName", string.Empty);
            propertyNode.InnerText = FileName;
            elementRoot.AppendChild(propertyNode);

            propertyNode           = doc.CreateNode(XmlNodeType.Element, "FileFormat", string.Empty);
            propertyNode.InnerText = FileFormat;
            elementRoot.AppendChild(propertyNode);

            doc.AppendChild(elementRoot);
        }
        public void ValidateReturnsFailureIfPasswordEmptyTest()
        {
            MongoConnectionManager target = new MongoConnectionManager();

            target.ServerName   = "server123";
            target.DatabaseName = "db123";
            target.UserName     = "******";
            target.Password     = "";
            IDTSInfoEvents infoEvents = null;
            DTSExecResult  expected   = DTSExecResult.Failure;
            DTSExecResult  actual     = default(DTSExecResult);

            actual = target.Validate(infoEvents);
            Assert.AreEqual(expected, actual);
        }
        public void ValidateReturnsSuccessIfServerNameSpecifiedTest()
        {
            MongoConnectionManager target = new MongoConnectionManager();

            target.ServerName   = "server123";
            target.DatabaseName = "db123";
            target.UserName     = "******";
            target.Password     = "******";
            IDTSInfoEvents infoEvents = null;
            DTSExecResult  expected   = DTSExecResult.Success;
            DTSExecResult  actual     = default(DTSExecResult);

            actual = target.Validate(infoEvents);
            Assert.AreEqual(expected, actual);
        }
示例#32
0
        public void SaveToXML(XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            var data = doc.CreateElement("VaiablesToXmlData");

            data.SetAttribute("ExportBinaryData", ExportBinaryData.ToString());
            data.SetAttribute("ExportDataType", ExportDataType.ToString());
            data.SetAttribute("ExportDescription", ExportDescription.ToString());
            data.SetAttribute("ExportValueDataType", ExportValueDataType.ToString());
            data.SetAttribute("ExportVariablePath", ExportVariablePath.ToString());
            data.SetAttribute("RootElementName", RootElementName);
            data.SetAttribute("VariableElementName", VariableElementName);
            data.SetAttribute("VariablesToExport", VariablesToExport);
            data.SetAttribute("XmlSaveOptions", XmlSaveOptions.ToString());
            data.SetAttribute("XmlVariable", XmlVariable);
            doc.AppendChild(data);
        }
 public override DTSExecResult Validate(IDTSInfoEvents infoEvents)
 {
     if (StringUtil.NullOrEmpty(_host))
     {
         infoEvents.FireError(0, "SSHConnectionManager", "Host cannot be null or empty.", string.Empty, 0);
         return DTSExecResult.Failure;
     }
     if (StringUtil.NullOrEmpty(_username))
     {
         infoEvents.FireError(0, "SSHConnectionManager", "Username cannot be null or empty.", string.Empty, 0);
         return DTSExecResult.Failure;
     }
     if (StringUtil.NullOrEmpty(_password))
     {
         infoEvents.FireError(0, "SSHConnectionManager", "Password cannot be null or empty.", string.Empty, 0);
         return DTSExecResult.Failure;
     }
     if (_port < 0 || _port > 65535)
     {
         infoEvents.FireError(0, "SSHConnectionManager", "Password cannot be null or empty.", string.Empty, 0);
         return DTSExecResult.Failure;
     }
     return base.Validate(infoEvents);
 }
示例#34
0
        public override Microsoft.SqlServer.Dts.Runtime.DTSExecResult Validate(IDTSInfoEvents infoEvents)
        {
            if (string.IsNullOrEmpty(this._OGRConnectionString))
            {
                infoEvents.FireError(0, "OGR Connection Manager", "No connection information specified", string.Empty, 0);
                return DTSExecResult.Failure;
            }

            return DTSExecResult.Success;
        }
 public void SaveToXML(XmlDocument doc, IDTSInfoEvents infoEvents)
 {
     XmlElement taskElement = doc.CreateElement(string.Empty, "SSHExecuteCommandTask", string.Empty);
     XmlAttribute commandTextAttribute = doc.CreateAttribute(string.Empty, "commandText", string.Empty);
     commandTextAttribute.Value = _commandText;
     XmlAttribute connMgrNameAttribute = doc.CreateAttribute(string.Empty, "connMgrName", string.Empty);
     connMgrNameAttribute.Value = _connMgrName;
     taskElement.Attributes.Append(commandTextAttribute);
     taskElement.Attributes.Append(connMgrNameAttribute);
     doc.AppendChild(taskElement);
 }
示例#36
0
 /// <summary>
 /// Loads settings from XML.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <param name="infoEvents">The info events.</param>
 /// <exception cref="System.Exception"></exception>
 void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
 {
     try
     {
         //    This might occur if the task's XML has been modified outside of the Business Intelligence
         //    Or SQL Server Workbenches.
         if (node.Name != "PGPTask")
         {
             throw new Exception(string.Format("Unexpected task element when loading task - {0}.", "PGPTask"));
         }
         else
         {
             // let error bubble up
             // populate the private property variables with values from the DTS node.
             this.sourceFile = node.Attributes.GetNamedItem(CONSTANTS.PGPSOURCEFILE).Value;
             this.targetFile = node.Attributes.GetNamedItem(CONSTANTS.PGPTARGETFILE).Value;
             this.publicKey = node.Attributes.GetNamedItem(CONSTANTS.PGPPUBLICKEY).Value;
             this.privateKey = node.Attributes.GetNamedItem(CONSTANTS.PGPPRIVATEKEY).Value;
             this.passPhrase = node.Attributes.GetNamedItem(CONSTANTS.PGPPASSPHRASE).Value;
             this.fileAction = (PGPFileAction)Enum.Parse(typeof(PGPFileAction), node.Attributes.GetNamedItem(CONSTANTS.PGPFILEACTION).Value);
             this.overwriteTarget = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.PGPOVERWRITETARGET).Value);
             this.removeSource = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.PGPREMOVESOURCE).Value);
             this.isArmored = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.PGPARMORED).Value);
         }
     }
     catch (Exception ex)
     {
         infoEvents.FireError(0, "Load From XML: ", ex.Message, "", 0);
     }
 }
        /// <summary>
        /// プロパティ値検証
        /// </summary>
        /// <param name="infoEvents"></param>
        /// <param name="properties"></param>
        /// <returns></returns>
        private static bool PropertiesValidate(IDTSInfoEvents infoEvents, params string[] properties)
        {
            if (properties.Any(x => string.IsNullOrEmpty(x)))
            {
                infoEvents.FireError(0, "Dynamics CRM 2011 接続マネージャー", "全てのプロパティに値を入力してください。", string.Empty, 0);
                return false;
            }

            return true;
        }
示例#38
0
        /// <summary>
        /// Saves settings to XML.
        /// </summary>
        /// <param name="doc">The doc.</param>
        /// <param name="infoEvents">The info events.</param>
        void IDTSComponentPersist.SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            try
            {
                XmlElement taskElement = doc.CreateElement(string.Empty, "ZipTask", string.Empty);
                doc.AppendChild(taskElement);

                taskElement.SetAttribute(CONSTANTS.ZIPFILEACTION, null, this.fileAction.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPCOMPRESSIONTYPE, null, this.compressionType.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPCOMPRESSIONLEVEL, null, this.zipCompressionLevel.ToString());
                taskElement.SetAttribute(CONSTANTS.TARCOMPRESSIONLEVEL, null, this.tarCompressionLevel.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPPASSWORD, null, this.zipPassword);
                taskElement.SetAttribute(CONSTANTS.ZIPSOURCE, null, this.sourceFile);
                taskElement.SetAttribute(CONSTANTS.ZIPTARGET, null, this.targetFile);
                taskElement.SetAttribute(CONSTANTS.ZIPREMOVESOURCE, null, this.removeSource.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPRECURSIVE, null, this.recursive.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPOVERWRITE, null, this.overwriteTarget.ToString());
                taskElement.SetAttribute(CONSTANTS.ZIPFILEFILTER, null, this.fileFilter);
                taskElement.SetAttribute(CONSTANTS.ZIPLOGLEVEL, null, this.logLevel.ToString());
            }
            catch (Exception ex)
            {
                infoEvents.FireError(0, "Save To XML: ", ex.Message + ex.StackTrace, "", 0);
            }
        }
示例#39
0
 /// <summary>
 /// Loads settings from XML.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <param name="infoEvents">The info events.</param>
 /// <exception cref="System.Exception"></exception>
 void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
 {
     try
     {
         //    This might occur if the task's XML has been modified outside of the Business Intelligence
         //    Or SQL Server Workbenches.
         if (node.Name != "ZipTask")
         {
             throw new Exception(string.Format("Unexpected task element when loading task - {0}.", "ZipTask"));
         }
         else
         {
             // let error bubble up
             // populate the private property variables with values from the DTS node.
             this.fileAction = (ZipFileAction)Enum.Parse(typeof(ZipFileAction), node.Attributes.GetNamedItem(CONSTANTS.ZIPFILEACTION).Value);
             this.compressionType = (CompressionType)Enum.Parse(typeof(CompressionType), node.Attributes.GetNamedItem(CONSTANTS.ZIPCOMPRESSIONTYPE).Value);
             this.zipCompressionLevel = (ZipCompressionLevel)Enum.Parse(typeof(ZipCompressionLevel), node.Attributes.GetNamedItem(CONSTANTS.ZIPCOMPRESSIONLEVEL).Value);
             this.tarCompressionLevel = (TarCompressionLevel)Enum.Parse(typeof(TarCompressionLevel), node.Attributes.GetNamedItem(CONSTANTS.TARCOMPRESSIONLEVEL).Value);
             this.sourceFile = node.Attributes.GetNamedItem(CONSTANTS.ZIPSOURCE).Value;
             this.zipPassword = node.Attributes.GetNamedItem(CONSTANTS.ZIPPASSWORD).Value;
             this.targetFile = node.Attributes.GetNamedItem(CONSTANTS.ZIPTARGET).Value;
             this.removeSource = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.ZIPREMOVESOURCE).Value);
             this.recursive = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.ZIPRECURSIVE).Value);
             this.overwriteTarget = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.ZIPOVERWRITE).Value);
             this.fileFilter = node.Attributes.GetNamedItem(CONSTANTS.ZIPFILEFILTER).Value;
             this.logLevel = (LogLevel)Enum.Parse(typeof(LogLevel), node.GetAttribute(CONSTANTS.SFTPLOGLEVEL, String.Empty));
         }
     }
     catch (Exception ex)
     {                
         infoEvents.FireError(0, "Load From XML: ", ex.Message, "", 0);
     }
 }
 public void LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
 {
     if (node.Name != "SSHFTPTask")
     {
         throw new Exception("Unexpected task element when loading task.");
     }
     else
     {
         try
         {
             _SSHconnMgrName = node.Attributes.GetNamedItem("SSHconnMgrName").Value;
             _sendFilesSourceConnectionManagerName = node.Attributes.GetNamedItem("sendFilesSourceConnectionManagerName").Value;
             _sendFilesDestinationDirectory = node.Attributes.GetNamedItem("sendFilesDestinationDirectory").Value;
             _receiveFilesDestinationConnectionManagerName = node.Attributes.GetNamedItem("receiveFilesDestinationConnectionManagerName").Value;
             _receiveFilesSourceFile = node.Attributes.GetNamedItem("receiveFilesSourceFile").Value;
             if (node.Attributes.GetNamedItem("operation").Value == string.Empty) { _operation = SSHFTPOperation.SendFiles; }
             if (node.Attributes.GetNamedItem("operation").Value == "SendFiles") { _operation = SSHFTPOperation.SendFiles; }
             if (node.Attributes.GetNamedItem("operation").Value == "ReceiveFiles") { _operation = SSHFTPOperation.ReceiveFiles; }
         }
         catch
         {
             throw;
         }
     }
 }
        void IDTSComponentPersist.LoadFromXML(XmlElement rootNode, IDTSInfoEvents infoEvents)
        {
            // Create an root node for the data
            if (rootNode.Name != PERSIST_XML_ELEMENT)
            {
                throw new ArgumentException("Unexpected element");
            }

            // Unpersist the password
            // The SSIS runtime will already have decrypted it for us
            foreach (XmlNode childNode in rootNode.ChildNodes)
            {
                if (childNode.Name == PERSIST_XML_PASSWORD)
                {
                    password = childNode.InnerText;
                }
            }

        }
        void IDTSComponentPersist.LoadFromXML(XmlElement rootNode, IDTSInfoEvents infoEvents)
        {
            // Create an root node for the data
            if (rootNode.Name != PERSIST_XML_ELEMENT)
            {
                throw new ArgumentException("Unexpected element");
            }

            // Unpersist the connection string (excluding the password)
            XmlNode csAttr = rootNode.Attributes.GetNamedItem(PERSIST_XML_CONNECTIONSTRING);
            if (csAttr != null)
            {
                this.ConnectionString = csAttr.Value;
            }

            // Unpersist the password
            // The SSIS runtime will already have decrypted it for us
            foreach (XmlNode childNode in rootNode.ChildNodes)
            {
                if (childNode.Name == PERSIST_XML_PASSWORD)
                {
                    password = childNode.InnerText;
                }
            }

            // Unpersist the service URL
            XmlNode urlAttr = rootNode.Attributes.GetNamedItem(PERSIST_XML_URL);
            if (urlAttr != null)
            {
                this.url = urlAttr.Value;
            }
        }
        void IDTSComponentPersist.SaveToXML(XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            // Create a root node for the data
            XmlElement rootElement = doc.CreateElement(String.Empty, PERSIST_XML_ELEMENT, String.Empty);
            doc.AppendChild(rootElement);

            // Persist the password separately
            if (!String.IsNullOrEmpty(password))
            {
                XmlNode node = doc.CreateNode(XmlNodeType.Element, PERSIST_XML_PASSWORD, String.Empty);
                XmlElement pswdElement = node as XmlElement;
                rootElement.AppendChild(node);

                // Adding the sensitive attribute tells the SSIS runtime that
                // this value should be protected according to the 
                // ProtectionLevel of the package
                pswdElement.InnerText = password;
                XmlAttribute pwAttr = doc.CreateAttribute(PERSIST_XML_SENSITIVE);
                pwAttr.Value = "1";
                pswdElement.Attributes.Append(pwAttr);
            }
        }
示例#44
0
        /// <summary>
        /// Loads settings from XML.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="infoEvents">The info events.</param>
        /// <exception cref="System.Exception"></exception>
        void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents)
        {
            //TaskProperties prop = this.Properties;

            try
            {
                //    This might occur if the task's XML has been modified outside of the Business Intelligence
                //    Or SQL Server Workbenches.
                if (node.Name != "SFTPTask")
                {
                    throw new Exception(string.Format("Unexpected task element when loading task - {0}.", "SFTPTask"));
                }
                else
                {
                    // let error bubble up
                    // populate the private property variables with values from the DTS node.
                    this.localFile = node.GetAttribute(CONSTANTS.SFTPLOCALFILE, String.Empty);
                    this.remoteFile = node.GetAttribute(CONSTANTS.SFTPREMOTEFILE, String.Empty);
                    this.fileAction = (SFTPFileAction)Enum.Parse(typeof(SFTPFileAction), node.GetAttribute(CONSTANTS.SFTPFILEACTION, String.Empty));
                    this.fileInfo = node.GetAttribute(CONSTANTS.SFTPFILEINFO, String.Empty);
                    this.overwriteDest = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPOVERWRITEDEST, String.Empty));
                    this.removeSource = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPREMOVESOURCE, String.Empty));
                    this.isRecursive = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPISRECURSIVE, String.Empty));
                    this.fileFilter = node.GetAttribute(CONSTANTS.SFTPFILEFILTER, String.Empty);
                    //this.reTries = Convert.ToInt32(node.GetAttribute(CONSTANTS.SFTPRETRIES, String.Empty));
                    this.hostName = node.GetAttribute(CONSTANTS.SFTPHOST, String.Empty);
                    this.portNumber = node.GetAttribute(CONSTANTS.SFTPPORT, String.Empty);
                    this.userName = node.GetAttribute(CONSTANTS.SFTPUSER, String.Empty);
                    this.passWord = node.GetAttribute(CONSTANTS.SFTPPASSWORD, String.Empty);
                    this.stopOnFailure = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPSTOPONFAILURE, String.Empty));
                    this.remoteFileListVariable = node.GetAttribute(CONSTANTS.SFTPREMOTEFILELISTVAR, String.Empty);
                    this.logLevel = (LogLevel)Enum.Parse(typeof(LogLevel), node.GetAttribute(CONSTANTS.SFTPLOGLEVEL, String.Empty));
                }
            }
            catch (Exception ex)
            {
                infoEvents.FireError(0, "Load From XML: ", ex.Message + Environment.NewLine + ex.StackTrace, "", 0);
            }
        }
示例#45
0
        /// <summary>
        /// Saves settings to XML.
        /// </summary>
        /// <param name="doc">The doc.</param>
        /// <param name="infoEvents">The info events.</param>
        void IDTSComponentPersist.SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            try
            {
                //create node in the package xml document
                XmlElement taskElement = doc.CreateElement(string.Empty, "PGPTask", string.Empty);

                XmlAttribute sourceAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPSOURCEFILE, string.Empty);
                sourceAttr.Value = this.sourceFile;
                taskElement.Attributes.Append(sourceAttr);

                XmlAttribute targetAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPTARGETFILE, string.Empty);
                targetAttr.Value = this.targetFile;
                taskElement.Attributes.Append(targetAttr);

                XmlAttribute publicAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPPUBLICKEY, string.Empty);
                publicAttr.Value = this.publicKey;
                taskElement.Attributes.Append(publicAttr);

                XmlAttribute privateAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPPRIVATEKEY, string.Empty);
                privateAttr.Value = this.privateKey;
                taskElement.Attributes.Append(privateAttr);

                XmlAttribute passAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPPASSPHRASE, string.Empty);
                passAttr.Value = this.passPhrase;
                taskElement.Attributes.Append(passAttr);

                XmlAttribute fileActionAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPFILEACTION, string.Empty);
                fileActionAttr.Value = this.fileAction.ToString();
                taskElement.Attributes.Append(fileActionAttr);

                XmlAttribute overwriteRemoteAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPOVERWRITETARGET, string.Empty);
                overwriteRemoteAttr.Value = this.overwriteTarget.ToString();
                taskElement.Attributes.Append(overwriteRemoteAttr);

                XmlAttribute removeAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPREMOVESOURCE, string.Empty);
                removeAttr.Value = this.removeSource.ToString();
                taskElement.Attributes.Append(removeAttr);

                XmlAttribute armoredAttr = doc.CreateAttribute(string.Empty, CONSTANTS.PGPARMORED, string.Empty);
                armoredAttr.Value = this.isArmored.ToString();
                taskElement.Attributes.Append(armoredAttr);

                //add the new element to the package document
                doc.AppendChild(taskElement);
            }
            catch (Exception ex)
            {
                infoEvents.FireError(0, "Save To XML: ", ex.Message + ex.StackTrace, "", 0);
            }
        }
示例#46
0
 /// <summary>
 /// Saves settings to XML.
 /// </summary>
 /// <param name="doc">The doc.</param>
 /// <param name="infoEvents">The info events.</param>
 void IDTSComponentPersist.SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents)
 {
     try
     {
         //create node in the package xml document
         XmlElement taskElement = doc.CreateElement(string.Empty, "SFTPTask", string.Empty);
         doc.AppendChild(taskElement);
         taskElement.SetAttribute(CONSTANTS.SFTPLOCALFILE, null, this.localFile);
         taskElement.SetAttribute(CONSTANTS.SFTPREMOTEFILE, null, this.remoteFile);
         taskElement.SetAttribute(CONSTANTS.SFTPFILEACTION, null, this.fileAction.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPFILEINFO, null, this.fileInfo);
         taskElement.SetAttribute(CONSTANTS.SFTPOVERWRITEDEST, null, this.overwriteDest.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPREMOVESOURCE, null, this.removeSource.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPISRECURSIVE, null, this.isRecursive.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPFILEFILTER, null, this.fileFilter);
         //taskElement.SetAttribute(CONSTANTS.SFTPRETRIES, null, this.reTries.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPHOST, null, this.hostName);
         taskElement.SetAttribute(CONSTANTS.SFTPPORT, null, this.portNumber);
         taskElement.SetAttribute(CONSTANTS.SFTPUSER, null, this.userName);
         taskElement.SetAttribute(CONSTANTS.SFTPPASSWORD, null, this.passWord);
         taskElement.SetAttribute(CONSTANTS.SFTPSTOPONFAILURE, null, this.stopOnFailure.ToString());
         taskElement.SetAttribute(CONSTANTS.SFTPREMOTEFILELISTVAR, null, this.remoteFileListVariable);
         taskElement.SetAttribute(CONSTANTS.SFTPLOGLEVEL, null, this.logLevel.ToString());
     }
     catch (Exception ex)
     {
         infoEvents.FireError(0, "Save To XML: ", ex.Message + Environment.NewLine + ex.StackTrace, "", 0);
     }
 }
 public void LoadFromXML(XmlElement node, IDTSInfoEvents infoEvents)
 {
     if (node.Name != "SSHExecuteCommandTask")
     {
         throw new Exception("Unexpected task element when loading task.");
     }
     else
     {
         try
         {
             _commandText = node.Attributes.GetNamedItem("commandText").Value.Replace("\n", Environment.NewLine);
             _connMgrName = node.Attributes.GetNamedItem("connMgrName").Value;
         }
         catch
         {
             throw;
         }
     }
 }
        public void SaveToXML(System.Xml.XmlDocument doc, IDTSInfoEvents infoEvents)
        {
            XmlElement taskElement = doc.CreateElement(string.Empty, "SSHFTPTask", string.Empty);

            XmlAttribute SSHconnMgrNameAttribute = doc.CreateAttribute(string.Empty, "SSHconnMgrName", string.Empty);
            SSHconnMgrNameAttribute.Value = _SSHconnMgrName;

            XmlAttribute sendFilesSourceConnectionManagerNameAttribute = doc.CreateAttribute(string.Empty, "sendFilesSourceConnectionManagerName", string.Empty);
            sendFilesSourceConnectionManagerNameAttribute.Value = _sendFilesSourceConnectionManagerName;

            XmlAttribute sendFilesDestinationDirectoryAttribute = doc.CreateAttribute(string.Empty, "sendFilesDestinationDirectory", string.Empty);
            sendFilesDestinationDirectoryAttribute.Value = _sendFilesDestinationDirectory;

            XmlAttribute receiveFilesDestinationConnectionManagerNameAttribute = doc.CreateAttribute(string.Empty, "receiveFilesDestinationConnectionManagerName", string.Empty);
            receiveFilesDestinationConnectionManagerNameAttribute.Value = _receiveFilesDestinationConnectionManagerName;

            XmlAttribute receiveFilesSourceFileAttribute = doc.CreateAttribute(string.Empty, "receiveFilesSourceFile", string.Empty);
            receiveFilesSourceFileAttribute.Value = _receiveFilesSourceFile;

            XmlAttribute operationAttribute = doc.CreateAttribute(string.Empty, "operation", string.Empty);
            operationAttribute.Value = _operation.ToString();

            taskElement.Attributes.Append(SSHconnMgrNameAttribute);
            taskElement.Attributes.Append(sendFilesSourceConnectionManagerNameAttribute);
            taskElement.Attributes.Append(sendFilesDestinationDirectoryAttribute);
            taskElement.Attributes.Append(receiveFilesDestinationConnectionManagerNameAttribute);
            taskElement.Attributes.Append(receiveFilesSourceFileAttribute);
            taskElement.Attributes.Append(operationAttribute);
            doc.AppendChild(taskElement);
        }
示例#49
0
 public override void InitializeTask(Connections connections, VariableDispenser variableDispenser, IDTSInfoEvents events, IDTSLogging log, EventInfos eventInfos, LogEntryInfos logEntryInfos, ObjectReferenceTracker refTracker)
 {
     base.InitializeTask(connections, variableDispenser, events, log, eventInfos, logEntryInfos, refTracker);
 }
示例#50
0
 /// <summary>
 /// Simple validation. Runtime only!
 /// </summary>
 /// <param name="infoEvents"></param>
 /// <returns></returns>
 public override DTSExecResult Validate(IDTSInfoEvents infoEvents)
 {
     if (string.IsNullOrEmpty(this.HostName) || string.IsNullOrEmpty(this.UserName) || string.IsNullOrEmpty(this.Password))
     {
         infoEvents.FireError(0, "WinSCP Connection Manager", "Hostname, username and password are mandatory.", string.Empty, 0);
         return DTSExecResult.Failure;
     }
     else
     {
         return DTSExecResult.Success;
     }
 }