public static ISet <IPAddress> GetServerListFromConfig(string cacheId) { var serverList = new HashSet <IPAddress>(); string path = Path.Combine(AppUtil.InstallDir, DIRNAME, FILENAME); try { var builder = new ConfigurationBuilder(path); builder.RegisterRootConfigurationObject(typeof(NewDom.CacheServerConfig)); builder.ReadConfiguration(); var newCaches = new NewDom.CacheServerConfig[builder.Configuration.Length]; builder.Configuration.CopyTo(newCaches, 0); foreach (var cacheServerConfig in newCaches) { if (cacheServerConfig.Name.Equals(cacheId, StringComparison.CurrentCultureIgnoreCase)) { List <Address> list = cacheServerConfig.CacheDeployment.Servers.GetAllConfiguredNodes(); foreach (Address item in list) { serverList.Add(item.IpAddress); } break; } } return(serverList); } catch { return(serverList); } }
private static void LoadConfig(string fileName, ref Hashtable properties) { ConfigurationBuilder builder = new ConfigurationBuilder(fileName); builder.RegisterRootConfigurationObject(typeof(Alachisoft.NCache.Config.NewDom.CacheServerConfig)); builder.ReadConfiguration(); Alachisoft.NCache.Config.NewDom.CacheServerConfig[] newCaches = new NewDom.CacheServerConfig[builder.Configuration.Length]; builder.Configuration.CopyTo(newCaches, 0); properties = ConfigConverter.ToHashtable(convertToOldDom(newCaches)); }
public static bool VerifyClusterConfigurations(Alachisoft.NCache.Config.NewDom.CacheServerConfig serverConfig , string cacheName) { if (serverConfig == null) { throw new Exception("Specified cache is not registered on the given server"); } double configVersion = -1; double deploymentVersion = -1; string configId = "dummyconfig"; NCacheRPCService NCache = new NCacheRPCService(""); if (serverConfig.CacheSettings.CacheType == "clustered-cache") { foreach (Address node in serverConfig.CacheDeployment.Servers.GetAllConfiguredNodes()) { NCache.ServerName = node.IpAddress.ToString(); ICacheServer cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); ConfigurationVersion config = cacheServer.GetConfigurationVersion(cacheName); if (configId.Equals(configId)) { configId = config.ConfigID; } else if (!configId.Equals(config.ConfigID, StringComparison.InvariantCultureIgnoreCase)) { throw new VersionException("same name cache is already registered on node : " + node.IpAddress, 0); } if (configVersion == -1) { configVersion = config.ConfigVersion; } else if (configVersion != config.ConfigVersion) { throw new VersionException("There is a configuration mismatch for caches : " + cacheName, 0); } if (deploymentVersion == -1) { deploymentVersion = config.DeploymentVersion; } else if (deploymentVersion != config.DeploymentVersion) { throw new Exception("Deployement version is not same on all nodes"); } cacheServer.Dispose(); } } return(true); }
public object Clone() { CacheServerConfig config = new CacheServerConfig(); config.cacheSettings = CacheSettings != null ? (CacheServerConfigSetting)CacheSettings.Clone() : null; config.cacheDeployment = CacheDeployment != null ? (CacheDeployment)CacheDeployment.Clone() : null; config.Name = Name != null ? (string)Name.Clone() : null; config.IsRegistered = this.IsRegistered; config.IsRunning = this.IsRunning; config.licenseIsExpired = this.licenseIsExpired; return(config); }
public object Clone() { CacheServerConfig config = new CacheServerConfig(); config.cacheSettings = CacheSettings != null ? (CacheServerConfigSetting)CacheSettings.Clone() : null; config.cacheDeployment = CacheDeployment != null ? (CacheDeployment)CacheDeployment.Clone() : null; config.ConfigID = ConfigID; config.configVersion = configVersion; config.IsRegistered = this.IsRegistered; config.IsRunning = this.IsRunning; config.licenseIsExpired = this.licenseIsExpired; config.name = this.name; config._alias = this._alias; return(config); }
public static Alachisoft.NCache.Config.NewDom.CacheServerConfig convertToNewDom(Alachisoft.NCache.Config.Dom.CacheServerConfig oldDom) { Alachisoft.NCache.Config.NewDom.CacheServerConfig newDom = null; try { if (oldDom != null) { newDom = new CacheServerConfig(); if (newDom.CacheSettings == null) { newDom.CacheSettings = new CacheServerConfigSetting(); } newDom.Name = oldDom.Name; newDom.CacheSettings.InProc = oldDom.InProc; newDom.ConfigID = oldDom.ConfigID; newDom.ConfigVersion = oldDom.ConfigVersion; newDom.CacheSettings.LastModified = oldDom.LastModified; newDom.CacheSettings.DataFormat = oldDom.DataFormat; if (oldDom.Log != null) { newDom.CacheSettings.Log = oldDom.Log; } else { newDom.CacheSettings.Log = new Alachisoft.NCache.Config.Dom.Log(); } if (oldDom.PerfCounters != null) { newDom.CacheSettings.PerfCounters = oldDom.PerfCounters; } else { newDom.CacheSettings.PerfCounters = new Alachisoft.NCache.Config.Dom.PerfCounters(); } if (oldDom.BackingSource != null) { newDom.CacheSettings.BackingSource = oldDom.BackingSource; } if (oldDom.Notifications != null) { newDom.CacheSettings.Notifications = oldDom.Notifications; } else { newDom.CacheSettings.Notifications = new Alachisoft.NCache.Config.Dom.Notifications(); } if (oldDom.Cleanup != null) { newDom.CacheSettings.Cleanup = oldDom.Cleanup; } else { newDom.CacheSettings.Cleanup = new Alachisoft.NCache.Config.Dom.Cleanup(); } if (oldDom.Storage != null) { newDom.CacheSettings.Storage = oldDom.Storage; } else { newDom.CacheSettings.Storage = new Alachisoft.NCache.Config.Dom.Storage(); } if (oldDom.EvictionPolicy != null) { newDom.CacheSettings.EvictionPolicy = oldDom.EvictionPolicy; } else { newDom.CacheSettings.EvictionPolicy = oldDom.EvictionPolicy; } if (newDom.CacheSettings.CacheTopology == null) { newDom.CacheSettings.CacheTopology = new CacheTopology(); } if (oldDom.ClientActivityNotification != null) { newDom.CacheSettings.ClientActivityNotification = oldDom.ClientActivityNotification; } newDom.CacheSettings.CacheType = oldDom.CacheType; if (oldDom.Cluster != null) { string topology = oldDom.Cluster.Topology; if (topology != null) { topology = topology.ToLower(); if (topology.Equals("replicated-server")) { topology = "replicated"; } else if (topology.Equals("partitioned-server")) { topology = "partitioned"; } else if (topology.Equals("partitioned-replicas-server")) { topology = "partitioned-replica"; } else if (topology.Equals("mirror-server")) { topology = "mirrored"; } else if (topology.Equals("local-cache")) { topology = "local-cache"; } } newDom.CacheSettings.CacheTopology.Topology = topology; if (oldDom.CacheType.Equals("clustered-cache")) { if (newDom.CacheDeployment == null) { newDom.CacheDeployment = new CacheDeployment(); } if (newDom.CacheSettings.CacheTopology.ClusterSettings == null) { newDom.CacheSettings.CacheTopology.ClusterSettings = new Cluster(); } newDom.CacheSettings.CacheTopology.ClusterSettings.OpTimeout = oldDom.Cluster.OpTimeout; newDom.CacheSettings.CacheTopology.ClusterSettings.StatsRepInterval = oldDom.Cluster.StatsRepInterval; if (newDom.CacheSettings.CacheTopology.ClusterSettings.Channel == null) { newDom.CacheSettings.CacheTopology.ClusterSettings.Channel = new Channel(); } if (oldDom.Cluster.Channel != null) { newDom.CacheSettings.CacheTopology.ClusterSettings.Channel.TcpPort = oldDom.Cluster.Channel.TcpPort; newDom.CacheSettings.CacheTopology.ClusterSettings.Channel.PortRange = oldDom.Cluster.Channel.PortRange; newDom.CacheSettings.CacheTopology.ClusterSettings.Channel.ConnectionRetries = oldDom.Cluster.Channel.ConnectionRetries; newDom.CacheSettings.CacheTopology.ClusterSettings.Channel.ConnectionRetryInterval = oldDom.Cluster.Channel.ConnectionRetryInterval; } if (oldDom.ReplicationStrategy != null) { newDom.CacheSettings.CacheTopology.ClusterSettings.ReplicationStrategy = oldDom.ReplicationStrategy; } else { newDom.CacheSettings.CacheTopology.ClusterSettings.ReplicationStrategy = new Alachisoft.NCache.Config.Dom.ReplicationStrategy(); } if (newDom.CacheDeployment.Servers == null) { newDom.CacheDeployment.Servers = new ServersNodes(); } newDom.CacheDeployment.Servers.NodesList = createServers(oldDom.Cluster.Channel.InitialHosts, oldDom.Cluster.ActiveMirrorNode); if (oldDom.ClientNodes != null) { if (newDom.CacheDeployment.ClientNodes == null) { newDom.CacheDeployment.ClientNodes = new Alachisoft.NCache.Config.Dom.ClientNodes(); } newDom.CacheDeployment.ClientNodes = oldDom.ClientNodes; } newDom.CacheDeployment.DeploymentVersion = oldDom.DeploymentVersion; } } else { if (oldDom.CacheType != null) { if (oldDom.CacheType.Equals("local-cache")) { newDom.CacheSettings.CacheTopology.Topology = oldDom.CacheType; } newDom.CacheSettings.CacheTopology.ClusterSettings = null; } } if (oldDom.Security != null) { newDom.CacheSettings.Security = oldDom.Security; } if (oldDom.AutoLoadBalancing != null) { newDom.CacheSettings.AutoLoadBalancing = oldDom.AutoLoadBalancing; } newDom.IsRunning = oldDom.IsRunning; newDom.IsRegistered = oldDom.IsRegistered; newDom.IsExpired = oldDom.IsExpired; } } catch (Exception ex) { throw new Exception("DomHelper.convertToNewDom" + ex.Message); } return(newDom); }
/// <summary> /// The main entry point for the tool. /// </summary> public static void Run(string[] args) { var failedNodes = string.Empty; NCache.Port = NCache.UseTcp ? CacheConfigManager.NCacheTcpPort : CacheConfigManager.HttpPort; CacheServerConfig[] caches = null; ICacheServer cacheServer = null; CacheServerConfig _cacheConfig = null; try { object param = new ConfigureCacheParam(); CommandLineArgumentParser.CommandLineParser(ref param, args); ccParam = (ConfigureCacheParam)param; if (ccParam.IsUsage) { AssemblyUsage.PrintLogo(ccParam.IsLogo); AssemblyUsage.PrintUsage(); return; } if (!ValidateParameters()) { return; } if (ccParam.Port != -1) { NCache.Port = ccParam.Port; } if (ccParam.Port == -1) { NCache.Port = NCache.UseTcp ? CacheConfigManager.NCacheTcpPort : CacheConfigManager.HttpPort; } if (ccParam.Path != null && ccParam.Path != string.Empty) { if (Path.HasExtension(ccParam.Path)) { var extension = Path.GetExtension(ccParam.Path); if (!extension.Equals(".ncconf") && !extension.Equals(".xml")) { throw new Exception("Incorrect file format. Only .ncconf and .xml are supported."); } } else { throw new Exception("Incorrect configuration file path specified."); } var builder = new ConfigurationBuilder(ccParam.Path); builder.RegisterRootConfigurationObject(typeof(CacheServerConfig)); builder.ReadConfiguration(); if (builder.Configuration != null) { caches = new CacheServerConfig[builder.Configuration.Length]; builder.Configuration.CopyTo(caches, 0); } else { throw new Exception("Configuration cannot be loaded."); } var validator = new ConfigurationValidator(); var _isConfigValidated = validator.ValidateConfiguration(caches); _cacheConfig = caches[0]; if (_cacheConfig.CacheSettings.Name == null) { _cacheConfig.CacheSettings.Name = ccParam.CacheId; } if (_cacheConfig.CacheSettings.Storage == null || _cacheConfig.CacheSettings.Storage.Size == -1) { throw new Exception("Cache size is not specified."); } if (_cacheConfig.CacheSettings.EvictionPolicy == null) { _cacheConfig.CacheSettings.EvictionPolicy = new EvictionPolicy(); _cacheConfig.CacheSettings.EvictionPolicy.Policy = "priority"; _cacheConfig.CacheSettings.EvictionPolicy.DefaultPriority = "normal"; _cacheConfig.CacheSettings.EvictionPolicy.EvictionRatio = 5; _cacheConfig.CacheSettings.EvictionPolicy.Enabled = true; } if (_cacheConfig.CacheSettings.Cleanup == null) { _cacheConfig.CacheSettings.Cleanup = new Cleanup(); _cacheConfig.CacheSettings.Cleanup.Interval = 15; } if (_cacheConfig.CacheSettings.Log == null) { _cacheConfig.CacheSettings.Log = new Log(); } if (_cacheConfig.CacheSettings.PerfCounters == null) { _cacheConfig.CacheSettings.PerfCounters = new PerfCounters(); _cacheConfig.CacheSettings.PerfCounters.Enabled = true; } if (_cacheConfig.CacheSettings.CacheType == "clustered-cache") { if (_cacheConfig.CacheSettings.CacheTopology.ClusterSettings == null) { throw new Exception("Cluster settings not specified for the cluster cache."); } if (_cacheConfig.CacheSettings.CacheTopology.ClusterSettings.Channel == null) { throw new Exception("Cluster channel related settings not specified for cluster cache."); } if (_cacheConfig.CacheSettings.CacheTopology.ClusterSettings.Channel.TcpPort == -1) { throw new Exception("Cluster port not specified for cluster cache."); } } } else { _SimpleCacheConfig.CacheSettings = new CacheServerConfigSetting(); _SimpleCacheConfig.CacheSettings.Name = ccParam.CacheId; _SimpleCacheConfig.CacheSettings.Storage = new Storage(); _SimpleCacheConfig.CacheSettings.EvictionPolicy = new EvictionPolicy(); _SimpleCacheConfig.CacheSettings.Cleanup = new Cleanup(); _SimpleCacheConfig.CacheSettings.Log = new Log(); _SimpleCacheConfig.CacheSettings.PerfCounters = new PerfCounters(); _SimpleCacheConfig.CacheSettings.PerfCounters.Enabled = true; _SimpleCacheConfig.CacheSettings.Storage.Type = "heap"; _SimpleCacheConfig.CacheSettings.Storage.Size = ccParam.CacheSize; _SimpleCacheConfig.CacheSettings.EvictionPolicy.Policy = "priority"; _SimpleCacheConfig.CacheSettings.EvictionPolicy.DefaultPriority = "normal"; _SimpleCacheConfig.CacheSettings.EvictionPolicy.EvictionRatio = 5; _SimpleCacheConfig.CacheSettings.EvictionPolicy.Enabled = false; _SimpleCacheConfig.CacheSettings.Cleanup.Interval = 15; _SimpleCacheConfig.CacheSettings.CacheTopology = new CacheTopology(); if (string.IsNullOrEmpty(ccParam.Topology)) { _SimpleCacheConfig.CacheSettings.CacheTopology.Topology = "Local"; } else { _SimpleCacheConfig.CacheSettings.CacheTopology.Topology = ccParam.Topology; } if (ccParam.IsInProc && _SimpleCacheConfig.CacheSettings.CacheTopology.Topology.Equals("local-cache")) { _SimpleCacheConfig.CacheSettings.InProc = true; } if (_SimpleCacheConfig.CacheSettings.CacheType == "clustered-cache") { _SimpleCacheConfig.CacheSettings.CacheTopology.ClusterSettings = new Cluster(); _SimpleCacheConfig.CacheSettings.CacheTopology.ClusterSettings.Channel = new Channel(); _SimpleCacheConfig.CacheSettings.CacheTopology.ClusterSettings.Channel.TcpPort = ccParam.ClusterPort; _SimpleCacheConfig.CacheSettings.CacheTopology.ClusterSettings.StatsRepInterval = 600; if (_SimpleCacheConfig.CacheSettings.CacheTopology.Topology == "partitioned-replica") { _SimpleCacheConfig.CacheSettings.CacheTopology.ClusterSettings.Channel.PortRange = 2; } } if (ccParam.EvictionPolicy != null && ccParam.EvictionPolicy != string.Empty) { _SimpleCacheConfig.CacheSettings.EvictionPolicy.Policy = ccParam.EvictionPolicy; _SimpleCacheConfig.CacheSettings.EvictionPolicy.Enabled = true; } if (ccParam.Ratio != -1) { _SimpleCacheConfig.CacheSettings.EvictionPolicy.EvictionRatio = ccParam.Ratio; } if (ccParam.CleanupInterval != -1) { _SimpleCacheConfig.CacheSettings.Cleanup.Interval = ccParam.CleanupInterval; } if (ccParam.DefaultPriority != null && ccParam.DefaultPriority != string.Empty) { _SimpleCacheConfig.CacheSettings.EvictionPolicy.DefaultPriority = ccParam.DefaultPriority; _SimpleCacheConfig.CacheSettings.EvictionPolicy.Enabled = true; } _cacheConfig = _SimpleCacheConfig; } try { _cacheConfig.CacheSettings.Name = ccParam.CacheId; if (_cacheConfig.CacheSettings.CacheType == "clustered-cache") { if (_cacheConfig.CacheDeployment == null) { _cacheConfig.CacheDeployment = new CacheDeployment(); _cacheConfig.CacheDeployment.Servers = new ServersNodes(); } _cacheConfig.CacheDeployment.Servers.NodesList = GetServers(ccParam.Server); } var serverList = new Dictionary <int, CacheServer>(); var serverCount = 0; foreach (ServerNode node in GetServers(ccParam.Server)) { var tempServer = new CacheServer(); tempServer.ServerName = node.IP; serverList.Add(serverCount, tempServer); serverCount++; } var servers = new CacheServerList(serverList); var serversToUpdate = new List <string>(); foreach (ServerNode node in GetServers(ccParam.Server)) { NCache.ServerName = node.IP; Console.WriteLine(AppendBlankLine("\nCreating cache") + " '{0}' on server '{1}' ", _cacheConfig.CacheSettings.Name, NCache.ServerName); try { cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 0, 30)); if (cacheServer != null) { var serverConfig = cacheServer.GetNewConfiguration(_cacheConfig.CacheSettings.Name); if (serverConfig != null) { throw new Exception("Specified cache already exists."); } if (serverConfig != null && ccParam.IsOverWrite) { NCache.ServerName = node.IP; if (serverConfig.CacheDeployment != null) { if (serverConfig.CacheDeployment.ClientNodes != null) { _cacheConfig.CacheDeployment.ClientNodes = serverConfig.CacheDeployment.ClientNodes; } } } cacheServer.RegisterCache(_cacheConfig.CacheSettings.Name, _cacheConfig, "", ccParam.IsOverWrite, ccParam.IsHotApply); cacheServer.UpdateClientServersList(_cacheConfig.CacheSettings.Name, servers, "NCACHE"); serversToUpdate.Add(node.IP); Console.WriteLine("Cache '{0}' successfully created on server {1}:{2} .", _cacheConfig.CacheSettings.Name, NCache.ServerName, NCache.Port); } } catch (Exception ex) { throw ex; } } ManagementWorkFlow.UpdateServerMappingConfig(serversToUpdate.ToArray()); } catch (Exception ex) { throw ex; } finally { if (cacheServer != null) { cacheServer.Dispose(); } } } catch (Exception ex) { Console.Error.WriteLine(AppendBlankLine("Failed") + " to create cache on server '{0}'. ", ccParam.Server); Console.Error.WriteLine("Error Detail: '{0}'. ", ex.Message); LogEvent(ex.Message); } finally { NCache.Dispose(); } }
public object Clone() { CacheServerConfig config = new CacheServerConfig(); config.cacheSettings = CacheSettings != null ? (CacheServerConfigSetting)CacheSettings.Clone() : null; config.cacheDeployment = CacheDeployment != null ? (CacheDeployment)CacheDeployment.Clone() : null; config.ConfigID = ConfigID; config.IsRegistered = this.IsRegistered; config.IsRunning = this.IsRunning; config.licenseIsExpired = this.licenseIsExpired; return config; }
public static Alachisoft.NCache.Config.NewDom.CacheServerConfig convertToNewDom(Alachisoft.NCache.Config.Dom.CacheServerConfig oldDom) { Alachisoft.NCache.Config.NewDom.CacheServerConfig newDom = null; try { if (oldDom != null) { newDom = new CacheServerConfig(); if (newDom.CacheSettings == null) { newDom.CacheSettings = new CacheServerConfigSetting(); } newDom.CacheSettings.Name = oldDom.Name; newDom.CacheSettings.InProc = oldDom.InProc; newDom.ConfigID = oldDom.ConfigID; newDom.CacheSettings.LastModified = oldDom.LastModified; if (oldDom.Log != null) { newDom.CacheSettings.Log = oldDom.Log; } else { newDom.CacheSettings.Log = new Alachisoft.NCache.Config.Dom.Log(); } if (oldDom.PerfCounters != null) { newDom.CacheSettings.PerfCounters = oldDom.PerfCounters; } else { newDom.CacheSettings.PerfCounters = new Alachisoft.NCache.Config.Dom.PerfCounters(); } if (oldDom.QueryIndices != null) { newDom.CacheSettings.QueryIndices = oldDom.QueryIndices; } if (oldDom.Cleanup != null) { newDom.CacheSettings.Cleanup = oldDom.Cleanup; } else { newDom.CacheSettings.Cleanup = new Alachisoft.NCache.Config.Dom.Cleanup(); } if (oldDom.Storage != null) { newDom.CacheSettings.Storage = oldDom.Storage; } else { newDom.CacheSettings.Storage = new Alachisoft.NCache.Config.Dom.Storage(); } if (oldDom.EvictionPolicy != null) { newDom.CacheSettings.EvictionPolicy = oldDom.EvictionPolicy; } else { newDom.CacheSettings.EvictionPolicy = oldDom.EvictionPolicy; } if (newDom.CacheSettings.CacheTopology == null) { newDom.CacheSettings.CacheTopology = new CacheTopology(); } newDom.CacheSettings.CacheType = oldDom.CacheType; if (oldDom.Cluster != null) { string topology = oldDom.Cluster.Topology; if (topology != null) { topology = topology.ToLower(); if (topology.Equals("partitioned-server")) { topology = "partitioned"; } else if (topology.Equals("replicated-server")) { topology = "replicated"; } else if (topology.Equals("local-cache")) { topology = "local-cache"; } } newDom.CacheSettings.CacheTopology.Topology = topology; if (oldDom.CacheType.Equals("clustered-cache")) { if (newDom.CacheDeployment == null) { newDom.CacheDeployment = new CacheDeployment(); } if (newDom.CacheSettings.CacheTopology.ClusterSettings == null) { newDom.CacheSettings.CacheTopology.ClusterSettings = new Cluster(); } newDom.CacheSettings.CacheTopology.ClusterSettings.OpTimeout = oldDom.Cluster.OpTimeout; newDom.CacheSettings.CacheTopology.ClusterSettings.StatsRepInterval = oldDom.Cluster.StatsRepInterval; newDom.CacheSettings.CacheTopology.ClusterSettings.UseHeartbeat = oldDom.Cluster.UseHeartbeat; if (newDom.CacheSettings.CacheTopology.ClusterSettings.Channel == null) { newDom.CacheSettings.CacheTopology.ClusterSettings.Channel = new Channel(); } if (oldDom.Cluster.Channel != null) { newDom.CacheSettings.CacheTopology.ClusterSettings.Channel.TcpPort = oldDom.Cluster.Channel.TcpPort; newDom.CacheSettings.CacheTopology.ClusterSettings.Channel.PortRange = oldDom.Cluster.Channel.PortRange; newDom.CacheSettings.CacheTopology.ClusterSettings.Channel.ConnectionRetries = oldDom.Cluster.Channel.ConnectionRetries; newDom.CacheSettings.CacheTopology.ClusterSettings.Channel.ConnectionRetryInterval = oldDom.Cluster.Channel.ConnectionRetryInterval; } if (newDom.CacheDeployment.Servers == null) { newDom.CacheDeployment.Servers = new ServersNodes(); } #if !CLIENT newDom.CacheDeployment.Servers.NodesList = createServers(oldDom.Cluster.Channel.InitialHosts); #endif if (oldDom.ClientNodes != null) { if (newDom.CacheDeployment.ClientNodes == null) { newDom.CacheDeployment.ClientNodes = new Alachisoft.NCache.Config.Dom.ClientNodes(); } newDom.CacheDeployment.ClientNodes = oldDom.ClientNodes; } } } else { if (oldDom.CacheType != null) { if (oldDom.CacheType.Equals("local-cache")) { newDom.CacheSettings.CacheTopology.Topology = oldDom.CacheType; } newDom.CacheSettings.CacheTopology.ClusterSettings = null; } } if (oldDom.AutoLoadBalancing != null) { newDom.CacheSettings.AutoLoadBalancing = oldDom.AutoLoadBalancing; } newDom.IsRunning = oldDom.IsRunning; newDom.IsRegistered = oldDom.IsRegistered; newDom.IsExpired = oldDom.IsExpired; } } catch (Exception ex) { throw new Exception("DomHelper.convertToNewDom" + ex.Message); } return newDom; }