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.ResourceLoaderProvides a specialized Velocity Resource loader which loads content from the portal_page and portal_resource tables.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVelocityDataSourceResourceLoader.ExceptionUtils
-
Field Summary
Fields Modifier and Type Field Description protected InitialContextctxprotected DataSourcedataSourceprotected StringdataSourceName
-
Constructor Summary
Constructors Constructor Description VelocityDataSourceResourceLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetLastModified(org.apache.velocity.runtime.resource.Resource resource)Return the timestamp when the given resource was last modifiedReadergetResourceReader(String path, String encoding)Get a resource reader.voidinit(org.apache.velocity.util.ExtProperties configuration)Initialize from the given configurationbooleanisSourceModified(org.apache.velocity.runtime.resource.Resource resource)Determine whether there is a newer version of the resource availablevoidsetDataSource(DataSource dataSource)Set the DataSource used by this resource loader.
-
-
-
Field Detail
-
dataSourceName
protected String dataSourceName
-
ctx
protected InitialContext ctx
-
dataSource
protected DataSource dataSource
-
-
Method Detail
-
init
public void init(org.apache.velocity.util.ExtProperties configuration)
Initialize from the given configuration- Specified by:
initin classorg.apache.velocity.runtime.resource.loader.ResourceLoader- Parameters:
configuration- the configuration- See Also:
ResourceLoader.init(org.apache.velocity.util.ExtProperties)
-
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
-
getResourceReader
public Reader getResourceReader(String path, String encoding) throws org.apache.velocity.exception.ResourceNotFoundException
Get a resource reader.- Specified by:
getResourceReaderin 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:
isSourceModifiedin classorg.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_Enabledis 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:
getLastModifiedin classorg.apache.velocity.runtime.resource.loader.ResourceLoader- Parameters:
resource- the resource to check- Returns:
- the last modification timestamp
-
-