You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ym...@apache.org on 2002/08/21 22:14:03 UTC
cvs commit: jakarta-avalon-excalibur/csframework/src/cs/Configuration IConfiguration.cs ConfigurationCollection.cs
ymikulski 2002/08/21 13:14:03
Modified: csframework/src/cs/Configuration IConfiguration.cs
ConfigurationCollection.cs
Log:
no message
Revision Changes Path
1.2 +22 -5 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IConfiguration.cs 13 Aug 2002 13:02:32 -0000 1.1
+++ IConfiguration.cs 21 Aug 2002 20:14:03 -0000 1.2
@@ -54,6 +54,28 @@
}
/// <summary>
+ /// Gets the Namespace of the node.
+ /// </summary>
+ /// <value>
+ /// The Namespace of the node.
+ /// </value>
+ string Namespace
+ {
+ get;
+ }
+
+ /// <summary>
+ /// Gets the Prefix of the node.
+ /// </summary>
+ /// <value>
+ /// The Prefix of the node.
+ /// </value>
+ string Prefix
+ {
+ get;
+ }
+
+ /// <summary>
/// Gets a value indicating whether the <c>IConfiguration</c> is read-only.
/// </summary>
/// <value>
@@ -130,10 +152,5 @@
/// </param>
/// <returns>The Value of the attribute.</returns>
object GetAttribute(string name, Type type, object defaultValue);
-
- /// <summary>
- /// Make the configuration read only.
- /// </summary>
- void MakeReadOnly();
}
}
1.2 +4 -60 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConfigurationCollection.cs 13 Aug 2002 13:02:32 -0000 1.1
+++ ConfigurationCollection.cs 21 Aug 2002 20:14:03 -0000 1.2
@@ -16,8 +16,6 @@
public class ConfigurationCollection: CollectionBase
{
- private bool readOnly;
-
/// <summary>
/// Creates a new instance of <c>ConfigurationCollection</c>.
/// </summary>
@@ -30,6 +28,7 @@
/// </summary>
public ConfigurationCollection(ConfigurationCollection value)
{
+
this.AddRange(value);
}
@@ -40,14 +39,6 @@
{
}
- public bool IsReadOnly
- {
- get
- {
- return readOnly;
- }
- }
-
/// <summary>
/// Represents the entry at the specified index of the <see cref="IConfiguration"/>.
/// </summary>
@@ -66,19 +57,11 @@
get
{
- IConfiguration configuration = (IConfiguration) List[index];
-
- if (IsReadOnly)
- {
- configuration.MakeReadOnly ();
- }
- return configuration;
-
+ return (IConfiguration) List[index];
}
set
{
- CheckReadOnly();
List[index] = value;
}
@@ -94,15 +77,14 @@
/// </returns>
public int Add(IConfiguration value)
{
- CheckReadOnly();
return List.Add(value);
}
public void AddRange(IConfiguration[] value)
{
+
AddRange(new ConfigurationCollection(value));
-
}
public void AddRange(ConfigurationCollection value)
@@ -117,14 +99,6 @@
{
List.CopyTo(array, index);
-
- foreach (IConfiguration configuration in array)
- {
- if (IsReadOnly)
- {
- configuration.MakeReadOnly();
- }
- }
}
/// <summary>
@@ -166,8 +140,6 @@
public void Insert(int index, IConfiguration value)
{
- CheckReadOnly();
-
List.Insert(index, value);
}
@@ -191,51 +163,23 @@
public void Remove(IConfiguration value)
{
- CheckReadOnly();
-
List.Remove(value);
}
- public void MakeReadOnly()
- {
- readOnly = true;
- }
-
- protected void CheckReadOnly()
- {
- if( IsReadOnly )
- {
- throw new ConfigurationException( "Configuration is read only and can not be modified." );
- }
- }
-
public class ConfigurationEnumerator : IEnumerator
{
private IEnumerator baseEnumerator;
- private bool IsReadOnly;
-
public ConfigurationEnumerator(ConfigurationCollection mappings)
{
this.baseEnumerator = mappings.GetEnumerator();
-
- if (mappings.IsReadOnly)
- this.IsReadOnly = true;
}
-
-
public IConfiguration Current
{
get
{
- IConfiguration configuration = (IConfiguration) baseEnumerator.Current;
-
- if (IsReadOnly)
- {
- configuration.MakeReadOnly();
- }
- return configuration;
+ return (IConfiguration) baseEnumerator.Current;
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>