Пример #1
0
 internal void ValidateMultiReferenceParameter(string parameterName, object propertyKey, ValidateRecipientWithBaseObjectDelegate <TDataObject> validateRecipient)
 {
     if (base.Fields.IsModified(propertyKey))
     {
         SyncTaskHelper.ValidateModifiedMultiReferenceParameter <TDataObject>(parameterName, propertyKey, this.DataObject, validateRecipient, this.ReferenceErrorReporter, this.recipientsDictionary, this.parameterDictionary);
     }
 }
Пример #2
0
 private static string FindAvailableServerFromWatermarks(WatermarkMap watermarks, IConfigurationSession configSession, ADObjectId allowedSite, out Guid newInvocationId)
 {
     newInvocationId = Guid.Empty;
     foreach (Guid guid in watermarks.Keys)
     {
         string text = SyncTaskHelper.FindAvailableServerByInvocationId(guid, configSession, allowedSite);
         if (text != null)
         {
             newInvocationId = guid;
             return(text);
         }
     }
     return(null);
 }
Пример #3
0
 internal static void RemoveModifiedRecipientIds(object sourceBagProperty, PropertyDefinition targetBagProperty, ADObject targetObject, Dictionary <object, MultiValuedProperty <ADObjectId> > recipientIdsDictionary)
 {
     SyncTaskHelper.RemoveModifiedRecipientIds(sourceBagProperty, targetBagProperty, targetObject, recipientIdsDictionary, null, null);
 }
Пример #4
0
        public static bool HandleTaskWritePagedResult <T>(IEnumerable <T> dataObjects, SyncCookie inputCookie, ref SyncCookie outputCookie, SyncTaskHelper.ParameterlessMethod <bool> isStopping, SyncTaskHelper.OneParameterMethod <bool, IConfigurable> shouldSkipObject, SyncTaskHelper.VoidOneParameterMethod <IConfigurable> writeResult, int pages, Task.TaskVerboseLoggingDelegate writeVerbose, Task.TaskErrorLoggingDelegate writeError) where T : IConfigurable, new()
        {
            bool flag;

            return(SyncTaskHelper.HandleTaskWritePagedResult <T>(dataObjects, inputCookie, ref outputCookie, isStopping, shouldSkipObject, writeResult, pages, writeVerbose, writeError, out flag));
        }
Пример #5
0
        public static SyncCookie ResolveSyncCookie(byte[] cookieData, IDirectorySession session, Task.TaskVerboseLoggingDelegate writeVerbose, Task.TaskErrorLoggingDelegate writeError)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            string text = SyncTaskHelper.GetCurrentServerFromSession(session);
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(text, true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 84, "ResolveSyncCookie", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Common\\recipient\\SyncTaskHelper.cs");
            Guid guid = topologyConfigurationSession.GetInvocationIdByFqdn(text);

            writeVerbose(Strings.VerboseSyncTaskDomainControllerToUse(text, guid));
            if (cookieData == null)
            {
                writeVerbose(SyncTaskHelper.FormatCookieVerboseString(null));
                SyncCookie syncCookie = new SyncCookie(guid, WatermarkMap.Empty, SyncConfiguration.GetReplicationCursors(topologyConfigurationSession), null);
                writeVerbose(Strings.VerboseSyncTaskHighestCommittedUSN(text, syncCookie.HighWatermark));
                return(syncCookie);
            }
            SyncCookie syncCookie2 = null;
            Exception  exception   = null;

            if (!SyncCookie.TryFromBytes(cookieData, out syncCookie2, out exception))
            {
                writeError(exception, ErrorCategory.InvalidData, null);
            }
            writeVerbose(SyncTaskHelper.FormatCookieVerboseString(syncCookie2));
            if (syncCookie2.DomainController != guid)
            {
                writeVerbose(Strings.VerboseSyncTaskDomainControllerMismatch(syncCookie2.DomainController, guid));
                ADServer adserver = topologyConfigurationSession.FindDCByFqdn(text);
                if (syncCookie2.PageCookie != null)
                {
                    writeVerbose(Strings.VerboseSyncTaskCookieHasPageData(syncCookie2.DomainController, guid));
                    string text2 = SyncTaskHelper.FindAvailableServerByInvocationId(syncCookie2.DomainController, topologyConfigurationSession, adserver.Site);
                    if (text2 != null)
                    {
                        session.DomainController = text2;
                        writeVerbose(Strings.VerboseSyncTaskHighestCommittedUSN(text2, syncCookie2.HighWatermark));
                        return(syncCookie2);
                    }
                    writeError(new PageCookieInterruptedException(), ErrorCategory.InvalidData, null);
                }
                if (!syncCookie2.LowWatermarks.ContainsKey(guid))
                {
                    writeVerbose(Strings.VerboseSyncTaskCookieCurrentWatermarksMissingCurrentDC(syncCookie2.DomainController, guid));
                    string text3 = SyncTaskHelper.FindAvailableServerByInvocationId(syncCookie2.DomainController, topologyConfigurationSession, adserver.Site);
                    if (text3 != null)
                    {
                        session.DomainController = text3;
                        topologyConfigurationSession.DomainController = text3;
                        text = text3;
                        guid = syncCookie2.DomainController;
                    }
                    else
                    {
                        writeVerbose(Strings.VerboseSyncTaskCookieOriginatingDCNotAvailable(syncCookie2.DomainController));
                        Guid   guid2;
                        string text4 = SyncTaskHelper.FindAvailableServerFromWatermarks(syncCookie2.LowWatermarks, topologyConfigurationSession, adserver.Site, out guid2);
                        if (text4 != null)
                        {
                            session.DomainController = text4;
                            topologyConfigurationSession.DomainController = text4;
                            text = text4;
                            guid = guid2;
                        }
                        else
                        {
                            writeError(new CookieExpiredException(syncCookie2.DomainController, guid), ErrorCategory.InvalidData, null);
                        }
                    }
                }
            }
            WatermarkMap lowWatermarks  = SyncTaskHelper.FallbackWatermarks(syncCookie2.LowWatermarks, syncCookie2.DomainController, guid);
            WatermarkMap highWatermarks = SyncTaskHelper.FallbackWatermarks(syncCookie2.HighWatermarks, syncCookie2.DomainController, guid);

            if (syncCookie2.HighWatermark == 0L)
            {
                syncCookie2 = new SyncCookie(guid, lowWatermarks, SyncConfiguration.GetReplicationCursors(topologyConfigurationSession), null);
            }
            else
            {
                syncCookie2 = new SyncCookie(guid, lowWatermarks, highWatermarks, syncCookie2.PageCookie);
            }
            writeVerbose(Strings.VerboseSyncTaskHighestCommittedUSN(text, syncCookie2.HighWatermark));
            return(syncCookie2);
        }