/// <summary> /// Creates a new instance of the configuration class using the XmlNode specified. /// </summary> /// <param name="configNode">The XmlNode for the configuration section.</param> public ConfigurationRoot(XmlNode configNode) { if (configNode == null) throw new ArgumentNullException("configNode"); // Load all attribute repositories var nodeList = configNode.SelectNodes("./attributeRepositories/repository"); Debug.Assert(nodeList != null, "nodeList != null"); foreach (XmlNode node in nodeList) { var repConfig = new AttributeRepositoryConfig(node); var rep = (IAttributeRepository)Activator.CreateInstance(repConfig.Type); rep.Init(repConfig.XmlNode); _attributeRepositories.Add(rep); } // Load all policy repositories nodeList = configNode.SelectNodes("./policyRepositories/repository"); Debug.Assert(nodeList != null, "nodeList != null"); foreach (XmlNode node in nodeList) { var policyConfig = new PolicyRepositoryConfig(node); var rep = (IPolicyRepository)Activator.CreateInstance(policyConfig.Type); rep.Init(policyConfig.XmlNode); _policyRepositories.Add(rep); } // Load all function repositories nodeList = configNode.SelectNodes("./functionRepositories/repository"); Debug.Assert(nodeList != null, "nodeList != null"); foreach (XmlNode node in nodeList) { var functionConfig = new FunctionRepositoryConfig(node); var rep = (IFunctionRepository)Activator.CreateInstance(functionConfig.Type); rep.Init(functionConfig.XmlNode); _functionRepositories.Add(rep); } // Load all dataType repositories nodeList = configNode.SelectNodes("./dataTypeRepositories/repository"); Debug.Assert(nodeList != null, "nodeList != null"); foreach (XmlNode node in nodeList) { var dataTypeConfig = new DataTypeRepositoryConfig(node); var rep = (IDataTypeRepository)Activator.CreateInstance(dataTypeConfig.Type); rep.Init(dataTypeConfig.XmlNode); _dataTypeRepositories.Add(rep); } // Load all rule combinig algorothm repositories nodeList = configNode.SelectNodes("./ruleCombiningAlgorithmRepositories/repository"); Debug.Assert(nodeList != null, "nodeList != null"); foreach (XmlNode node in nodeList) { var ruleCaConfig = new RuleCombiningAlgorithmRepository(node); var rep = (IRuleCombiningAlgorithmRepository)Activator.CreateInstance(ruleCaConfig.Type); rep.Init(ruleCaConfig.XmlNode); _ruleCombiningRepositories.Add(rep); } // Load all policy combinig algorothm repositories nodeList = configNode.SelectNodes("./policyCombiningAlgorithmRepositories/repository"); Debug.Assert(nodeList != null, "nodeList != null"); foreach (XmlNode node in nodeList) { var policyCaConfig = new PolicyCombiningAlgorithmRepository(node); var rep = (IPolicyCombiningAlgorithmRepository)Activator.CreateInstance(policyCaConfig.Type); rep.Init(policyCaConfig.XmlNode); _policyCombiningRepositories.Add(rep); } // Load all rule combinig algorothm repositories nodeList = configNode.SelectNodes("./ruleCombiningAlgorithmRepositories/repository"); Debug.Assert(nodeList != null, "nodeList != null"); foreach (XmlNode node in nodeList) { _ruleCombiningRepositories.Add(new RuleCombiningAlgorithmRepository(node)); } }
/// <summary> /// Creates a new instance of the configuration class using the XmlNode specified. /// </summary> /// <param name="configNode">The XmlNode for the configuration section.</param> public ConfigurationRoot(XmlNode configNode) { if (configNode == null) { throw new ArgumentNullException("configNode"); } // Load all attribute repositories var nodeList = configNode.SelectNodes("./attributeRepositories/repository"); Debug.Assert(nodeList != null, "nodeList != null"); foreach (XmlNode node in nodeList) { var repConfig = new AttributeRepositoryConfig(node); var rep = (IAttributeRepository)Activator.CreateInstance(repConfig.Type); rep.Init(repConfig.XmlNode); _attributeRepositories.Add(rep); } // Load all policy repositories nodeList = configNode.SelectNodes("./policyRepositories/repository"); Debug.Assert(nodeList != null, "nodeList != null"); foreach (XmlNode node in nodeList) { var policyConfig = new PolicyRepositoryConfig(node); var rep = (IPolicyRepository)Activator.CreateInstance(policyConfig.Type); rep.Init(policyConfig.XmlNode); _policyRepositories.Add(rep); } // Load all function repositories nodeList = configNode.SelectNodes("./functionRepositories/repository"); Debug.Assert(nodeList != null, "nodeList != null"); foreach (XmlNode node in nodeList) { var functionConfig = new FunctionRepositoryConfig(node); var rep = (IFunctionRepository)Activator.CreateInstance(functionConfig.Type); rep.Init(functionConfig.XmlNode); _functionRepositories.Add(rep); } // Load all dataType repositories nodeList = configNode.SelectNodes("./dataTypeRepositories/repository"); Debug.Assert(nodeList != null, "nodeList != null"); foreach (XmlNode node in nodeList) { var dataTypeConfig = new DataTypeRepositoryConfig(node); var rep = (IDataTypeRepository)Activator.CreateInstance(dataTypeConfig.Type); rep.Init(dataTypeConfig.XmlNode); _dataTypeRepositories.Add(rep); } // Load all rule combinig algorothm repositories nodeList = configNode.SelectNodes("./ruleCombiningAlgorithmRepositories/repository"); Debug.Assert(nodeList != null, "nodeList != null"); foreach (XmlNode node in nodeList) { var ruleCaConfig = new RuleCombiningAlgorithmRepository(node); var rep = (IRuleCombiningAlgorithmRepository)Activator.CreateInstance(ruleCaConfig.Type); rep.Init(ruleCaConfig.XmlNode); _ruleCombiningRepositories.Add(rep); } // Load all policy combinig algorothm repositories nodeList = configNode.SelectNodes("./policyCombiningAlgorithmRepositories/repository"); Debug.Assert(nodeList != null, "nodeList != null"); foreach (XmlNode node in nodeList) { var policyCaConfig = new PolicyCombiningAlgorithmRepository(node); var rep = (IPolicyCombiningAlgorithmRepository)Activator.CreateInstance(policyCaConfig.Type); rep.Init(policyCaConfig.XmlNode); _policyCombiningRepositories.Add(rep); } // Load all rule combinig algorothm repositories nodeList = configNode.SelectNodes("./ruleCombiningAlgorithmRepositories/repository"); Debug.Assert(nodeList != null, "nodeList != null"); foreach (XmlNode node in nodeList) { _ruleCombiningRepositories.Add(new RuleCombiningAlgorithmRepository(node)); } }