Package org.apache.jetspeed.cache

Examples of org.apache.jetspeed.cache.CacheElement


            List principalKeys = principalPropertiesCache.getKeys();
            Iterator principalKeysIter = principalKeys.iterator();
            while (principalKeysIter.hasNext())
            {
                String principalKey = (String)principalKeysIter.next();
                CacheElement propertiesElement = principalPropertiesCache.get(principalKey);
                if (propertiesElement != null)
                {
                    // scan cached principal fragment property list
                    DatabasePageManagerCachedFragmentPropertyList cachedPrincipalFragmentPropertyList = (DatabasePageManagerCachedFragmentPropertyList)propertiesElement.getContent();
                    Iterator fragmentPropertyIter = cachedPrincipalFragmentPropertyList.iterator();
                    while (fragmentPropertyIter.hasNext())
                    {
                        FragmentPropertyImpl fragmentProperty = (FragmentPropertyImpl)fragmentPropertyIter.next();
                        if (((BaseFragmentElementImpl)fragmentProperty.getFragment()).getIdentity() == fragmentId)
View Full Code Here


    public synchronized static NodeImpl cacheLookup(String path)
    {
        if (path != null)
        {
            // return valid object cached by path and oid
            CacheElement pathElement = pathCache.get(path);
            if (pathElement != null)
            {
                DatabasePageManagerCacheObject cacheObject = (DatabasePageManagerCacheObject)pathElement.getContent();
                return (NodeImpl)cacheLookup(cacheObject.getId());
            }
        }
        return null;
    }
View Full Code Here

            // add node to caches; note that removes force notification
            // of update to distributed caches
            oidCache.remove(oid);
            boolean removed = pathCache.remove(path);
            CacheElement pathElement = pathCache.createElement(path, new DatabasePageManagerCacheObject(oid, path));
            pathCache.put(pathElement);
            // if a remove was not successful from the path cache, update
            // notification to distributed peers was not performed;
            // for updates of objects evicted from the cache or newly
            // created ones, this is problematic: remove and put into
            // path cache a second time to force
            if (!removed && updatePathsList.contains(path))
            {
                pathCache.remove(path);
                pathCache.put(pathElement);
            }
            // add node to local oid cache by key after removes from
            // distributed path cache since those removes will remove
            // from local oid cache in notifications, (despite the
            // 'local' listener registration)
            CacheElement element = oidCache.createElement(oid, node);
            oidCache.put(element);
        }
    }
View Full Code Here

                                            PortletDefinition portletDefinition)
        throws Exception
    {
        ContentFragment fragment = portletWindow.getFragment();
        ContentCacheKey cacheKey = portletContentCache.createCacheKey(requestContext, fragment.getId());       
        CacheElement cachedElement = portletContentCache.get(cacheKey);
       
        if (cachedElement != null)
        {
            PortletContent portletContent = (PortletContent) cachedElement.getContent();
           
            PortletMode portletMode = portletContent.getPortletMode();
            WindowState windowState = portletContent.getWindowState();
           
            if (portletWindow.getPortletMode().equals(portletMode) && portletWindow.getWindowState().equals(windowState))
View Full Code Here

        return true;
    }
    protected void addToCache(RequestContext context, PortletContent content)
    {
        CacheElement cachedElement = portletContentCache.createElement(content.getCacheKey(), content);
        if (content.getExpiration() == -1)
        {
            cachedElement.setTimeToIdleSeconds(portletContentCache.getTimeToIdleSeconds());
            cachedElement.setTimeToLiveSeconds(portletContentCache.getTimeToLiveSeconds());
        }
        else
        {      
            cachedElement.setTimeToIdleSeconds(content.getExpiration());
            cachedElement.setTimeToLiveSeconds(content.getExpiration());
        }
        portletContentCache.put(cachedElement);
        context.getPortalURL().getNavigationalState().registerPortletContentCachedForPublicRenderParameters(context, content);
    }   
View Full Code Here

                    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.getRootFragment(),
                                                    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.getRootFragment();
            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

   
    public PortletApplication getPortletApplication(String name, boolean fromCache)
    {
        if (fromCache)
        {
            CacheElement cacheElement = applicationNameCache.get(name);
            if (cacheElement != null)
            {
                cacheElement = applicationOidCache.get(((RegistryCacheObjectWrapper)cacheElement.getContent()).getId());
                if (cacheElement != null)
                {
                    return (PortletApplication)cacheElement.getContent();
                }
            }
        }
        Criteria c = new Criteria();
        c.addEqualTo("name", name);
View Full Code Here

    public PortletDefinition getPortletDefinitionByUniqueName( String name, boolean fromCache )
    {
        if (fromCache)
        {
            CacheElement cacheElement = portletNameCache.get(name);
            if (cacheElement != null)
            {
                cacheElement = portletOidCache.get(((RegistryCacheObjectWrapper)cacheElement.getContent()).getId());
                if (cacheElement != null)
                {
                    return (PortletDefinition)cacheElement.getContent();
                }
            }
        }
        String appName = PortletRegistryHelper.parseAppName(name);
        String portletName = PortletRegistryHelper.parsePortletName(name);
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.