Пример #1
0
        /// <summary>
        /// This overload is used to pass on the security credentials of the user to the clustering layer
        /// to avoid the possibility of joining a cluster to non-authorized nodes.
        /// </summary>
        /// <param name="propertyString"></param>
        /// <returns></returns>
        static public Cache CreateFromPropertyString(string propertyString, string userId, string password, bool isStartedAsMirror)
        {
            ConfigReader propReader = new PropsConfigReader(propertyString);

            //Make old style config-hashtable
            return(CreateFromProperties(propReader.Properties, null, null, null, null, null, null, null, userId, password, isStartedAsMirror, false));
        }
Пример #2
0
        /// <summary>
        /// Creates a cache object by parsing configuration string passed as parameter.
        /// </summary>
        /// <param name="propertyString">property string provided by the user </param>
        /// <param name="itemAdded">item added handler</param>
        /// <param name="itemRemoved">item removed handler</param>
        /// <param name="itemUpdated">item updated handler</param>
        /// <param name="cacheMiss">cache miss handler</param>
        /// <param name="cacheCleared">cache cleared handler</param>
        /// <returns>return the Cache object</returns>
        static public Cache CreateFromPropertyString(string propertyString,
                                                     CustomRemoveCallback customRemove,
                                                     CustomUpdateCallback customUpdate)
        {
            ConfigReader propReader = new PropsConfigReader(propertyString);

            return(CreateFromProperties(propReader.Properties, customRemove, customUpdate));
        }
Пример #3
0
        /// <summary>
        /// Creates a cache object by parsing configuration string passed as parameter.
        /// </summary>
        /// <param name="propertyString">property string provided by the user </param>
        /// <param name="itemAdded">item added handler</param>
        /// <param name="itemRemoved">item removed handler</param>
        /// <param name="itemUpdated">item updated handler</param>
        /// <param name="cacheMiss">cache miss handler</param>
        /// <param name="cacheCleared">cache cleared handler</param>
        /// <returns>return the Cache object</returns>
        static public Cache CreateFromPropertyString(string propertyString,
                                                     ItemAddedCallback itemAdded,
                                                     ItemRemovedCallback itemRemoved,
                                                     ItemUpdatedCallback itemUpdated,
                                                     CacheClearedCallback cacheCleared,
                                                     CustomRemoveCallback customRemove,
                                                     CustomUpdateCallback customUpdate)
        {
            ConfigReader propReader = new PropsConfigReader(propertyString);

            return(CreateFromProperties(propReader.Properties, itemAdded, itemRemoved, itemUpdated, cacheCleared, customRemove, customUpdate));
        }
Пример #4
0
        /// <summary>
        /// Populates the object from specified configuration string.
        /// </summary>
        /// <returns></returns>
        internal static CacheConfig FromPropertyString(string props)
        {
            CacheConfig cConfig = null;

            if (props != null)
            {
                PropsConfigReader pcr         = new PropsConfigReader(props);
                IDictionary       cacheConfig = pcr.Properties;
                cConfig = CacheConfig.FromProperties(cacheConfig);
            }
            return(cConfig);
        }
Пример #5
0
        static private void PrintDetailedCacheInfo(Cache cache, string partId, bool printConf, bool xmlSyntax)
        {
            CacheStatistics s          = cache.Statistics;
            long            MaxSize    = 0;
            string          schemeName = s.ClassName.ToLower(CultureInfo.CurrentCulture);
            bool            running    = cache.IsRunning;

            Console.WriteLine("Cache-ID:       {0}", cache.Name);

            if (partId != null && partId != string.Empty)
            {
                Console.WriteLine("Partition-ID:   {0}", partId);
            }

            Console.WriteLine("Scheme:         {0}", schemeName);
            Console.WriteLine("Status:         {0}", cache.IsRunning ? "Running":"Stopped");
            if (running)
            {
                if (s is ClusterCacheStatistics)
                {
                    System.Text.StringBuilder nodes = new System.Text.StringBuilder();

                    ClusterCacheStatistics cs = s as ClusterCacheStatistics;

                    Console.WriteLine("Cluster size:   {0}", cs.Nodes.Count);

                    MaxSize = (cs.LocalNode.Statistics.MaxSize / 1024) / 1024;


                    foreach (NodeInfo n in cs.Nodes)
                    {
                        nodes.Append("                ").Append(n.Address).Append("\n");
                    }
                    Console.Write("{0}", nodes.ToString());

                    if (partId != null && partId != string.Empty)
                    {
                        if (cs.SubgroupNodes != null && cs.SubgroupNodes.Contains(partId.ToLower()))
                        {
                            nodes = new System.Text.StringBuilder();
                            ArrayList groupNodes = cs.SubgroupNodes[partId.ToLower()] as ArrayList;
                            Console.WriteLine("Partition size: {0}", groupNodes.Count);

                            foreach (Address address in groupNodes)
                            {
                                nodes.Append("                ").Append(address).Append("\n");
                            }
                        }
                        Console.Write("{0}", nodes.ToString());
                    }
                }
                Console.WriteLine("UpTime:         {0}", s.UpTime);

                if (s.MaxSize != 0)
                {
                    Console.WriteLine("Capacity:       {0} MB", ((s.MaxSize / 1024) / 1024));
                }
                else
                {
                    Console.WriteLine("Capacity:       {0} MB", MaxSize);
                }

                Console.WriteLine("Count:          {0}", s.Count);
            }
            if (printConf)
            {
                try
                {
                    if (xmlSyntax)
                    {
                        PropsConfigReader pr = new PropsConfigReader(cache.ConfigString);
                        Console.WriteLine("Configuration:\n{0}", ConfigReader.ToPropertiesXml(pr.Properties, true));
                    }
                    else
                    {
                        Console.WriteLine("Configuration:\n{0}", cache.ConfigString);
                    }
                }
                catch (ConfigurationException) {}
            }
            Console.WriteLine("");
        }
Пример #6
0
        ///// <summary>
        ///// Creates a cache object by parsing configuration string passed as parameter.
        ///// </summary>
        ///// <param name="propertyString">property string provided by the user </param>
        ///// <returns>return the Cache object</returns>
        static public Cache CreateFromPropertyString(string propertyString)
        {
            ConfigReader propReader = new PropsConfigReader(propertyString);

            return(CreateFromProperties(propReader.Properties, null, null));
        }
Пример #7
0
        /// <summary>
        /// This overload is used to call the Internal method that actually creates the cache.
        /// </summary>
        /// <param name="propertyString"></param>
        /// <returns></returns>
        static public Cache CreateFromPropertyString(string propertyString, CacheServerConfig config, bool isStartedAsMirror, bool twoPhaseInitialization)
        {
            ConfigReader propReader = new PropsConfigReader(propertyString);

            return(CreateFromProperties(propReader.Properties, config, null, null, isStartedAsMirror, twoPhaseInitialization));
        }
Пример #8
0
        /// <summary>
        /// This overload is used to pass on the security credentials of the user to the clustering layer
        /// to avoid the possibility of joining a cluster to non-authorized nodes.
        /// </summary>
        /// <param name="propertyString"></param>
        /// <returns></returns>
        static public Cache CreateFromPropertyString(string propertyString, bool isStartedAsMirror)
        {
            ConfigReader propReader = new PropsConfigReader(propertyString);

            return(CreateFromProperties(propReader.Properties, null, null, null, null, null, null, null, isStartedAsMirror, false));
        }
Пример #9
0
        /// <summary>
        /// Cria o cache com base em um texto com as as configurações das propriedades.
        /// </summary>
        /// <param name="propertyString"></param>
        /// <param name="config"></param>
        /// <param name="twoPhaseInitialization"></param>
        /// <returns></returns>
        public static Cache CreateFromPropertyString(string propertyString, Configuration.Dom.CacheConfig config, bool twoPhaseInitialization)
        {
            ConfigReader reader = new PropsConfigReader(propertyString);

            return(CreateFromProperties(reader.Properties, config, twoPhaseInitialization));
        }
Пример #10
0
        /// <summary>
        /// Cria o cache com base em um texto com as as configurações das propriedades.
        /// </summary>
        /// <param name="propertyString">Texto contendo as propriedades de configuração.</param>
        /// <returns></returns>
        public static Cache CreateFromPropertyString(string propertyString)
        {
            ConfigReader reader = new PropsConfigReader(propertyString);

            return(CreateFromProperties(reader.Properties));
        }