protected override ICacheGroup ParserLocalGroup(XmlNode node) { if (ValidateService.IsNull(node)) { throw new ArgumentNullException("node"); } object oName; object oSize; if (!XmlFileParserService.TryGetAttributeValue(node, "Name", out oName)) { if (null != _logger) { _logger.Error("no the name of cache group."); } return(null); } ICacheGroup group = new CacheGroup(); group.Name = oName.ToString(); if (!XmlFileParserService.TryGetAttributeValue(node, "Size", out oSize)) { if (null != _logger) { _logger.Error("no the servers of cache group."); } return(null); } group.Size = int.Parse(oSize.ToString()); return(group); }
public override IAlbianServiceAttrbuite ServiceParser(XmlNode node) { if (null == node) { throw new ArgumentNullException("node"); } object oId; object oType; if (!XmlFileParserService.TryGetAttributeValue(node, "Type", out oType)) { if (null != Logger) { Logger.Error("There is not 'Implement' config item in the service.config."); } throw new ServiceException("There is not 'Implement' config item in the service.config."); } if (!XmlFileParserService.TryGetAttributeValue(node, "Id", out oId)) { if (null != Logger) { Logger.ErrorFormat("There is not 'Id' config-item with the {0} in the service.config.", oType); } throw new ServiceException(string.Format("There is not 'Id' config-item with the {0} in the service.config.", oType)); } IAlbianServiceAttrbuite serviceAttr = new AlbianServiceAttrbuite { Id = oId.ToString(), Type = oType.ToString(), }; return(serviceAttr); }
public void Init(string filePath) { if (string.IsNullOrEmpty(filePath)) { throw new ArgumentNullException("filePath"); } try { XmlDocument doc = XmlFileParserService.LoadXml(filePath); XmlNodeList nodes = XmlFileParserService.Analyze(doc, "AlbianCache"); if (1 != nodes.Count) //root node { throw new Exception("Analyze the Objects node is error in the cached.config"); } _service = ParserCached(nodes[0]); } catch (Exception exc) { throw exc; } }
public void Init(string path) { XmlDocument doc = XmlFileParserService.LoadXml(path); if (null == doc) { if (null != Logger) { Logger.Error("Init the Service.config is fail."); } throw new ServiceException("Init the Service.config is fail."); } XmlNodeList nodes = doc.SelectNodes("Services/Service"); if (null == nodes || 0 == nodes.Count) { if (null != Logger) { Logger.Error("There is not 'service' items in the service.config"); } throw new ServiceException("There is not 'service' items in the service.config"); } _services = ServicesParser(nodes); }