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.
-
Field Summary
Fields inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader
className, isCachingOn, modificationCheckInterval, rsvc
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
getLastModified
(org.apache.velocity.runtime.resource.Resource resource) getResourceStream
(String source) Retrieves a velocity template from Hibernate, using the given source URL.void
init
(org.apache.commons.collections.ExtendedProperties configuration) protected boolean
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
-
Constructor Details
-
HibernateResourceLoader
public HibernateResourceLoader()
-
-
Method Details
-
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
-
setSpaceManager
-
setPersistentDecoratorDao
-
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
- Returns:
- the upgrade manager configured for the application; null if there is none.
-