Package org.apache.jetspeed.cache

Examples of org.apache.jetspeed.cache.CacheElement


                    theme = (Theme) requestContext.getSessionAttribute(themeCacheKey);
                }
                else
                {
                    themeContentCacheKey = cache.createCacheKey(requestContext, page.getId());
                    CacheElement themeCacheElem = cache.get(themeContentCacheKey);
                   
                    if (themeCacheElem != null)
                    {
                        theme = (Theme) themeCacheElem.getContent();
                    }
                }
            }
        }

        if (theme != null)
        {
            theme.init(page, decorationFactory, requestContext);
            requestContext.setAttribute(PortalReservedParameters.PAGE_THEME_ATTRIBUTE, theme);
            boolean solo = isSoloMode(requestContext);           
            SessionPathResolverCache sessionPathResolver = new SessionPathResolverCache( requestContext.getRequest().getSession() );
            initDepthFragmentDecorations(requestContext, theme, page.getRootContentFragment(),
                                                    pageActionAccess, isAjaxRequest,
                                                    ((DecorationFactoryImpl) decorationFactory).getResourceValidator(),
                                                    sessionPathResolver, (theme.isInvalidated() && !solo));
           
            if (theme.isInvalidated() && !solo)
            {
                if (this.useSessionForThemeCaching)
                {
                    requestContext.setSessionAttribute(themeCacheKey, theme);
                }
                else
                {                   
                    CacheElement themeCacheElem = cache.createElement(themeContentCacheKey, theme);
                    cache.put(themeCacheElem);
                }
                theme.setInvalidated(false);                           
            }                       
            return;
        }
        theme = decorationFactory.getTheme(page, requestContext);       
        requestContext.setAttribute(PortalReservedParameters.PAGE_THEME_ATTRIBUTE, theme);
        if ( fragments == null || fragments.size() == 0 )
        {
            ContentFragment rootFragment = page.getRootContentFragment();
            initDepthFragments(requestContext, theme, rootFragment, pageActionAccess, isAjaxRequest, fragments);
        }
        else
        {
            Iterator fragmentsIter = fragments.iterator();
            while ( fragmentsIter.hasNext() )
            {
                ContentFragment fragment = (ContentFragment)fragmentsIter.next();
                initFragment(requestContext, theme, fragment, pageActionAccess, isAjaxRequest);
            }
        }
       
        if (useCache() && !isSoloMode(requestContext))
        {
            if (themeContentCacheKey == null && themeCacheKey == null)
            {
                if (this.useSessionForThemeCaching)
                {
                    themeCacheKey = cache.createSessionKey(requestContext);                   
                    requestContext.getRequest().getSession().removeAttribute(themeCacheKey);
                }
                else
                {
                    themeContentCacheKey = cache.createCacheKey(requestContext, page.getId());
                    cache.remove(themeContentCacheKey);
                }               
            }
            else
            {
                if (this.useSessionForThemeCaching)
                {
                    themeContentCacheKey = cache.createCacheKey(requestContext, page.getId());
                    requestContext.setSessionAttribute(themeCacheKey, theme);
                }
                else
                {
                    CacheElement themeCacheElem = cache.createElement(themeContentCacheKey, theme);
                    cache.put(themeCacheElem);
                }
            }
        }               
    }
View Full Code Here


        else
        {
          return (Properties)this.layoutDecoratorProperties.get( name );
        }
      }
      CacheElement cachedElement = decorationConfigurationCache.get( getCachedConfigurationKey( type, name ) );
        if (cachedElement != null)
          return (Properties)cachedElement.getContent()
        return null;
    }
View Full Code Here

          this.layoutDecoratorProperties.put( name, props );
        }
      }
      else
      {
        CacheElement cachedElement = decorationConfigurationCache.createElement( getCachedConfigurationKey( type, name ), props );
        cachedElement.setTimeToIdleSeconds(decorationConfigurationCache.getTimeToIdleSeconds());
        cachedElement.setTimeToLiveSeconds(decorationConfigurationCache.getTimeToLiveSeconds());
        decorationConfigurationCache.put( cachedElement );
      }
    }
View Full Code Here

    {
        return cacheLookup(oid);
    }   
    public synchronized static Object cacheLookup(Identity oid)
    {
        CacheElement element = oidCache.get(oid);
        if (element != null)
        {
            return element.getContent();
        }
        return null;
    }   
View Full Code Here

        cacheAdd(oid, obj);
    }
    public synchronized static void cacheAdd(Identity oid, Object obj)
    {       
        oidCache.remove(oid);
        CacheElement entry = new EhCacheElementImpl(oid, obj);
        oidCache.put(entry);
       
        MutablePortletApplication pa = (MutablePortletApplication)obj;
        DistributedCacheObject wrapper = new RegistryCacheObjectWrapper(oid, pa.getName());
        nameCache.remove(pa.getName());
        CacheElement nameEntry = nameCache.createElement(pa.getName(), wrapper);
        nameCache.put(nameEntry);
              
        if (listeners != null)
        {       
            for (int ix=0; ix < listeners.size(); ix++)
View Full Code Here

    {
        return cacheLookup(oid);
    }   
    public synchronized static Object cacheLookup(Identity oid)
    {
        CacheElement element = oidCache.get(oid);
        if (element != null)
        {
            return element.getContent();
        }
        return null;
    }       
View Full Code Here

        cacheAdd(oid, obj);
    }
    public synchronized static void cacheAdd(Identity oid, Object obj)
    {
        oidCache.remove(oid);
        CacheElement entry = new EhCacheElementImpl(oid, obj);
        oidCache.put(entry);
       
        PortletDefinitionComposite pd = (PortletDefinitionComposite)obj;
        DistributedCacheObject wrapper = new RegistryCacheObjectWrapper(oid, pd.getUniqueName());
        nameCache.remove(pd.getUniqueName());
        CacheElement nameEntry = nameCache.createElement(pd.getUniqueName(), wrapper);
        nameCache.put(nameEntry);
              
        if (listeners != null)
        {       
            for (int ix=0; ix < listeners.size(); ix++)
View Full Code Here

        this.preloadEntities = preloadEntities;
    }
   
    protected void addToCache(NodeCache content)
    {
        CacheElement cachedElement = preferenceCache.createElement(content.getCacheKey(), content);
        cachedElement.setTimeToIdleSeconds(preferenceCache.getTimeToIdleSeconds());
        cachedElement.setTimeToLiveSeconds(preferenceCache.getTimeToLiveSeconds());
        preferenceCache.put(cachedElement);       
    }   
View Full Code Here

        preferenceCache.put(cachedElement);       
    }   
 
    private NodeCache getNode(String cacheKey)
    {
      CacheElement cachedElement = preferenceCache.get(cacheKey);
        if (cachedElement != null)
         return (NodeCache)cachedElement.getContent()
        return null;
    }
View Full Code Here

        return new EhPortletContentCacheElementImpl(cachedElement, cckey);
    }

    public boolean remove(Object key)
    {
        CacheElement element = this.get(key);
        boolean removed = false;
        if (element == null)
            return false;
       
        ContentCacheElement ccElement = (ContentCacheElement)element;
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.cache.CacheElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.