Class VelocityDataSourceResourceLoader


  • public class VelocityDataSourceResourceLoader
    extends org.apache.velocity.runtime.resource.loader.ResourceLoader
    Provides a specialized Velocity Resource loader which loads content from the portal_page and portal_resource tables.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected InitialContext ctx  
      protected DataSource dataSource  
      protected String dataSourceName  
      • Fields inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader

        className, isCachingOn, log, modificationCheckInterval, rsvc
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getLastModified​(org.apache.velocity.runtime.resource.Resource resource)
      Return the timestamp when the given resource was last modified
      InputStream getResourceStream​(String path)
      Return an input stream for the resource with the given name
      void init​(org.apache.commons.collections.ExtendedProperties configuration)
      Initialize from the given configuration
      boolean isSourceModified​(org.apache.velocity.runtime.resource.Resource resource)
      Determine whether there is a newer version of the resource available
      void setDataSource​(DataSource dataSource)
      Set the DataSource used by this resource loader.
      • Methods inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader

        commonInit, getClassName, getModificationCheckInterval, isCachingOn, resourceExists, setCachingOn, setModificationCheckInterval
    • Constructor Detail

      • VelocityDataSourceResourceLoader

        public VelocityDataSourceResourceLoader()
    • Method Detail

      • init

        public void init​(org.apache.commons.collections.ExtendedProperties configuration)
        Initialize from the given configuration
        Specified by:
        init in class org.apache.velocity.runtime.resource.loader.ResourceLoader
        Parameters:
        configuration - the configuration
        See Also:
        ResourceLoader.init(org.apache.commons.collections.ExtendedProperties)
      • setDataSource

        public void setDataSource​(DataSource dataSource)
        Set the DataSource used by this resource loader. Call this as an alternative to specifying the data source name via properties.
        Parameters:
        dataSource - the data source for this ResourceLoader
      • getResourceStream

        public InputStream getResourceStream​(String path)
                                      throws org.apache.velocity.exception.ResourceNotFoundException
        Return an input stream for the resource with the given name
        Specified by:
        getResourceStream in class org.apache.velocity.runtime.resource.loader.ResourceLoader
        Parameters:
        path - the name of the resource
        Returns:
        an input stream pointing to the resource data
        Throws:
        org.apache.velocity.exception.ResourceNotFoundException - if the resource could not be located
      • isSourceModified

        public boolean isSourceModified​(org.apache.velocity.runtime.resource.Resource resource)
        Determine whether there is a newer version of the resource available
        Specified by:
        isSourceModified in class org.apache.velocity.runtime.resource.loader.ResourceLoader
        Parameters:
        resource - the resource to check
        Returns:
        true If a newer version is available. If com.avoka.fc.core.entity.DeploymentProperty#PROPERTY_Portal_Cache_Enabled is set, always returns false.
      • getLastModified

        public long getLastModified​(org.apache.velocity.runtime.resource.Resource resource)
        Return the timestamp when the given resource was last modified
        Specified by:
        getLastModified in class org.apache.velocity.runtime.resource.loader.ResourceLoader
        Parameters:
        resource - the resource to check
        Returns:
        the last modification timestamp