Package org.apache.jetspeed.cache

Examples of org.apache.jetspeed.cache.CacheElement


        {
            throw new FileNotFoundException("File to cache: "+file.getAbsolutePath()+" does not exist.");
        }

        FileCacheEntry entry = new FileCacheEntryImpl(file, document);
        CacheElement element = this.cache.createElement(key, entry);
        this.cache.put(element);
    }
View Full Code Here


                {
                    try
                    {
                        for (Object key : getKeys())
                        {
                            CacheElement element = cache.get(key);
                           
                            if (element != null)
                            {
                                FileCacheEntry entry = (FileCacheEntry) element.getContent();
                                File file = entry.getFile();
                                Date modified = new Date(file.lastModified());
                               
                                if (modified.after(entry.getLastModified()))
                                {
                                    FileCacheEntry updatedEntry = new FileCacheEntryImpl(file, entry.getDocument());
                                    CacheElement updatedElement = cache.createElement(key, updatedEntry);
                                    cache.put(updatedElement);
                                   
                                    if (log.isDebugEnabled())
                                    {
                                        log.debug("page file has been updated: " + key);
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

        {
            JetspeedPreferencesMap entityMap = null;
            String appName = pd.getApplication().getName();
            String portletName = pd.getPortletName();
            String entityCacheKey = this.getEntityPreferenceKey(appName, portletName, entityId);
            CacheElement cachedEntity = preferenceCache.get(entityCacheKey);       
            if (cachedEntity != null)
            {
                entityMap = (JetspeedPreferencesMap)cachedEntity.getContent();
            }           
            else
            {
                entityMap = (JetspeedPreferencesMap)retrieveEntityPreferences(window);               
            }
View Full Code Here

        String appName = window.getPortletDefinition().getApplication().getName();
        String portletName = window.getPortletDefinition().getPortletName();
        String entityId = window.getPortletEntityId();       
        String cacheKey = getUserPreferenceKey(appName, portletName, entityId, userName);
        // first search in cache       
        CacheElement cachedElement = preferenceCache.get(cacheKey);       
        if (cachedElement != null)
        {
            JetspeedPreferencesMap map = (JetspeedPreferencesMap)cachedElement.getContent();
            return map;
        }           
        // not found in cache, lookup in database
        JetspeedPreferencesMap map = new JetspeedPreferencesMap();
        Criteria c = new Criteria();
View Full Code Here

        getPersistenceBrokerTemplate().store(dbPref);

        JetspeedPreferenceImpl cached = new JetspeedPreferenceImpl(preferenceName, dbPref.getValues());
        cached.setReadOnly(dbPref.isReadOnly());
        String defaultsCacheKey = getPorletPreferenceKey(appName, portletName);
        CacheElement cacheElement = preferenceCache.get(defaultsCacheKey);
        JetspeedPreferencesMap map = (cacheElement != null ? (JetspeedPreferencesMap) cacheElement.getContent() : new JetspeedPreferencesMap());
        map.put(preferenceName, cached);
        preferenceCache.put(preferenceCache.createElement(defaultsCacheKey, map));
    }
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

        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

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.