public void start(int options) { if (this.state == Bundle_Const.INSTALLED) { try { resolve(); this.state = Bundle_Const.RESOLVED; } catch { this.state = Bundle_Const.INSTALLED; throw; } } if (this.state == Bundle_Const.RESOLVED && this.activatorClassName != null) { this.state = Bundle_Const.STARTING; try { framework.fireBundleEvent(new BundleEvent(BundleEvent.STARTING, this)); bundleActivator = Activator.CreateInstance(bundleAssembly.GetType(activatorClassName)) as BundleActivator; bundleActivator.start(bundleContext); this.state = Bundle_Const.ACTIVE; framework.fireBundleEvent(new BundleEvent(BundleEvent.STARTED, this)); } catch { this.state = Bundle_Const.RESOLVED; throw; } } }
public HttpSite(Config conf) { if (conf == null) { throw new ArgumentNullException(nameof(conf)); } this.conf = conf; var loggerFactory = new LoggerFactory(); loggerFactory.AddProvider <FileLoggerProvider>(); Logger.LoggerFactory = loggerFactory; logger = Logger.GetLogger <HttpSite>(); root = conf.GetString(RootProperty); notFound = conf.GetString(NotFoundProperty); if (notFound != null && !notFound.StartsWith(HttpUtility.ForwardSlashString)) { notFound = HttpUtility.ForwardSlashString + notFound; } var dirPath = root.Contains(":") ? root : Path.Combine(AppDomain.CurrentDomain.BaseDirectory, root); baseDir = new DirectoryInfo(dirPath); if (!baseDir.Exists) { baseDir.Create(); } if (conf.HasPath(BundlesProperty)) { var bconf = conf.GetConfig(BundlesProperty); var bobj = bconf.Root.GetObject(); foreach (var val in bobj.Items.Values) { var acf = new Config(new HoconRoot(val)); var bundleActivator = BundleActivator.Parse(acf); bundleActivator.Config = acf; bundleActivator.Site = this; bundleActivators.Add(bundleActivator); } } if (conf.HasPath(ProcessorsProperty)) { var hconf = conf.GetConfig(ProcessorsProperty); var hobj = hconf.Root.GetObject(); foreach (var val in hobj.Items.Values) { var acf = new Config(new HoconRoot(val)); var processor = Processor.Parse(acf); processor.Config = acf; processor.Site = this; processors.Add(processor); } } }
public void stop(int options) { if (this.state == Bundle_Const.ACTIVE) { this.state = Bundle_Const.STOPPING; if (bundleActivator != null) { framework.fireBundleEvent(new BundleEvent(BundleEvent.STOPPING, this)); bundleActivator.stop(bundleContext); bundleContext.stop(); unloadAssemblyLoadContext(); framework.fireBundleEvent(new BundleEvent(BundleEvent.STOPPED, this)); bundleActivator = null; } this.state = Bundle_Const.RESOLVED; } }
public void stop(int options) { if (this.state == Bundle_Const.ACTIVE) { this.state = Bundle_Const.STOPPING; if (bundleActivator != null) { framework.fireBundleEvent(new BundleEvent(BundleEvent.STOPPING, this)); bundleActivator.stop(bundleContext); bundleContext.stop(); if (framework.IsUseAppDomain()) { unloadAppDomain(); } framework.fireBundleEvent(new BundleEvent(BundleEvent.STOPPED, this)); bundleActivator = null; } this.state = Bundle_Const.RESOLVED; } }
public void start(int options) { if (this.state == Bundle_Const.INSTALLED) { try { resolve(); this.state = Bundle_Const.RESOLVED; } catch (Exception ex) { this.state = Bundle_Const.INSTALLED; throw ex; } } if (this.state == Bundle_Const.RESOLVED && this.activatorClassName != null) { this.state = Bundle_Const.STARTING; try { framework.fireBundleEvent(new BundleEvent(BundleEvent.STARTING, this)); if (framework.IsUseAppDomain()) { bundleActivator = bundleAppDomain.CreateInstanceAndUnwrap(bundleAssemblyFullName, activatorClassName) as BundleActivator; } else { bundleActivator = Activator.CreateInstance(bundleAssembly.GetType(activatorClassName)) as BundleActivator; } bundleActivator.start(bundleContext); this.state = Bundle_Const.ACTIVE; framework.fireBundleEvent(new BundleEvent(BundleEvent.STARTED, this)); } catch (Exception ex) { this.state = Bundle_Const.RESOLVED; throw ex; } } }