Esempio n. 1
0
        protected virtual void DoInitApplication()
        {
            ConfigAttribute.Apply(this, m_ConfigRoot);

            m_Name = m_ConfigRoot.AttrByName(CONFIG_NAME_ATTR).ValueAsString(GetType().FullName);

            var appid = m_ConfigRoot.AttrByName(CONFIG_ID_ATTR).Value;

            if (appid.IsNotNullOrWhiteSpace())
            {
                m_AppId = Atom.Encode(appid);
            }

            m_CloudOrigin       = m_ConfigRoot.AttrByName(CONFIG_CLOUD_ORIGIN_ATTR).ValueAsAtom(Atom.ZERO);
            m_NodeDiscriminator = m_ConfigRoot.AttrByName(CONFIG_NODE_DISCRIMINATOR_ATTR).ValueAsUShort(0);

            Debugging.DefaultDebugAction = Debugging.ReadDefaultDebugActionFromConfig();
            Debugging.TraceDisabled      = Debugging.ReadTraceDisableFromConfig();

            //20200616 DKh
            Serialization.Bix.Bixer.RegisterFromConfiguration(m_ConfigRoot[Serialization.Bix.Bixer.CONFIG_AZOS_SERIALIZATION_BIX_SECTION]);


            //the order of root component boot is important:

            InitLog();                //1.  must be the first one so others can log
            InitModule();             //2.  other services may use module references
            InitTimeSource();         //3.  start accurate time asap
            InitSecurityManager();    //4.  security context
            InitEventTimer();         //5.  event scheduler/bg jobs
            InitInstrumentation();    //6.  instrumentation
            InitDataStore();          //7.  data store
            InitObjectStore();        //8.  object store
            InitGlue();               //9.  glue
            InitDependencyInjector(); //10.  custom dep injector last

            //After all inits apply the behavior top the root
            try
            {
                Behavior.ApplyConfiguredBehaviors(this, m_ConfigRoot);
                Behavior.ApplyBehaviorAttributes(this);
            }
            catch (Exception error)
            {
                var msg = StringConsts.APP_APPLY_BEHAVIORS_ERROR + error.ToMessageWithType();
                WriteLog(MessageType.CatastrophicError, INIT_FROM, msg, error);
                throw new AzosException(msg, error);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Blocking call that starts the daemon instance
 /// </summary>
 public void Start()
 {
     EnsureObjectNotDisposed();
     lock (m_StatusLock)
         if (m_Status == DaemonStatus.Inactive)
         {
             m_Status = DaemonStatus.Starting;
             try
             {
                 Behavior.ApplyBehaviorAttributes(this);
                 DoStart();
                 m_Status = DaemonStatus.Active;
             }
             catch
             {
                 m_Status = DaemonStatus.Inactive;
                 throw;
             }
         }
 }
Esempio n. 3
0
                          protected virtual void DoInitApplication()
                          {
                              ConfigAttribute.Apply(this, m_ConfigRoot);

                              m_Name = m_ConfigRoot.AttrByName(CONFIG_APP_NAME_ATTR).ValueAsString(GetType().FullName);

                              Debugging.DefaultDebugAction = Debugging.ReadDefaultDebugActionFromConfig();
                              Debugging.TraceDisabled      = Debugging.ReadTraceDisableFromConfig();

                              //the order of root component boot is important:

                              InitLog();                //1.  must be the first one so others can log
                              InitModule();             //2.  other services may use module references
                              InitTimeSource();         //3.  start accurate time asap
                              InitSecurityManager();    //4.  security context
                              InitEventTimer();         //5.  event scheduler/bg jobs
                              InitInstrumentation();    //6.  instrumentation
                              InitDataStore();          //7.  data store
                              InitObjectStore();        //8.  object store
                              InitGlue();               //9.  glue
                              InitDependencyInjector(); //10.  custom dep injector last



                              //After all inits apply the behavior top the root
                              try
                              {
                                  Behavior.ApplyConfiguredBehaviors(this, m_ConfigRoot);
                                  Behavior.ApplyBehaviorAttributes(this);
                              }
                              catch (Exception error)
                              {
                                  var msg = StringConsts.APP_APPLY_BEHAVIORS_ERROR + error.ToMessageWithType();
                                  WriteLog(MessageType.CatastrophicError, INIT_FROM, msg, error);
                                  throw new AzosException(msg, error);
                              }
                          }