Class 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 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 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 class org.apache.velocity.runtime.resource.loader.ResourceLoader
        source - a URL in the form [spacekey]/[template-path], optionally with a leading slash. For global templates, the spacekey is omitted.
        an InputStream for the contents of the template, or null if the template cannot be found.
        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
      • 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.
        true if setup was completed
      • getUpgradeManager

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