Class HibernateResourceLoader
- java.lang.Object
-
- org.apache.velocity.runtime.resource.loader.ResourceLoader
-
- 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.
-
-
Constructor Summary
Constructors Constructor Description HibernateResourceLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getLastModified(org.apache.velocity.runtime.resource.Resource resource)
PersistentDecoratorDao
getPersistentDecoratorDao()
InputStream
getResourceStream(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)
-
-
-
Method Detail
-
init
public void init(org.apache.commons.collections.ExtendedProperties configuration)
- Specified by:
init
in classorg.apache.velocity.runtime.resource.loader.ResourceLoader
-
getResourceStream
public InputStream getResourceStream(String source) throws org.apache.velocity.exception.ResourceNotFoundException
Retrieves a velocity template from Hibernate, using the given source URL.- Specified by:
getResourceStream
in classorg.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 classorg.apache.velocity.runtime.resource.loader.ResourceLoader
-
getLastModified
public long getLastModified(org.apache.velocity.runtime.resource.Resource resource)
- Specified by:
getLastModified
in classorg.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.
-
-