Package com.avoka.fc.core.util
Class VelocityDataSourceResourceLoader
java.lang.Object
org.apache.velocity.runtime.resource.loader.ResourceLoader
com.avoka.fc.core.util.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.
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader
className, isCachingOn, log, modificationCheckInterval, rsvc
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
getLastModified
(org.apache.velocity.runtime.resource.Resource resource) Return the timestamp when the given resource was last modifiedgetResourceReader
(String path, String encoding) Get a resource reader.void
init
(org.apache.velocity.util.ExtProperties configuration) Initialize from the given configurationboolean
isSourceModified
(org.apache.velocity.runtime.resource.Resource resource) Determine whether there is a newer version of the resource availablevoid
setDataSource
(DataSource dataSource) Set the DataSource used by this resource loader.Methods inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader
buildReader, commonInit, getClassName, getModificationCheckInterval, isCachingOn, resourceExists, setCachingOn, setModificationCheckInterval
-
Field Details
-
dataSourceName
-
ctx
-
dataSource
-
-
Constructor Details
-
VelocityDataSourceResourceLoader
public VelocityDataSourceResourceLoader()
-
-
Method Details
-
init
public void init(org.apache.velocity.util.ExtProperties configuration) Initialize from the given configuration- Specified by:
init
in classorg.apache.velocity.runtime.resource.loader.ResourceLoader
- Parameters:
configuration
- the configuration- See Also:
-
setDataSource
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
-
getResourceReader
public Reader getResourceReader(String path, String encoding) throws org.apache.velocity.exception.ResourceNotFoundException Get a resource reader.- Specified by:
getResourceReader
in classorg.apache.velocity.runtime.resource.loader.ResourceLoader
- Parameters:
path
- name of resourcesencoding
- asked encoding- Returns:
- InputStream containing resource
- Throws:
org.apache.velocity.exception.ResourceNotFoundException
- Exception- Since:
- 21.11.0
-
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 classorg.apache.velocity.runtime.resource.loader.ResourceLoader
- Parameters:
resource
- the resource to check- Returns:
- true If a newer version is available. If
invalid reference
com.avoka.fc.core.entity.DeploymentProperty#PROPERTY_Portal_Cache_Enabled
-
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 classorg.apache.velocity.runtime.resource.loader.ResourceLoader
- Parameters:
resource
- the resource to check- Returns:
- the last modification timestamp
-