Removed untyped contructor from ComponentRegistration and add a protected setter.
[castle.git] / Tools / ManagedExtensions / ManagementExtensions / Default / Domain.cs
blobbb0c40ecfebca946928d2daac71924b128bf8a80
1 // Copyright 2003-2004 DigitalCraftsmen - http://www.digitalcraftsmen.com.br/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.ManagementExtensions.Default
17 using System;
18 using System.Collections;
19 using System.Collections.Specialized;
21 /// <summary>
22 /// Summary description for Domain.
23 /// </summary>
24 public class Domain : DictionaryBase
26 protected String name;
28 public Domain()
30 Name = "default";
33 public Domain(String name)
35 Name = name;
38 public void Add(ManagedObjectName objectName, Entry instance)
40 lock(this)
42 InnerHashtable.Add(objectName, instance);
46 public bool Contains(ManagedObjectName objectName)
48 return InnerHashtable.ContainsKey(objectName);
51 public void Remove(ManagedObjectName objectName)
53 lock(this)
55 InnerHashtable.Remove(objectName);
59 public String Name
61 get
63 return name;
65 set
67 name = value;
71 public Entry this[ManagedObjectName objectName]
73 get
75 return (Entry) InnerHashtable[objectName];
79 public ManagedObjectName[] ToArray()
81 lock(this)
83 int index = 0;
84 ManagedObjectName[] names = new ManagedObjectName[ Count ];
85 foreach(ManagedObjectName name in InnerHashtable.Keys)
87 names[index++] = name;
89 return names;