示例#1
0
 internal BposServiceInstanceInfo(ServiceInstanceId serviceInstanceId, string endpointName, Uri backSyncUrl, bool authorityTransferIsSupported) : this()
 {
     this.Identity     = serviceInstanceId;
     this.EndpointName = endpointName;
     this.BackSyncUrl  = backSyncUrl;
     this.AuthorityTransferIsSupported = authorityTransferIsSupported;
 }
 // Token: 0x06000905 RID: 2309 RVA: 0x0001F6A8 File Offset: 0x0001D8A8
 private static bool TryParseServiceInstanceId(string identity, out ServiceInstanceId serviceInstanceId)
 {
     serviceInstanceId = null;
     try
     {
         serviceInstanceId = new ServiceInstanceId(identity);
     }
     catch (InvalidServiceInstanceIdException)
     {
         return(false);
     }
     return(true);
 }
        public void MigrateE15CookieToE14Cookie(string serviceInstanceName)
        {
            SyncServiceInstance syncServiceInstance = ServiceInstanceId.GetSyncServiceInstance(serviceInstanceName);

            if (syncServiceInstance != null)
            {
                int      maxCookieHistoryCount = 100;
                TimeSpan cookieHistoryInterval = new TimeSpan(0, 30, 0);
                MsoCookieConverter.ConvertE15toE14MV(syncServiceInstance, maxCookieHistoryCount, cookieHistoryInterval);
                return;
            }
            throw new ArgumentException("serviceInstanceName could not be found");
        }
        public NuGetServiceRuntime(NuGetService service)
        {
            var instanceId = Interlocked.Increment(ref _nextId) - 1;

            ServiceInstanceId.Set(instanceId);


            Service       = service;
            TempDirectory = Path.Combine(Path.GetTempPath(), "NuGetServices", serviceName, instanceId.ToString());


            ServiceInstanceName = String.Format(
                CultureInfo.InvariantCulture,
                "{0}_{1}_{2}",
                Service.Host.HostInstanceName,
                Service.Name,
                ServiceInstanceId.Get());
        }
        public void MigrateE14CookieToE15Cookie(string serviceInstanceName)
        {
            SyncServiceInstance syncServiceInstance = ServiceInstanceId.GetSyncServiceInstance(serviceInstanceName);

            if (syncServiceInstance == null)
            {
                throw new ArgumentException("serviceInstanceName could not be found");
            }
            int      maxCookieHistoryCount = 100;
            TimeSpan cookieHistoryInterval = new TimeSpan(0, 30, 0);

            if (syncServiceInstance.IsMultiObjectCookieEnabled)
            {
                MsoCookieConverter.PerformConversion(serviceInstanceName, maxCookieHistoryCount, cookieHistoryInterval);
                return;
            }
            MsoCookieConverter.ConvertE14MVtoE15MV(syncServiceInstance, maxCookieHistoryCount, cookieHistoryInterval);
        }
        public static void PerformConversion(string serviceInstanceName, int maxCookieHistoryCount, TimeSpan cookieHistoryInterval)
        {
            SyncServiceInstance syncServiceInstance = ServiceInstanceId.GetSyncServiceInstance(serviceInstanceName);

            if (syncServiceInstance != null && syncServiceInstance.IsMultiObjectCookieEnabled)
            {
                MsoMultiObjectCookieManager   msoMultiObjectCookieManager  = new MsoMultiObjectCookieManager(serviceInstanceName, maxCookieHistoryCount, cookieHistoryInterval, ForwardSyncCookieType.RecipientIncremental);
                MsoMultiObjectCookieManager   msoMultiObjectCookieManager2 = new MsoMultiObjectCookieManager(serviceInstanceName, maxCookieHistoryCount, cookieHistoryInterval, ForwardSyncCookieType.CompanyIncremental);
                ITopologyConfigurationSession ridmasterSession             = MsoCookieConverter.GetRIDMasterSession();
                MsoMainStreamCookieContainer  msoMainStreamCookieContainer = ridmasterSession.GetMsoMainStreamCookieContainer(serviceInstanceName);
                MsoCookieConverter.FromMultiValuedCookieToMultiObjectCookie(serviceInstanceName, msoMainStreamCookieContainer.MsoForwardSyncRecipientCookie, msoMultiObjectCookieManager);
                MsoCookieConverter.FromMultiValuedCookieToMultiObjectCookie(serviceInstanceName, msoMainStreamCookieContainer.MsoForwardSyncNonRecipientCookie, msoMultiObjectCookieManager2);
                ridmasterSession.UseConfigNC = true;
                ADObjectId orgContainerId = ridmasterSession.GetOrgContainerId();
                ADRawEntry adrawEntry     = ridmasterSession.ReadADRawEntry(orgContainerId.Parent, MsoCookieConverter.E14MsoMainStreamCookieContainerSchema.CookieProperties);
                MsoCookieConverter.FromMultiValuedCookieToMultiObjectCookie(serviceInstanceName, adrawEntry.propertyBag[MsoCookieConverter.E14MsoMainStreamCookieContainerSchema.MsoForwardSyncRecipientCookie] as IEnumerable <byte[]>, msoMultiObjectCookieManager);
                MsoCookieConverter.FromMultiValuedCookieToMultiObjectCookie(serviceInstanceName, adrawEntry.propertyBag[MsoCookieConverter.E14MsoMainStreamCookieContainerSchema.MsoForwardSyncNonRecipientCookie] as IEnumerable <byte[]>, msoMultiObjectCookieManager2);
            }
        }
示例#7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ServiceInstanceId != 0)
            {
                hash ^= ServiceInstanceId.GetHashCode();
            }
            if (Time != 0L)
            {
                hash ^= Time.GetHashCode();
            }
            if (ServiceInstanceUUID.Length != 0)
            {
                hash ^= ServiceInstanceUUID.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        private bool HandleRelocationState(bool isRelocationCompleted, bool isSourceOfRelocation, PropertyBag propertyBag, ADRawEntry org)
        {
            if (!isRelocationCompleted)
            {
                if (!isSourceOfRelocation)
                {
                    this.reporter.ReportExcludedObject(propertyBag, DirectoryObjectErrorCode.ObjectOutOfScope, ProcessingStage.RelocationStageFilter);
                }
                return(isSourceOfRelocation);
            }
            if (!isSourceOfRelocation)
            {
                if (this.isIncrementalSync)
                {
                    WatermarkMap vectorToFilterRelocationData = TenantRelocationProcessor.GetVectorToFilterRelocationData(org);
                    if (vectorToFilterRelocationData.ContainsKey(this.invocationId))
                    {
                        long num = vectorToFilterRelocationData[this.invocationId];
                        if ((long)(propertyBag[ADRecipientSchema.UsnChanged] ?? 9223372036854775807L) < num)
                        {
                            this.reporter.ReportExcludedObject(propertyBag, DirectoryObjectErrorCode.ObjectOutOfScope, ProcessingStage.RelocationPartOfRelocationSyncFilter);
                            return(false);
                        }
                    }
                }
                return(true);
            }
            if (ProcessorHelper.IsObjectOrganizationUnit(propertyBag))
            {
                this.reporter.ReportExcludedObject(propertyBag, DirectoryObjectErrorCode.ObjectOutOfScope, ProcessingStage.RelocationStageFilter);
                return(false);
            }
            ServiceInstanceId value = new ServiceInstanceId(string.Format("exchange/{0}", org[ExchangeConfigurationUnitSchema.TargetForest]));

            propertyBag.SetField(SyncObjectSchema.FaultInServiceInstance, value);
            return(true);
        }
            public override CookieManager GetCookieManager(ForwardSyncCookieType cookieType, string serviceInstanceName, int maxCookieHistoryCount, TimeSpan cookieHistoryInterval)
            {
                SyncServiceInstance syncServiceInstance = ServiceInstanceId.GetSyncServiceInstance(serviceInstanceName);

                switch (cookieType)
                {
                case ForwardSyncCookieType.RecipientIncremental:
                    if (syncServiceInstance != null && syncServiceInstance.IsMultiObjectCookieEnabled)
                    {
                        return(new MsoMultiObjectCookieManager(serviceInstanceName, maxCookieHistoryCount, cookieHistoryInterval, cookieType));
                    }
                    return(new MsoRecipientMainStreamCookieManager(serviceInstanceName, maxCookieHistoryCount, cookieHistoryInterval));

                case ForwardSyncCookieType.CompanyIncremental:
                    if (syncServiceInstance != null && syncServiceInstance.IsMultiObjectCookieEnabled)
                    {
                        return(new MsoMultiObjectCookieManager(serviceInstanceName, maxCookieHistoryCount, cookieHistoryInterval, cookieType));
                    }
                    return(new MsoCompanyMainStreamCookieManager(serviceInstanceName, maxCookieHistoryCount, cookieHistoryInterval));

                default:
                    throw new InvalidOperationException("Cookie type not supported");
                }
            }
 public PagedOutputResultWriter(WriteResultDelegate writeDelegate, Func <IEnumerable <SyncObject>, bool, byte[], ServiceInstanceId, object> createResponseDelegate, Action <int> serializeCountDelegate, AddErrorSyncObjectDelegate addErrorObjectDelegate, ServiceInstanceId currentServiceInstanceId)
 {
     this.writeDelegate          = writeDelegate;
     this.createResponseDelegate = createResponseDelegate;
     this.serializeCountDelegate = serializeCountDelegate;
     this.entries = new List <PropertyBag>();
     this.addErrorSyncObjectDelegate = addErrorObjectDelegate;
     this.currentServiceInstanceId   = currentServiceInstanceId;
 }
 // Token: 0x06000BB4 RID: 2996 RVA: 0x00025082 File Offset: 0x00023282
 public ServiceInstanceIdParameter(ServiceInstanceId serviceInstanceId) : base(serviceInstanceId.InstanceId)
 {
 }
 public IncludedBackIntoBacksyncDetector(IDataProcessor next, ServiceInstanceId serviceInstanceId) : base(next)
 {
     this.serviceInstanceId = serviceInstanceId;
 }
        protected override void InternalBeginProcessing()
        {
            TaskLogger.LogEnter();
            if (this.nameWarning != LocalizedString.Empty)
            {
                this.WriteWarning(this.nameWarning);
            }
            base.InternalBeginProcessing();
            if (this.Administrator != null)
            {
                OrganizationTaskHelper.ValidateParamString("Administrator", this.Administrator.ToString(), new Task.TaskErrorLoggingDelegate(base.WriteError));
            }
            if (this.AdministratorNetID != null)
            {
                OrganizationTaskHelper.ValidateParamString("AdministratorNetID", this.AdministratorNetID.ToString(), new Task.TaskErrorLoggingDelegate(base.WriteError));
            }
            if (this.AdministratorNetID != null && this.Administrator != null && this.Administrator.NetId != null && !this.AdministratorNetID.Equals(this.Administrator.NetId))
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorNetIDValuesDoNotMatch(this.AdministratorNetID.ToString(), this.Administrator.NetId.ToString())), ErrorCategory.InvalidArgument, null);
            }
            if (this.AdministratorNetID != null && this.Administrator == null)
            {
                this.Administrator = new WindowsLiveId(this.AdministratorNetID.ToString());
            }
            if (base.Fields.IsModified("TenantDirSyncServiceInstance") && !string.IsNullOrEmpty(this.DirSyncServiceInstance) && !ServiceInstanceId.IsValidServiceInstanceId(this.DirSyncServiceInstance))
            {
                base.WriteError(new InvalidServiceInstanceIdException(this.DirSyncServiceInstance), ExchangeErrorCategory.Client, null);
            }
            if (this.ServicePlanConfig.IsPilotOffer(this.ProgramId, this.OfferId) && !this.CreateSharedConfiguration)
            {
                base.WriteError(new ArgumentException(Strings.ErrorPilotServicePlanCanBeUsedToCreateSharedOrgsOnly(this.ProgramId, this.OfferId)), (ErrorCategory)1000, null);
            }
            Exception ex   = null;
            string    text = null;

            if (base.Fields["TenantExternalDirectoryOrganizationId"] == null && !this.CreateSharedConfiguration)
            {
                base.Fields["TenantExternalDirectoryOrganizationId"] = Guid.NewGuid();
            }
            try
            {
                bool flag = this.ServicePlanConfig.TryGetHydratedOfferId(this.ProgramId, this.OfferId, out text);
                if (!this.CreateSharedConfiguration && this.Name == null)
                {
                    base.WriteError(new ArgumentException(Strings.ErrorNameNotSet), (ErrorCategory)1000, null);
                }
                this.partition = ((this.AccountPartition != null) ? NewOrganizationTask.ResolvePartitionId(this.AccountPartition, new Task.TaskErrorLoggingDelegate(base.WriteError)) : NewOrganizationTask.ChoosePartition(this.Name, this.CreateSharedConfiguration, new Task.TaskErrorLoggingDelegate(base.WriteError)));
                if (this.CreateSharedConfiguration && flag)
                {
                    this.OfferId         = text;
                    this.shouldCreateSCT = NewOrganizationTask.ShouldCreateSharedConfiguration(this.ProgramId, this.OfferId, this.partition, out this.sctConfigUnit);
                }
                string text2 = this.ServicePlanConfig.ResolveServicePlanName(this.ProgramId, this.OfferId);
                this.servicePlanSettings = this.ServicePlanConfig.GetServicePlanSettings(text2);
                bool flag2 = this.ServicePlanConfig.IsTemplateTenantServicePlan(this.servicePlanSettings);
                if (flag2)
                {
                    this.shouldCreateSCT = NewOrganizationTask.ShouldCreateTenantTemplate(this.ProgramId, this.OfferId, this.partition, out this.sctConfigUnit);
                }
                if (this.CreateSharedConfiguration)
                {
                    if (!this.shouldCreateSCT)
                    {
                        this.WriteWarning(Strings.WarningSharedConfigurationAlreadyExists(this.ProgramId, this.OfferId));
                        return;
                    }
                    if (string.IsNullOrEmpty(this.Name))
                    {
                        this.Name = (flag2 ? TemplateTenantConfiguration.CreateSharedConfigurationName(this.ProgramId, this.OfferId) : SharedConfiguration.CreateSharedConfigurationName(this.ProgramId, this.OfferId));
                    }
                    if (this.DomainName == null)
                    {
                        this.DomainName = (flag2 ? TemplateTenantConfiguration.CreateSharedConfigurationDomainName(this.Name) : SharedConfiguration.CreateSharedConfigurationDomainName(this.Name));
                    }
                }
                OrganizationTaskHelper.ValidateParamString("Name", this.Name, new Task.TaskErrorLoggingDelegate(base.WriteError), true);
                ADOrganizationalUnit adorganizationalUnit = new ADOrganizationalUnit();
                adorganizationalUnit[ADObjectSchema.Name] = this.Name;
                base.InternalIsSharedConfigServicePlan    = this.ServicePlanConfig.IsSharedConfigurationAllowedForServicePlan(this.servicePlanSettings);
                if (this.CreateSharedConfiguration && !base.InternalIsSharedConfigServicePlan && !this.ServicePlanConfig.IsHydratedOffer(text2))
                {
                    base.WriteError(new SharedConfigurationValidationException(Strings.ErrorServicePlanDoesntAllowSharedConfiguration(this.ProgramId, this.OfferId)), (ErrorCategory)1000, null);
                }
                else if (!flag && base.InternalIsSharedConfigServicePlan)
                {
                    text = this.OfferId;
                }
                if (this.CreateSharedConfiguration)
                {
                    base.InternalCreateSharedConfiguration = true;
                }
                else if (!this.CreateSharedConfiguration && base.InternalIsSharedConfigServicePlan)
                {
                    SharedConfigurationInfo sharedConfigurationInfo = SharedConfigurationInfo.FromInstalledVersion(this.ProgramId, text);
                    base.InternalSharedConfigurationId = SharedConfiguration.FindOneSharedConfigurationId(sharedConfigurationInfo, this.partition);
                    if (base.InternalSharedConfigurationId == null)
                    {
                        base.WriteError(new SharedConfigurationValidationException(Strings.ErrorSharedConfigurationNotFound(this.ProgramId, text, sharedConfigurationInfo.CurrentVersion.ToString())), (ErrorCategory)1000, null);
                    }
                    base.InternalCreateSharedConfiguration = false;
                }
                List <ValidationError> list = new List <ValidationError>();
                list.AddRange(ServicePlan.ValidateFileSchema(text2));
                list.AddRange(this.servicePlanSettings.Validate());
                if (list.Count != 0)
                {
                    ex = new ArgumentException(Strings.ErrorServicePlanInconsistent(text2, this.ProgramId, this.OfferId, ValidationError.CombineErrorDescriptions(list)));
                }
            }
            catch (ArgumentException ex2)
            {
                ex = ex2;
            }
            catch (IOException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                base.WriteError(ex, ErrorCategory.InvalidArgument, null);
            }
            base.InternalLocalStaticConfigEnabled      = (!this.servicePlanSettings.Organization.AdvancedHydrateableObjectsSharedEnabled || this.CreateSharedConfiguration);
            base.InternalLocalHydrateableConfigEnabled = (!this.servicePlanSettings.Organization.CommonHydrateableObjectsSharedEnabled || this.CreateSharedConfiguration);
            TaskLogger.LogExit();
        }
示例#14
0
 protected override void InternalValidate()
 {
     base.InternalValidate();
     if (this.DataObject.IsModified(ExchangeConfigurationUnitSchema.DirSyncServiceInstance) && !string.IsNullOrEmpty(this.DataObject.DirSyncServiceInstance) && !ServiceInstanceId.IsValidServiceInstanceId(this.DataObject.DirSyncServiceInstance))
     {
         base.WriteError(new InvalidServiceInstanceIdException(this.DataObject.DirSyncServiceInstance), ExchangeErrorCategory.Client, null);
     }
     if (this.DataObject.IsChanged(OrganizationSchema.SupportedSharedConfigurations) && !this.RemoveSharedConfigurations)
     {
         foreach (ExchangeConfigurationUnit exchangeConfigurationUnit in this.SharedConfigurationUnits)
         {
             if (exchangeConfigurationUnit.SharedConfigurationInfo == null)
             {
                 base.WriteError(new SharedConfigurationValidationException(Strings.SharedConfigurationInfoNotPresent(exchangeConfigurationUnit.Identity.ToString())), ExchangeErrorCategory.Client, null);
             }
             ServicePlanConfiguration instance = ServicePlanConfiguration.GetInstance();
             if (!exchangeConfigurationUnit.ProgramId.Equals(this.DataObject.ProgramId, StringComparison.OrdinalIgnoreCase) || (!this.IsHydratedOfferIdMatched(this.DataObject.ProgramId, this.DataObject.OfferId, exchangeConfigurationUnit, instance) && !this.IsPilotOfferIdMatched(this.DataObject.ProgramId, this.DataObject.OfferId, exchangeConfigurationUnit, instance) && !this.IsHydratedPilotOfferIdMatched(this.DataObject.ProgramId, this.DataObject.OfferId, exchangeConfigurationUnit, instance)))
             {
                 base.WriteError(new SharedConfigurationValidationException(Strings.OfferIdMatchError(this.Identity.ToString(), this.DataObject.ProgramId, this.DataObject.OfferId, exchangeConfigurationUnit.Identity.ToString(), exchangeConfigurationUnit.ProgramId, exchangeConfigurationUnit.OfferId)), ExchangeErrorCategory.Client, null);
             }
             if (!exchangeConfigurationUnit.EnableAsSharedConfiguration)
             {
                 base.WriteError(new SharedConfigurationValidationException(Strings.SharedConfigurationNotEnabled(this.Identity.ToString(), exchangeConfigurationUnit.Identity.ToString())), ExchangeErrorCategory.Client, null);
             }
         }
         if (this.DataObject.SharedConfigurationInfo != null)
         {
             base.WriteError(new SharedConfigurationValidationException(Strings.SharedConfigurationInfoExists(this.Identity.ToString(), this.DataObject.SharedConfigurationInfo.ToString())), ExchangeErrorCategory.Client, null);
         }
     }
     if (this.DataObject.IsChanged(OrganizationSchema.EnableAsSharedConfiguration) && !this.DataObject.EnableAsSharedConfiguration)
     {
         if (this.DataObject.SharedConfigurationInfo == null)
         {
             base.WriteError(new SharedConfigurationValidationException(Strings.SharedConfigurationInfoNotPresent(this.DataObject.Identity.ToString())), ExchangeErrorCategory.Client, null);
         }
         ExchangeConfigurationUnit[] array = OrganizationTaskHelper.FindSharedConfigurations(this.DataObject.SharedConfigurationInfo, this.DataObject.OrganizationId.PartitionId);
         if (array == null || array.Length < 2)
         {
             this.confirmLastSharedConfiguration = true;
         }
     }
 }