com.atlassian.confluence.util.velocity
Class ConfluenceVelocityResourceCache

java.lang.Object
  extended by com.atlassian.confluence.util.velocity.ConfluenceVelocityResourceCache
All Implemented Interfaces:
org.apache.velocity.runtime.resource.ResourceCache
Direct Known Subclasses:
ConfluenceVelocityResourceCache

public class ConfluenceVelocityResourceCache
extends Object
implements org.apache.velocity.runtime.resource.ResourceCache

Clearable velocity cache.

We configure velocity to use this cache, then we can get at the static methods to globally remove things from the cache if we need to. This is necessary for the dynamic decorator stuff.


Field Summary
static org.apache.log4j.Logger log
          Deprecated. 
 
Constructor Summary
ConfluenceVelocityResourceCache(com.atlassian.cache.CacheFactory cacheFactory)
          Create a resource cache using the provided cache manager.
 
Method Summary
 void clear()
           
static void clearAllCaches()
          Deprecated. since 2.9 Use getInstance().clear()
 Iterator enumerateKeys()
           
 org.apache.velocity.runtime.resource.Resource get(Object key)
           
static ConfluenceVelocityResourceCache getInstance()
          Get the Confluence resource cache singleton.
 void initialize(org.apache.velocity.runtime.RuntimeServices runtimeServices)
           
 org.apache.velocity.runtime.resource.Resource put(Object key, org.apache.velocity.runtime.resource.Resource resource)
           
 org.apache.velocity.runtime.resource.Resource remove(Object key)
           
static void removeFromCaches(Object key)
          Remove a particular object from the cache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

@Deprecated
public static final org.apache.log4j.Logger log
Deprecated. 
Constructor Detail

ConfluenceVelocityResourceCache

public ConfluenceVelocityResourceCache(com.atlassian.cache.CacheFactory cacheFactory)
Create a resource cache using the provided cache manager. Everytime this is called, the resource cache singleton is replaced with the newly provided instance. There should only ever be one of these created but as we don't have control over the creating code (WebWork velcoity manager), we can't enforce singleton use via a factory method.

Method Detail

getInstance

public static ConfluenceVelocityResourceCache getInstance()
Get the Confluence resource cache singleton.

Returns:
Resource cache singleton, may be null if Confluence caching has not been initialised.

clearAllCaches

public static void clearAllCaches()
Deprecated. since 2.9 Use getInstance().clear()

Clear the contents of all caches that have been created so far


removeFromCaches

public static void removeFromCaches(Object key)
Remove a particular object from the cache

Parameters:
key - the cache-key to remove. Any cached object with a key that has this key as a substring will be removed, for safety's sake.

initialize

public void initialize(org.apache.velocity.runtime.RuntimeServices runtimeServices)
Specified by:
initialize in interface org.apache.velocity.runtime.resource.ResourceCache

get

public org.apache.velocity.runtime.resource.Resource get(Object key)
Specified by:
get in interface org.apache.velocity.runtime.resource.ResourceCache

put

public org.apache.velocity.runtime.resource.Resource put(Object key,
                                                         org.apache.velocity.runtime.resource.Resource resource)
Specified by:
put in interface org.apache.velocity.runtime.resource.ResourceCache

remove

public org.apache.velocity.runtime.resource.Resource remove(Object key)
Specified by:
remove in interface org.apache.velocity.runtime.resource.ResourceCache

enumerateKeys

public Iterator enumerateKeys()
Specified by:
enumerateKeys in interface org.apache.velocity.runtime.resource.ResourceCache

clear

public void clear()


Copyright © 2003-2011 Atlassian. All Rights Reserved.