Exemplo n.º 1
0
        protected override void DoConfigure(IConfigSectionNode node)
        {
            base.DoConfigure(node);

            foreach (var tnode in node[CONFIG_TESTS_SECTION].Children.Where(cn => cn.IsSameName(CONFIG_TEST_SECTION)))
            {
                var item = FactoryUtils.Make <Test>(tnode, args: new object[] { this, tnode });
                m_Tests.Register(item);
                log(MessageType.Info, "conf tests", "Added test {0}.'{1}'[{2}]".Args(item.GetType().FullName, item.Name, item.Order));
            }

            if (m_Tests.Count == 0)
            {
                throw new SerbenchException("No test specified in config. Nothing to do");
            }


            foreach (var snode in node[CONFIG_SERIALIZERS_SECTION].Children.Where(cn => cn.IsSameName(CONFIG_SERIALIZER_SECTION)))
            {
                var item = FactoryUtils.Make <Serializer>(snode, args: new object[] { this, snode });
                m_Serializers.Register(item);
                log(MessageType.Info, "conf sers", "Added serializer {0}.'{1}'[{2}]".Args(item.GetType().FullName, item.Name, item.Order));
            }

            if (m_Serializers.Count == 0)
            {
                throw new SerbenchException("No serializers specified in config. Nothing to do");
            }
        }
Exemplo n.º 2
0
        public static IErlTransport Create(string transportTypeFullName, string remoteNodeName)
        {
            var res = FactoryUtils.Make <IErlTransport>(string.Format("nfx{{type=\"{0}\"}}", transportTypeFullName).AsLaconicConfig(), typeof(ErlTcpTransport));

            res.NodeName = remoteNodeName;

            return(res);
        }
Exemplo n.º 3
0
 public CompositeHandler(WorkDispatcher dispatcher, IConfigSectionNode confNode) : base(dispatcher, confNode)
 {
     foreach (var hNode in confNode.Children.Where(cn => cn.IsSameName(WorkHandler.CONFIG_HANDLER_SECTION)))
     {
         var sub = FactoryUtils.Make <WorkHandler>(hNode, args: new object[] { dispatcher, hNode });
         sub.___setParentHandler(this);
         if (!m_Handlers.Register(sub))
         {
             throw new WaveException(StringConsts.CONFIG_DUPLICATE_HANDLER_NAME_ERROR.Args(hNode.AttrByName(Configuration.CONFIG_NAME_ATTR).Value));
         }
     }
 }
Exemplo n.º 4
0
         protected TypeLookupHandler(WorkDispatcher dispatcher, IConfigSectionNode confNode) : base(dispatcher, confNode)
         {
          if (confNode==null)
            throw new WaveException(StringConsts.ARGUMENT_ERROR+GetType().FullName+".ctor(confNode==null)");

          foreach(var ntl in confNode.Children.Where(cn=>cn.IsSameName(TypeLocation.CONFIG_TYPE_LOCATION_SECTION)))
            m_TypeLocations.Register( FactoryUtils.Make<TypeLocation>(ntl, typeof(TypeLocation), args: new object[]{ ntl }) );

          m_DefaultTypeName = confNode.AttrByName(CONFIG_DEFAULT_TYPE_ATTR).Value;
          m_CloakTypeName = confNode.AttrByName(CONFIG_CLOAK_TYPE_ATTR).Value;
          m_NotFoundRedirectURL = confNode.AttrByName(CONFIG_NOT_FOUND_REDIRECT_URL_ATTR).Value;
         }
Exemplo n.º 5
0
        protected override void DoConfigure(IConfigSectionNode node)
        {
            base.DoConfigure(node);
            deleteVolumes();
            if (node == null || !node.Exists)
            {
                return;
            }

            var nHost = node[CONFIG_TRENDING_HOST_SECTION];

            m_TrendingHost = FactoryUtils.Make <TrendingSystemHost>(nHost, args: new object[] { this, nHost });

            foreach (var cnode in node.Children.Where(cn => cn.IsSameName(CONFIG_VOLUME_SECTION)))
            {
                var volume = FactoryUtils.MakeAndConfigure <Volume>(cnode, args: new object[] { this });
                if (!m_Volumes.Register(volume))
                {
                    throw new WebMessagingException(StringConsts.TS_SERVICE_DUPLICATE_VOLUMES_ERROR.Args(GetType().Name, volume.Name));
                }
            }
        }