com.atlassian.confluence.setup.velocity
Class HibernateResourceLoader

java.lang.Object
  extended by org.apache.velocity.runtime.resource.loader.ResourceLoader
      extended by com.atlassian.confluence.setup.velocity.HibernateResourceLoader

public class HibernateResourceLoader
extends org.apache.velocity.runtime.resource.loader.ResourceLoader

Load resources via Hibernate.

For CONF-9959 this loader has been changed so that if the UpgradeManager does not indicate that the install is upgraded then it will return null for all resources requested (instead of going to Hibernate/the DB). This copes with the situation where an upgrade has not been successful and therefore the database does not contain the tables this loader would expect.


Field Summary
 
Fields inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader
className, isCachingOn, modificationCheckInterval, rsvc
 
Constructor Summary
HibernateResourceLoader()
           
 
Method Summary
 long getLastModified(org.apache.velocity.runtime.resource.Resource resource)
           
 PersistentDecoratorDao getPersistentDecoratorDao()
           
 java.io.InputStream getResourceStream(java.lang.String source)
          Retrieves a velocity template from Hibernate, using the given source URL.
 UpgradeManager getUpgradeManager()
           
 void init(org.apache.commons.collections.ExtendedProperties configuration)
           
protected  boolean isSetupComplete()
          Checks whether the Confluence setup was completed.
 boolean isSourceModified(org.apache.velocity.runtime.resource.Resource resource)
           
 void setPersistentDecoratorDao(PersistentDecoratorDao persistentDecoratorDao)
           
 void setSpaceManager(SpaceManager spaceManager)
           
 
Methods inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader
commonInit, getClassName, getModificationCheckInterval, isCachingOn, resourceExists, setCachingOn, setModificationCheckInterval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateResourceLoader

public HibernateResourceLoader()
Method Detail

init

public void init(org.apache.commons.collections.ExtendedProperties configuration)
Specified by:
init in class org.apache.velocity.runtime.resource.loader.ResourceLoader

getResourceStream

public java.io.InputStream getResourceStream(java.lang.String source)
                                      throws org.apache.velocity.exception.ResourceNotFoundException
Retrieves a velocity template from Hibernate, using the given source URL.

Specified by:
getResourceStream in class org.apache.velocity.runtime.resource.loader.ResourceLoader
Parameters:
source - a URL in the form [spacekey]/[template-path], optionally with a leading slash. For global templates, the spacekey is omitted.
Returns:
an InputStream for the contents of the template, or null if the template cannot be found.
Throws:
org.apache.velocity.exception.ResourceNotFoundException - if there is an error while trying to retrieve the template.

isSourceModified

public boolean isSourceModified(org.apache.velocity.runtime.resource.Resource resource)
Specified by:
isSourceModified in class org.apache.velocity.runtime.resource.loader.ResourceLoader

getLastModified

public long getLastModified(org.apache.velocity.runtime.resource.Resource resource)
Specified by:
getLastModified in class org.apache.velocity.runtime.resource.loader.ResourceLoader

getPersistentDecoratorDao

public PersistentDecoratorDao getPersistentDecoratorDao()

setSpaceManager

public void setSpaceManager(SpaceManager spaceManager)

setPersistentDecoratorDao

public void setPersistentDecoratorDao(PersistentDecoratorDao persistentDecoratorDao)

isSetupComplete

protected boolean isSetupComplete()
Checks whether the Confluence setup was completed. Method acts as a convenience method for easier testing of the HibernateResourceLoader.

Returns:
true if setup was completed

getUpgradeManager

public UpgradeManager getUpgradeManager()
Returns:
the upgrade manager configured for the application; null if there is none.


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