コード例 #1
0
        internal ILicenseManager CreateCurrentLicenseManager()
        {
            LicenseStateTransitionCallback callback = (previousLicense, newLicense) => {
                var init = false;
                _sessionFactory.Initialize(Config ?? _deki.Config, newLicense.LicenseDoc, new DekiInstanceSettings());
                if (previousLicense.LicenseState == LicenseStateType.INACTIVE && (newLicense.LicenseState == LicenseStateType.COMMUNITY || newLicense.LicenseState == LicenseStateType.COMMERCIAL || newLicense.LicenseState == LicenseStateType.TRIAL))
                {
                    // this is used to import packages that should only be imported into a fresh instance, being activated for the first time
                    init = true;
                }
                _log.DebugFormat("[{0}] executing license transition from '{1}' to '{2}' with init={3}", Id, previousLicense.LicenseState, newLicense.LicenseState, init);
                ServiceBL.RestartServices();
                EventSink.LicenseUpdated(previousLicense.LicenseState, newLicense.LicenseState, DekiContext.Current.Now);
                _deki.PackageUpdater.At("update").Post(
                    new XDoc("update")
                    .Attr("wikiid", Id)
                    .Attr("init", init)
                    .Elem("uri", _deki.Self),
                    new Result <DreamMessage>());
            };
            var container = DreamContext.Current.Container;
            var licenseBL = container.Resolve <ILicenseBL>();
            var seatingBL = container.Resolve <ISeatingBL>();
            var userBL    = container.Resolve <IUserBL>();
            var settings  = container.Resolve <IInstanceSettings>();

            return(new LicenseManager(_licenseController, userBL, _licenseData, licenseBL, settings, seatingBL, callback));
        }
コード例 #2
0
 //--- Constructors ---
 public LicenseManager(ILicenseController licenseController, IUserBL userBL, LicenseData licenseData, ILicenseBL licenseBL, IInstanceSettings settings, ISeatingBL seatingBL, LicenseStateTransitionCallback licenseStateTransitionCallback)
 {
     _licenseController = licenseController;
     _userBL            = userBL;
     _licenseData       = licenseData;
     _licenseBL         = licenseBL;
     _settings          = settings;
     _seatingBL         = seatingBL;
     _licenseStateTransitionCallback = licenseStateTransitionCallback;
 }
コード例 #3
0
ファイル: LicenseManager.cs プロジェクト: heran/DekiWiki
 //--- Constructors ---
 public LicenseManager(ILicenseController licenseController, IUserBL userBL, LicenseData licenseData, ILicenseBL licenseBL, IInstanceSettings settings, ISeatingBL seatingBL, LicenseStateTransitionCallback licenseStateTransitionCallback) {
     _licenseController = licenseController;
     _userBL = userBL;
     _licenseData = licenseData;
     _licenseBL = licenseBL;
     _settings = settings;
     _seatingBL = seatingBL;
     _licenseStateTransitionCallback = licenseStateTransitionCallback;
 }