예제 #1
0
 /// <summary>
 /// Default constructor used by XMLSerialization. It should not be used.
 /// </summary>
 public CacheConfig()
 {
     this.ocspLookupCache      = new CacheConfigElement();
     this.crlLookupCache       = new CacheConfigElement();
     this.uddiServiceCache     = new CacheConfigElement();
     this.uddiTModelCache      = new CacheConfigElement();
     this.certificateCache     = new CacheConfigElement();
     this.schemaStoreCache     = new CacheConfigElement();
     this.schematronStoreCache = new CacheConfigElement();
     this.messageIdUnfinishedSignaturesCache  = new CacheConfigElement();
     this.sequenceIdUnfinishedSignaturesCache = new CacheConfigElement();
 }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ocspLookupCache"></param>
        /// <param name="crlLookupCache"></param>
        /// <param name="uddiServiceCache"></param>
        /// <param name="uddiTModelCache"></param>
        /// <param name="certificateCache"></param>
        /// <param name="schematronStoreCache"></param>
        /// <param name="schemaStoreCache"></param>
        /// <param name="messageIdUnfinishedSignaturesCache"></param>
        /// <param name="sequenceIdUnfinishedSignaturesCache"></param>
        public CacheConfig(CacheConfigElement ocspLookupCache, CacheConfigElement crlLookupCache, CacheConfigElement uddiServiceCache, CacheConfigElement uddiTModelCache, CacheConfigElement certificateCache, CacheConfigElement schematronStoreCache, CacheConfigElement schemaStoreCache, CacheConfigElement messageIdUnfinishedSignaturesCache, CacheConfigElement sequenceIdUnfinishedSignaturesCache)
        {
            if (ocspLookupCache == null)
            {
                throw new NullArgumentException("CacheConfigElement");
            }
            if (crlLookupCache == null)
            {
                throw new NullArgumentException("crlLookupCache");
            }
            if (uddiServiceCache == null)
            {
                throw new NullArgumentException("uddiServiceCache");
            }
            if (uddiTModelCache == null)
            {
                throw new NullArgumentException("uddiTModelCache");
            }
            if (certificateCache == null)
            {
                throw new NullArgumentException("certificateCache");
            }
            if (schematronStoreCache == null)
            {
                throw new NullArgumentException("schematromStoreCache");
            }
            if (schematronStoreCache == null)
            {
                throw new NullArgumentException("schemaStoreCache");
            }
            if (messageIdUnfinishedSignaturesCache == null)
            {
                throw new NullArgumentException("messageIdUnfinishedSignaturesCache");
            }
            if (sequenceIdUnfinishedSignaturesCache == null)
            {
                throw new NullArgumentException("sequenceIdUnfinishedSignaturesCache");
            }

            this.ocspLookupCache      = ocspLookupCache;
            this.crlLookupCache       = crlLookupCache;
            this.uddiServiceCache     = uddiServiceCache;
            this.uddiTModelCache      = uddiTModelCache;
            this.certificateCache     = certificateCache;
            this.schematronStoreCache = schematronStoreCache;
            this.schemaStoreCache     = schemaStoreCache;
            this.messageIdUnfinishedSignaturesCache  = messageIdUnfinishedSignaturesCache;
            this.sequenceIdUnfinishedSignaturesCache = sequenceIdUnfinishedSignaturesCache;
        }
예제 #3
0
        private T Create <T>(CacheConfigElement element, string name)
        {
            T cache;

            if (string.IsNullOrEmpty(element.ImplementationNamespaceClass))
            {
                throw new NotImplementedException("The Assembly and NamespaceClass for the cache '" + name + "' is not defined correct.");
            }

            StringBuilder builder = new StringBuilder();

            builder.Append(element.ImplementationNamespaceClass);
            if (!string.IsNullOrEmpty(element.ImplementationAssembly))
            {
                builder.Append(", ");
                builder.Append(element.ImplementationAssembly);
            }

            string qualifiedTypename = builder.ToString();

            Type cacheType = Type.GetType(qualifiedTypename);

            if (cacheType == null)
            {
                this.logger.Warn("Cache type not valid. The cache type with qualifiedTypename '" + qualifiedTypename + "' is null.");
                throw new FailedToLoadLookupTypeException(qualifiedTypename);
            }

            // Add the cacheName to the cache, if the name does not already exist
            bool nameExist = false;
            int  index     = 0;

            while (nameExist == false && index < element.CacheConfigurationCollection.Count)
            {
                if (element.CacheConfigurationCollection[index].Key.Equals("CacheName", StringComparison.OrdinalIgnoreCase))
                {
                    // name exist
                    nameExist = true;
                }

                index++;
            }

            if (nameExist == false)
            {
                // the name configuration did not exist
                // add a name config element
                element.CacheConfigurationCollection.Add(new CacheConfiguration("CacheName", name));
            }

            Type[]          parameterArray  = new Type[] { typeof(IDictionary <string, string>) };
            object[]        objectArray     = new object[] { element.GetDictionary() };
            ConstructorInfo constructorInfo = cacheType.GetConstructor(parameterArray);

            if (constructorInfo == null)
            {
                throw new Exception("Cache implementation must contain a construtore, that takes a IDictionary<string,string> as parameter.");
            }

            cache = (T)constructorInfo.Invoke(objectArray);

            return(cache);
        }