示例#1
0
        protected void ReserveDomain(string domain, string applicationIdentifier, ManageDelegationClient client, LocalizedString errorProofDomainOwnership, LiveFederationProvision.GetDomainStateDelegate getDomainState)
        {
            LocalizedString localizedString = Strings.SetLiveFedDomainReserveRequest(domain);

            this.WriteVerbose(localizedString);
            this.WriteProgress(localizedString, localizedString, 0);
            try
            {
                client.ReserveDomain(applicationIdentifier, domain, "ExchangeConnector");
            }
            catch (LiveDomainServicesException ex)
            {
                if (ex.DomainError != null && ex.DomainError.Value == DomainError.ProofOfOwnershipNotValid)
                {
                    throw new DomainProofOwnershipException(errorProofDomainOwnership, ex);
                }
                throw new UnableToReserveDomainException(domain, applicationIdentifier, ex.Message, ex);
            }
            this.WriteVerbose(Strings.SetLiveFedDomainReserveResponse(domain));
            DomainState domainState = this.WaitWhilePendingState(DomainState.PendingActivation, localizedString, getDomainState);

            this.WriteProgress(localizedString, localizedString, 100);
            if (domainState == DomainState.Unknown)
            {
                this.WriteVerbose(Strings.ErrorCannotGetDomainStatusFromPartnerSTS(domain, applicationIdentifier, string.Empty));
                return;
            }
            if (DomainState.PendingRelease == domainState)
            {
                throw new UnableToReserveDomainException(domain, applicationIdentifier, DomainState.PendingRelease.ToString());
            }
        }
示例#2
0
 protected void RemoveUri(ManageDelegationClient client, string uri, bool force)
 {
     this.WriteVerbose(Strings.RemoveLiveFedUriReserveRequest(uri));
     try
     {
         client.RemoveUri(this.ApplicationIdentifier, uri);
         this.WriteVerbose(Strings.RemoveLiveFedUriReserveResponse(uri));
     }
     catch (LiveDomainServicesException ex)
     {
         if (!force)
         {
             throw new UnableToReleaseUriException(uri, uri, this.ApplicationIdentifier, ex.Message, ex);
         }
         this.WriteVerbose(Strings.ErrorUnableToReleaseUri(uri, uri, this.ApplicationIdentifier, ex.Message));
     }
 }
示例#3
0
 protected void AddUri(string domain, string applicationIdentifier, ManageDelegationClient client, LocalizedString errorProofDomainOwnership)
 {
     this.WriteVerbose(Strings.SetLiveFedUriReserveRequest(domain));
     try
     {
         client.AddUri(this.ApplicationIdentifier, domain);
     }
     catch (LiveDomainServicesException ex)
     {
         if (ex.DomainError != null && ex.DomainError.Value == DomainError.ProofOfOwnershipNotValid)
         {
             throw new DomainProofOwnershipException(errorProofDomainOwnership, ex);
         }
         throw new UnableToReserveUriException(domain, domain, applicationIdentifier, ex.Message, ex);
     }
     this.WriteVerbose(Strings.SetLiveFedUriReserveResponse(domain));
 }
示例#4
0
        protected void ReleaseDomain(string domain, string applicationIdentifier, bool force, ManageDelegationClient client, LiveFederationProvision.GetDomainStateDelegate getDomainState)
        {
            LocalizedString localizedString = Strings.RemoveLiveFedDomainReserveRequest(domain);

            this.WriteVerbose(localizedString);
            this.WriteProgress(localizedString, localizedString, 0);
            try
            {
                client.ReleaseDomain(this.ApplicationIdentifier, domain);
            }
            catch (LiveDomainServicesException ex)
            {
                if (!force)
                {
                    throw new UnableToReleaseDomainException(domain, applicationIdentifier, ex.Message, ex);
                }
                this.WriteVerbose(Strings.ErrorUnableToReleaseDomain(domain, applicationIdentifier, ex.Message));
            }
            this.WriteVerbose(Strings.RemoveLiveFedDomainReserveResponse(domain));
            this.WaitWhilePendingState(DomainState.PendingRelease, localizedString, getDomainState);
            this.WriteProgress(localizedString, localizedString, 100);
        }