示例#1
0
 public SkyApplication(IApplication bootApplication,
                       SystemApplicationType sysAppType,
                       IFileSystem metabaseFileSystem,
                       FileSystemSessionConnectParams metabaseFileSystemSessionParams,
                       string metabaseFileSystemRootPath,
                       string thisHostName,
                       bool allowNesting,
                       string[] cmdArgs,
                       ConfigSectionNode rootConfig) : base()
 {
     ctor(allowNesting, cmdArgs, rootConfig);
     m_BootLoader = new BootConfLoader(this, bootApplication,
                                       sysAppType,
                                       metabaseFileSystem,
                                       metabaseFileSystemSessionParams,
                                       metabaseFileSystemRootPath,
                                       thisHostName,
                                       cmdArgs,
                                       rootConfig);
     try
     {
         m_ConfigRoot = m_BootLoader.ApplicationConfiguration.Root;
         InitApplication();
     }
     catch
     {
         Destructor();
         throw;
     }
 }
示例#2
0
        public static IDisposable LoadForTest(SystemApplicationType appType, Metabank mbase, string host, string dynamicHostNameSuffix = null)
        {
            SetDomainInvariantCulture();
            s_Loaded = true;
            s_SystemApplicationType = appType;
            s_Metabase = mbase;
            s_HostName = host;

            if (dynamicHostNameSuffix.IsNotNullOrWhiteSpace())
            {
                s_DynamicHostNameSuffix = Metabank.HOST_DYNAMIC_SUFFIX_SEPARATOR + dynamicHostNameSuffix;
            }
            else
            {
                var sh = mbase.CatalogReg.NavigateHost(host);
                if (sh.Dynamic)
                {
                    s_DynamicHostNameSuffix = thisMachineDynamicNameSuffix();
                }
            }

            if (s_DynamicHostNameSuffix.IsNotNullOrWhiteSpace())
            {
                s_HostName = s_HostName + s_DynamicHostNameSuffix;
            }

            SystemVarResolver.Bind();

            Configuration.ProcesswideConfigNodeProviderType = typeof(Metabase.MetabankFileConfigNodeProvider);

            return(new TestDisposer());
        }
示例#3
0
        internal BootConfLoader(IApplication bootApp, SystemApplicationType appType, Metabank mbase, string host, string dynamicHostNameSuffix = null)
        {
            Platform.Abstraction.PlatformAbstractionLayer.SetProcessInvariantCulture();

            m_BootApplication       = bootApp;
            m_SystemApplicationType = appType;
            m_Metabase = mbase;
            m_HostName = host;

            if (dynamicHostNameSuffix.IsNotNullOrWhiteSpace())
            {
                m_DynamicHostNameSuffix = Metabank.HOST_DYNAMIC_SUFFIX_SEPARATOR + dynamicHostNameSuffix;
            }
            else
            {
                var sh = mbase.CatalogReg.NavigateHost(host);
                if (sh.Dynamic)
                {
                    m_DynamicHostNameSuffix = thisMachineDynamicNameSuffix();
                }
            }

            if (m_DynamicHostNameSuffix.IsNotNullOrWhiteSpace())
            {
                m_HostName = m_HostName + m_DynamicHostNameSuffix;
            }

            SystemVarResolver.Bind();

            Configuration.ProcesswideConfigNodeProviderType = typeof(Sky.Metabase.MetabankFileConfigNodeProvider);
        }
示例#4
0
        public SkyApplication(SystemApplicationType sysAppType,
                              bool allowNesting,
                              string[] args,
                              ConfigSectionNode rootConfig) : base()
        {
            var loader = new BootConfLoader(sysAppType);

            ctor(loader, allowNesting, args, rootConfig);
        }
示例#5
0
        internal SkyApplication(IApplication bootApp,
                                SystemApplicationType sysAppType,
                                Metabank metabase,
                                string thisHost,
                                bool allowNesting,
                                string[] args,
                                ConfigSectionNode rootConfig) : base()
        {
            var loader = new BootConfLoader(bootApp, sysAppType, metabase, thisHost);

            ctor(loader, allowNesting, args, rootConfig);
        }
示例#6
0
        internal BootConfLoader(ISkyApplication application,
                                IApplication bootApplication,
                                SystemApplicationType appType,
                                IFileSystem metabaseFileSystem,
                                FileSystemSessionConnectParams metabaseFileSystemSessionParams,
                                string metabaseFileSystemRootPath,
                                string thisHostName,
                                string[] cmdArgs,
                                ConfigSectionNode rootConfig,
                                string dynamicHostNameSuffix = null)
        {
            Platform.Abstraction.PlatformAbstractionLayer.SetProcessInvariantCulture();
            SystemVarResolver.Bind();//todo: Refactor to use ~App. app var resolver instead
            Configuration.ProcesswideConfigNodeProviderType = typeof(MetabankFileConfigNodeProvider);

            m_SystemApplicationType = appType;

            m_Application = application.NonNull(nameof(application));

            //1. Init boot app container
            m_BootApplication = bootApplication;

            if (m_BootApplication == null)
            {
                m_BootApplication        = new AzosApplication(allowNesting: true, cmdArgs: cmdArgs, rootConfig: rootConfig);
                m_IsBootApplicationOwner = true;
            }

            writeLog(MessageType.Trace, "Entering Sky app bootloader...");

            //2. what host is this?
            m_HostName = determineHostName(thisHostName);

            //Sets cluster host name in all log messages
            if (m_HostName.IsNotNullOrWhiteSpace())
            {
                Message.DefaultHostName = m_HostName;
            }

            //3. Mount metabank
            var mNode = m_BootApplication.ConfigRoot[CONFIG_SKY_SECTION][CONFIG_METABASE_SECTION];

            ensureMetabaseAppName(mNode);

            m_Metabase          = new Metabank(m_BootApplication, m_Application, metabaseFileSystem, metabaseFileSystemSessionParams, metabaseFileSystemRootPath);
            m_IsMetabaseFSOwner = false;//externally supplied

            writeLog(MessageType.Trace, "...exiting Sky app bootloader");
        }
示例#7
0
 public SkyApplication(SystemApplicationType sysAppType,
                       bool allowNesting,
                       string[] cmdArgs,
                       ConfigSectionNode rootConfig) : base()
 {
     ctor(allowNesting, cmdArgs, rootConfig);
     m_BootLoader = new BootConfLoader(this, null, sysAppType, cmdArgs, rootConfig);
     try
     {
         m_ConfigRoot = m_BootLoader.ApplicationConfiguration.Root;
         InitApplication();
     }
     catch
     {
         Destructor();
         throw;
     }
 }
示例#8
0
        internal BootConfLoader(ISkyApplication application,
                                IApplication bootApplication,
                                SystemApplicationType appType,
                                string [] cmdArgs,
                                ConfigSectionNode rootConfig)
        {
            Platform.Abstraction.PlatformAbstractionLayer.SetProcessInvariantCulture();
            SystemVarResolver.Bind();//todo: Refactor to use ~App. app var resolver instead
            Configuration.ProcesswideConfigNodeProviderType = typeof(MetabankFileConfigNodeProvider);

            m_SystemApplicationType = appType;

            m_Application = application.NonNull(nameof(application));



            //1. Init boot app container
            m_BootApplication = bootApplication;

            if (m_BootApplication == null)
            {
                m_BootApplication        = new AzosApplication(allowNesting: true, cmdArgs: cmdArgs, rootConfig: rootConfig);
                m_IsBootApplicationOwner = true;
            }

            writeLog(MessageType.Trace, "Entering Sky app bootloader...");

            //2. what host is this?
            m_HostName = determineHostName(null);

            //Sets cluster host name in all log messages
            if (m_HostName.IsNotNullOrWhiteSpace())
            {
                Message.DefaultHostName = m_HostName;
            }

            //3. Mount Metabank
            m_Metabase = mountMetabank();

            writeLog(MessageType.Trace, "...exiting Sky app bootloader");
        }
示例#9
0
        internal static void Unload()
        {
            if (!s_Loaded)
            {
                return;
            }
            s_Loaded = false;
            s_SystemApplicationType = AppModel.SystemApplicationType.Unspecified;
            s_HostName = null;
            s_DynamicHostNameSuffix             = null;
            s_ParentZoneGovernorPrimaryHostName = null;
            try
            {
                if (s_Metabase != null)
                {
                    var mb = s_Metabase;
                    var fs = mb.FileSystem;
                    s_Metabase = null;

                    try
                    {
                        mb.Dispose();
                    }
                    finally
                    {
                        if (fs != null)
                        {
                            fs.Dispose();
                        }
                    }//finally
                }
            }
            catch
            {
                //nowhere to log anymore as all loggers have stopped
            }
        }
示例#10
0
 public SkyApplication(SystemApplicationType sysAppType, string[] cmdArgs, ConfigSectionNode rootConfig)
     : this(sysAppType, false, cmdArgs, rootConfig)
 {
 }
示例#11
0
 public SkyApplication(SystemApplicationType sysAppType, string[] cmdArgs)
     : this(sysAppType, false, cmdArgs, null)
 {
 }
示例#12
0
 /// <summary>
 /// Internal hack to compensate for c# inability to call .ctor within .ctor body
 /// </summary>
 internal static string[] SetSystemApplicationType(SystemApplicationType appType, string[] args)
 {
     s_SystemApplicationType = appType;
     return(args);
 }
示例#13
0
 public AgniServiceApplication(SystemApplicationType sysAppType, string[] args, ConfigSectionNode rootConfig)
     : base(BootConfLoader.SetSystemApplicationType(sysAppType, args), rootConfig)
 {
 }
示例#14
0
 internal BootConfLoader(SystemApplicationType appType)
 {
     Platform.Abstraction.PlatformAbstractionLayer.SetProcessInvariantCulture();
     m_SystemApplicationType = appType;
 }