Exemplo n.º 1
0
        internal static MRSCapabilities MapJobTypeToCapability(MRSJobType jobType)
        {
            switch (jobType)
            {
            case MRSJobType.Unknown:
                return(MRSCapabilities.E14_RTM);

            case MRSJobType.RequestJobE14R4_WithDurations:
                return(MRSCapabilities.E14_RTM);

            case MRSJobType.RequestJobE14R5_WithImportExportMerge:
            case MRSJobType.RequestJobE14R5_PrimaryOrArchiveExclusiveMoves:
            case MRSJobType.RequestJobE14R6_CompressedReports:
                return(MRSCapabilities.Merges);

            case MRSJobType.RequestJobE15_TenantHint:
                return(MRSCapabilities.TenantHint);

            case MRSJobType.RequestJobE15_AutoResume:
                return(MRSCapabilities.AutoResume);

            case MRSJobType.RequestJobE15_SubType:
                return(MRSCapabilities.SubType);

            case MRSJobType.RequestJobE15_AutoResumeMerges:
                return(MRSCapabilities.AutoResumeMerges);

            case MRSJobType.RequestJobE15_CreatePublicFoldersUnderParentInSecondary:
                return(MRSCapabilities.CreatePublicFoldersUnderParentInSecondary);
            }
            return(MRSCapabilities.E14_RTM);
        }
Exemplo n.º 2
0
        internal static bool IsMessageTypeSupported(MapiMessage message, MapiStore store)
        {
            RequestJobNamedPropertySet requestJobNamedPropertySet = RequestJobNamedPropertySet.Get(store);
            PropValue  prop  = message.GetProp(requestJobNamedPropertySet.PropTags[9]);
            MRSJobType value = MapiUtils.GetValue <MRSJobType>(prop, MRSJobType.RequestJobE14R3);

            return(RequestJobXML.IsKnownJobType(value));
        }
Exemplo n.º 3
0
        internal static bool IsKnownJobType(MRSJobType jobType)
        {
            switch (jobType)
            {
            case MRSJobType.RequestJobE14R4_WithDurations:
            case MRSJobType.RequestJobE14R5_WithImportExportMerge:
            case MRSJobType.RequestJobE14R5_PrimaryOrArchiveExclusiveMoves:
            case MRSJobType.RequestJobE14R6_CompressedReports:
            case MRSJobType.RequestJobE15_TenantHint:
            case MRSJobType.RequestJobE15_AutoResume:
            case MRSJobType.RequestJobE15_SubType:
            case MRSJobType.RequestJobE15_AutoResumeMerges:
            case MRSJobType.RequestJobE15_CreatePublicFoldersUnderParentInSecondary:
                return(true);

            default:
                return(false);
            }
        }
 public static MailboxReplicationServiceClient Create(string serverName, MRSJobType jobType)
 {
     return(MailboxReplicationServiceClient.Create(serverName, RequestJobXML.MapJobTypeToCapability(jobType)));
 }
        internal static MailboxReplicationServiceClient Create(IConfigurationSession session, MRSJobType jobType, Guid mdbGuid, List <string> unreachableMrsServers)
        {
            MRSCapabilities     requiredCapability = RequestJobXML.MapJobTypeToCapability(jobType);
            string              text = null;
            DatabaseInformation databaseInformation = MapiUtils.FindServerForMdb(mdbGuid, null, null, FindServerFlags.None);

            if (!string.IsNullOrEmpty(databaseInformation.ServerFqdn))
            {
                text = databaseInformation.ServerFqdn.ToLower(CultureInfo.InvariantCulture);
            }
            List <string> mrsServers = MailboxReplicationServiceClient.GetMrsServers(session, mdbGuid);
            List <string> list       = new List <string>(mrsServers.Count);

            foreach (string text2 in mrsServers)
            {
                string text3 = text2.ToLower(CultureInfo.InvariantCulture);
                if (string.Compare(text3, text, CultureInfo.InvariantCulture, CompareOptions.Ordinal) != 0 && !unreachableMrsServers.Contains(text3))
                {
                    list.Add(text2);
                }
            }
            List <string> list2 = CommonUtils.RandomizeSequence <string>(list);

            if (text != null)
            {
                list2.Insert(0, text);
            }
            foreach (string text4 in list2)
            {
                try
                {
                    return(MailboxReplicationServiceClient.Create(text4, requiredCapability));
                }
                catch (MailboxReplicationPermanentException ex)
                {
                    MrsTracer.Common.Warning("Attempt to connect to CAS Server {0} failed with error: {1}", new object[]
                    {
                        text4,
                        CommonUtils.FullExceptionMessage(ex)
                    });
                }
                catch (MailboxReplicationTransientException ex2)
                {
                    MrsTracer.Common.Warning("Attempt to connect to CAS Server {0} failed with error: {1}", new object[]
                    {
                        text4,
                        CommonUtils.FullExceptionMessage(ex2)
                    });
                }
                unreachableMrsServers.Add(text4.ToLower(CultureInfo.InvariantCulture));
            }
            throw new NoMRSAvailableTransientException();
        }