예제 #1
0
        protected override void DoExecute(CommandResult <string[]> result)
        {
            Assert.ArgumentNotNull(result, "result");

            var name = this.Name;

            Assert.ArgumentNotNullOrEmpty(name, "name");

            var profile          = Profile.Read();
            var connectionString = profile.GetValidConnectionString();

            InstanceManager.Initialize();
            var instance = InstanceManager.Instances.FirstOrDefault(x => x.Name.Equals(name, StringComparison.OrdinalIgnoreCase));

            Ensure.IsNotNull(instance, "instance is not found");

            PipelineManager.Initialize(XmlDocumentEx.LoadXml(PipelinesConfig.Contents).DocumentElement);

            var deleteArgs = new DeleteArgs(instance, connectionString);
            var controller = new AggregatePipelineController();

            PipelineManager.StartPipeline("delete", deleteArgs, controller, false);

            result.Success = !string.IsNullOrEmpty(controller.Message);
            result.Message = controller.Message;
            result.Data    = controller.GetMessages().ToArray();
        }
        protected override void DoExecute(CommandResultBase <string[]> result)
        {
            Assert.ArgumentNotNull(result, "result");

            var name = this.Name;

            Assert.ArgumentNotNullOrEmpty(name, "name");

            var product  = this.Product;
            var version  = this.Version;
            var revision = this.Revision;

            var profile    = Profile.Read();
            var repository = profile.LocalRepository;

            Assert.IsNotNullOrEmpty(repository, "Profile.LocalRepository is null or empty");
            Assert.IsTrue(Directory.Exists(repository), "Profile.LocalRepository points to non-existing folder");

            var license = profile.License;

            Assert.IsNotNullOrEmpty(license, "Profile.License is null or empty");
            Assert.IsTrue(File.Exists(license), "Profile.License points to non-existing file");

            var builder = profile.GetValidConnectionString();

            var instancesFolder = profile.InstancesFolder;

            Assert.IsNotNullOrEmpty(instancesFolder, "Profile.InstancesFolder is null or empty");
            Assert.IsTrue(Directory.Exists(instancesFolder), "Profile.InstancesFolder points to non-existing folder");

            var rootPath = Path.Combine(instancesFolder, name);

            Assert.IsTrue(!Directory.Exists(rootPath), "The folder already exists: {0}", rootPath);

            ProductManager.Initialize(repository);

            var distributive = ProductManager.FindProduct(ProductType.Standalone, product, version, revision);

            if (distributive == null)
            {
                result.Success = false;
                result.Message = "product not found";
                result.Data    = null;

                return;
            }

            PipelineManager.Initialize();

            var sqlServerAccountName = SqlServerManager.Instance.GetSqlServerAccountName(builder);
            var webServerIdentity    = Settings.CoreInstallWebServerIdentity.Value;
            var installArgs          = new InstallArgs(name, name, distributive, rootPath, builder, sqlServerAccountName, webServerIdentity, new FileInfo(license), true, false, false, false, false, false, true, new Product[0]);
            var controller           = new AggregatePipelineController();

            PipelineManager.StartPipeline("install", installArgs, controller, false);

            result.Success = !string.IsNullOrEmpty(controller.Message);
            result.Message = controller.Message;
            result.Data    = controller.GetMessages().ToArray();
        }
예제 #3
0
        protected override void DoExecute(CommandResult <string[]> result)
        {
            Assert.ArgumentNotNull(result, nameof(result));

            var name = Name;

            Assert.ArgumentNotNullOrEmpty(name, nameof(name));

            var hostNames = new[] { name };
            var sqlPrefix = name;
            var product   = Product;
            var version   = Version;
            var revision  = Revision;

            var profile    = Profile.Read();
            var repository = profile.LocalRepository;

            Ensure.IsNotNullOrEmpty(repository, "Profile.LocalRepository is not specified");
            Ensure.IsTrue(Directory.Exists(repository), "Profile.LocalRepository points to missing folder");

            var license = profile.License;

            Ensure.IsNotNullOrEmpty(license, "Profile.License is not specified");
            Ensure.IsTrue(File.Exists(license), "Profile.License points to missing file");

            var builder = profile.GetValidConnectionString();

            var instancesFolder = profile.InstancesFolder;

            Ensure.IsNotNullOrEmpty(instancesFolder, "Profile.InstancesFolder is not specified");
            Ensure.IsTrue(Directory.Exists(instancesFolder), "Profile.InstancesFolder points to missing folder");

            var rootPath = Path.Combine(instancesFolder, name);

            Ensure.IsTrue(!Directory.Exists(rootPath), "Folder already exists: {0}", rootPath);

            ProductManager.Initialize(repository);

            var distributive = ProductManager.FindProduct(ProductType.Standalone, product, version, revision);

            Ensure.IsNotNull(distributive, "product is not found");

            PipelineManager.Initialize(XmlDocumentEx.LoadXml(PipelinesConfig.Contents).DocumentElement);

            var sqlServerAccountName = SqlServerManager.Instance.GetSqlServerAccountName(builder);
            var webServerIdentity    = Settings.CoreInstallWebServerIdentity.Value;
            var installArgs          = new InstallArgs(name, hostNames, sqlPrefix, true, distributive, rootPath, builder, sqlServerAccountName, webServerIdentity, new FileInfo(license), true, false, false, false, false, false, true, true, new Product[0]);
            var controller           = new AggregatePipelineController();

            PipelineManager.StartPipeline("install", installArgs, controller, false);

            result.Success = !string.IsNullOrEmpty(controller.Message);
            result.Message = controller.Message;
            result.Data    = controller.GetMessages().ToArray();
        }
        protected override void DoExecute(CommandResultBase <string[]> result)
        {
            Assert.ArgumentNotNull(result, "result");

            var name = this.Name;

            Assert.ArgumentNotNullOrEmpty(name, "name");

            var product  = this.Module;
            var version  = this.Version;
            var revision = this.Revision;

            var profile    = Profile.Read();
            var repository = profile.LocalRepository;

            Assert.IsNotNullOrEmpty(repository, "Profile.LocalRepository is null or empty");
            Assert.IsTrue(Directory.Exists(repository), "Profile.LocalRepository points to non-existing folder");

            var license = profile.License;

            Assert.IsNotNullOrEmpty(license, "Profile.License is null or empty");
            Assert.IsTrue(File.Exists(license), "Profile.License points to non-existing file");

            var builder = profile.GetValidConnectionString();

            var instance = InstanceManager.GetInstance(name);

            Assert.IsNotNull(instance, "InstanceManager.GetInstance({0}) is null", name);

            ProductManager.Initialize(repository);

            var distributive = ProductManager.FindProduct(ProductType.Module, product, version, revision);

            if (distributive == null)
            {
                result.Success = false;
                result.Message = "product " + product + " not found";
                result.Data    = null;

                return;
            }

            PipelineManager.Initialize();

            var installArgs = new InstallModulesArgs(instance, new[] { distributive }, builder);
            var controller  = new AggregatePipelineController();

            PipelineManager.StartPipeline("installmodules", installArgs, controller, false);

            result.Success = !string.IsNullOrEmpty(controller.Message);
            result.Message = controller.Message;
            result.Data    = controller.GetMessages().ToArray();
        }
        protected override void DoExecute(CommandResult <string[]> result)
        {
            Assert.ArgumentNotNull(result, "result");

            var name = this.Name;

            Assert.ArgumentNotNullOrEmpty(name, "name");

            var product  = this.Module;
            var version  = this.Version;
            var revision = this.Revision;

            var profile    = Profile.Read();
            var repository = profile.LocalRepository;

            Ensure.IsNotNullOrEmpty(repository, "Profile.LocalRepository is not specified");
            Ensure.IsTrue(Directory.Exists(repository), "Profile.LocalRepository points to missing location");

            var license = profile.License;

            Ensure.IsNotNullOrEmpty(license, "Profile.License is not specified");
            Ensure.IsTrue(File.Exists(license), "Profile.License points to missing file");

            var builder = profile.GetValidConnectionString();

            var instance = InstanceManager.GetInstance(name);

            Ensure.IsNotNull(instance, "instance is not found", name);

            ProductManager.Initialize(repository);

            var distributive = ProductManager.FindProduct(ProductType.Module, product, version, revision);

            Ensure.IsNotNull(distributive, "product is not found");

            PipelineManager.Initialize(XmlDocumentEx.LoadXml(PipelinesConfig.Contents).DocumentElement);

            var installArgs = new InstallModulesArgs(instance, new[] { distributive }, builder);
            var controller  = new AggregatePipelineController();

            PipelineManager.StartPipeline("install", installArgs, controller, false);

            result.Success = !string.IsNullOrEmpty(controller.Message);
            result.Message = controller.Message;
            result.Data    = controller.GetMessages().ToArray();
        }
예제 #6
0
        protected override void DoExecute(Instance instance, CommandResult <string[]> result)
        {
            Assert.ArgumentNotNull(instance, nameof(instance));
            Assert.ArgumentNotNull(result, nameof(result));

            var profile          = Profile.Read();
            var connectionString = profile.GetValidConnectionString();

            PipelineManager.Initialize(XmlDocumentEx.LoadXml(PipelinesConfig.Contents).DocumentElement);

            var deleteArgs = new DeleteArgs(instance, connectionString);
            var controller = new AggregatePipelineController();

            PipelineManager.StartPipeline("delete", deleteArgs, controller, false);

            result.Success = !string.IsNullOrEmpty(controller.Message);
            result.Message = controller.Message;
            result.Data    = controller.GetMessages().ToArray();
        }