public static MtrSchemaVersion GetMtrSchemaVersion(ServerVersion serverVersion)
        {
            int num = serverVersion.ToInt();

            if (num < Globals.E14Version)
            {
                return(MtrSchemaVersion.Unknown);
            }
            if (num < Globals.E15Version)
            {
                return(MtrSchemaVersion.E14);
            }
            return(MtrSchemaVersion.E15RTM);
        }
Example #2
0
        public static LocalizedString?CheckForMinimumRequiredVersion(ServerVersion sourceServerVersion)
        {
            LocalizedString?result = null;
            int             num    = sourceServerVersion.ToInt();

            if (sourceServerVersion.Major < 8)
            {
                result = new LocalizedString?(MrsStrings.PublicFolderMigrationNotSupportedFromExchange2003OrEarlier(sourceServerVersion.Major, sourceServerVersion.Minor, sourceServerVersion.Build, sourceServerVersion.Revision));
            }
            else if (sourceServerVersion.Major == 8 && num < ParallelPublicFolderMigrationVersionChecker.E12MinVersionNumber)
            {
                result = new LocalizedString?(MrsStrings.PublicFolderMigrationNotSupportedFromCurrentExchange2007Version(sourceServerVersion.Major, sourceServerVersion.Minor, sourceServerVersion.Build, sourceServerVersion.Revision));
            }
            else if (sourceServerVersion.Major == 14 && num < ParallelPublicFolderMigrationVersionChecker.E14MinVersionNumber)
            {
                result = new LocalizedString?(MrsStrings.PublicFolderMigrationNotSupportedFromCurrentExchange2010Version(sourceServerVersion.Major, sourceServerVersion.Minor, sourceServerVersion.Build, sourceServerVersion.Revision));
            }
            return(result);
        }
Example #3
0
        internal static BackEndServer GetAnyBackEndServerForVersion <ServiceType>(ServerVersion serverVersion, bool exactVersionMatch, ClientAccessType clientAccessType, bool currentSiteOnly = false) where ServiceType : HttpService
        {
            if (serverVersion == null)
            {
                throw new ArgumentNullException("version");
            }
            ServiceTopology currentServiceTopology = ServiceTopology.GetCurrentServiceTopology("f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\Cafe\\HttpProxyBackEndHelper.cs", "GetAnyBackEndServerForVersion", 349);
            string          empty               = string.Empty;
            int             version             = 0;
            ServerRole      serverRoleToLookFor = (serverVersion.Major < 15) ? ServerRole.ClientAccess : ServerRole.Mailbox;

            if (currentServiceTopology.TryGetRandomServerFromCurrentSite(serverRoleToLookFor, serverVersion.ToInt(), ServiceTopology.RandomServerSearchType.ExactVersion, out empty, out version, "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\Cafe\\HttpProxyBackEndHelper.cs", "GetAnyBackEndServerForVersion", 358))
            {
                return(new BackEndServer(empty, version));
            }
            if (!exactVersionMatch)
            {
                ServerVersion serverVersion2 = new ServerVersion(serverVersion.Major, 0, 0, 0);
                if (currentServiceTopology.TryGetRandomServerFromCurrentSite(serverRoleToLookFor, serverVersion2.ToInt(), ServiceTopology.RandomServerSearchType.MinimumVersionMatchMajor, out empty, out version, "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\Cafe\\HttpProxyBackEndHelper.cs", "GetAnyBackEndServerForVersion", 374))
                {
                    return(new BackEndServer(empty, version));
                }
            }
            if (!currentSiteOnly)
            {
                HttpService httpService = currentServiceTopology.FindAny <ServiceType>(clientAccessType, (ServiceType service) => service != null && !service.IsFrontEnd && (service.ServerRole & serverRoleToLookFor) == serverRoleToLookFor && !service.IsOutOfService && service.AdminDisplayVersionNumber == serverVersion, "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\Cafe\\HttpProxyBackEndHelper.cs", "GetAnyBackEndServerForVersion", 389);
                if (httpService != null)
                {
                    return(new BackEndServer(httpService.ServerFullyQualifiedDomainName, httpService.ServerVersionNumber));
                }
                if (!exactVersionMatch)
                {
                    new ServerVersion(serverVersion.Major, 0, 0, 0);
                    httpService = currentServiceTopology.FindAny <ServiceType>(clientAccessType, (ServiceType service) => service != null && !service.IsFrontEnd && (service.ServerRole & serverRoleToLookFor) == serverRoleToLookFor && !service.IsOutOfService && service.ServerVersionNumber > serverVersion.ToInt() && new ServerVersion(service.ServerVersionNumber).Major == serverVersion.Major, "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\Cafe\\HttpProxyBackEndHelper.cs", "GetAnyBackEndServerForVersion", 408);
                    if (httpService != null)
                    {
                        return(new BackEndServer(httpService.ServerFullyQualifiedDomainName, httpService.ServerVersionNumber));
                    }
                }
            }
            if (!exactVersionMatch)
            {
                ServerVersion higherVersion = new ServerVersion(serverVersion.Major + 1, 0, 0, 0);
                ServerRole    higherVersionServerRoleToLookFor = (higherVersion.Major < 15) ? ServerRole.ClientAccess : ServerRole.Mailbox;
                if (currentServiceTopology.TryGetRandomServerFromCurrentSite(higherVersionServerRoleToLookFor, higherVersion.ToInt(), ServiceTopology.RandomServerSearchType.MinimumVersion, out empty, out version, "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\Cafe\\HttpProxyBackEndHelper.cs", "GetAnyBackEndServerForVersion", 431))
                {
                    return(new BackEndServer(empty, version));
                }
                if (!currentSiteOnly)
                {
                    HttpService httpService2 = currentServiceTopology.FindAny <ServiceType>(clientAccessType, (ServiceType service) => service != null && !service.IsFrontEnd && (service.ServerRole & higherVersionServerRoleToLookFor) == higherVersionServerRoleToLookFor && !service.IsOutOfService && service.ServerVersionNumber > higherVersion.ToInt(), "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\Cafe\\HttpProxyBackEndHelper.cs", "GetAnyBackEndServerForVersion", 444);
                    if (httpService2 != null)
                    {
                        return(new BackEndServer(httpService2.ServerFullyQualifiedDomainName, httpService2.ServerVersionNumber));
                    }
                }
            }
            string message = string.Format("Unable to find any backend server for version {0}.", serverVersion);

            throw new ServerNotFoundException(message, serverVersion.ToString());
        }
        internal static List <string> GetMrsServers(IConfigurationSession session, Guid mdbGuid)
        {
            DatabaseInformation databaseInformation = MapiUtils.FindServerForMdb(mdbGuid, null, null, FindServerFlags.None);

            if (databaseInformation.ServerSite == null)
            {
                throw new UnableToDetermineMDBSitePermanentException(mdbGuid);
            }
            MrsTracer.Common.Debug("MDB '{0}' ({1}) found to belong to Site: '{2}'", new object[]
            {
                databaseInformation.DatabaseName,
                mdbGuid,
                databaseInformation.ServerSite
            });
            ServerVersion serverVersion = MailboxReplicationServiceClient.minRequiredVersion;
            QueryFilter   filter        = new AndFilter(new QueryFilter[]
            {
                new BitMaskAndFilter(ServerSchema.CurrentServerRole, 4UL),
                new ComparisonFilter(ComparisonOperator.NotEqual, ActiveDirectoryServerSchema.IsOutOfService, true),
                new ComparisonFilter(ComparisonOperator.GreaterThanOrEqual, ServerSchema.VersionNumber, serverVersion.ToInt()),
                new ComparisonFilter(ComparisonOperator.Equal, ServerSchema.ServerSite, databaseInformation.ServerSite.DistinguishedName)
            });

            Server[] array = session.Find <Server>(null, QueryScope.SubTree, filter, null, 0);
            if (array == null || array.Length == 0)
            {
                MrsTracer.Common.Error("No Client Access servers running an appropriate version of Exchange 2010 (or later) were found in site '{0}'.", new object[]
                {
                    databaseInformation.ServerSite.ToString()
                });
                throw new ErrorNoCASServersInSitePermanentException(databaseInformation.ServerSite.ToString(), serverVersion.ToString());
            }
            List <string> list = new List <string>(array.Length);

            foreach (Server server in array)
            {
                string fqdn = server.Fqdn;
                if (!string.IsNullOrEmpty(fqdn))
                {
                    list.Add(fqdn);
                }
            }
            return(list);
        }