예제 #1
0
        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);
        }
예제 #2
0
        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);
        }