Exemplo n.º 1
0
        protected override void DoConfigure(IConfigSectionNode node)
        {
            base.DoConfigure(node);
            DisposeAndNull(ref m_LogArchiveGraph);
            DisposeAndNull(ref m_Log);
            DisposeAndNull(ref m_Instrumentation);

            if (node == null)
            {
                return;
            }

            var nArchive = node[CONFIG_LOG_ARCHIVE_SECTION];

            if (nArchive.Exists)
            {
                m_LogArchiveGraph = FactoryUtils.MakeAndConfigureDirectedComponent <ILogImplementation>(this, nArchive, typeof(LogDaemon));
            }

            var nStore = node[CONFIG_STORE_SECTION];

            if (nStore.Exists)
            {
                m_Log             = FactoryUtils.MakeAndConfigureDirectedComponent <ILogChronicleStoreImplementation>(this, nStore);
                m_Instrumentation = m_Log.CastTo <IInstrumentationChronicleStoreImplementation>("cfg section `{0}`".Args(CONFIG_STORE_SECTION));
            }
            else
            {
                m_Log = FactoryUtils.MakeAndConfigureDirectedComponent <ILogChronicleStoreImplementation>(this,
                                                                                                          node[CONFIG_LOG_STORE_SECTION].NonEmpty(CONFIG_LOG_STORE_SECTION));

                m_Instrumentation = FactoryUtils.MakeAndConfigureDirectedComponent <IInstrumentationChronicleStoreImplementation>(this,
                                                                                                                                  node[CONFIG_INSTRUMENTATION_STORE_SECTION].NonEmpty(CONFIG_INSTRUMENTATION_STORE_SECTION));
            }
        }