public class VelocityRendering extends Object implements Renderer.BytesOut
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_VELOCITY_ROOT_PATH
The default place we look for Velocity files
|
static String |
VELOCITY_FILE_RESOURCE_LOADER_PATH
Velocity property for configuring loader path
|
static String |
VELOCITY_PATH_CONFIG_PARAM
The configuration parameter which sets an alternative location for Velocity templates etc
|
static String |
VELOCITY_PATH_ENV_VAR
Name of environment var to check for a velocity root directory
|
static String |
VELOCITY_PROPERTIES_FILE
Name of the properties file
|
Constructor and Description |
---|
VelocityRendering(Bindings b,
APIResultSet rs,
VelocityRenderer vr)
Construct a Velocity rendering closure
|
Modifier and Type | Method and Description |
---|---|
protected void |
addBindingsToContext(org.apache.velocity.VelocityContext vc,
Bindings binds)
Add the Elda bindings as context variables
|
protected void |
addContextSelfReference(org.apache.velocity.VelocityContext vc)
Add the Velocity Contex itself, as a debugging aide
|
protected void |
addEventHandlers(org.apache.velocity.VelocityContext vc)
Attach the event handlers we want
|
protected void |
addStandardVariables(org.apache.velocity.VelocityContext vc,
Page page,
DisplayHierarchy dh)
Add the standard variables to the context
|
protected void |
addTools(org.apache.velocity.VelocityContext vc)
Add generic tools to the Velocity context
|
protected void |
coerceAllMetadata()
Irrespective of what is stated in the request URL, we ensure that we see
all of the available metadata for this endpoint
|
protected org.apache.velocity.VelocityContext |
createVelocityContext(Bindings binds) |
protected org.apache.velocity.app.VelocityEngine |
createVelocityEngine()
Create a Velocity engine instance, and initialise it with properties
loaded from the
velocity.properties file. |
protected String |
defaultVelocityRoot() |
protected List<String> |
expandVelocityPath(Bindings b) |
protected Properties |
getProperties(List<String> velocityPath) |
protected DisplayHierarchy |
initialiseHierarchy(Page page)
Initialise the display hierarchy, which unrolls the RDF graph into a displayable tree
|
protected Page |
initialisePage() |
protected void |
loadPropertiesFile(List<String> velocityPath,
Properties p)
Load the
velocity.properties file from the Velocity root, if it exists. |
protected void |
render(OutputStream os)
Render the top-level template, given the result set and other state stored
in this rendering closure.
|
protected void |
setDynamicProperties(List<String> velocityPath,
Properties p)
Set additional properties that are calculated based on current state
|
void |
writeAll(Times times,
OutputStream os)
Write the rendered output to the output stream, and side-effect the given
Times object to record duration and output counts. |
public static final String DEFAULT_VELOCITY_ROOT_PATH
public static final String VELOCITY_PATH_CONFIG_PARAM
public static final String VELOCITY_PATH_ENV_VAR
public static final String VELOCITY_PROPERTIES_FILE
public static final String VELOCITY_FILE_RESOURCE_LOADER_PATH
public VelocityRendering(Bindings b, APIResultSet rs, VelocityRenderer vr)
b
- Current bindingsrs
- Current result setvr
- Reference to the Velocity renderer object, which is also a container for some of the
configuration informationpublic void writeAll(Times times, OutputStream os)
Times
object to record duration and output counts.writeAll
in interface Renderer.BytesOut
times
- Record used to capture time and size information on outputos
- The output stream to write toprotected void coerceAllMetadata()
protected void render(OutputStream os)
os
- The output stream to write toprotected org.apache.velocity.app.VelocityEngine createVelocityEngine()
velocity.properties
file.protected List<String> expandVelocityPath(Bindings b)
protected String defaultVelocityRoot()
protected Properties getProperties(List<String> velocityPath)
protected void setDynamicProperties(List<String> velocityPath, Properties p)
velocityPath
- The Velocity path as givenp
- The current Properties objectprotected void loadPropertiesFile(List<String> velocityPath, Properties p)
velocity.properties
file from the Velocity root, if it exists.velocityPath
- One or more Velocity root directories to look inp
- Properties to instantiateprotected org.apache.velocity.VelocityContext createVelocityContext(Bindings binds)
protected void addStandardVariables(org.apache.velocity.VelocityContext vc, Page page, DisplayHierarchy dh)
protected void addBindingsToContext(org.apache.velocity.VelocityContext vc, Bindings binds)
protected void addEventHandlers(org.apache.velocity.VelocityContext vc)
protected void addContextSelfReference(org.apache.velocity.VelocityContext vc)
protected void addTools(org.apache.velocity.VelocityContext vc)
protected DisplayHierarchy initialiseHierarchy(Page page)
page
- The current page objectprotected Page initialisePage()
Copyright © 2014. All Rights Reserved.