Package org.apache.jetspeed.cache

Examples of org.apache.jetspeed.cache.CacheElement


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


            final String nodePath = node.getPath();

            // add node to caches; note that removes force notification
            // of update to distributed caches
            oidCache.remove(oid);
            final CacheElement element = oidCache.createElement(oid, node);
            oidCache.put(element);
            final boolean removed = pathCache.remove(nodePath);
            final CacheElement pathElement = pathCache.createElement(nodePath, new DatabasePageManagerCacheObject(oid, nodePath));
            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
View Full Code Here

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

                // remove notification to distributed peers was not
                // performed; this is problematic: put into path cache
                // and remove a second time to force
                if (!removed)
                {
                    final CacheElement pathElement = pathCache.createElement(nodePath, new DatabasePageManagerCacheObject(oid, nodePath));
                    pathCache.put(pathElement);
                    pathCache.remove(nodePath);
                }
            }
        }
View Full Code Here

    public synchronized static void cacheRemove(final String path)
    {
        // remove from cache by path
        if (path != null)
        {
            CacheElement pathElement = pathCache.get(path);
            if (pathElement != null)
            {
                final DatabasePageManagerCacheObject cacheObject = (DatabasePageManagerCacheObject)pathElement.getContent();
                // remove from caches; note that removes are
                // propagated to distributed caches
                oidCache.remove(cacheObject.getId());
                pathCache.remove(path);
            }
View Full Code Here

     * @return the entry
     */
    public FileCacheEntry get(String key)
    {
        FileCacheEntry entry = null;
        CacheElement element = this.cache.get(key);

        if (element != null)
        {
            entry = (FileCacheEntry) element.getContent();
        }

        return entry;
    }
View Full Code Here

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

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

        {
            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

        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.