using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Drawing.Design;
using Microsoft.Practices.EnterpriseLibrary.Configuration.Design;
using Microsoft.Practices.EnterpriseLibrary.Configuration.Design.Validation;
using Microsoft.Practices.EnterpriseLibrary.Caching.Velocity.Configuration.Design.Properties;
using Microsoft.Practices.EnterpriseLibrary.Caching.Configuration;
namespace Microsoft.Practices.EnterpriseLibrary.Caching.Velocity.Configuration.Design
{ /// <summary>
/// Represents a <see cref="Microsoft.Practices.EnterpriseLibrary.Caching.Velocity.Configuration.VelocityCacheManagerData"/> configuration element.
/// </summary>
public class VelocityCacheManagerNode : Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.Design.CustomCacheManagerNode
{ /// <summary>
/// Initialize a new instance of the <see cref="VelocityCacheManagerNode"/> class.
/// </summary>
public VelocityCacheManagerNode()
: this(new VelocityCacheManagerData(Resources.VelocityCacheManagerNodeName, false, false, "localhost", 22233, "DistributedCacheService", "default"))
{ }
/// <summary>
/// Initialize a new instance of the <see cref="VelocityCacheManagerNode"/> class with a <see cref="Microsoft.Practices.EnterpriseLibrary.Caching.Velocity.Configuration.VelocityCacheManagerData"/> instance.
/// </summary>
/// <param name="data">A <see cref="Microsoft.Practices.EnterpriseLibrary.Caching.Velocity.Configuration.VelocityCacheManagerData"/> instance</param>
public VelocityCacheManagerNode(VelocityCacheManagerData data)
{ if (null == data)
{ throw new ArgumentNullException("error in creating the data node - VelocityCacheManagerData is null"); }
Rename(data.Name);
this.routingClient = data.RoutingClient;
this.localCache = data.LocalCache;
this.hostName = data.HostName;
this.cachePort = data.CachePort;
this.cacheHostName = data.CacheHostName;
this.namedCache = data.NamedCache;
Type = typeof(VelocityCacheManager).ToString();
}
/// <summary>
/// Gets the <see cref="Microsoft.Practices.EnterpriseLibrary.Caching.Velocity.Configuration.VelocityCacheManagerData"/> this node represents.
/// </summary>
/// <value>
/// The <see cref="Microsoft.Practices.EnterpriseLibrary.Caching.Velocity.Configuration.VelocityCacheManagerData"/> this node represents.
/// </value>
[Browsable(false)]
public override CacheManagerDataBase CacheManagerData
{ get
{ VelocityCacheManagerData data = new VelocityCacheManagerData();
data.Name = this.Name;
data.RoutingClient = this.routingClient;
data.LocalCache = this.localCache;
data.HostName = this.hostName;
data.CachePort = this.cachePort;
data.CacheHostName = this.cacheHostName;
data.NamedCache = this.namedCache;
return data;
}
}
/// <summary>
/// Releases the unmanaged resources used by the <see cref="VelocityCacheManagerNode"/> and optionally releases the managed resources.
/// </summary>
/// <param name="disposing">
/// <see langword="true"/> to release both managed and unmanaged resources; <see langword="false"/> to release only unmanaged resources.
/// </param>
protected override void Dispose(bool disposing)
{ if (disposing)
{ }
base.Dispose(disposing);
}
private System.Boolean routingClient;
/// <summary>
///
/// </summary>
/// <value>
///
/// </value>
[SRDescription("RoutingClientDescription", typeof(Resources))] [SRCategory("CategoryGeneral", typeof(Resources))] public System.Boolean RoutingClient
{ get { return this.routingClient; } set { this.routingClient = value; } }
private System.Boolean localCache;
/// <summary>
///
/// </summary>
/// <value>
///
/// </value>
[SRDescription("LocalCacheDescription", typeof(Resources))] [SRCategory("CategoryGeneral", typeof(Resources))] public System.Boolean LocalCache
{ get { return this.localCache; } set { this.localCache = value; } }
private System.String hostName;
/// <summary>
///
/// </summary>
/// <value>
///
/// </value>
[SRDescription("HostNameDescription", typeof(Resources))] [SRCategory("CategoryGeneral", typeof(Resources))] public System.String HostName
{ get { return this.hostName; } set { this.hostName = value; } }
private System.Int32 cachePort;
/// <summary>
///
/// </summary>
/// <value>
///
/// </value>
[SRDescription("CachePortDescription", typeof(Resources))] [SRCategory("CategoryGeneral", typeof(Resources))] public System.Int32 CachePort
{ get { return this.cachePort; } set { this.cachePort = value; } }
private System.String cacheHostName;
/// <summary>
///
/// </summary>
/// <value>
///
/// </value>
[SRDescription("CacheHostNameDescription", typeof(Resources))] [SRCategory("CategoryGeneral", typeof(Resources))] public System.String CacheHostName
{ get { return this.cacheHostName; } set { this.cacheHostName = value; } }
private System.String namedCache;
/// <summary>
///
/// </summary>
/// <value>
///
/// </value>
[SRDescription("NamedCacheDescription", typeof(Resources))] [SRCategory("CategoryGeneral", typeof(Resources))] public System.String NamedCache
{ get { return this.namedCache; } set { this.namedCache = value; } }
}
}