Exemple #1
0
        private Uri GetFirstOrgServiceLocation(ServiceType serviceType)
        {
            if (this.enableOrgAndTemplateCache)
            {
                return(null);
            }
            RmsConfiguration.FirstOrgServiceLocationsCache.FirstOrgServiceLocations firstOrgServiceLocations = this.firstOrgCache.GetFirstOrgServiceLocations();
            if (firstOrgServiceLocations == null)
            {
                return(null);
            }
            switch (serviceType)
            {
            case ServiceType.Certification:
                return(firstOrgServiceLocations.CertificationLocation);

            case ServiceType.Activation | ServiceType.Certification:
                goto IL_45;

            case ServiceType.Publishing:
                break;

            default:
                if (serviceType != ServiceType.ClientLicensor)
                {
                    goto IL_45;
                }
                break;
            }
            return(firstOrgServiceLocations.PublishingLocaton);

IL_45:
            return(null);
        }
Exemple #2
0
 private void Refresh(bool throwExceptions)
 {
     if (DateTime.UtcNow < this.timeout)
     {
         return;
     }
     RmsConfiguration.Tracer.TraceDebug <bool>((long)this.objHashCode, "Refreshing the first org service locations cache. Initializing for the first time: {0}", throwExceptions);
     lock (this)
     {
         if (DateTime.UtcNow < this.timeout)
         {
             return;
         }
         RmsConfiguration.FirstOrgServiceLocationsCache.FirstOrgServiceLocations firstOrgServiceLocations = new RmsConfiguration.FirstOrgServiceLocationsCache.FirstOrgServiceLocations();
         try
         {
             firstOrgServiceLocations.CertificationLocation = DrmClientUtils.GetServiceLocation(SafeRightsManagementSessionHandle.InvalidHandle, ServiceType.Certification, ServiceLocation.Enterprise, null);
             firstOrgServiceLocations.PublishingLocaton     = DrmClientUtils.GetServiceLocation(SafeRightsManagementSessionHandle.InvalidHandle, ServiceType.ClientLicensor, ServiceLocation.Enterprise, null);
             this.firstOrgServiceLocations = firstOrgServiceLocations;
         }
         catch (RightsManagementException ex)
         {
             RmsConfiguration.Tracer.TraceError <RightsManagementException>((long)this.objHashCode, "Failed to get the service locations. Error {0}", ex);
             if (ex.FailureCode != RightsManagementFailureCode.ServiceNotFound && throwExceptions)
             {
                 throw;
             }
             RmsConfiguration.Tracer.TraceError((long)this.objHashCode, "Failed to refresh the first org cache");
         }
         if (this.firstOrgServiceLocations != null)
         {
             this.timeout = DateTime.UtcNow.Add(RmsConfiguration.FirstOrgServiceLocationsCache.ExpirationTime);
         }
     }
     RmsConfiguration.Tracer.TraceDebug <Uri, Uri, DateTime>((long)this.objHashCode, "Values for the first org cache. CertificationLocation: {0}, PublishingLocation: {1}, ExpirationTime: {2}", (this.firstOrgServiceLocations != null) ? this.firstOrgServiceLocations.CertificationLocation : null, (this.firstOrgServiceLocations != null) ? this.firstOrgServiceLocations.PublishingLocaton : null, this.timeout);
 }