Exemplo n.º 1
0
 public void UpdateExistingDivergence(FailedMSOSyncObject divergence, int occurenceCount, bool incrementalOnly, bool linkRelated, bool temporary, bool tenantWide, string[] errors, int errorListLengthLimit, bool validationDivergence, bool retriable, IDictionary divergenceInfoTable)
 {
     divergence.IsIncrementalOnly      = (divergence.IsIncrementalOnly && incrementalOnly);
     divergence.IsLinkRelated          = (divergence.IsLinkRelated || linkRelated);
     divergence.IsTemporary            = temporary;
     divergence.IsTenantWideDivergence = (divergence.IsTenantWideDivergence || tenantWide);
     divergence.IsValidationDivergence = (divergence.IsValidationDivergence && validationDivergence);
     divergence.IsRetriable            = retriable;
     if (!validationDivergence && divergence.IsValidationDivergence)
     {
         divergence.DivergenceCount = 1;
     }
     else
     {
         divergence.DivergenceCount += occurenceCount;
     }
     if (divergence.Errors == null)
     {
         divergence.Errors = new MultiValuedProperty <string>();
     }
     if (errors != null)
     {
         ForwardSyncDataAccessHelper.AddErrors(errors, divergence);
     }
     while (divergence.Errors.Count > 0 && divergence.Errors.Count > errorListLengthLimit)
     {
         divergence.Errors.RemoveAt(0);
     }
     if (divergenceInfoTable != null)
     {
         ForwardSyncDataAccessHelper.SetDivergenceInfoValues(divergenceInfoTable, divergence);
         divergence.SaveDivergenceInfoXml();
     }
     this.SaveDivergence(divergence);
 }
        internal static bool IsServiceInstanceEmpty(SyncServiceInstance syncServiceInstance)
        {
            TaskLogger.LogEnter();
            CookieManager cookieManager = CookieManagerFactory.Default.GetCookieManager(ForwardSyncCookieType.RecipientIncremental, syncServiceInstance.Name, 1, TimeSpan.FromMinutes(30.0));

            byte[] array = cookieManager.ReadCookie();
            if (array != null && array.Length > 0)
            {
                return(false);
            }
            CookieManager cookieManager2 = CookieManagerFactory.Default.GetCookieManager(ForwardSyncCookieType.CompanyIncremental, syncServiceInstance.Name, 1, TimeSpan.FromMinutes(30.0));

            array = cookieManager2.ReadCookie();
            if (array != null && array.Length > 0)
            {
                return(false);
            }
            ForwardSyncDataAccessHelper       forwardSyncDataAccessHelper = new ForwardSyncDataAccessHelper(syncServiceInstance.Name);
            IEnumerable <FailedMSOSyncObject> source = forwardSyncDataAccessHelper.FindDivergence(null);

            if (source.Any <FailedMSOSyncObject>())
            {
                return(false);
            }
            TaskLogger.LogExit();
            return(true);
        }
Exemplo n.º 3
0
        public void PersistNewDivergence(SyncObjectId syncObjectId, DateTime divergenceTime, bool incrementalOnly, bool linkRelated, bool temporary, bool tenantWide, string[] errors, bool validationDivergence, bool retriable, IDictionary divergenceInfoTable)
        {
            FailedMSOSyncObject failedMSOSyncObject = new FailedMSOSyncObject();

            failedMSOSyncObject.LoadDivergenceInfoXml();
            failedMSOSyncObject.SetId(this.GetDivergenceObjectId(syncObjectId));
            failedMSOSyncObject.ObjectId               = syncObjectId;
            failedMSOSyncObject.DivergenceTimestamp    = new DateTime?(divergenceTime);
            failedMSOSyncObject.IsIncrementalOnly      = incrementalOnly;
            failedMSOSyncObject.IsLinkRelated          = linkRelated;
            failedMSOSyncObject.IsTemporary            = temporary;
            failedMSOSyncObject.DivergenceCount        = 1;
            failedMSOSyncObject.IsTenantWideDivergence = tenantWide;
            failedMSOSyncObject.IsValidationDivergence = validationDivergence;
            failedMSOSyncObject.IsRetriable            = retriable;
            if (failedMSOSyncObject.IsValidationDivergence)
            {
                failedMSOSyncObject.IsIgnoredInHaltCondition = true;
            }
            else
            {
                failedMSOSyncObject.IsIgnoredInHaltCondition = false;
            }
            failedMSOSyncObject.Errors = new MultiValuedProperty <string>();
            if (errors != null)
            {
                ForwardSyncDataAccessHelper.AddErrors(errors, failedMSOSyncObject);
            }
            if (divergenceInfoTable != null)
            {
                ForwardSyncDataAccessHelper.SetDivergenceInfoValues(divergenceInfoTable, failedMSOSyncObject);
                failedMSOSyncObject.SaveDivergenceInfoXml();
            }
            this.SaveDivergence(failedMSOSyncObject);
        }
 protected override void InternalProcessRecord()
 {
     ForwardSyncDataAccessHelper.CleanUpDivergenceIds((IConfigurationSession)base.DataSession, base.DataObject);
     if (base.DataObject.IsTenantWideDivergence)
     {
         this.MarkDivergenceHaltingForContext(base.DataObject.ObjectId.ContextId);
     }
     base.InternalProcessRecord();
 }
        private void MarkDivergencesUnhalting(QueryFilter filter)
        {
            IEnumerable <FailedMSOSyncObject> enumerable           = this.forwardSyncDataAccessHelper.FindDivergence(filter);
            IConfigurationSession             configurationSession = ForwardSyncDataAccessHelper.CreateSession(false);

            foreach (FailedMSOSyncObject failedMSOSyncObject in enumerable)
            {
                failedMSOSyncObject.IsIgnoredInHaltCondition = true;
                configurationSession.Save(failedMSOSyncObject);
            }
        }
        internal static ArbitrationConfigFromAD GetArbitrationConfigFromAD(string serviceInstanceName)
        {
            IConfigurationSession configurationSession = ForwardSyncDataAccessHelper.CreateSession(true);
            RidMasterInfo         ridMasterInfo        = SyncDaemonArbitrationConfigHelper.GetRidMasterInfo(configurationSession);

            SyncServiceInstance[] array = configurationSession.Find <SyncServiceInstance>(SyncServiceInstance.GetMsoSyncRootContainer(), QueryScope.SubTree, new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, serviceInstanceName), null, 1);
            if (array == null || array.Length != 1)
            {
                throw new SyncDaemonArbitrationConfigException(Strings.ErrorCannotRetrieveSyncDaemonArbitrationConfigContainer((array == null) ? "0" : array.Length.ToString()));
            }
            return(new ArbitrationConfigFromAD(array[0], ridMasterInfo));
        }
        private void MarkDivergencesHalting(QueryFilter filter)
        {
            ForwardSyncDataAccessHelper       forwardSyncDataAccessHelper = new ForwardSyncDataAccessHelper(base.DataObject.ServiceInstanceId);
            IEnumerable <FailedMSOSyncObject> enumerable           = forwardSyncDataAccessHelper.FindDivergence(filter);
            IConfigurationSession             configurationSession = ForwardSyncDataAccessHelper.CreateSession(false);

            foreach (FailedMSOSyncObject failedMSOSyncObject in enumerable)
            {
                failedMSOSyncObject.IsIgnoredInHaltCondition = false;
                configurationSession.Save(failedMSOSyncObject);
            }
        }
 protected override IConfigDataProvider CreateSession()
 {
     return(ForwardSyncDataAccessHelper.CreateSession(false));
 }
Exemplo n.º 9
0
 private void InitializeSession()
 {
     this.configSession = ForwardSyncDataAccessHelper.CreateSession(false);
 }
Exemplo n.º 10
0
 public virtual void DeleteDivergence(FailedMSOSyncObject divergence)
 {
     ForwardSyncDataAccessHelper.CleanUpDivergenceIds(this.configSession, divergence);
     this.configSession.Delete(divergence);
 }