com.atlassian.confluence.util.velocity
Class ConfluenceVelocityResourceManager

java.lang.Object
  extended by org.apache.velocity.runtime.resource.ResourceManagerImpl
      extended by com.atlassian.confluence.util.velocity.ConfluenceVelocityResourceManager
All Implemented Interfaces:
org.apache.velocity.runtime.resource.ResourceManager
Direct Known Subclasses:
CompatibleVelocityResourceManager

public class ConfluenceVelocityResourceManager
extends org.apache.velocity.runtime.resource.ResourceManagerImpl

Specialisation that allows for a hot swappable ResourceCache


Field Summary
protected static org.apache.log4j.Category log
           
 
Fields inherited from class org.apache.velocity.runtime.resource.ResourceManagerImpl
globalCache, RESOURCE_CONTENT, RESOURCE_TEMPLATE, resourceLoaders, rsvc
 
Constructor Summary
ConfluenceVelocityResourceManager()
          Everytime this is called, the resource manager singleton is replaced with the newly provided instance.
 
Method Summary
 org.apache.velocity.runtime.resource.Resource getResource(java.lang.String resourceName, int resourceType, java.lang.String encoding)
          This has been copied for the base class and modified to NOT be synchronized.
 void initialize(org.apache.velocity.runtime.RuntimeServices runtimeServices)
           
static void setCacheFactory(com.atlassian.cache.CacheFactory cacheFactory)
           
 
Methods inherited from class org.apache.velocity.runtime.resource.ResourceManagerImpl
getLoaderNameForResource, getResource, loadResource, refreshResource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Category log
Constructor Detail

ConfluenceVelocityResourceManager

public ConfluenceVelocityResourceManager()
Everytime this is called, the resource manager 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 velocity manager), we can't enforce singleton use via a factory method.

Method Detail

setCacheFactory

public static void setCacheFactory(com.atlassian.cache.CacheFactory cacheFactory)

initialize

public void initialize(org.apache.velocity.runtime.RuntimeServices runtimeServices)
                throws java.lang.Exception
Specified by:
initialize in interface org.apache.velocity.runtime.resource.ResourceManager
Overrides:
initialize in class org.apache.velocity.runtime.resource.ResourceManagerImpl
Throws:
java.lang.Exception

getResource

public org.apache.velocity.runtime.resource.Resource getResource(java.lang.String resourceName,
                                                                 int resourceType,
                                                                 java.lang.String encoding)
                                                          throws org.apache.velocity.exception.ResourceNotFoundException,
                                                                 org.apache.velocity.exception.ParseErrorException,
                                                                 java.lang.Exception
This has been copied for the base class and modified to NOT be synchronized. The only reason I could imagine for this method being declared thread safe is to protect the global cache from concurrent access. As our global cache should be threadsafe anyway (I think), this is not needed.

Specified by:
getResource in interface org.apache.velocity.runtime.resource.ResourceManager
Overrides:
getResource in class org.apache.velocity.runtime.resource.ResourceManagerImpl
Throws:
org.apache.velocity.exception.ResourceNotFoundException
org.apache.velocity.exception.ParseErrorException
java.lang.Exception


Copyright © 2003-2008 Atlassian Pty Ltd. All Rights Reserved.