ymikulski 2003/01/23 13:50:47 Modified: csframework/src/cs/Service IServiceSelector.cs IServiceable.cs csframework/src/cs/Parameters Parameters.cs csframework/src/cs/Activity ISuspendable.cs IStartable.cs IInitializable.cs IExecutable.cs IDisposable.cs csframework/src/cs/Context DefaultContext.cs ContextException.cs csframework/src/cs/Configuration IReconfigurable.cs IConfiguration.cs IConfigurable.cs DefaultConfigurationSerializer.cs DefaultConfigurationSectionHandler.cs DefaultConfiguration.cs ConfigurationException.cs ConfigurationCollection.cs AbstractConfiguration.cs csframework/src/cs/Util ContainerUtil.cs Log: no message Revision Changes Path 1.3 +1 -1 jakarta-avalon-excalibur/csframework/src/cs/Service/IServiceSelector.cs Index: IServiceSelector.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Service/IServiceSelector.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IServiceSelector.cs 25 Sep 2002 22:48:11 -0000 1.2 +++ IServiceSelector.cs 23 Jan 2003 21:50:33 -0000 1.3 @@ -10,7 +10,7 @@ namespace Apache.Avalon.Service { /// <summary> - /// A <code>IServiceSelector</code> selects components based on a + /// A <c>IServiceSelector</c> selects components based on a /// supplied policy. The contract is that all the components implement the /// same role. /// </summary> 1.3 +3 -3 jakarta-avalon-excalibur/csframework/src/cs/Service/IServiceable.cs Index: IServiceable.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Service/IServiceable.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IServiceable.cs 25 Sep 2002 22:48:11 -0000 1.2 +++ IServiceable.cs 23 Jan 2003 21:50:33 -0000 1.3 @@ -24,14 +24,14 @@ public interface IServiceable { /// <summary> - /// Pass the <see cref="IServiceManager"/> to the <code>IServiceable</code>. + /// Pass the <see cref="IServiceManager"/> to the <c>IServicable</c>. /// - /// The <code>IServiceable</code> implementation should use the specified + /// The <c>IServiceable</c> implementation should use the specified /// <see cref="IServiceManager"/> to acquire the components it needs for execution. /// </summary> /// <param name="manager"> /// The <see cref="IServiceManager"/> which - /// this <code>IServiceable</code> uses. + /// this <c>IServiceable</c> uses. /// </param> /// <exception cref="ServiceException">if an error occurs</exception> void Service( IServiceManager manager ); 1.7 +22 -26 jakarta-avalon-excalibur/csframework/src/cs/Parameters/Parameters.cs Index: Parameters.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Parameters/Parameters.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Parameters.cs 19 Nov 2002 10:35:13 -0000 1.6 +++ Parameters.cs 23 Jan 2003 21:50:33 -0000 1.7 @@ -11,7 +11,6 @@ using Apache.Avalon.Util; - namespace Apache.Avalon.Parameter { /// <summary> @@ -26,6 +25,10 @@ [Serializable] public class Parameters: IEnumerable, ISerializable { + private const string SERIAL_NAME_KEYS = "keys"; + private const string SERIAL_NAME_VALUES = "values"; + private const string SERIAL_NAME_READ_ONLY = "read-only"; + private bool readOnly; private Hashtable parameters = new Hashtable(); @@ -53,37 +56,18 @@ /// <param name="context"></param> public Parameters (SerializationInfo info, StreamingContext context) { - - parameters = new Hashtable(); - - object[] keys = (object[]) info.GetValue("parameters-keys", typeof(object)); - object[] values = (object[]) info.GetValue("parameters-values", typeof(object)); + parameters = new Hashtable(RuntimeSerializer.DeserializeIDictionary(info, + SERIAL_NAME_KEYS, SERIAL_NAME_VALUES)); - for (int i = 0; i < keys.Length; i++) + bool readOnlyMode = info.GetBoolean(SERIAL_NAME_READ_ONLY); + + if (readOnlyMode) { - parameters[keys[i]] = values[i]; + MakeReadOnly(); } } /// <summary> - /// - /// </summary> - /// <param name="info"></param> - /// <param name="context"></param> - public void GetObjectData(SerializationInfo info, StreamingContext context) - { - - object[] keys = new object[parameters.Keys.Count]; - parameters.Keys.CopyTo(keys, 0); - - object[] values = new object[parameters.Values.Count]; - parameters.Values.CopyTo(values, 0); - - info.AddValue("parameters-keys", keys); - info.AddValue("parameters-values", values); - } - - /// <summary> /// Gets a value indicating whether the parameters is read-only. /// </summary> /// <value>True if the parameters are read-only; otherwise, false.</value> @@ -244,6 +228,18 @@ { return parameters.Count; } + } + + /// <summary> + /// + /// </summary> + /// <param name="info"></param> + /// <param name="context"></param> + public void GetObjectData(SerializationInfo info, StreamingContext context) + { + RuntimeSerializer.SerializeIDictionary(info, parameters, SERIAL_NAME_KEYS, SERIAL_NAME_VALUES); + + info.AddValue(SERIAL_NAME_READ_ONLY, IsReadOnly); } } } 1.3 +2 -2 jakarta-avalon-excalibur/csframework/src/cs/Activity/ISuspendable.cs Index: ISuspendable.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Activity/ISuspendable.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ISuspendable.cs 25 Sep 2002 22:46:30 -0000 1.2 +++ ISuspendable.cs 23 Jan 2003 21:50:34 -0000 1.3 @@ -10,10 +10,10 @@ namespace Apache.Avalon.Activity { /// <summary> - /// The ISuspendable interface is used when a component + /// The <see cref="ISuspendable"/> interface is used when a component /// will need to temporarily halt execution of a component. /// The execution may be halted so that you can reconfigure/ - /// recompose/recontextualize component. + /// recompose/recontextualize the component. /// </summary> public interface ISuspendable { 1.3 +4 -4 jakarta-avalon-excalibur/csframework/src/cs/Activity/IStartable.cs Index: IStartable.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Activity/IStartable.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IStartable.cs 25 Sep 2002 22:46:30 -0000 1.2 +++ IStartable.cs 23 Jan 2003 21:50:36 -0000 1.3 @@ -10,7 +10,7 @@ namespace Apache.Avalon.Activity { /// <summary> - /// The IStartable interface is used when components need to + /// The <see cref="IStartable"/> interface is used when components need to /// be "running" to be active. It provides a method through /// which components can be "started" and "stopped" without /// requiring a thread. @@ -24,8 +24,8 @@ /// <summary> /// Starts the component. /// </summary> - /// <exception cref="System.Exception"> - /// The Exception if Component can not be started. + /// <exception cref="Exception"> + /// The Exception if the component can not be started. /// </exception> void Start(); @@ -33,7 +33,7 @@ /// Stops the component. /// </summary> /// <exception cref="System.Exception"> - /// The Exception if the Component can not be stopped. + /// The Exception if the component can not be stopped. /// </exception> void Stop(); } 1.3 +7 -6 jakarta-avalon-excalibur/csframework/src/cs/Activity/IInitializable.cs Index: IInitializable.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Activity/IInitializable.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IInitializable.cs 25 Sep 2002 22:46:30 -0000 1.2 +++ IInitializable.cs 23 Jan 2003 21:50:36 -0000 1.3 @@ -10,18 +10,19 @@ namespace Apache.Avalon.Activity { /// <summary> - /// The IInitializable interface is used by components - /// that need to allocate resources prior - /// to them becoming active. + /// The <see cref="IInitializable"/> interface is used by components + /// that need to allocate resources prior to them becoming active. /// </summary> public interface IInitializable { /// <summary> /// Initialializes the component. - /// An Initialization includes allocating any resources - /// required throughout the components lifecycle. /// </summary> - /// <exception cref="System.Exception"> + /// <remarks> + /// An Initialization includes allocating any resources + /// required throughout the component lifecycle. + /// </remarks> + /// <exception cref="Exception"> /// The Exception if an error occurs. /// </exception> void Initialize(); 1.3 +2 -2 jakarta-avalon-excalibur/csframework/src/cs/Activity/IExecutable.cs Index: IExecutable.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Activity/IExecutable.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IExecutable.cs 25 Sep 2002 22:46:30 -0000 1.2 +++ IExecutable.cs 23 Jan 2003 21:50:36 -0000 1.3 @@ -10,7 +10,7 @@ namespace Apache.Avalon.Activity { /// <summary> - /// The IExecutable can be implemented by components + /// The <see cref="IExecutable"/> can be implemented by components /// that need to perform some work. /// </summary> /// <remarks> @@ -22,7 +22,7 @@ /// <summary> /// Executes the action associated with this component. /// </summary> - /// <exception cref="System.Exception"> + /// <exception cref="Exception"> /// The Exception if an error occurs. /// </exception> void Execute(); 1.3 +5 -3 jakarta-avalon-excalibur/csframework/src/cs/Activity/IDisposable.cs Index: IDisposable.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Activity/IDisposable.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IDisposable.cs 25 Sep 2002 22:46:30 -0000 1.2 +++ IDisposable.cs 23 Jan 2003 21:50:36 -0000 1.3 @@ -17,10 +17,12 @@ { /// <summary> /// The Dispose operation is called at the end of a components lifecycle. - /// This method will be called after IStartable.stop() method (if implemented - /// by component). Components use this method to release and destroy any - /// resources that the Component owns. /// </summary> + /// <remarks> + /// This method will be called after <see cref="IStartable.Stop()"/> method + /// (if implemented by the component). Components use this method to release + /// and destroy any resources that the component owns. + /// </remarks> void Dispose(); } } 1.5 +50 -9 jakarta-avalon-excalibur/csframework/src/cs/Context/DefaultContext.cs Index: DefaultContext.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Context/DefaultContext.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- DefaultContext.cs 19 Nov 2002 10:35:13 -0000 1.4 +++ DefaultContext.cs 23 Jan 2003 21:50:43 -0000 1.5 @@ -7,27 +7,32 @@ //------------------------------------------------------------------------------ using System; using System.Collections; +using System.Runtime.Serialization; + +using Apache.Avalon.Util; namespace Apache.Avalon.Context { /// <summary> /// Default implementation of IContext. /// </summary> - public class DefaultContext: MarshalByRefObject, IContext, IEnumerable + [Serializable] + public class DefaultContext: MarshalByRefObject, IContext, IEnumerable, ISerializable { + private const string SERIAL_NAME_KEYS = "keys"; + private const string SERIAL_NAME_VALUES = "values"; + private const string SERIAL_NAME_PARENT = "parent"; + private const string SERIAL_NAME_READ_ONLY = "read-only"; + private IDictionary components; private IContext parent; private bool readOnly; /// <summary> - /// Creates a context with specified data and parent. + /// Creates a context with no parent. /// </summary> - /// <param name="data">The Context data.</param> - /// <param name="context">The Parent context (may be null).</param> - public DefaultContext(IDictionary data, IContext context) + public DefaultContext(): this ((IContext) null) { - parent = context; - components = data; } /// <summary> @@ -47,10 +52,34 @@ } /// <summary> - /// Creates a context with no parent. + /// Creates a context with specified data and parent. /// </summary> - public DefaultContext(): this ((IContext) null) + /// <param name="data">The Context data.</param> + /// <param name="context">The Parent context (may be null).</param> + public DefaultContext(IDictionary data, IContext context) { + parent = context; + components = data; + } + + /// <summary> + /// Creates a new Parameters instance. + /// </summary> + /// <param name="info"></param> + /// <param name="context"></param> + public DefaultContext (SerializationInfo info, StreamingContext context) + { + components = new Hashtable(RuntimeSerializer.DeserializeIDictionary(info, + SERIAL_NAME_KEYS, SERIAL_NAME_VALUES)); + + parent = (IContext) info.GetValue(SERIAL_NAME_PARENT, typeof(IContext)); + + bool readOnlyMode = info.GetBoolean(SERIAL_NAME_READ_ONLY); + + if (readOnlyMode) + { + MakeReadOnly(); + } } /// <summary> @@ -164,5 +193,17 @@ return components.GetEnumerator(); } + /// <summary> + /// + /// </summary> + /// <param name="info"></param> + /// <param name="context"></param> + public void GetObjectData(SerializationInfo info, StreamingContext context) + { + RuntimeSerializer.SerializeIDictionary(info, components, SERIAL_NAME_KEYS, SERIAL_NAME_VALUES); + + info.AddValue(SERIAL_NAME_PARENT, parent); + info.AddValue(SERIAL_NAME_READ_ONLY, IsReadOnly); + } } } 1.4 +3 -3 jakarta-avalon-excalibur/csframework/src/cs/Context/ContextException.cs Index: ContextException.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Context/ContextException.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ContextException.cs 8 Nov 2002 20:38:17 -0000 1.3 +++ ContextException.cs 23 Jan 2003 21:50:43 -0000 1.4 @@ -21,14 +21,14 @@ public class ContextException: Exception { /// <summary> - /// Constructs a new <code>ContextException</code> instance. + /// Constructs a new <c>ContextException</c> instance. /// </summary> public ContextException(): this(null) { } /// <summary> - /// Constructs a new <code>ContextException</code> instance. + /// Constructs a new <c>ContextException</c> instance. /// </summary> /// <param name="message">The Detail message for this exception.</param> public ContextException(string message): this(message, null) @@ -36,7 +36,7 @@ } /// <summary> - /// Constructs a new <code>ContextException</code> instance. + /// Constructs a new <c>ContextException</c> instance. /// </summary> /// <param name="message">The Detail message for this exception.</param> /// <param name="inner">The Root cause of the exception.</param> 1.3 +5 -0 jakarta-avalon-excalibur/csframework/src/cs/Configuration/IReconfigurable.cs Index: IReconfigurable.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Configuration/IReconfigurable.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IReconfigurable.cs 25 Sep 2002 22:46:57 -0000 1.2 +++ IReconfigurable.cs 23 Jan 2003 21:50:43 -0000 1.3 @@ -14,6 +14,11 @@ /// </summary> public interface IReconfigurable: IConfigurable { + /// <summary> + /// Allows reconfiguration at runtime. + /// </summary> + /// <param name="configuration">An <see cref="IConfiguration"/> value.</param> + /// <exception cref="ConfigurationException">If an error occurs.</exception> void Reconfigure( IConfiguration configuration ); } } 1.4 +24 -26 jakarta-avalon-excalibur/csframework/src/cs/Configuration/IConfiguration.cs Index: IConfiguration.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Configuration/IConfiguration.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- IConfiguration.cs 25 Sep 2002 22:46:57 -0000 1.3 +++ IConfiguration.cs 23 Jan 2003 21:50:43 -0000 1.4 @@ -11,13 +11,9 @@ namespace Apache.Avalon.Configuration { /// <summary> - /// <c>IConfiguration</c> is a interface encapsulating a configuration node + /// <see cref="IConfiguration"/> is a interface encapsulating a configuration node /// used to retrieve configuration values. /// </summary> - /// <remarks> - /// This is a "read only" interface preventing applications from modifying their - /// own configurations. Once it is created, the information never changes. - /// </remarks> public interface IConfiguration { /// <summary> @@ -32,10 +28,10 @@ } /// <summary> - /// Gets a string describing location of <c>IConfiguration</c>. + /// Gets a string describing location of <see cref="IConfiguration"/>. /// </summary> /// <value> - /// A String describing location of <c>IConfiguration</c>. + /// A String describing location of <see cref="IConfiguration"/>. /// </value> string Location { @@ -54,7 +50,7 @@ } /// <summary> - /// Gets the Namespace of the node. + /// Gets the namespace of the node. /// </summary> /// <value> /// The Namespace of the node. @@ -65,7 +61,7 @@ } /// <summary> - /// Gets the Prefix of the node. + /// Gets the prefix of the node. /// </summary> /// <value> /// The Prefix of the node. @@ -76,10 +72,10 @@ } /// <summary> - /// Gets a value indicating whether the <c>IConfiguration</c> is read-only. + /// Gets a value indicating whether the <see cref="IConfiguration"/> is read-only. /// </summary> /// <value> - /// True if the <c>IConfiguration</c> is read-only; otherwise, false. + /// <see langword="true"/> if the <see cref="IConfiguration"/> is read-only; otherwise, <see langword="false"/>. /// </value> bool IsReadOnly { @@ -87,7 +83,7 @@ } /// <summary> - /// Gets an <see cref="ConfigurationCollection"/> of <c>IConfiguration</c> + /// Gets an <see cref="ConfigurationCollection"/> of <see cref="IConfiguration"/> /// elements containing all node children. /// </summary> /// <value>The Collection of child nodes.</value> @@ -105,50 +101,52 @@ } /// <summary> - /// Gets a <c>IConfiguration</c> instance encapsulating the specified + /// Gets a <see cref="IConfiguration"/> instance encapsulating the specified /// child node. /// </summary> /// <param name="child">The Name of the child node.</param> /// <param name="createNew"> - /// If <c>true</c>, a new <c>IConfiguration</c> + /// If <see langword="true"/>, a new <see cref="IConfiguration"/> /// will be created and returned if the specified child does not exist. - /// If <c>false</c>, <c>null</c> will be returned when the specified + /// If <see langword="false"/>, <see langword="null"/> will be returned when the specified /// child doesn't exist. /// </param> - /// <returns><c>IConfiguration</c></returns> + /// <returns> + /// The <see cref="IConfiguration"/> instance encapsulating the specified child node. + /// </returns> IConfiguration GetChild(string child, bool createNew); /// <summary> - /// Return an <see cref="ConfigurationCollection"/> of <c>IConfiguration</c> + /// Return an <see cref="ConfigurationCollection"/> of <see cref="IConfiguration"/> /// elements containing all node children with the specified name. /// </summary> /// <param name="name">The Name of the children to get.</param> /// <returns> - /// An <see cref="ConfigurationCollection"/> of - /// <c>IConfiguration</c> objects children of + /// The <see cref="ConfigurationCollection"/> of + /// <see cref="IConfiguration"/> children of /// this associated with the given name. /// </returns> ConfigurationCollection GetChildren(string name); /// <summary> - /// Gets the Value of the node and converts it - /// into specified <see cref="System.Type"/>. + /// Gets the value of the node and converts it + /// into specified <see cref="Type"/>. /// </summary> - /// <param name="type">The <see cref="System.Type"/></param> + /// <param name="type">The <see cref="Type"/></param> /// <param name="defaultValue"> - /// The defaultValue returned if the convertion fails. + /// The Default value returned if the convertion fails. /// </param> /// <returns>The Value converted into the specified type.</returns> object GetValue(Type type, object defaultValue); /// <summary> /// Gets the value of specified attribute and - /// converts it into specified <see cref="System.Type"/>. + /// converts it into specified <see cref="Type"/>. /// </summary> /// <param name="name">The Name of the attribute you ask the value of.</param> - /// <param name="type">The <see cref="System.Type"/></param> + /// <param name="type">The <see cref="Type"/></param> /// <param name="defaultValue"> - /// The defaultValue returned if the convertion fails. + /// The Default value returned if the convertion fails. /// </param> /// <returns>The Value of the attribute.</returns> object GetAttribute(string name, Type type, object defaultValue); 1.3 +13 -11 jakarta-avalon-excalibur/csframework/src/cs/Configuration/IConfigurable.cs Index: IConfigurable.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Configuration/IConfigurable.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IConfigurable.cs 25 Sep 2002 22:46:57 -0000 1.2 +++ IConfigurable.cs 23 Jan 2003 21:50:43 -0000 1.3 @@ -12,25 +12,27 @@ /// <summary> /// This interface should be implemented by classes that need to be /// configured with custom parameters before initialization. - /// <para> - /// The contract surrounding a <c>IConfigurable</c> is that the - /// instantiating entity must call the <c>Configure</c> - /// method before it is valid. The <c>Configure</c> method - /// must be called after the constructor, and before any other method. - /// </para> /// </summary> + /// <remarks> + /// The contract surrounding a <see cref="IConfigurable"/> is that the + /// instantiating entity must call the <see cref="IConfigurable.Configure(IConfiguration configuration)"/> + /// method before it is valid. + /// The <see cref="IConfigurable.Configure(IConfiguration configuration)"/> method + /// must be called after the constructor, and before any other method. + /// </remarks> /// <remarks> /// Note that this interface is incompatible with <see cref="Apache.Avalon.Parameter.IParameterizable"/>. /// </remarks> public interface IConfigurable { /// <summary> - /// - /// Pass the <see cref="IConfiguration"/> to the <c>IConfigurable</c> - /// class. This method must always be called after the constructor - /// and before any other method. + /// Pass the <see cref="IConfiguration"/> to the <see cref="IConfigurable"/> instanse. /// </summary> - /// <param name="configuration">The Configuration</param> + /// <remarks> + /// This method must always be called after the constructor and before any other method. + /// </remarks> + /// <param name="configuration">The <see cref="IConfiguration"/> to pass.</param> + /// <exception cref="ConfigurationException">If an error occurs.</exception> void Configure( IConfiguration configuration ); } } 1.8 +9 -9 jakarta-avalon-excalibur/csframework/src/cs/Configuration/DefaultConfigurationSerializer.cs Index: DefaultConfigurationSerializer.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Configuration/DefaultConfigurationSerializer.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- DefaultConfigurationSerializer.cs 19 Nov 2002 11:34:02 -0000 1.7 +++ DefaultConfigurationSerializer.cs 23 Jan 2003 21:50:43 -0000 1.8 @@ -75,8 +75,8 @@ /// <summary> /// Makes a deserialization of a <see cref="DefaultConfiguration"/> instance. /// </summary> - /// <param name="fileName">The name of the file, containing the XML document to deserialize.</param> - /// <returns>A deserialized <see cref="DefaultConfiguration"/> instance.</returns> + /// <param name="fileName">The Name of the file, containing the XML document to deserialize.</param> + /// <returns>A Deserialized <see cref="DefaultConfiguration"/> instance.</returns> public static DefaultConfiguration Deserialize(string fileName) { DefaultConfiguration configuration = null; @@ -95,11 +95,11 @@ } /// <summary> - /// Makes a deserialization of <see cref="System.Xml.XmlNode"/> instance. + /// Makes a deserialization of <see cref="XmlNode"/> instance. /// </summary> - /// <param name="node">The node to deserialize.</param> - /// <param name="parent">A deserialized <see cref="DefaultConfiguration"/> parent instance.</param> - /// <returns>A deserialized <see cref="DefaultConfiguration"/> instance.</returns> + /// <param name="node">The Node to deserialize.</param> + /// <param name="parent">A Deserialized <see cref="DefaultConfiguration"/> parent instance.</param> + /// <returns>A Deserialized <see cref="DefaultConfiguration"/> instance.</returns> public static DefaultConfiguration Deserialize(XmlNode node, DefaultConfiguration parent) { // node deserialization @@ -145,10 +145,10 @@ } /// <summary> - /// Makes a deserialization of <see cref="System.Xml.XmlNode"/> instance. + /// Makes a deserialization of <see cref="XmlNode"/> instance. /// </summary> - /// <param name="node">The node to deserialize.</param> - /// <returns>A deserialized <see cref="DefaultConfiguration"/> instance.</returns> + /// <param name="node">The Node to deserialize.</param> + /// <returns>A Deserialized <see cref="DefaultConfiguration"/> instance.</returns> public static DefaultConfiguration Deserialize(XmlNode node) { return Deserialize(node, null); 1.3 +2 -2 jakarta-avalon-excalibur/csframework/src/cs/Configuration/DefaultConfigurationSectionHandler.cs Index: DefaultConfigurationSectionHandler.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Configuration/DefaultConfigurationSectionHandler.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DefaultConfigurationSectionHandler.cs 25 Sep 2002 22:46:57 -0000 1.2 +++ DefaultConfigurationSectionHandler.cs 23 Jan 2003 21:50:43 -0000 1.3 @@ -29,7 +29,7 @@ /// <seealso cref="IConfigurationSectionHandler"/> /// </summary> /// <param name="parent"> - /// The configuration settings in a corresponding parent configuration section. + /// The Configuration settings in a corresponding parent configuration section. /// </param> /// <param name="configContext"> /// <see cref="IConfigurationSectionHandler"/>. @@ -38,7 +38,7 @@ /// Contains the configuration information from the configuration file. /// </param> /// <returns> - /// A DefaultConfiguration instance based on a configuration section. + /// A <see cref="DefaultConfiguration"/> instance based on a configuration section. /// </returns> public object Create(object parent, object configContext, XmlNode section) { 1.3 +84 -18 jakarta-avalon-excalibur/csframework/src/cs/Configuration/DefaultConfiguration.cs Index: DefaultConfiguration.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Configuration/DefaultConfiguration.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DefaultConfiguration.cs 25 Sep 2002 22:46:57 -0000 1.2 +++ DefaultConfiguration.cs 23 Jan 2003 21:50:43 -0000 1.3 @@ -7,6 +7,9 @@ //------------------------------------------------------------------------------ using System; using System.Collections; +using System.Runtime.Serialization; + +using Apache.Avalon.Util; namespace Apache.Avalon.Configuration { @@ -14,21 +17,30 @@ /// This is the default <see cref="IConfiguration"/> implementation. /// </summary> [Serializable] - public class DefaultConfiguration: AbstractConfiguration + public class DefaultConfiguration: AbstractConfiguration, ISerializable { - + private const string SERIAL_NAME_NAME = "name"; + private const string SERIAL_NAME_LOCATION = "location"; + private const string SERIAL_NAME_NAMESPACE = "namespace"; + private const string SERIAL_NAME_PREFIX = "prefix"; + private const string SERIAL_NAME_VALUE = "value"; + private const string SERIAL_NAME_READ_ONLY = "read-only"; + private const string SERIAL_NAME_ATTRIBUTE_KEYS = "attribute-keys"; + private const string SERIAL_NAME_ATTRIBUTE_VALUES = "attribute-values"; + private const string SERIAL_NAME_CHILDREN = "children"; + /// <summary> - /// Creates a new <c>DefaultConfiguration</c> instance. + /// Creates a new <see cref="DefaultConfiguration"/> instance. /// </summary> public DefaultConfiguration() { } /// <summary> - /// Creates a new <c>DefaultConfiguration</c> instance. + /// Creates a new <see cref="DefaultConfiguration"/> instance. /// </summary> - /// <param name="name"></param> - /// <param name="location"></param> + /// <param name="name">The Name of the node.</param> + /// <param name="location">The Location of the node.</param> public DefaultConfiguration(string name, string location ) { Name = name; @@ -36,12 +48,12 @@ } /// <summary> - /// Creates a new <c>DefaultConfiguration</c> instance. + /// Creates a new <see cref="DefaultConfiguration"/> instance. /// </summary> - /// <param name="name"></param> - /// <param name="location"></param> - /// <param name="ns"></param> - /// <param name="prefix"></param> + /// <param name="name">The Name of the node.</param> + /// <param name="location">The Location of the node.</param> + /// <param name="ns">The Namespace of the node.</param> + /// <param name="prefix">The Prefix of the node.</param> public DefaultConfiguration(string name, string location, string ns, string prefix): this(name, location) { Namespace = ns; @@ -49,17 +61,49 @@ } /// <summary> - /// Gets a <c>IConfiguration</c> instance encapsulating the specified + /// Creates a new <see cref="DefaultConfiguration"/> instance. + /// </summary> + /// <param name="info">The <see cref="SerializationInfo"/> to populate with data.</param> + /// <param name="context">The destination for this serialization.</param> + public DefaultConfiguration(SerializationInfo info, StreamingContext context) + { + Name = info.GetString(SERIAL_NAME_NAME); + Location = info.GetString(SERIAL_NAME_LOCATION); + Namespace = info.GetString(SERIAL_NAME_NAMESPACE); + Prefix = info.GetString(SERIAL_NAME_PREFIX); + + Value = info.GetString(SERIAL_NAME_VALUE); + + Attributes = new Hashtable(RuntimeSerializer.DeserializeIDictionary(info, + SERIAL_NAME_ATTRIBUTE_KEYS, SERIAL_NAME_ATTRIBUTE_VALUES)); + + foreach (IConfiguration config in RuntimeSerializer.DeserializeArray(info, SERIAL_NAME_CHILDREN)) + { + Children.Add((IConfiguration) config); + } + + bool readOnlyMode = info.GetBoolean(SERIAL_NAME_READ_ONLY); + + if (readOnlyMode) + { + MakeReadOnly(); + } + } + + /// <summary> + /// Gets an <see cref="IConfiguration"/> instance encapsulating the specified /// child node. /// </summary> /// <param name="name">The Name of the child node.</param> /// <param name="createNew"> - /// If <c>true</c>, a new <c>IConfiguration</c> + /// If <see langword="true"/>, a new <see cref="IConfiguration"/> /// will be created and returned if the specified child does not exist. - /// If <c>false</c>, <c>null</c> will be returned when the specified + /// If <see langword="true"/>, <see langword="null"/> will be returned when the specified /// child doesn't exist. /// </param> - /// <returns><c>IConfiguration</c></returns> + /// <returns> + /// The <see cref="IConfiguration"/> instance encapsulating the specified child node. + /// </returns> public override IConfiguration GetChild(string name, bool createNew ) { IConfiguration result = null; @@ -88,13 +132,12 @@ } /// <summary> - /// Return an <see cref="ConfigurationCollection"/> of <c>IConfiguration</c> + /// Return a collection of <see cref="IConfiguration"/> /// elements containing all node children with the specified name. /// </summary> /// <param name="name">The Name of the children to get.</param> /// <returns> - /// An <see cref="ConfigurationCollection"/> of - /// <c>IConfiguration</c> objects children of + /// The collection of <see cref="IConfiguration"/> children of /// this associated with the given name. /// </returns> public override ConfigurationCollection GetChildren(string name) @@ -110,6 +153,29 @@ } return result; + } + + /// <summary> + /// Populates a <see cref="SerializationInfo"/> with the data needed + /// to serialize the target object. + /// </summary> + /// <param name="info">The <see cref="SerializationInfo"/> to populate with data.</param> + /// <param name="context">The destination for this serialization.</param> + public void GetObjectData(SerializationInfo info, StreamingContext context) + { + info.AddValue(SERIAL_NAME_NAME, Name); + info.AddValue(SERIAL_NAME_LOCATION, Location); + info.AddValue(SERIAL_NAME_NAMESPACE, Namespace); + info.AddValue(SERIAL_NAME_PREFIX, Prefix); + + info.AddValue(SERIAL_NAME_VALUE, Value); + + info.AddValue(SERIAL_NAME_READ_ONLY, IsReadOnly); + + RuntimeSerializer.SerializeIDictionary(info, Attributes, + SERIAL_NAME_ATTRIBUTE_KEYS, SERIAL_NAME_ATTRIBUTE_VALUES); + + RuntimeSerializer.SerializeICollection(info, Children, SERIAL_NAME_CHILDREN); } } } 1.4 +3 -3 jakarta-avalon-excalibur/csframework/src/cs/Configuration/ConfigurationException.cs Index: ConfigurationException.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Configuration/ConfigurationException.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ConfigurationException.cs 8 Nov 2002 20:38:17 -0000 1.3 +++ ConfigurationException.cs 23 Jan 2003 21:50:43 -0000 1.4 @@ -17,14 +17,14 @@ public class ConfigurationException: Exception { /// <summary> - /// Constructs a new <c>ConfigurationException</c> instance. + /// Constructs a new <see cref="ConfigurationException"/> instance. /// </summary> public ConfigurationException(): this(null) { } /// <summary> - /// Constructs a new <c>ConfigurationException</c> instance. + /// Constructs a new <see cref="ConfigurationException"/> instance. /// </summary> /// <param name="message">The Detail message of the exception.</param> public ConfigurationException(string message): this(message, null) @@ -32,7 +32,7 @@ } /// <summary> - /// Constructs a new <c>ConfigurationException</c> instance. + /// Constructs a new <see cref="ConfigurationException"/> instance. /// </summary> /// <param name="message">The Detail message of the exception.</param> /// <param name="inner">The Root cause of the exception.</param> 1.5 +24 -59 jakarta-avalon-excalibur/csframework/src/cs/Configuration/ConfigurationCollection.cs Index: ConfigurationCollection.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Configuration/ConfigurationCollection.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ConfigurationCollection.cs 25 Sep 2002 22:46:57 -0000 1.4 +++ ConfigurationCollection.cs 23 Jan 2003 21:50:43 -0000 1.5 @@ -35,8 +35,9 @@ /// <summary> /// Creates a new instance of <c>ConfigurationCollection</c>. /// </summary> - public ConfigurationCollection(IConfiguration[] value): this(new ConfigurationCollection(value)) + public ConfigurationCollection(IConfiguration[] value) { + this.AddRange(value); } /// <summary> @@ -81,12 +82,22 @@ return List.Add(value); } + /// <summary> + /// Adds an array of <see cref="IConfiguration"/>. + /// </summary> + /// <param name="value">The Array of <see cref="IConfiguration"/> to add.</param> public void AddRange(IConfiguration[] value) { - - AddRange(new ConfigurationCollection(value)); + foreach(IConfiguration configuration in value) + { + this.Add(configuration); + } } + /// <summary> + /// Adds a <see cref="ConfigurationCollection"/>. + /// </summary> + /// <param name="value">The <see cref="ConfigurationCollection"/> to add.</param> public void AddRange(ConfigurationCollection value) { foreach(IConfiguration configuration in value) @@ -95,7 +106,14 @@ } } - public void CopyTo(IConfiguration[] array, int index) + /// <summary> + /// Copies the elements to a one-dimensional <see cref="Array"/> instance at the specified index. + /// </summary> + /// <param name="array"> + /// The one-dimensional <see cref="Array"/> must have zero-based indexing. + /// </param> + /// <param name="index">The zero-based index in array at which copying begins.</param> + public void CopyTo(IConfiguration[] array, int index) { List.CopyTo(array, index); @@ -117,7 +135,7 @@ } /// <summary> - /// Retuns the index of a <see cref="IConfiguration"/> in + /// Gets the index of a <see cref="IConfiguration"/> in /// the collection. /// </summary> /// <param name="value">The <see cref="IConfiguration"/> to locate.</param> @@ -142,22 +160,13 @@ List.Insert(index, value); } - - /// <summary> - /// Returns an enumerator that can iterate through the collection. - /// </summary> - public new ConfigurationEnumerator GetEnumerator() - { - - return new ConfigurationEnumerator(this); - } /// <summary> /// Removes a specific <see cref="IConfiguration"/> from the /// collection. /// </summary> /// <param name="value">The <see cref="IConfiguration"/> to remove from the collection.</param> - /// <exception cref="System.ArgumentException"> + /// <exception cref="ArgumentException"> /// <paramref name="value"/> is not found in the collection. /// </exception> public void Remove(IConfiguration value) @@ -165,49 +174,5 @@ List.Remove(value); } - - public class ConfigurationEnumerator : IEnumerator - { - private IEnumerator baseEnumerator; - - public ConfigurationEnumerator(ConfigurationCollection mappings) - { - this.baseEnumerator = mappings.GetEnumerator(); - } - -/* - public IConfiguration Current - { - get - { - return (IConfiguration) baseEnumerator.Current; - } - - } -*/ - - public bool MoveNext() - { - - return baseEnumerator.MoveNext(); - } - - object IEnumerator.Current - { - get - { - return baseEnumerator.Current; - } - - } - - public void Reset() - { - - baseEnumerator.Reset(); - } - - } - } } 1.4 +49 -30 jakarta-avalon-excalibur/csframework/src/cs/Configuration/AbstractConfiguration.cs Index: AbstractConfiguration.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Configuration/AbstractConfiguration.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- AbstractConfiguration.cs 25 Sep 2002 22:46:57 -0000 1.3 +++ AbstractConfiguration.cs 23 Jan 2003 21:50:43 -0000 1.4 @@ -29,10 +29,11 @@ private ConfigurationCollection children = new ConfigurationCollection(); /// <summary> - /// Gets a value indicating whether the <c>IConfiguration</c> is read-only. + /// Gets a value indicating whether the <see cref="IConfiguration"/> is read-only. /// </summary> /// <value> - /// True if the <c>IConfiguration</c> is read-only; otherwise, false. + /// <see langword="true"> if the <see cref="IConfiguration"/> is read-only; + /// otherwise, <see langword="false">. /// </value> public bool IsReadOnly { @@ -43,10 +44,10 @@ } /// <summary> - /// Gets the name of the node. + /// Gets the name of the <see cref="IConfiguration"/>. /// </summary> /// <value> - /// The Name of the node. + /// The Name of the <see cref="IConfiguration"/>. /// </value> public string Name { @@ -63,10 +64,10 @@ } /// <summary> - /// Gets a string describing location of <c>IConfiguration</c>. + /// Gets a string describing location of the <see cref="IConfiguration"/>. /// </summary> /// <value> - /// A String describing location of <c>IConfiguration</c>. + /// A String describing location of the <see cref="IConfiguration"/>. /// </value> public string Location { @@ -83,10 +84,10 @@ } /// <summary> - /// Gets the value of the node. + /// Gets the value of <see cref="IConfiguration"/>. /// </summary> /// <value> - /// The Value of the node. + /// The Value of the <see cref="IConfiguration"/>. /// </value> public string Value { @@ -103,10 +104,10 @@ } /// <summary> - /// Gets the Namespace of the node. + /// Gets the namespace of the <see cref="IConfiguration"/>. /// </summary> /// <value> - /// The Namespace of the node. + /// The Namespace of the <see cref="IConfiguration"/>. /// </value> public string Namespace { @@ -124,10 +125,10 @@ } /// <summary> - /// Gets the Prefix of the node. + /// Gets the prefix of the <see cref="IConfiguration"/>. /// </summary> /// <value> - /// The Prefix of the node. + /// The prefix of the <see cref="IConfiguration"/>. /// </value> public string Prefix { @@ -146,10 +147,9 @@ /// <summary> - /// Gets an <see cref="ConfigurationCollection"/> of <c>IConfiguration</c> - /// elements containing all node children. + /// Gets all child nodes. /// </summary> - /// <value>The Collection of child nodes.</value> + /// <value>The <see cref="ConfigurationCollection"/> of child nodes.</value> public ConfigurationCollection Children { get @@ -171,8 +171,11 @@ } /// <summary> - /// Gets an <see cref="IDictionary"/> of the configuration attributes. + /// Gets node attributes. /// </summary> + /// <value> + /// All attributes of the node. + /// </value> public IDictionary Attributes { get @@ -193,44 +196,54 @@ } } + /// <summary> + /// Gets a <see cref="IConfiguration"/> instance encapsulating the specified + /// child node. + /// </summary> + /// <param name="child">The Name of the child node.</param> + /// <returns> + /// The <see cref="IConfiguration"/> instance encapsulating the specified + /// child node. + /// </returns> public IConfiguration GetChild(string child) { return GetChild(child, false); } /// <summary> - /// Gets a <c>IConfiguration</c> instance encapsulating the specified + /// Gets a <see cref="IConfiguration"/> instance encapsulating the specified /// child node. /// </summary> /// <param name="child">The Name of the child node.</param> /// <param name="createNew"> - /// If <c>true</c>, a new <c>IConfiguration</c> + /// If <see langword="true"/>, a new <see cref="IConfiguration"/> /// will be created and returned if the specified child does not exist. - /// If <c>false</c>, <c>null</c> will be returned when the specified + /// If <see langword="false"/>, <see langword="null"/> will be returned when the specified /// child doesn't exist. /// </param> - /// <returns><c>IConfiguration</c></returns> + /// <returns> + /// The <see cref="IConfiguration"/> instance encapsulating the specified + /// child node. + /// </returns> public abstract IConfiguration GetChild(string child, bool createNew); /// <summary> - /// Return an <see cref="ConfigurationCollection"/> of <c>IConfiguration</c> + /// Return an <see cref="ConfigurationCollection"/> of <see cref="IConfiguration"/> /// elements containing all node children with the specified name. /// </summary> /// <param name="name">The Name of the children to get.</param> /// <returns> - /// An <see cref="ConfigurationCollection"/> of - /// <c>IConfiguration</c> objects children of - /// this associated with the given name. + /// All node children with the specified name /// </returns> public abstract ConfigurationCollection GetChildren(string name); /// <summary> - /// Gets the Value of the node and converts it + /// Gets the value of the node and converts it /// into specified <see cref="System.Type"/>. /// </summary> /// <param name="type">The <see cref="System.Type"/></param> /// <returns>The Value converted into the specified type.</returns> - /// <exception cref="System.InvalidCastException"> + /// <exception cref="InvalidCastException"> /// If the convertion fails, an exception will be thrown. /// </exception> public object GetValue(Type type) @@ -239,12 +252,12 @@ } /// <summary> - /// Gets the Value of the node and converts it + /// Gets the value of the node and converts it /// into specified <see cref="System.Type"/>. /// </summary> /// <param name="type">The <see cref="System.Type"/></param> /// <param name="defaultValue"> - /// The defaultValue returned if the convertion fails. + /// The Default value returned if the convertion fails. /// </param> /// <returns>The Value converted into the specified type.</returns> public object GetValue(Type type, object defaultValue) @@ -260,7 +273,7 @@ /// <param name="name">The Name of the attribute you ask the value of.</param> /// <param name="type">The <see cref="System.Type"/></param> /// <returns>The Value converted into the specified type.</returns> - /// <exception cref="System.InvalidCastException"> + /// <exception cref="InvalidCastException"> /// If the convertion fails, an exception will be thrown. /// </exception> public object GetAttribute(string name, Type type) @@ -276,7 +289,7 @@ /// <param name="name">The Name of the attribute you ask the value of.</param> /// <param name="type">The <see cref="System.Type"/></param> /// <param name="defaultValue"> - /// The defaultValue returned if the convertion fails. + /// The Default value returned if the convertion fails. /// </param> /// <returns>The Value converted into the specified type.</returns> public object GetAttribute(string name, Type type, object defaultValue) @@ -293,6 +306,12 @@ readOnly = true; } + /// <summary> + /// Check whether this node is readonly or not. + /// </summary> + /// <exception cref="ConfigurationException"> + /// If this node is readonly then an exception will be thrown. + /// </exception> protected void CheckReadOnly() { if( IsReadOnly ) 1.3 +0 -5 jakarta-avalon-excalibur/csframework/src/cs/Util/ContainerUtil.cs Index: ContainerUtil.cs =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/csframework/src/cs/Util/ContainerUtil.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ContainerUtil.cs 25 Sep 2002 22:48:22 -0000 1.2 +++ ContainerUtil.cs 23 Jan 2003 21:50:47 -0000 1.3 @@ -251,11 +251,6 @@ /// </exception> public static void Dispose(object component) { - if (component is System.IDisposable) - { - ((System.IDisposable) component).Dispose(); - } - if (component is Apache.Avalon.Activity.IDisposable) { ((Apache.Avalon.Activity.IDisposable) component).Dispose();
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>