Ejemplo n.º 1
0
        public void Start(string bundleSymbolicName, BundleStartOptions option)
        {
            IBundle bundleBySymbolicName = Framework.GetBundleBySymbolicName(bundleSymbolicName);

            if (bundleBySymbolicName != null)
            {
                bundleBySymbolicName.Start(option);
            }
        }
Ejemplo n.º 2
0
 public virtual void Start(BundleStartOptions option)
 {
     if ((Framework.StartLevelManager.StartLevel < GetBunldeStartLevel()) && (option == BundleStartOptions.Transient))
     {
         throw new BundleException(string.Format(Messages.NotStartedSinceStartLevel, SymbolicName, Version));
     }
     FileLogUtility.Debug(string.Format(Messages.BundleStarting, SymbolicName, Version));
     DoLifecycleAction(() => DoStart(option), Messages.StartAction);
     FileLogUtility.Debug(string.Format(Messages.BundleInState, SymbolicName, Version, State));
 }
Ejemplo n.º 3
0
 protected override void DoStart(BundleStartOptions option)
 {
     if (((base.State != BundleState.Starting) && (base.State != BundleState.Stopping)) && !base.IsActive)
     {
         if (!base.IsResolved)
         {
             base.Framework.FrameworkAdaptor.State.Resolve();
             if (!base.IsResolved)
             {
                 throw new BundleException($"The bundle '{base.SymbolicName}, {base.Version}' is started failed since it can not be resolved.");
             }
         }
         if (LicenseService.RequireBundleLicenseValidation)
         {
             try
             {
                 LicenseService.ValidateBundleLicense(base.BundleData, true);
             }
             catch (Exception exception)
             {
                 FileLogUtility.Error(exception);
                 return;
             }
         }
         if ((base.BundleData.Activator == null) || (base.BundleData.Activator.Policy != ActivatorPolicy.Lazy))
         {
             base.State = BundleState.Starting;
             if (option != BundleStartOptions.Transient)
             {
                 BundlePersistentData persistentData = this.GetPersistentData();
                 if ((persistentData != null) && (persistentData.State == BundleState.Active))
                 {
                     this.CallTryStart();
                     return;
                 }
             }
             this.CallTryStart();
             if (option != BundleStartOptions.Transient)
             {
                 this.SavePersistent();
             }
         }
         else if (base.State != BundleState.Starting)
         {
             base.State = BundleState.Starting;
             base.Framework.EventManager.DispatchBundleLazyActivateEvent(this, new BundleLazyActivatedEventArgs(this));
         }
     }
 }
Ejemplo n.º 4
0
        protected override void DoStart(BundleStartOptions option)
        {
            Stopwatch stopwatch = new Stopwatch();

            try
            {
                if (((base.State != BundleState.Active) && (base.State != BundleState.Starting)) && (base.State != BundleState.Stopping))
                {
                    stopwatch.Start();
                    base.State = BundleState.Starting;
                    if (base.Context == null)
                    {
                        base.Context = this.CreateBundleContext();
                    }
                    base.Framework.StartLevelManager.ChangeStartLevel(base.Framework.StartLevelManager.StartLevel);
                    base.State = BundleState.Active;
                }
            }
            finally
            {
                stopwatch.Stop();
                FileLogUtility.Verbose(string.Format(Messages.StartSystemBundleTimeCounter, stopwatch.ElapsedMilliseconds));
            }
        }
Ejemplo n.º 5
0
 protected override void DoStart(BundleStartOptions option)
 {
     throw new BundleException(Messages.FragmentBundleCanNotBeStarted);
 }
Ejemplo n.º 6
0
 protected abstract void DoStart(BundleStartOptions option);