예제 #1
0
        protected override string[] ExpandPath(string path)
        {
            List <string> childs = new List <string>();

            string[]   pathChunks = SplitPath(path);
            NodeDetail thisNode   = null;

            if (pathChunks[pathChunks.Length - 1].EndsWith("*"))
            {
                NodeDetail parent = null;
                if (TryGetParentDetail(path, out parent))
                {
                    if (parent.ChilderanName != null)
                    {
                        string partialName = pathChunks[pathChunks.Length - 1].Split('*')[0];
                        string parentPath  = path.Substring(0, path.LastIndexOf(ProviderUtil.SEPARATOR));
                        foreach (string child in parent.ChilderanName)
                        {
                            if (child.ToLower().StartsWith(partialName.ToLower()))
                            {
                                childs.Add(parentPath + "\\" + child);
                            }
                        }
                    }
                }
            }

            return(childs.ToArray());
        }
예제 #2
0
        public override bool TryGetNodeDetail(out NodeDetail nodeDetail)
        {
            NodeDetail thisNodeDetail;
            bool       sucess;

            string[] childPathChunks = new string[this.PathChunks.Length - 1];
            Array.Copy(this.PathChunks, 1, childPathChunks, 0, this.PathChunks.Length - 1);

            switch (PathChunks[0].ToLower())
            {
            case ProviderUtil.COLLECTIONS:
                thisNodeDetail = new CollectionsDetail(NodeName, PathChunks[0], ((DatabaseConfiguration)Configuration).Storage.Collections,
                                                       childPathChunks);
                sucess = true;
                break;

            default:
                thisNodeDetail = null;
                sucess         = false;
                break;
            }

            if (PathChunks.Length == 1)
            {
                nodeDetail = thisNodeDetail;
                return(sucess);
            }
            return(thisNodeDetail.TryGetNodeDetail(out nodeDetail));
        }
예제 #3
0
        public override bool TryGetNodeDetail(out NodeDetail nodeDetail)
        {
            if (PathChunks.Length == 0)
            {
                nodeDetail = new EndNodeDetail();
                return(false);
            }
            if (string.IsNullOrEmpty(ConfigurationConnection.ClusterConfiguration.DisplayName) || (!PathChunks[0].Equals(ConfigurationConnection.ClusterConfiguration.DisplayName)))
            {
                nodeDetail = this;
                return(false);
            }
            NodeDetail thisNode = new EndNodeDetail();
            bool       sucess   = false;

            string[] childPathChunks = new string[this.PathChunks.Length - 1];
            Array.Copy(this.PathChunks, 1, childPathChunks, 0, this.PathChunks.Length - 1);
            if (PathChunks[0].Equals(ConfigurationConnection.ClusterConfiguration.DisplayName))
            {
                thisNode = new ConfigManagerDetail(PathChunks[0], true, true, (ClusterConfiguration)this.Configuration,
                                                   childPathChunks);
            }
            else if (PathChunks[0].Equals(MiscUtil.STAND_ALONE))
            {
                thisNode = new LocalDatabaseDetail(PathChunks[0], true, true, (ClusterConfiguration)this.Configuration
                                                   , childPathChunks);
            }
            if (PathChunks.Length == 1)
            {
                nodeDetail = thisNode;
                return(true);
            }
            return(thisNode.TryGetNodeDetail(out nodeDetail));
        }
예제 #4
0
        public override bool TryGetNodeDetail(out NodeDetail nodeDetail)
        {
            NodeDetail         thisNode       = new EndNodeDetail();
            List <string>      childernNaames = new List <string>();
            ShardConfiguration shardConfig    = (ShardConfiguration)Configuration;

            foreach (ServerNode node in shardConfig.Servers.Nodes.Values)
            {
                if (node.Name.Equals(PathChunks[0]))
                {
                    childernNaames.Add(node.Priority.ToString());
                    string[] childPathChunks = new string[this.PathChunks.Length - 1];
                    Array.Copy(this.PathChunks, 1, childPathChunks, 0, this.PathChunks.Length - 1);
                    ServerDetail s1 = new ServerDetail()
                    {
                        IPAddress = node.Name,
                        Priority  = node.Priority
                    };
                    thisNode = new ServerValueDetail(PathChunks[0], PathType.Server, s1, childPathChunks);
                }
            }
            if (PathChunks.Length == 1)
            {
                nodeDetail = thisNode;
                return(true);
            }

            return(thisNode.TryGetNodeDetail(out nodeDetail));
        }
예제 #5
0
        public override bool TryGetNodeDetail(out NodeDetail nodeDetail)
        {
            NodeDetail    thisNodeDetail;
            bool          sucess;
            List <object> childernNaames = new List <object>();

            string[] childPathChunks = new string[this.PathChunks.Length - 1];
            Array.Copy(this.PathChunks, 1, childPathChunks, 0, this.PathChunks.Length - 1);
            switch (PathChunks[0].ToLower())
            {
            case ProviderUtil.DATABASES:
                DatabaseConfigurations databasees = ((ClusterConfiguration)Configuration).Databases;

                thisNodeDetail = new DatabasesDetail(PathChunks[0], databasees, childPathChunks);

                sucess = true;
                break;

            default:
                thisNodeDetail = new EndNodeDetail();
                sucess         = false;
                break;
            }

            if (PathChunks.Length == 1)
            {
                nodeDetail = thisNodeDetail;
                return(sucess);
            }
            return(thisNodeDetail.TryGetNodeDetail(out nodeDetail));
        }
예제 #6
0
        public override bool TryGetNodeDetail(out NodeDetail nodeDetail)
        {
            NodeDetail thisNodeDetail;
            bool       sucess;

            string[] childPathChunks = new string[this.PathChunks.Length - 1];
            Array.Copy(this.PathChunks, 1, childPathChunks, 0, this.PathChunks.Length - 1);

            switch (PathChunks[0].ToLower())
            {
            case ProviderUtil.INDICES:
                thisNodeDetail = new IndicesValueDetail(PathChunks[0], ((CollectionConfiguration)Configuration).Indices, childPathChunks, DatabaseName);
                sucess         = true;
                break;

            default:
                thisNodeDetail = null;
                sucess         = false;
                break;
            }

            if (PathChunks.Length == 1)
            {
                nodeDetail = thisNodeDetail;
                return(sucess);
            }
            return(thisNodeDetail.TryGetNodeDetail(out nodeDetail));
        }
예제 #7
0
        protected override bool ItemExists(string path)
        {
            if (PathIsDrive(path))
            {
                return(true);
            }
            string[] pathChunks = SplitPath(path);
            if (path.EndsWith("*"))
            {
                NodeDetail parent = null;
                if (TryGetParentDetail(path, out parent))
                {
                    string partialName = pathChunks[pathChunks.Length - 1].Split('*')[0];
                    foreach (string child in parent.ChilderanName)
                    {
                        if (child.ToLower().StartsWith(partialName.ToLower()))
                        {
                            return(true);
                        }
                    }
                }
            }

            else
            {
                NodeDetail thisNode;
                if (new NoSDbDetail(pathChunks, this.PSDriveInfo).TryGetNodeDetail(out thisNode))
                {
                    return(thisNode.IsValid);
                }
            }
            return(false);
        }
예제 #8
0
        public override bool TryGetNodeDetail(out NodeDetail nodeDetail)
        {
            NodeDetail    thisNode       = new EndNodeDetail();
            bool          sucess         = false;
            List <string> childernNaames = new List <string>();

            foreach (var node in ((ConfigClusterInfo)Configuration).Servers)
            {
                if (node.IPAddress.Equals(PathChunks[0]))
                {
                    childernNaames.Add(node.Priority.ToString());
                    string[] childPathChunks = new string[this.PathChunks.Length - 1];
                    Array.Copy(this.PathChunks, 1, childPathChunks, 0, this.PathChunks.Length - 1);

                    thisNode = new ServerValueDetail(PathChunks[0], PathType.ConfigurationNode, node, childPathChunks);
                    sucess   = true;
                }
            }
            if (PathChunks.Length == 1)
            {
                nodeDetail = thisNode;
                return(sucess);
            }
            return(thisNode.TryGetNodeDetail(out nodeDetail));
        }
예제 #9
0
        private bool TryGetParentDetail(string path, out NodeDetail thisNode)
        {
            string[] pathChunks = SplitPath(path);
            if (pathChunks.Length == 1)
            {
                thisNode = new NoSDbDetail(null, PSDriveInfo);
                return(true);
            }
            var parentChunks = new string[pathChunks.Length - 1];

            Array.Copy(pathChunks, 0, parentChunks, 0, pathChunks.Length - 1);
            return(new NoSDbDetail(parentChunks, PSDriveInfo).TryGetNodeDetail(out thisNode));
        }
예제 #10
0
 public override bool TryGetNodeDetail(out NodeDetail nodeDetail)
 {
     if (ChilderanName.Contains(PathChunks[0]))
     {
         nodeDetail = new EndNodeDetail(PathChunks[0], PathType.IndexAttribute, true);
         return(true);
     }
     else
     {
         nodeDetail = new EndNodeDetail();
         return(false);
     }
 }
예제 #11
0
        public override bool TryGetNodeDetail(out NodeDetail nodeDetail)
        {
            NodeDetail    thisNodeDetail;
            bool          sucess;
            List <object> childernNaames = new List <object>();

            string[] childPathChunks = new string[this.PathChunks.Length - 1];
            Array.Copy(this.PathChunks, 1, childPathChunks, 0, this.PathChunks.Length - 1);

            switch (PathChunks[0].ToLower())
            {
            case ProviderUtil.SHARDS:
                DeploymentConfiguration deployment = ((ClusterConfiguration)Configuration).Deployment;

                thisNodeDetail = new ShardsDetail(PathChunks[0], deployment, childPathChunks);

                sucess = true;
                break;

            case ProviderUtil.DATABASES:
                DatabaseConfigurations databasees = ((ClusterConfiguration)Configuration).Databases;

                thisNodeDetail = new DatabasesDetail(PathChunks[0], databasees, childPathChunks);

                sucess = true;
                break;

            case ProviderUtil.CONFIGCLUSTER:

                thisNodeDetail = new ConfigurationNodesDetail(PathChunks[0], true, true,
                                                              new ConfigClusterInfo(ConfigurationConnection.ConfigCluster), childPathChunks);

                sucess = true;
                break;

            default:
                thisNodeDetail = null;
                sucess         = false;
                break;
            }

            if (PathChunks.Length == 1)
            {
                nodeDetail = thisNodeDetail;
                return(sucess);
            }
            return(thisNodeDetail.TryGetNodeDetail(out nodeDetail));
        }
예제 #12
0
        public override bool TryGetNodeDetail(out NodeDetail nodeDetail)
        {
            NodeDetail thisNode = new EndNodeDetail();
            bool       sucess   = false;

            if (((DatabaseConfigurations)Configuration).ContainsDatabase(PathChunks[0].ToLower()))
            {
                DatabaseConfiguration dbconfig = ((DatabaseConfigurations)Configuration).GetDatabase(PathChunks[0].ToLower());
                string[] childPathChunks       = new string[this.PathChunks.Length - 1];
                Array.Copy(this.PathChunks, 1, childPathChunks, 0, this.PathChunks.Length - 1);
                thisNode = new DatabaseValueDetail(PathChunks[0], dbconfig, childPathChunks);
                sucess   = true;
            }
            if (PathChunks.Length == 1)
            {
                nodeDetail = thisNode;
                return(sucess);
            }
            return(thisNode.TryGetNodeDetail(out nodeDetail));
        }
예제 #13
0
        public override bool TryGetNodeDetail(out NodeDetail nodeDetail)
        {
            NodeDetail thisNode = null;
            bool       sucess   = false;

            if (((Indices)Configuration).ContainsIndex(PathChunks[0]))
            {
                IndexConfiguration dbconfig        = (((Indices)Configuration).GetIndex(PathChunks[0]));
                string[]           childPathChunks = new string[this.PathChunks.Length - 1];
                Array.Copy(this.PathChunks, 1, childPathChunks, 0, this.PathChunks.Length - 1);
                thisNode = new IndexValueDetail(PathChunks[0], dbconfig, childPathChunks, _databaseName);
                sucess   = true;
            }
            if (PathChunks.Length == 1)
            {
                nodeDetail = new EndNodeDetail();
                return(sucess);
            }
            return(thisNode.TryGetNodeDetail(out nodeDetail));
        }
예제 #14
0
        public override bool TryGetNodeDetail(out NodeDetail nodeDetail)
        {
            NodeDetail thisNode = new EndNodeDetail();
            bool       sucess   = false;

            if (((CollectionConfigurations)Configuration).ContainsCollection(PathChunks[0].ToLower()))
            {
                string[] childPathChunks = new string[PathChunks.Length - 1];
                Array.Copy(PathChunks, 1, childPathChunks, 0, PathChunks.Length - 1);
                CollectionConfiguration cConfig = ((CollectionConfigurations)Configuration).GetCollection(PathChunks[0].ToLower());
                thisNode = new CollectionValueDetail(_databaseName, PathChunks[0], cConfig, childPathChunks);
                sucess   = true;
            }

            if (PathChunks.Length == 1)
            {
                nodeDetail = thisNode;
                return(sucess);
            }
            return(thisNode.TryGetNodeDetail(out nodeDetail));
        }
예제 #15
0
        public override bool TryGetNodeDetail(out NodeDetail nodeDetail)
        {
            NodeDetail thisNode = new EndNodeDetail();
            bool       sucess   = false;

            if (((ServerDetail)this.Configuration).IPAddress.Equals(PathChunks[0]))
            {
                string[] childPathChunks = new string[this.PathChunks.Length - 1];
                Array.Copy(this.PathChunks, 1, childPathChunks, 0, this.PathChunks.Length - 1);

                thisNode = new EndNodeDetail(PathChunks[0], PathType.Priority, true);
                sucess   = true;
            }

            if (PathChunks.Length == 1)
            {
                nodeDetail = thisNode;
                return(sucess);
            }
            Array.Copy(this.PathChunks, 1, thisNode.PathChunks, 0, this.PathChunks.Length - 1);
            return(thisNode.TryGetNodeDetail(out nodeDetail));
        }
예제 #16
0
        public override bool TryGetNodeDetail(out NodeDetail nodeDetail)
        {
            NodeDetail              thisNode       = new EndNodeDetail();
            List <string>           childernNaames = new List <string>();
            DeploymentConfiguration config         = (DeploymentConfiguration)this.Configuration;

            foreach (ShardConfiguration singleShard in config.Shards.Values)
            {
                if (singleShard.Name.ToLower().Equals(PathChunks[0].ToLower()))
                {
                    string[] childPathChunks = new string[this.PathChunks.Length - 1];
                    Array.Copy(this.PathChunks, 1, childPathChunks, 0, this.PathChunks.Length - 1);
                    thisNode = new ShardValueDetail(PathChunks[0], singleShard, childPathChunks);
                }
            }
            if (PathChunks.Length == 1)
            {
                nodeDetail = thisNode;
                return(true);
            }

            return(thisNode.TryGetNodeDetail(out nodeDetail));
        }
예제 #17
0
 public override bool TryGetNodeDetail(out NodeDetail nodeDetail)
 {
     nodeDetail = null;
     return(false);
 }
예제 #18
0
 public abstract bool TryGetNodeDetail(out NodeDetail nodeDetail);