Esempio n. 1
0
        private void LoadCookieIfNeeded(IJobExecutionContext context)
        {
            if (cookie == null)
            {
                cookie = (List <byte>)context.JobDetail.JobDataMap[JOB_DATA_COOKIE];

                if (cookie == null)
                {
                    cookie = new List <byte>();
                    context.JobDetail.JobDataMap.Put(JOB_DATA_COOKIE, cookie);
                }
            }

            if (cookie.Count != 0) // Cookie is already set, no need to load it
            {
                return;
            }
            else if (IsCookieInDB())
            {
                string b64cookie = RecordDao.FindByKey(DIR_SYNC_COOKIE_KEY).Value;
                SetCookie(Convert.FromBase64String(b64cookie));
                directorySearcher.DirectorySynchronization.ResetDirectorySynchronizationCookie(Convert.FromBase64String(b64cookie));

                log.Info("Loaded DirSyncCookie from the database.");
            }
            else
            {
                log.Info("No DirSyncCookie, performing a full sync!");
            }
        }
Esempio n. 2
0
 private static bool IsCookieInDB()
 {
     return(RecordDao.FindByKey(DIR_SYNC_COOKIE_KEY) == null ? false : true);
 }