Package org.apache.jetspeed.cache

Examples of org.apache.jetspeed.cache.CacheElement


                                            PortletWindow portletWindow, int expiration,
                                            PortletDefinitionComposite portletDefinition)
        throws Exception
    {
        String cacheKey = portletContentCache.createCacheKey(requestContext.getUserPrincipal().getName(), fragment.getId());
        CacheElement cachedElement = portletContentCache.get(cacheKey);
        if (cachedElement != null)
        {
            PortletContent portletContent = (PortletContent)cachedElement.getContent();           
            fragment.setPortletContent(portletContent);
            ContentDispatcherCtrl dispatcher = new ContentDispatcherImpl(portletContent);
            HttpServletRequest servletRequest = requestContext.getRequestForWindow(portletWindow);
            HttpServletResponse servletResponse = dispatcher.getResponseForWindow(portletWindow, requestContext);
View Full Code Here


        return true;
    }
    protected void addToCache(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);       
    }   
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 new EhPortletContentCacheElementImpl(cachedElement);
    }

    public boolean remove(Object key)
    {
        CacheElement element = this.get(key);
        boolean removed = false;
        if (element == null)
            return false;
        removed = ehcache.remove(key);
        EhPortletContentCacheElementImpl impl = (EhPortletContentCacheElementImpl)element;
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

    }

    private IdentityToken createToken(String token)
    {
        IdentityToken identityToken = new IdentityTokenImpl(token);
        CacheElement element = cache.createElement(token, identityToken);       
        cache.put(element);
        return identityToken;       
    }
View Full Code Here

          flags[0] |= propIsTrueBit;
    }

    private String getCachedContent( String cacheKey )
    {
      CacheElement cachedElement = desktopContentCache.get(cacheKey);
        if (cachedElement != null)
         return (String)cachedElement.getContent()
        return null;
    }
View Full Code Here

         return (String)cachedElement.getContent()
        return null;
    }
    private void setCachedContent( String cacheKey, String content )
    {
      CacheElement cachedElement = desktopContentCache.createElement( cacheKey, content );
      cachedElement.setTimeToIdleSeconds(desktopContentCache.getTimeToIdleSeconds());
      cachedElement.setTimeToLiveSeconds(desktopContentCache.getTimeToLiveSeconds());
      desktopContentCache.put( cachedElement );
    }
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.