public CacheSubmitter(IRedirectFolderRetriever redirectFolderRetriever, IItemToRedirectItemMapper itemToRedirectItemMapper, IConfigurationSettings configurationSettings, ICacheRetriever cacheRetriever)
 {
     _redirectFolderRetriever  = redirectFolderRetriever;
     _itemToRedirectItemMapper = itemToRedirectItemMapper;
     _configurationSettings    = configurationSettings;
     _cacheRetriever           = cacheRetriever;
 }
 public CacheSubmitter(IRedirectFolderRetriever redirectFolderRetriever, IItemToRedirectItemMapper itemToRedirectItemMapper, IConfigurationSettings configurationSettings, ICacheRetriever cacheRetriever)
 {
     _redirectFolderRetriever = redirectFolderRetriever;
     _itemToRedirectItemMapper = itemToRedirectItemMapper;
     _configurationSettings = configurationSettings;
     _cacheRetriever = cacheRetriever;
 }
示例#3
0
        public void RegisterCacheRetriever(ICacheRetriever cacheRetriever, Type handledType)
        {
            ParamChecker.AssertParamNotNull(cacheRetriever, "CacheRetriever");
            ParamChecker.AssertParamNotNull(handledType, "handledType");

            writeLock.Lock();
            try
            {
                ICacheRetriever registered = typeToCacheRetrieverMap.GetExtension(handledType);
                if (registered == null)
                {
                    this.typeToCacheRetrieverMap.Register(cacheRetriever, handledType);
                }
                else if (registered.Equals(cacheRetriever))
                {
                    if (Log.InfoEnabled)
                    {
                        Log.Info("Duplicat registration of same service object for " + handledType);
                    }
                }
                else
                {
                    if (Log.InfoEnabled)
                    {
                        Log.Info("There is already a CacheService mapped to " + handledType);
                    }
                }
            }
            finally
            {
                writeLock.Unlock();
            }
        }
示例#4
0
        public void UnregisterCacheRetriever(ICacheRetriever cacheRetriever, Type handledType)
        {
            ParamChecker.AssertParamNotNull(cacheRetriever, "CacheRetriever");
            ParamChecker.AssertParamNotNull(handledType, "handledType");

            writeLock.Lock();
            try
            {
                this.typeToCacheRetrieverMap.Unregister(cacheRetriever, handledType);
            }
            finally
            {
                writeLock.Unlock();
            }
        }
示例#5
0
        protected IDictionary <ICacheRetriever, IList <IObjRelation> > AssignObjRelsToCacheRetriever(IDictionary <Type, IList <IObjRelation> > sortedIObjRefs)
        {
            IDictionary <ICacheRetriever, IList <IObjRelation> > serviceToAssignedObjRefsDict = new IdentityDictionary <ICacheRetriever, IList <IObjRelation> >();

            DictionaryExtension.Loop(sortedIObjRefs, delegate(Type type, IList <IObjRelation> objRefs)
            {
                ICacheRetriever cacheRetriever       = GetRetrieverForType(type);
                IList <IObjRelation> assignedObjRefs = DictionaryExtension.ValueOrDefault(serviceToAssignedObjRefsDict, cacheRetriever);
                if (assignedObjRefs == null)
                {
                    assignedObjRefs = new List <IObjRelation>();
                    serviceToAssignedObjRefsDict.Add(cacheRetriever, assignedObjRefs);
                }
                foreach (IObjRelation objRef in objRefs)
                {
                    assignedObjRefs.Add(objRef);
                }
            });
            return(serviceToAssignedObjRefsDict);
        }
示例#6
0
        protected ICacheRetriever GetRetrieverForType(Type type)
        {
            if (type == null)
            {
                return(null);
            }
            ICacheRetriever cacheRetriever = typeToCacheRetrieverMap.GetExtension(type);

            if (cacheRetriever == null)
            {
                if (DefaultCacheRetriever != null && DefaultCacheRetriever != this)
                {
                    cacheRetriever = DefaultCacheRetriever;
                }
                else
                {
                    throw new Exception("No cache retriever found to handle entity type '" + type.FullName + "'");
                }
            }

            return(cacheRetriever);
        }
        protected IRootCache AcquireRootCache(bool privileged, ThreadLocal <RootCache> currentRootCacheTL, ICacheRetriever cacheRetriever, Lock readLock, Lock writeLock)
        {
            IBeanRuntime <RootCache> rootCacheBR = ServiceContext.RegisterBean <RootCache>()        //
                                                   .PropertyValue("CacheRetriever", cacheRetriever) //
                                                   .PropertyValue("BoundThread", Thread.CurrentThread);

            if (readLock != null)
            {
                rootCacheBR.PropertyValue("ReadLock", readLock);
            }
            if (writeLock != null)
            {
                rootCacheBR.PropertyValue("WriteLock", writeLock);
            }
            RootCache rootCache = PostProcessRootCacheConfiguration(rootCacheBR).PropertyValue("Privileged", privileged).Finish();

            if (OfflineListenerExtendable != null)
            {
                OfflineListenerExtendable.AddOfflineListener(rootCache);
            }
            currentRootCacheTL.Value = rootCache;
            return(rootCache);
        }
 public RedirectRetreiver(IAbsolutePathFromUrl absolutePathFromUrl, ICacheRetriever cacheRetriever)
 {
     _absolutePathFromUrl = absolutePathFromUrl;
     _cacheRetriever = cacheRetriever;
 }
示例#9
0
 public RedirectRetreiver(IAbsolutePathFromUrl absolutePathFromUrl, ICacheRetriever cacheRetriever)
 {
     _absolutePathFromUrl = absolutePathFromUrl;
     _cacheRetriever      = cacheRetriever;
 }