Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Config
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv6039/Config
Modified Files:
PropertyResourceConfigurer.cs VariableAccessor.cs
Log Message:
more xml doc comments
Index: VariableAccessor.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Config/VariableAccessor.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** VariableAccessor.cs 22 Aug 2007 20:16:27 -0000 1.1
--- VariableAccessor.cs 27 Aug 2007 14:49:42 -0000 1.2
***************
*** 95,98 ****
--- 95,107 ----
}
+ /// <summary>
+ /// Returns a <see cref="double"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <returns>
+ /// A <see cref="double"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.
+ /// </returns>
public double GetDouble(string name, double defaultValue)
{
***************
*** 100,103 ****
--- 109,125 ----
}
+ /// <summary>
+ /// Returns a <see cref="double"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <param name="throwOnInvalidValue">
+ /// If <c>false</c>, suppresses exceptions if the result
+ /// of <see cref="IVariableSource.ResolveVariable"/> cannot be parsed
+ /// and returns <paramref name="defaultValue"/> instead.</param>
+ /// <returns>
+ /// A <see cref="double"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> cannot be parsed.
+ /// </returns>
public double GetDouble(string name, double defaultValue, bool throwOnInvalidValue)
{
***************
*** 120,123 ****
--- 142,154 ----
}
+ /// <summary>
+ /// Returns a <see cref="decimal"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <returns>
+ /// A <see cref="decimal"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.
+ /// </returns>
public decimal GetDecimal(string name, decimal defaultValue)
{
***************
*** 125,128 ****
--- 156,172 ----
}
+ /// <summary>
+ /// Returns a <see cref="decimal"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <param name="throwOnInvalidValue">
+ /// If <c>false</c>, suppresses exceptions if the result
+ /// of <see cref="IVariableSource.ResolveVariable"/> cannot be parsed
+ /// and returns <paramref name="defaultValue"/> instead.</param>
+ /// <returns>
+ /// A <see cref="decimal"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> cannot be parsed.
+ /// </returns>
public decimal GetDecimal(string name, decimal defaultValue, bool throwOnInvalidValue)
{
***************
*** 145,148 ****
--- 189,201 ----
}
+ /// <summary>
+ /// Returns a <see cref="long"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <returns>
+ /// A <see cref="long"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.
+ /// </returns>
public long GetInt64(string name, long defaultValue)
{
***************
*** 150,153 ****
--- 203,219 ----
}
+ /// <summary>
+ /// Returns a <see cref="long"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <param name="throwOnInvalidValue">
+ /// If <c>false</c>, suppresses exceptions if the result
+ /// of <see cref="IVariableSource.ResolveVariable"/> cannot be parsed
+ /// and returns <paramref name="defaultValue"/> instead.</param>
+ /// <returns>
+ /// A <see cref="long"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> cannot be parsed.
+ /// </returns>
public long GetInt64(string name, long defaultValue, bool throwOnInvalidValue)
{
***************
*** 170,173 ****
--- 236,248 ----
}
+ /// <summary>
+ /// Returns a <see cref="ulong"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <returns>
+ /// A <see cref="ulong"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.
+ /// </returns>
public ulong GetUInt64(string name, ulong defaultValue)
{
***************
*** 175,178 ****
--- 250,266 ----
}
+ /// <summary>
+ /// Returns a <see cref="ulong"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <param name="throwOnInvalidValue">
+ /// If <c>false</c>, suppresses exceptions if the result
+ /// of <see cref="IVariableSource.ResolveVariable"/> cannot be parsed
+ /// and returns <paramref name="defaultValue"/> instead.</param>
+ /// <returns>
+ /// A <see cref="ulong"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> cannot be parsed.
+ /// </returns>
public ulong GetUInt64(string name, ulong defaultValue, bool throwOnInvalidValue)
{
***************
*** 195,198 ****
--- 283,295 ----
}
+ /// <summary>
+ /// Returns a <see cref="int"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <returns>
+ /// A <see cref="int"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.
+ /// </returns>
public int GetInt32(string name, int defaultValue)
{
***************
*** 200,203 ****
--- 297,313 ----
}
+ /// <summary>
+ /// Returns a <see cref="int"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <param name="throwOnInvalidValue">
+ /// If <c>false</c>, suppresses exceptions if the result
+ /// of <see cref="IVariableSource.ResolveVariable"/> cannot be parsed
+ /// and returns <paramref name="defaultValue"/> instead.</param>
+ /// <returns>
+ /// A <see cref="int"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> cannot be parsed.
+ /// </returns>
public int GetInt32(string name, int defaultValue, bool throwOnInvalidValue)
{
***************
*** 220,223 ****
--- 330,342 ----
}
+ /// <summary>
+ /// Returns a <see cref="uint"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <returns>
+ /// A <see cref="uint"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.
+ /// </returns>
public uint GetUInt32(string name, uint defaultValue)
{
***************
*** 225,228 ****
--- 344,360 ----
}
+ /// <summary>
+ /// Returns a <see cref="uint"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <param name="throwOnInvalidValue">
+ /// If <c>false</c>, suppresses exceptions if the result
+ /// of <see cref="IVariableSource.ResolveVariable"/> cannot be parsed
+ /// and returns <paramref name="defaultValue"/> instead.</param>
+ /// <returns>
+ /// A <see cref="uint"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> cannot be parsed.
+ /// </returns>
public uint GetUInt32(string name, uint defaultValue, bool throwOnInvalidValue)
{
***************
*** 245,248 ****
--- 377,389 ----
}
+ /// <summary>
+ /// Returns a <see cref="short"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <returns>
+ /// A <see cref="short"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.
+ /// </returns>
public short GetInt16(string name, short defaultValue)
{
***************
*** 250,253 ****
--- 391,407 ----
}
+ /// <summary>
+ /// Returns a <see cref="short"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <param name="throwOnInvalidValue">
+ /// If <c>false</c>, suppresses exceptions if the result
+ /// of <see cref="IVariableSource.ResolveVariable"/> cannot be parsed
+ /// and returns <paramref name="defaultValue"/> instead.</param>
+ /// <returns>
+ /// A <see cref="short"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> cannot be parsed.
+ /// </returns>
public short GetInt16(string name, short defaultValue, bool throwOnInvalidValue)
{
***************
*** 270,273 ****
--- 424,436 ----
}
+ /// <summary>
+ /// Returns a <see cref="short"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <returns>
+ /// A <see cref="short"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.
+ /// </returns>
public ushort GetUInt16(string name, ushort defaultValue)
{
***************
*** 275,278 ****
--- 438,454 ----
}
+ /// <summary>
+ /// Returns a <see cref="short"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <param name="throwOnInvalidValue">
+ /// If <c>false</c>, suppresses exceptions if the result
+ /// of <see cref="IVariableSource.ResolveVariable"/> cannot be parsed
+ /// and returns <paramref name="defaultValue"/> instead.</param>
+ /// <returns>
+ /// A <see cref="short"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> cannot be parsed.
+ /// </returns>
public ushort GetUInt16(string name, ushort defaultValue, bool throwOnInvalidValue)
{
***************
*** 295,298 ****
--- 471,483 ----
}
+ /// <summary>
+ /// Returns a <see cref="byte"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <returns>
+ /// A <see cref="byte"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.
+ /// </returns>
public byte GetByte(string name, byte defaultValue)
{
***************
*** 300,303 ****
--- 485,501 ----
}
+ /// <summary>
+ /// Returns a <see cref="byte"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <param name="throwOnInvalidValue">
+ /// If <c>false</c>, suppresses exceptions if the result
+ /// of <see cref="IVariableSource.ResolveVariable"/> cannot be parsed
+ /// and returns <paramref name="defaultValue"/> instead.</param>
+ /// <returns>
+ /// A <see cref="byte"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> cannot be parsed.
+ /// </returns>
public byte GetByte(string name, byte defaultValue, bool throwOnInvalidValue)
{
***************
*** 320,323 ****
--- 518,530 ----
}
+ /// <summary>
+ /// Returns a <see cref="Guid"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <returns>
+ /// A <see cref="Guid"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.
+ /// </returns>
public Guid GetGuid(string name, Guid defaultValue)
{
***************
*** 325,328 ****
--- 532,548 ----
}
+ /// <summary>
+ /// Returns a <see cref="Guid"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <param name="throwOnInvalidValue">
+ /// If <c>false</c>, suppresses exceptions if the result
+ /// of <see cref="IVariableSource.ResolveVariable"/> cannot be parsed
+ /// and returns <paramref name="defaultValue"/> instead.</param>
+ /// <returns>
+ /// A <see cref="Guid"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> cannot be parsed.
+ /// </returns>
public Guid GetGuid(string name, Guid defaultValue, bool throwOnInvalidValue)
{
***************
*** 345,348 ****
--- 565,578 ----
}
+ /// <summary>
+ /// Returns a <see cref="DateTime"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="format">The expected format of the variable's value</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <returns>
+ /// A <see cref="DateTime"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.
+ /// </returns>
public DateTime GetDateTime(string name, string format, DateTime defaultValue)
{
***************
*** 350,353 ****
--- 580,597 ----
}
+ /// <summary>
+ /// Returns a <see cref="DateTime"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="format">The expected format of the variable's value</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <param name="throwOnInvalidValue">
+ /// If <c>false</c>, suppresses exceptions if the result
+ /// of <see cref="IVariableSource.ResolveVariable"/> cannot be parsed
+ /// and returns <paramref name="defaultValue"/> instead.</param>
+ /// <returns>
+ /// A <see cref="DateTime"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> cannot be parsed.
+ /// </returns>
public DateTime GetDateTime(string name, string format, DateTime defaultValue, bool throwOnInvalidValue)
{
***************
*** 377,380 ****
--- 621,633 ----
}
+ /// <summary>
+ /// Returns a <see cref="char"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <returns>
+ /// A <see cref="char"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.
+ /// </returns>
public char GetChar(string name, char defaultValue)
{
***************
*** 382,385 ****
--- 635,651 ----
}
+ /// <summary>
+ /// Returns a <see cref="char"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <param name="throwOnInvalidValue">
+ /// If <c>false</c>, suppresses exceptions if the result
+ /// of <see cref="IVariableSource.ResolveVariable"/> cannot be parsed
+ /// and returns <paramref name="defaultValue"/> instead.</param>
+ /// <returns>
+ /// A <see cref="char"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> cannot be parsed.
+ /// </returns>
public char GetChar(string name, char defaultValue, bool throwOnInvalidValue)
{
***************
*** 406,409 ****
--- 672,684 ----
}
+ /// <summary>
+ /// Returns a <see cref="bool"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <returns>
+ /// A <see cref="bool"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.
+ /// </returns>
public bool GetBoolean(string name, bool defaultValue)
{
***************
*** 411,414 ****
--- 686,702 ----
}
+ /// <summary>
+ /// Returns a <see cref="bool"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <param name="throwOnInvalidValue">
+ /// If <c>false</c>, suppresses exceptions if the result
+ /// of <see cref="IVariableSource.ResolveVariable"/> cannot be parsed
+ /// and returns <paramref name="defaultValue"/> instead.</param>
+ /// <returns>
+ /// A <see cref="bool"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> cannot be parsed.
+ /// </returns>
public bool GetBoolean(string name, bool defaultValue, bool throwOnInvalidValue)
{
***************
*** 431,434 ****
--- 719,731 ----
}
+ /// <summary>
+ /// Returns an <see cref="Enum"/> of type <paramref name="defaultValue.GetType()"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <returns>
+ /// An <see cref="Enum"/> of type <paramref name="defaultValue.GetType()"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.
+ /// </returns>
public Enum GetEnum(string name, Enum defaultValue)
{
***************
*** 436,439 ****
--- 733,749 ----
}
+ /// <summary>
+ /// Returns an <see cref="Enum"/> of type <paramref name="defaultValue.GetType()"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.</param>
+ /// <param name="throwOnInvalidValue">
+ /// If <c>false</c>, suppresses exceptions if the result
+ /// of <see cref="IVariableSource.ResolveVariable"/> cannot be parsed
+ /// and returns <paramref name="defaultValue"/> instead.</param>
+ /// <returns>
+ /// An <see cref="Enum"/> of type <paramref name="defaultValue.GetType()"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> cannot be parsed.
+ /// </returns>
public Enum GetEnum(string name, Enum defaultValue, bool throwOnInvalidValue)
{
***************
*** 455,458 ****
--- 765,777 ----
}
+ /// <summary>
+ /// Returns a <see cref="string"/> that contains the value of the specified variable.
+ /// </summary>
+ /// <param name="name">The name of the variable to be read.</param>
+ /// <param name="defaultValue">The value to be returned if <see cref="IVariableSource.ResolveVariable"/> returns <see lang="null"/> or <see cref="String.Empty"/>.</param>
+ /// <returns>
+ /// A <see cref="string"/> that contains the value of the specified variable
+ /// or <paramref name="defaultValue"/>, if <see cref="IVariableSource.ResolveVariable"/> returns <c>null</c>.
+ /// </returns>
public string GetString(string name, string defaultValue)
{
Index: PropertyResourceConfigurer.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Config/PropertyResourceConfigurer.cs,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** PropertyResourceConfigurer.cs 22 Aug 2007 08:52:03 -0000 1.18
--- PropertyResourceConfigurer.cs 27 Aug 2007 14:49:42 -0000 1.19
***************
*** 32,207 ****
namespace Spring.Objects.Factory.Config
{
! /// <summary>
! /// Allows for the configuration of individual object property values from
! /// a .NET .config file.
! /// </summary>
! /// <remarks>
! /// <p>
! /// Useful for custom .NET .config files targetted at system administrators
! /// that override object properties configured in the application context.
! /// </p>
! /// <p>
! /// Two concrete implementations are provided in the Spring.NET core library:
! /// <list type="bullet">
! /// <item>
! /// <description>
! /// <see cref="Spring.Objects.Factory.Config.PropertyOverrideConfigurer"/>
! /// for <c><add key="placeholderKey" value="..."/></c> style
! /// overriding (pushing values from a .NET .config file into object
! /// definitions).
! /// </description>
! /// </item>
! /// <item>
! /// <description>
! /// <see cref="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer"/>
! /// for replacing "${...}" placeholders (pulling values from a .NET .config
! /// file into object definitions).
! /// </description>
! /// </item>
! /// </list>
! /// </p>
! /// <p>
! /// Please refer to the API documentation for the concrete implementations
! /// listed above for example usage.
! /// </p>
! /// </remarks>
! /// <author>Juergen Hoeller</author>
! /// <author>Simon White (.NET)</author>
! /// <seealso cref="Spring.Objects.Factory.Config.PropertyOverrideConfigurer"/>
! /// <seealso cref="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer"/>
! /// <version>$Id$</version>
[Serializable]
public abstract class PropertyResourceConfigurer
! : IObjectFactoryPostProcessor, IOrdered
! {
! /// <summary>
! /// The default configuration section name to use if none is explictly supplied.
! /// </summary>
! /// <seealso cref="Spring.Objects.Factory.Config.PropertyResourceConfigurer.ConfigSections"/>
! public const string DefaultConfigSectionName = "spring-config";
! #region Fields
! private static readonly ILog _log = LogManager.GetLogger(typeof (PropertyResourceConfigurer));
! private int _order = Int32.MaxValue; // default: same as non-Ordered
! private NameValueCollection _defaultProperties;
! private IResource[] _locations;
! private string[] _configSections;
! private bool _ignoreResourceNotFound = false;
! private bool _lastLocationOverrides = true;
! #endregion
! #region Constructor (s) / Destructor
! /// <summary>
! /// Creates a new instance of the
! /// <see cref="Spring.Objects.Factory.Config.PropertyResourceConfigurer"/>
! /// class.
! /// </summary>
! /// <remarks>
! /// <p>
! /// This is an <see langword="abstract"/> class, and as such exposes no
! /// public constructors.
! /// </p>
! /// </remarks>
! protected PropertyResourceConfigurer()
! {
! }
! #endregion
! #region Properties
! /// <summary>
! /// The policy for resolving conflicting property overrides from
! /// several resources.
! /// </summary>
! /// <remarks>
! /// <p>
! /// When merging conflicting property overrides from several resources,
! /// should append an override with the same key be appended to the
! /// current value, or should the property override from the last resource
! /// processed override previous values?
! /// </p>
! /// <p>
! /// The default value is <see langword="true"/>; i.e. a property
! /// override from the last resource to be processed overrides previous
! /// values.
! /// </p>
! /// </remarks>
! /// <value>
! /// <see langword="true"/> if the property override from the last resource
! /// processed overrides previous values.
! /// </value>
! public bool LastLocationOverrides
! {
! set { _lastLocationOverrides = value; }
! }
! /// <summary>
! /// Return the order value of this object, where a higher value means greater in
! /// terms of sorting.
! /// </summary>
! /// <returns>The order value.</returns>
! /// <seealso cref="Spring.Core.IOrdered.Order"/>
! public int Order
! {
! get { return _order; }
! set { _order = value; }
! }
! /// <summary>
! /// The default properties to be applied.
! /// </summary>
! /// <remarks>
! /// <p>
! /// These are to be considered defaults, to be overridden by values
! /// loaded from other resources.
! /// </p>
! /// </remarks>
! public NameValueCollection Properties
! {
! get { return _defaultProperties; }
! set { _defaultProperties = value; }
! }
! /// <summary>
! /// The location of the .NET .config file that contains the property
! /// overrides that are to be applied.
! /// </summary>
! public IResource Location
! {
! set { _locations = new IResource[] {value}; }
! }
! /// <summary>
! /// The locations of the .NET .config files containing the property
! /// overrides that are to be applied.
! /// </summary>
! public IResource[] Locations
! {
! set { _locations = value; }
! }
! /// <summary>
! /// The configuration sections to look for within the .config files.
! /// </summary>
! /// <seealso cref="Spring.Objects.Factory.Config.PropertyResourceConfigurer.Location"/>
! /// <seealso cref="Spring.Objects.Factory.Config.PropertyResourceConfigurer.Locations"/>
! public string[] ConfigSections
! {
! get
! {
! if (_configSections == null
! || _configSections.Length == 0)
! {
! _configSections = new string[] {DefaultConfigSectionName};
! }
! return _configSections;
! }
! set { _configSections = value; }
! }
/// <summary>
--- 32,207 ----
namespace Spring.Objects.Factory.Config
{
! /// <summary>
! /// Allows for the configuration of individual object property values from
! /// a .NET .config file.
! /// </summary>
! /// <remarks>
! /// <p>
! /// Useful for custom .NET .config files targetted at system administrators
! /// that override object properties configured in the application context.
! /// </p>
! /// <p>
! /// Two concrete implementations are provided in the Spring.NET core library:
! /// <list type="bullet">
! /// <item>
! /// <description>
! /// <see cref="Spring.Objects.Factory.Config.PropertyOverrideConfigurer"/>
! /// for <c><add key="placeholderKey" value="..."/></c> style
! /// overriding (pushing values from a .NET .config file into object
! /// definitions).
! /// </description>
! /// </item>
! /// <item>
! /// <description>
! /// <see cref="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer"/>
! /// for replacing "${...}" placeholders (pulling values from a .NET .config
! /// file into object definitions).
! /// </description>
! /// </item>
! /// </list>
! /// </p>
! /// <p>
! /// Please refer to the API documentation for the concrete implementations
! /// listed above for example usage.
! /// </p>
! /// </remarks>
! /// <author>Juergen Hoeller</author>
! /// <author>Simon White (.NET)</author>
! /// <seealso cref="Spring.Objects.Factory.Config.PropertyOverrideConfigurer"/>
! /// <seealso cref="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer"/>
! /// <version>$Id$</version>
[Serializable]
public abstract class PropertyResourceConfigurer
! : IObjectFactoryPostProcessor, IOrdered
! {
! /// <summary>
! /// The default configuration section name to use if none is explictly supplied.
! /// </summary>
! /// <seealso cref="Spring.Objects.Factory.Config.PropertyResourceConfigurer.ConfigSections"/>
! public const string DefaultConfigSectionName = "spring-config";
! #region Fields
! private static readonly ILog _log = LogManager.GetLogger(typeof(PropertyResourceConfigurer));
! private int _order = Int32.MaxValue; // default: same as non-Ordered
! private NameValueCollection _defaultProperties;
! private IResource[] _locations;
! private string[] _configSections;
! private bool _ignoreResourceNotFound = false;
! private bool _lastLocationOverrides = true;
! #endregion
! #region Constructor (s) / Destructor
! /// <summary>
! /// Creates a new instance of the
! /// <see cref="Spring.Objects.Factory.Config.PropertyResourceConfigurer"/>
! /// class.
! /// </summary>
! /// <remarks>
! /// <p>
! /// This is an <see langword="abstract"/> class, and as such exposes no
! /// public constructors.
! /// </p>
! /// </remarks>
! protected PropertyResourceConfigurer()
! {
! }
! #endregion
! #region Properties
! /// <summary>
! /// The policy for resolving conflicting property overrides from
! /// several resources.
! /// </summary>
! /// <remarks>
! /// <p>
! /// When merging conflicting property overrides from several resources,
! /// should append an override with the same key be appended to the
! /// current value, or should the property override from the last resource
! /// processed override previous values?
! /// </p>
! /// <p>
! /// The default value is <see langword="true"/>; i.e. a property
! /// override from the last resource to be processed overrides previous
! /// values.
! /// </p>
! /// </remarks>
! /// <value>
! /// <see langword="true"/> if the property override from the last resource
! /// processed overrides previous values.
! /// </value>
! public bool LastLocationOverrides
! {
! set { _lastLocationOverrides = value; }
! }
! /// <summary>
! /// Return the order value of this object, where a higher value means greater in
! /// terms of sorting.
! /// </summary>
! /// <returns>The order value.</returns>
! /// <seealso cref="Spring.Core.IOrdered.Order"/>
! public int Order
! {
! get { return _order; }
! set { _order = value; }
! }
! /// <summary>
! /// The default properties to be applied.
! /// </summary>
! /// <remarks>
! /// <p>
! /// These are to be considered defaults, to be overridden by values
! /// loaded from other resources.
! /// </p>
! /// </remarks>
! public NameValueCollection Properties
! {
! get { return _defaultProperties; }
! set { _defaultProperties = value; }
! }
! /// <summary>
! /// The location of the .NET .config file that contains the property
! /// overrides that are to be applied.
! /// </summary>
! public IResource Location
! {
! set { _locations = new IResource[] {value}; }
! }
! /// <summary>
! /// The locations of the .NET .config files containing the property
! /// overrides that are to be applied.
! /// </summary>
! public IResource[] Locations
! {
! set { _locations = value; }
! }
! /// <summary>
! /// The configuration sections to look for within the .config files.
! /// </summary>
! /// <seealso cref="Spring.Objects.Factory.Config.PropertyResourceConfigurer.Location"/>
! /// <seealso cref="Spring.Objects.Factory.Config.PropertyResourceConfigurer.Locations"/>
! public string[] ConfigSections
! {
! get
! {
! if (_configSections == null
! || _configSections.Length == 0)
! {
! _configSections = new string[] {DefaultConfigSectionName};
! }
! return _configSections;
! }
! set { _configSections = value; }
! }
/// <summary>
***************
*** 223,390 ****
}
! #endregion
!
!
! /// <summary>
! /// Modify the application context's internal object factory after its
! /// standard initialization.
! /// </summary>
! /// <param name="factory">
! /// The object factory used by the application context.
! /// </param>
! /// <exception cref="Spring.Objects.ObjectsException">
! /// In case of errors.
! /// </exception>
! /// <seealso cref="Spring.Objects.Factory.Config.IObjectFactoryPostProcessor.PostProcessObjectFactory(IConfigurableListableObjectFactory)"/>
! public void PostProcessObjectFactory(IConfigurableListableObjectFactory factory)
! {
! try
! {
! NameValueCollection properties = new NameValueCollection();
! InitializeWithDefaultProperties(properties);
! LoadProperties(properties);
! ProcessProperties(factory, properties);
! }
! catch (Exception ex)
! {
! if (typeof (ObjectsException).IsInstanceOfType(ex))
! {
! throw;
! }
! else
! {
! throw new ObjectsException(
! "Errored while postprocessing an object factory.", ex);
! }
! }
! }
! protected virtual void LoadProperties(NameValueCollection properties)
! {
! string[] configSections = ConfigSections;
! if (_locations != null)
! {
! ValidateConfigSections(configSections);
! bool usingMultipleConfigSections = configSections.Length > 1;
! int sectionNameIndex = 0;
! foreach (IResource resource in _locations)
! {
! #region Instrumentation
! if (_log.IsDebugEnabled)
! {
! _log.Debug(string.Format(
! CultureInfo.InvariantCulture,
! "Loading configuration from '{0}'.", resource));
! }
! #endregion
! string sectionName = configSections[sectionNameIndex];
! if (resource is ConfigSectionResource)
! {
! ConfigurationReader.PopulateFromAppConfig(
! properties, sectionName, _lastLocationOverrides);
! }
! else
! {
! if (resource.Exists)
! {
! ConfigurationReader.Read(
! resource, sectionName, properties, _lastLocationOverrides);
! }
! else
! {
! string errorMessage = "Could not load configuration from " + resource;
! if (_ignoreResourceNotFound)
! {
! #region Instrumentation
! if (_log.IsWarnEnabled)
! {
! _log.Warn(errorMessage);
! }
! #endregion
! }
! else
! {
! throw new ObjectInitializationException(errorMessage);
! }
! }
! }
! if (usingMultipleConfigSections)
! {
! ++sectionNameIndex;
! }
! }
! }
! else
! {
! foreach (string sectionName in configSections)
! {
! ConfigurationReader.PopulateFromAppConfig(
! properties, sectionName, _lastLocationOverrides);
! }
! }
! }
! /// <summary>
! /// Apply the given properties to the supplied
! /// <see cref="Spring.Objects.Factory.Config.IConfigurableListableObjectFactory"/>.
! /// </summary>
! /// <param name="factory">
! /// The <see cref="Spring.Objects.Factory.Config.IConfigurableListableObjectFactory"/>
! /// used by the application context.
! /// </param>
! /// <param name="props">The properties to apply.</param>
! /// <exception cref="Spring.Objects.ObjectsException">
! /// If an error occured.
! /// </exception>
! protected abstract void ProcessProperties(
! IConfigurableListableObjectFactory factory,
! NameValueCollection props);
! /// <summary>
! /// Validates the supplied <paramref name="configSections"/>.
! /// </summary>
! /// <remarks>
! /// <p>
! /// Basically, if external locations are specified, ensure that either
! /// one or a like number of config sections are also specified.
! /// </p>
! /// </remarks>
! /// <param name="configSections">
! /// The <paramref name="configSections"/> to be validated.
! /// </param>
! private void ValidateConfigSections(string[] configSections)
! {
! if (_locations.Length != configSections.Length)
! {
! // if only one config section is specified for all locations that's cool...
! if (configSections.Length != 1)
! {
! throw new ObjectInitializationException(
! "Invalid number of config sections specified.");
! }
! }
! }
! /// <summary>
! /// Simply initializes the supplied <paramref name="properties"/>
! /// collection with this instances default <see cref="Properties"/>
! /// (if any).
! /// </summary>
! /// <param name="properties">
! /// The collection to be so initialized.
! /// </param>
! private void InitializeWithDefaultProperties(NameValueCollection properties)
! {
! if (Properties != null)
! {
! properties.Add(Properties);
! }
! }
! }
}
\ No newline at end of file
--- 223,393 ----
}
! #endregion
! /// <summary>
! /// Modify the application context's internal object factory after its
! /// standard initialization.
! /// </summary>
! /// <param name="factory">
! /// The object factory used by the application context.
! /// </param>
! /// <exception cref="Spring.Objects.ObjectsException">
! /// In case of errors.
! /// </exception>
! /// <seealso cref="Spring.Objects.Factory.Config.IObjectFactoryPostProcessor.PostProcessObjectFactory(IConfigurableListableObjectFactory)"/>
! public void PostProcessObjectFactory(IConfigurableListableObjectFactory factory)
! {
! try
! {
! NameValueCollection properties = new NameValueCollection();
! InitializeWithDefaultProperties(properties);
! LoadProperties(properties);
! ProcessProperties(factory, properties);
! }
! catch (Exception ex)
! {
! if (typeof(ObjectsException).IsInstanceOfType(ex))
! {
! throw;
! }
! else
! {
! throw new ObjectsException(
! "Errored while postprocessing an object factory.", ex);
! }
! }
! }
! /// <summary>
! /// Loads properties from the configuration sections
! /// specified in <see cref="ConfigSections"/> into <paramref name="properties"/>.
! /// </summary>
! /// <param name="properties">The <see cref="NameValueCollection"/> instance to be filled with properties.</param>
! protected virtual void LoadProperties(NameValueCollection properties)
! {
! string[] configSections = ConfigSections;
! if (_locations != null)
! {
! ValidateConfigSections(configSections);
! bool usingMultipleConfigSections = configSections.Length > 1;
! int sectionNameIndex = 0;
! foreach (IResource resource in _locations)
! {
! #region Instrumentation
! if (_log.IsDebugEnabled)
! {
! _log.Debug(string.Format(
! CultureInfo.InvariantCulture,
! "Loading configuration from '{0}'.", resource));
! }
! #endregion
! string sectionName = configSections[sectionNameIndex];
! if (resource is ConfigSectionResource)
! {
! ConfigurationReader.PopulateFromAppConfig(
! properties, sectionName, _lastLocationOverrides);
! }
! else
! {
! if (resource.Exists)
! {
! ConfigurationReader.Read(
! resource, sectionName, properties, _lastLocationOverrides);
! }
! else
! {
! string errorMessage = "Could not load configuration from " + resource;
! if (_ignoreResourceNotFound)
! {
! #region Instrumentation
! if (_log.IsWarnEnabled)
! {
! _log.Warn(errorMessage);
! }
! #endregion
! }
! else
! {
! throw new ObjectInitializationException(errorMessage);
! }
! }
! }
! if (usingMultipleConfigSections)
! {
! ++sectionNameIndex;
! }
! }
! }
! else
! {
! foreach (string sectionName in configSections)
! {
! ConfigurationReader.PopulateFromAppConfig(
! properties, sectionName, _lastLocationOverrides);
! }
! }
! }
! /// <summary>
! /// Apply the given properties to the supplied
! /// <see cref="Spring.Objects.Factory.Config.IConfigurableListableObjectFactory"/>.
! /// </summary>
! /// <param name="factory">
! /// The <see cref="Spring.Objects.Factory.Config.IConfigurableListableObjectFactory"/>
! /// used by the application context.
! /// </param>
! /// <param name="props">The properties to apply.</param>
! /// <exception cref="Spring.Objects.ObjectsException">
! /// If an error occured.
! /// </exception>
! protected abstract void ProcessProperties(
! IConfigurableListableObjectFactory factory,
! NameValueCollection props);
! /// <summary>
! /// Validates the supplied <paramref name="configSections"/>.
! /// </summary>
! /// <remarks>
! /// <p>
! /// Basically, if external locations are specified, ensure that either
! /// one or a like number of config sections are also specified.
! /// </p>
! /// </remarks>
! /// <param name="configSections">
! /// The <paramref name="configSections"/> to be validated.
! /// </param>
! private void ValidateConfigSections(string[] configSections)
! {
! if (_locations.Length != configSections.Length)
! {
! // if only one config section is specified for all locations that's cool...
! if (configSections.Length != 1)
! {
! throw new ObjectInitializationException(
! "Invalid number of config sections specified.");
! }
! }
! }
! /// <summary>
! /// Simply initializes the supplied <paramref name="properties"/>
! /// collection with this instances default <see cref="Properties"/>
! /// (if any).
! /// </summary>
! /// <param name="properties">
! /// The collection to be so initialized.
! /// </param>
! private void InitializeWithDefaultProperties(NameValueCollection properties)
! {
! if (Properties != null)
! {
! properties.Add(Properties);
! }
! }
! }
}
\ No newline at end of file
|