Beispiel #1
0
        protected override void GetChildItems(string path, bool recurse)
        {
            if (PathIsDrive(path))
            {
                NodeDetail thisNode = new NoSDbDetail(null, this.PSDriveInfo);
                WriteItemObject("\n    Context: " + path + "\n", path, false);
                PrintableTable childs = thisNode.ChilderanTable;
                WriteItemObject(childs.GetTableRows(), path, false);
                WriteItemObject("", path, false);
            }
            else
            {
                try
                {
                    ConfigurationConnection.UpdateClusterConfiguration();
                    ConfigurationConnection.UpdateDatabaseClusterInfo();
                }
                catch (Exception ex)
                {
                    throw ex;
                }


                string[]   pathChunks = SplitPath(path);
                NodeDetail thisNode;
                if (new NoSDbDetail(pathChunks, this.PSDriveInfo).TryGetNodeDetail(out thisNode))
                {
                    WriteItemObject("\n    Context: " + path + "\n", path, false);
                    PrintableTable childs = thisNode.ChilderanTable;
                    WriteItemObject(childs.GetTableRows(), path, false);
                    WriteItemObject("", path, false);
                }
            }
        }
Beispiel #2
0
 public ServerValueDetail(string nodeName, PathType nodeType, ServerDetail configuration, string[] pathChunks)
 {
     NodeName       = nodeName;
     NodeType       = nodeType;
     IsContainer    = true;
     IsValid        = true;
     Configuration  = configuration;
     PathChunks     = pathChunks;
     ChilderanTable = new PrintableTable();
     ChilderanTable.AddHeader("Priority");
     ChilderanTable.AddRow(((ServerDetail)configuration).Priority.ToString());
 }
Beispiel #3
0
 internal CollectionValueDetail(string databaseName, string nodeName, CollectionConfiguration configuration, string[] pathChunks)
 {
     _databaseName  = databaseName;
     NodeName       = nodeName;
     NodeType       = PathType.Collection;
     IsContainer    = true;
     IsValid        = true;
     Configuration  = configuration;
     PathChunks     = pathChunks;
     ChilderanTable = new PrintableTable();
     ChilderanName  = new List <string>();
     ChilderanTable.AddRow(ProviderUtil.INDICES);
     ChilderanName.Add(ProviderUtil.INDICES);
 }
Beispiel #4
0
 public DatabaseValueDetail(string nodeName, DatabaseConfiguration configuration, string[] pathChunks)
 {
     NodeName       = nodeName;
     NodeType       = PathType.Database;
     IsContainer    = true;
     IsValid        = true;
     Configuration  = configuration;
     PathChunks     = pathChunks;
     ChilderanTable = new PrintableTable();
     ChilderanName  = new List <string>();
     ChilderanTable.AddRow(ProviderUtil.COLLECTIONS);
     ChilderanName.Add(ProviderUtil.COLLECTIONS);
     ChilderanTable.AddRow(ProviderUtil.FUNCTIONS);
     ChilderanName.Add(ProviderUtil.FUNCTIONS);
 }
Beispiel #5
0
        public ShardValueDetail(string nodeName, ShardConfiguration configuration, string[] pathChunks)
        {
            NodeName       = nodeName;
            NodeType       = PathType.Shard;
            IsContainer    = true;
            IsValid        = true;
            Configuration  = configuration;
            PathChunks     = pathChunks;
            ChilderanTable = new PrintableTable();
            ChilderanName  = new List <string>();
            ClusterInfo       clusterInfo = ConfigurationConnection.ClusterInfo;
            ShardInfo         shardInfo   = clusterInfo.GetShard(nodeName);
            List <ServerInfo> running     = new List <ServerInfo>();

            if (shardInfo != null)
            {
                if (shardInfo.RunningNodes != null)
                {
                    running = shardInfo.RunningNodes.Values.ToList();
                }
            }
            ChilderanTable.AddHeader("Node IP Address", "Running Status", "Primary Status", "Priority");

            foreach (ServerNode node in configuration.Servers.Nodes.Values)
            {
                ServerInfo serverInfo = null;
                string     isPrimery  = ProviderUtil.NOT_PRIMARY;
                string     isRunning  = ProviderUtil.NOT_RUNNING;
                if (running != null)
                {
                    serverInfo = running.Find(x => x.Address.ip.Equals(node.Name));
                }

                if (serverInfo != null)
                {
                    if (running.Contains(serverInfo))
                    {
                        isRunning = ProviderUtil.RUNNING;
                    }
                    if (shardInfo.Primary != null && serverInfo.Equals(shardInfo.Primary))
                    {
                        isPrimery = ProviderUtil.PRIMARY;
                    }
                }
                ChilderanTable.AddRow(node.Name, isRunning, isPrimery, node.Priority.ToString());
                ChilderanName.Add(node.Name);
            }
        }
Beispiel #6
0
        internal LocalDatabaseDetail(string nodeName, bool isContainer, bool isValid,
                                     ClusterConfiguration configuration, string[] pathChunks)
        {
            NodeName       = nodeName;
            NodeType       = PathType.LocalDB;
            IsContainer    = isContainer;
            IsValid        = isValid;
            Configuration  = configuration;
            ChilderanTable = new PrintableTable();
            ChilderanTable.AddRow(ProviderUtil.DATABASES);
            ChilderanName = new List <string>();
            ChilderanName.Add(ProviderUtil.DATABASES);
            string tableString = ChilderanTable.GetTableRows();

            PathChunks = pathChunks;
        }
Beispiel #7
0
 internal DatabasesDetail(string nodeName, DatabaseConfigurations configuration, string[] pathChunks)
 {
     NodeName       = nodeName;
     NodeType       = PathType.Databases;
     IsContainer    = true;
     IsValid        = true;
     Configuration  = configuration;
     PathChunks     = pathChunks;
     ChilderanTable = new PrintableTable();
     ChilderanTable.AddHeader("Database name", "Provider");
     ChilderanName = new List <string>();
     foreach (var db in configuration.Configurations.Values)
     {
         ChilderanName.Add(db.Name);
         ChilderanTable.AddRow(db.Name, db.Storage.StorageProvider.StorageProviderType.ToString());
     }
 }
Beispiel #8
0
        public ShardsDetail(string nodeName, DeploymentConfiguration configuration, string[] pathChunks)
        {
            NodeName       = nodeName;
            NodeType       = PathType.Shards;
            IsContainer    = true;
            IsValid        = true;
            Configuration  = configuration;
            ChilderanTable = new PrintableTable();
            PathChunks     = pathChunks;
            ChilderanName  = new List <string>();
            ChilderanTable.AddHeader("Shard Name", "Node(s)", "Status", "Shard Port");
            ClusterInfo clusterInfo = ConfigurationConnection.ClusterInfo;

            foreach (ShardConfiguration shard in configuration.Shards.Values)
            {
                List <string> status    = new List <string>();
                ShardInfo     shardInfo = clusterInfo.GetShard(shard.Name);
                if (shardInfo != null)
                {
                    foreach (String node in shard.Servers.Nodes.Keys)
                    {
                        string statusString = "";
                        if (shardInfo.RunningNodes.Values.ToList().Exists(k => k.Address.IpAddress.ToString().Equals(node)))
                        {
                            statusString = ProviderUtil.STARTED;

                            if (shardInfo.Primary != null)
                            {
                                if (shardInfo.Primary.Address.IpAddress.ToString().Equals(node))
                                {
                                    statusString += ProviderUtil.PRIMARY_STATUS;
                                }
                            }
                        }
                        else
                        {
                            statusString = ProviderUtil.STOPPED;
                        }
                        status.Add(statusString);
                    }
                }

                ChilderanTable.AddMultiLineRow(new string[] { shard.Name }, shard.Servers.Nodes.Keys.ToArray(), status.ToArray(), new string[] { shard.Port.ToString() });
                ChilderanName.Add(shard.Name);
            }
        }
Beispiel #9
0
 internal CollectionsDetail(string databaseName, string nodeName, CollectionConfigurations configuration, string[] pathChunks)
 {
     _databaseName  = databaseName;
     NodeName       = nodeName;
     NodeType       = PathType.Collections;
     IsContainer    = true;
     IsValid        = true;
     ChilderanTable = new PrintableTable();
     Configuration  = configuration;
     ChilderanTable = new PrintableTable();
     ChilderanTable.AddHeader("Name", "Type", "Detail");
     ChilderanName = new List <string>();
     foreach (CollectionConfiguration cConfig in configuration.Configuration.Values)
     {
         ChilderanTable.AddRow(cConfig.CollectionName, "Non Sharded", cConfig.Shard);
     }
     PathChunks = pathChunks;
 }
Beispiel #10
0
 internal NoSDbDetail(string[] pathChunks, PSDriveInfo drive)
 {
     if (ConfigurationConnection.ClusterConfiguration != null)
     {
         PathChunks = pathChunks;
         Drive      = (NosDBPSDriveInfo)drive;
         ClusterConfiguration configuration = ConfigurationConnection.ClusterConfiguration;
         new ConfigClusterInfo(ConfigurationConnection.ConfigCluster);
         Configuration  = configuration;
         IsContainer    = true;
         IsValid        = true;
         NodeType       = PathType.NoSDB;
         ChilderanName  = new List <string>();
         ChilderanTable = new PrintableTable();
         ChilderanTable.AddHeader("Database Cluster");
         ChilderanTable.AddRow(ConfigurationConnection.ClusterConfiguration.DisplayName);
         ChilderanName.Add(ConfigurationConnection.ClusterConfiguration.DisplayName);
     }
 }
Beispiel #11
0
 internal IndexValueDetail(string nodeName,
                           IndexConfiguration configuration, string[] pathChunks, string databaseName)
 {
     _databaseName  = databaseName;
     NodeName       = nodeName;
     NodeType       = PathType.Index;
     IsContainer    = true;
     IsValid        = true;
     Configuration  = configuration;
     PathChunks     = pathChunks;
     ChilderanTable = new PrintableTable();
     ChilderanName  = new List <string>();
     ChilderanTable.AddHeader("Attribute Name", "Order");
     if (configuration.Attributes != null)
     {
         ChilderanTable.AddRow(configuration.Attributes.Name, configuration.Attributes.Order);
         ChilderanName.Add(configuration.Attributes.Name);
     }
 }
Beispiel #12
0
 internal IndicesValueDetail(string nodeName,
                             Indices configuration, string[] pathChunks, string databaseName)
 {
     NodeName       = nodeName;
     NodeType       = PathType.Indexes;
     IsContainer    = true;
     IsValid        = true;
     Configuration  = configuration;
     PathChunks     = pathChunks;
     ChilderanTable = new PrintableTable();
     ChilderanTable.AddHeader("Indices");
     ChilderanName = new List <string>();
     if (configuration.IndexConfigurations != null)
     {
         foreach (IndexConfiguration index in configuration.IndexConfigurations.Values)
         {
             ChilderanName.Add(index.IndexName);
             ChilderanTable.AddRow(index.IndexName);
         }
     }
 }
Beispiel #13
0
 public ConfigurationNodesDetail(string nodeName, bool isContainer, bool isValid,
                                 ConfigClusterInfo configCluster, string[] pathChunks)
 {
     NodeName       = nodeName;
     NodeType       = PathType.ConfigurationNodes;
     IsContainer    = isContainer;
     IsValid        = isValid;
     Configuration  = configCluster;
     PathChunks     = pathChunks;
     ChilderanTable = new PrintableTable();
     ChilderanTable.AddHeader("Node IP Address", "Status");
     ChilderanName = new List <string>();
     foreach (ServerDetail server in ((ConfigClusterInfo)this.Configuration).Servers)
     {
         ChilderanName.Add(server.IPAddress);
         string statusString = ConfigurationConnection.Current.ConfigServerIP.Equals(server.IPAddress)
             ? ProviderUtil.ACTIVE
             : "";
         ChilderanTable.AddRow(server.IPAddress, statusString);
     }
 }
        internal ConfigManagerDetail(string nodeName, bool isContainer, bool isValid,
                                     ClusterConfiguration configuration, string[] pathChunks)
        {
            NodeName       = nodeName;
            NodeType       = PathType.ConfigurationManager;
            IsContainer    = isContainer;
            IsValid        = isValid;
            Configuration  = configuration;
            ChilderanTable = new PrintableTable(" ");
            ChilderanName  = new List <string>();
            ChilderanTable.AddRow(ProviderUtil.DATABASES);
            ChilderanName.Add(ProviderUtil.DATABASES);
            if (!ConfigurationConnection.ClusterConfiguration.DisplayName.Equals(MiscUtil.STAND_ALONE))
            {
                ChilderanTable.AddRow(ProviderUtil.SHARDS);
                ChilderanName.Add(ProviderUtil.SHARDS);
                ChilderanTable.AddRow(ProviderUtil.CONFIGCLUSTER);
                ChilderanName.Add(ProviderUtil.CONFIGCLUSTER);
            }

            ChilderanTable.GetTableRows();
            PathChunks = pathChunks;
        }
Beispiel #15
0
 public TableRow(PrintableTable printableTable)
 {
     // TODO: Complete member initialization
     this.printableTable = printableTable;
 }