public override async Task ExecuteAsync(List <string> arguments)
        {
            try
            {
                List <string> serverLines = SystemConfiguration.GetInstance().GetServerLines();
                if (serverLines == null || serverLines.Count == 0)
                {
                    throw new ApplySystemConfigurationException("No configuration provided. Please configure the system first.");
                }

                string servers    = SystemConfiguration.GetInstance().GetServersArgument();
                string partitions = SystemConfiguration.GetInstance().GetPartitionsArgument();

                await ApplySystemConfigurationController.Execute(ConnectionManager, serverLines, servers, partitions);

                txtBoxOutput.AppendText(Environment.NewLine + "System Configuration Applied.");
            }
            catch (ApplySystemConfigurationException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new ApplySystemConfigurationException("Apply system configuration (internal command)", e);
            }
        }
Exemple #2
0
        public override async Task ExecuteAsync(List <string> arguments)
        {
            if (arguments.Count != EXPECTED_ARGUMENTS)
            {
                txtBoxOutput.AppendText(Environment.NewLine + "Expected a minimum of " + EXPECTED_ARGUMENTS + " arguments but found " + arguments.Count + ".");
                return;
            }

            string username   = arguments.ElementAt(0);
            string clientURL  = arguments.ElementAt(1);
            string scriptFile = arguments.ElementAt(2);
            string partitions = SystemConfiguration.GetInstance().GetPartitionsArgument();
            string servers    = SystemConfiguration.GetInstance().GetServersArgument();

            await CreateClientController.Execute(ConnectionManager, username, clientURL, scriptFile, servers, partitions);

            ConnectionManager.SetNewClientConnection(username, clientURL);
            txtBoxOutput.AppendText(Environment.NewLine + "Client Created.");
        }
        public override Task ExecuteAsync(List <string> arguments)
        {
            if (arguments.Count != EXPECTED_ARGUMENTS)
            {
                throw new ApplySystemConfigurationException($"Expected {EXPECTED_ARGUMENTS} arguments but found {arguments.Count}.");
            }

            try
            {
                SystemConfiguration.GetInstance().AddServerConfig(string.Join(" ", arguments));
                ConnectionManager.SetNewServerConnection(arguments[0], arguments[1]);
                txtBoxOutput.AppendText(Environment.NewLine + "Server Configured.");
            }
            catch (Exception e)
            {
                throw new ApplySystemConfigurationException("Create server command", e);
            }
            return(Task.CompletedTask);
        }
Exemple #4
0
        public override Task ExecuteAsync(List <string> arguments)
        {
            try
            {
                int serversNumber = Int32.Parse(arguments[0]);
                int MAX_ARGUMENTS = EXPECTED_ARGUMENTS + serversNumber;
                if (arguments.Count != MAX_ARGUMENTS)
                {
                    throw new ApplySystemConfigurationException($"Expected {MAX_ARGUMENTS} arguments but found {arguments.Count}.");
                }

                SystemConfiguration.GetInstance().AddPartitionConfig(string.Join(" ", arguments));
                txtBoxOutput.AppendText(Environment.NewLine + "Partition Configured.");
            }
            catch (ApplySystemConfigurationException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new ApplySystemConfigurationException("Create partition command", e);
            }
            return(Task.CompletedTask);
        }