com.atlassian.velocity
Class PluginAwareResourceManager

java.lang.Object
  extended by org.apache.velocity.runtime.resource.ResourceManagerImpl
      extended by com.atlassian.velocity.PluginAwareResourceManager
All Implemented Interfaces:
org.apache.velocity.runtime.resource.ResourceManager

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

Listens for Plugin Uninstall and Upgraded events, and clears the velocity resource cache accordingly.

The resource cache contains the velocity templates that have already been rendered by the VelocityEngine.


Field Summary
 
Fields inherited from class org.apache.velocity.runtime.resource.ResourceManagerImpl
globalCache, RESOURCE_CONTENT, RESOURCE_TEMPLATE, rsvc
 
Constructor Summary
PluginAwareResourceManager()
           
 
Method Summary
 void clearCacheOnUninstall(com.atlassian.plugin.event.events.PluginUninstalledEvent event)
          Clears the velocity resource cache when a PluginUninstalledEvent is fired.
 void clearCacheOnUpgrade(com.atlassian.plugin.event.events.PluginUpgradedEvent event)
          Clears the velocity resource cache when a PluginUpgradedEvent is fired.
 void initialize(org.apache.velocity.runtime.RuntimeServices rs)
          Registers this class with the EventPublisher, and delegates to the super class initialize method.
 
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
 

Constructor Detail

PluginAwareResourceManager

public PluginAwareResourceManager()
Method Detail

initialize

public void initialize(org.apache.velocity.runtime.RuntimeServices rs)
                throws Exception
Registers this class with the EventPublisher, and delegates to the super class initialize method.

Specified by:
initialize in interface org.apache.velocity.runtime.resource.ResourceManager
Overrides:
initialize in class org.apache.velocity.runtime.resource.ResourceManagerImpl
Parameters:
rs - RuntimeServices instance
Throws:
Exception

clearCacheOnUninstall

@EventListener
public void clearCacheOnUninstall(com.atlassian.plugin.event.events.PluginUninstalledEvent event)
Clears the velocity resource cache when a PluginUninstalledEvent is fired.

Parameters:
event - PluginUninstalledEvent

clearCacheOnUpgrade

@EventListener
public void clearCacheOnUpgrade(com.atlassian.plugin.event.events.PluginUpgradedEvent event)
Clears the velocity resource cache when a PluginUpgradedEvent is fired.

Parameters:
event - PluginUpgradedEvent


Copyright © 2002-2012 Atlassian. All Rights Reserved.