/// <summary>
        /// Executes command or batch file
        /// </summary>
        /// <param name="targetConfig">Target environment</param>
        /// <param name="commandFileName">Command file name relative to target service path</param>
        public override string ExecuteCommand(SreEnvironmentConfig targetConfig, string commandFileName)
        {
            EnvironmentServicePacket packet = new EnvironmentServicePacket(EnvironmentServiceCommands.ExecuteDOSCommand);

            packet.Params.Add("Command", commandFileName);
            return(CreateAndCopyFile(targetConfig, packet) ? Constants.success : Constants.failed);
        }
        public override FileTransferPacket GetConfigFile(SreEnvironmentConfig toEnvironment, string configFileName)
        {
            EnvironmentServicePacket packet = new EnvironmentServicePacket();

            packet.ConfigFileName = configFileName;
            return(GetWcfClient(toEnvironment).GetConfigFile(packet));
        }
        /// <summary>
        /// Deploys data source into specific environment
        /// </summary>
        /// <param name="targetConfig">Target environment</param>
        public override string ProcessFile(SreEnvironmentConfig targetConfig, int datasourceId, string fileName)
        {
            string destFileName = Path.Combine(targetConfig.Environment.PullFolder, "100", Path.GetFileName(fileName));

            File.Copy(fileName, destFileName, true);
            return("success");
        }
        /// <summary>
        /// Restarts service
        /// </summary>
        /// <param name="targetConfig">Target environment</param>
        /// <param name="dataSourceId">Data source id</param>
        public override string StartSqlPuller(SreEnvironmentConfig targetConfig, int dataSourceId)
        {
            EnvironmentServicePacket packet = new EnvironmentServicePacket(EnvironmentServiceCommands.StartSqlPuller);

            packet.DataSourceId = dataSourceId;
            return(CreateAndCopyFile(targetConfig, packet) ? Constants.success : Constants.failed);
        }
        public override FileTransferPacket GetConfigFile(SreEnvironmentConfig targetConfig, string configFileName)
        {
            FileTransferPacket packet = new FileTransferPacket();

            packet.FileName = configFileName + ".config";
            packet.Content  = File.ReadAllBytes(configFileName + ".config");
            return(packet);
        }
 public override string ProcessFile(SreEnvironmentConfig toEnvironment, int dataSourceId, string fileName)
 {
     Packet.DataSourceId                = dataSourceId;
     Packet.FileTransferPacket          = new FileTransferPacket();
     Packet.FileTransferPacket.FileName = fileName;
     Packet.FileTransferPacket.Content  = File.ReadAllBytes(fileName);
     return(GetWcfClient(toEnvironment).ProcessFile(Packet));
 }
        public override string DeploySdf(SreEnvironmentConfig toEnvironment)
        {
            string sourceFileName = ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].GetSdfFileName();

            Packet.FileTransferPacket          = new FileTransferPacket();
            Packet.FileTransferPacket.FileName = sourceFileName;
            Packet.FileTransferPacket.Content  = File.ReadAllBytes(sourceFileName);
            return(GetWcfClient(toEnvironment).DeploySdf(Packet));
        }
        /// <summary>
        /// Deploys data source into specific environment
        /// </summary>
        /// <param name="targetConfig">Target environment</param>
        public override string DeploySdf(SreEnvironmentConfig targetConfig)
        {
            string sourceFileName = ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].GetSdfFileName();

            Packet.FileTransferPacket          = new FileTransferPacket();
            Packet.FileTransferPacket.FileName = sourceFileName;
            Packet.FileTransferPacket.Content  = File.ReadAllBytes(sourceFileName);
            return(CreateAndCopyFile(targetConfig, Packet) ? Constants.success : Constants.failed);
        }
        public override FileTransferPacket GetLastDeploymentLog(SreEnvironmentConfig fromEnvironment)
        {
            FileTransferPacket packet = new FileTransferPacket();

            packet.FileName = Path.Combine(fromEnvironment.Environment.RootFolder, "sreupdate.log");
            if (File.Exists(packet.FileName))
            {
                packet.Content = File.ReadAllBytes(packet.FileName);
            }
            return(packet);
        }
 public override string DeployArtifacts(SreEnvironmentConfig toEnvironment)
 {
     if (base.DeployArtifacts(toEnvironment) == Constants.success)
     {
         return(CreateAndCopyFile(toEnvironment, Packet) ? Constants.success : Constants.failed);
     }
     else
     {
         return(Constants.failed);
     }
 }
        private string GetEnvironmentTargetLocation(SreEnvironmentConfig targetConfig)
        {
            string destFileName = Path.Combine(targetConfig.Environment.PullFolder, "100", ShortGuid.NewGuid().Value + ".sred");

            if (!Directory.Exists(Path.GetDirectoryName(destFileName)))
            {
                throw new DirectoryNotFoundException(string.Format("The directory '{0}' does not exist on '{1}' environment, please make sure the environment is correctly configured!",
                                                                   Path.GetDirectoryName(destFileName), targetConfig.Environment.Name));
            }

            return(destFileName);
        }
 public override string DeployArtifacts(SreEnvironmentConfig toEnvironment)
 {
     if (base.DeployArtifacts(toEnvironment) == Constants.success)
     {
         GetWcfClient(toEnvironment).DeployArtifacts(Packet);
         return(Constants.success);
     }
     else
     {
         return(Constants.failed);
     }
 }
 private bool CreateAndCopyFile(SreEnvironmentConfig targetConfig, EnvironmentServicePacket packet)
 {
     try
     {
         string       sourceFileName = Path.Combine(Path.GetTempPath(), ShortGuid.NewGuid().Value + ".sred");
         StreamWriter sw             = new StreamWriter(sourceFileName);
         sw.Write(packet.Serialize());
         sw.Close();
         File.Copy(sourceFileName, GetEnvironmentTargetLocation(targetConfig), true);
         return(true);
     }
     catch (Exception ex)
     {
         CallCallBack(ex.Message, true);
         return(false);
     }
 }
예제 #14
0
        public virtual string DeployArtifacts(SreEnvironmentConfig toEnvironment)
        {
            Packet.Command            = EnvironmentServiceCommands.DeployArtifacts;
            Packet.FileTransferPacket = new FileTransferPacket();
            DeploymentService deploymentService = new DeploymentService();

            deploymentService.Callback        += CallbackEvent;
            Packet.FileTransferPacket.FileName = deploymentService.PickupDlls();
            if (!string.IsNullOrEmpty(Packet.FileTransferPacket.FileName))
            {
                Packet.FileTransferPacket.Content = File.ReadAllBytes(Packet.FileTransferPacket.FileName);
                return(Constants.success);
            }
            else
            {
                return(Constants.failed);
            }
        }
예제 #15
0
 public abstract string RestartService(SreEnvironmentConfig toEnvironment);
예제 #16
0
 public virtual string DeployKeys(SreEnvironmentConfig toEnvironment, List <IdpeKey> keys)
 {
     Packet.DataSourceBundle = new DataSourceBundle();
     Packet.DataSourceBundle.Keys.AddRange(keys);
     return(Constants.success);
 }
예제 #17
0
 public abstract string DeploySdf(SreEnvironmentConfig toEnvironment);
예제 #18
0
 public virtual string DeployDataSource(SreEnvironmentConfig toEnvironment, int datasourceId)
 {
     Packet.DataSourceBundle = new DataSourceBundle();
     Packet.DataSourceBundle.Export(datasourceId, true);
     return(Constants.success);
 }
예제 #19
0
 public virtual string DeployRule(SreEnvironmentConfig toEnvironment, IdpeRule rule)
 {
     Packet.DataSourceBundle = new DataSourceBundle();
     Packet.DataSourceBundle.Rules.Add(rule);
     return(Constants.success);
 }
예제 #20
0
 public abstract FileTransferPacket GetLastDeploymentLog(SreEnvironmentConfig fromEnvironment);
예제 #21
0
 public virtual string SetServiceLogonUser(SreEnvironmentConfig toEnvironment, string batchFileContent)
 {
     Packet.Params.Add("BatchFileContent", batchFileContent);
     return(Constants.success);
 }
예제 #22
0
 public abstract FileTransferPacket GetConfigFile(SreEnvironmentConfig toEnvironment, string configFileName);
예제 #23
0
 public abstract string SetConfigFile(SreEnvironmentConfig toEnvironment, FileTransferPacket fileTransferPacket);
예제 #24
0
 public abstract string ProcessFile(SreEnvironmentConfig toEnvironment, int datasourceId, string fileName);
예제 #25
0
 public abstract List <IdpeDataSource> GetDataSources(SreEnvironmentConfig toEnvironment);
예제 #26
0
 public abstract string ExecuteCommand(SreEnvironmentConfig toEnvironment, string commandFileName);
예제 #27
0
 public abstract string StartSqlPuller(SreEnvironmentConfig toEnvironment, int datasourceId);
예제 #28
0
 public abstract string StopService(SreEnvironmentConfig toEnvironment);
 /// <summary>
 /// Deploys data source into specific targetConfigironment
 /// </summary>
 /// <param name="toConfig">Target environment</param>
 /// <param name="rule">The rule object</param>
 public override string DeployRule(SreEnvironmentConfig toEnvironment, IdpeRule rule)
 {
     base.DeployRule(toEnvironment, rule);
     return(CreateAndCopyFile(toEnvironment, Packet) ? Constants.success : Constants.failed);
 }
 /// <summary>
 /// Deploys data source into specific targetConfigironment
 /// </summary>
 /// <param name="toConfig">Target environment</param>
 public override string DeployKeys(SreEnvironmentConfig toEnvironment, List <IdpeKey> keys)
 {
     base.DeployKeys(toEnvironment, keys);
     return(CreateAndCopyFile(toEnvironment, Packet) ? Constants.success : Constants.failed);
 }