|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.dvsl.DVSL
public class DVSL
Main DVSL class - use this as the helper class for apps
Nested Class Summary | |
---|---|
protected static class |
DVSL.LogAdapter
|
Field Summary | |
---|---|
private java.util.Map |
appVals
|
private DVSLContext |
baseContext
|
private java.lang.ClassLoader |
classLoader
|
private org.dom4j.Document |
currentDocument
|
private java.io.Writer |
currentWriter
|
private static java.lang.String |
INTEGER_PROP_PREFIX
|
private java.io.File |
logFile
|
private org.apache.velocity.runtime.log.LogChute |
logger
|
private boolean |
ready
|
private static java.lang.String |
STRING_PROP_PREFIX
|
private org.apache.velocity.context.Context |
styleContext
|
private TemplateHandler |
templateHandler
|
private static java.lang.String |
TOOL_PROP_PREFIX
|
private static java.lang.String |
TOOLBOX_NAME
|
private org.apache.velocity.context.Context |
toolContext
|
private Transformer |
transformer
|
private org.apache.velocity.context.Context |
userContext
|
(package private) boolean |
validate
|
private org.apache.velocity.app.VelocityEngine |
ve
|
private java.util.Map |
velConfig
|
Constructor Summary | |
---|---|
DVSL()
|
Method Summary | |
---|---|
private void |
configureVelocityEngine(org.apache.velocity.app.VelocityEngine ve,
java.util.Map map)
Adds the allowed properties from the Properties to the velocity engine So far, we support, in RuntimeConstant parlance : VM_LIBRARY FILE_RESOURCE_LOADER_PATH RUNTIME_LOG RUNTIME_LOG_LOGSYSTEM RUNTIME_LOG_LOGSYSTEM_CLASS If you are going to use this, ensure you do it *before* setting the stylesheet, as that creates the VelocityEngine |
java.lang.Object |
getAppValue(java.lang.Object key)
Gets the application value for the specified key |
static void |
main(java.lang.String[] args)
Allows command-line access. |
protected void |
makeReady()
sets up all the context goodies |
java.lang.Object |
putAppValue(java.lang.Object key,
java.lang.Object value)
Sets the application value for the specified key |
void |
setClassLoader(java.lang.ClassLoader classLoader)
Specify a classloader for loading the Toolbox classes. |
void |
setLogChute(org.apache.velocity.runtime.log.LogChute logger)
lets the user specify a class instance for logging. |
void |
setLogFile(java.io.File logFile)
lets the user specify a filename for logging. |
void |
setLogSystem(org.apache.velocity.runtime.log.LogSystem logger)
Deprecated. use setLogChute instead |
void |
setStylesheet(java.io.File stylesheet)
Convenience function. |
void |
setStylesheet(java.io.File stylesheet,
java.lang.String stylesheetEncoding)
Convenience function. |
void |
setStylesheet(java.io.Reader styleReader)
Sets the stylesheet for this transformation set Note that don't need this for each document you want to transform. |
void |
setStylesheet(java.lang.String stylesheet)
Convenience function. |
void |
setToolbox(java.util.Properties p)
Loads the toolbox from the input Properties. |
void |
setUserContext(org.apache.velocity.context.Context ctx)
Sets the user context. |
void |
setValidatingParser(boolean validate)
Uses a validating parser on all input documents |
void |
setVelocityConfig(java.util.Map map)
lets the user pass a java.util.Properties containing properties for the configuration of the VelocityEngine used by DVSL |
long |
transform(org.dom4j.Document dom4jdoc,
java.io.Writer writer)
Transforms the given dom4j Document into the writer. |
long |
transform(java.io.File f,
java.io.Writer writer)
|
long |
transform(java.io.InputStream is,
java.io.Writer writer)
|
long |
transform(java.io.Reader reader,
java.io.Writer writer)
|
long |
transform(java.lang.String infile,
java.io.Writer writer)
|
protected long |
xform(org.dom4j.Document dom4jdoc,
java.io.Writer writer)
|
protected long |
xform(java.io.Reader reader,
java.io.Writer writer)
does the transformation of the inputstream into the output writer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static java.lang.String TOOL_PROP_PREFIX
private static java.lang.String STRING_PROP_PREFIX
private static java.lang.String INTEGER_PROP_PREFIX
private static java.lang.String TOOLBOX_NAME
private org.apache.velocity.app.VelocityEngine ve
private org.dom4j.Document currentDocument
private java.io.Writer currentWriter
private org.apache.velocity.context.Context toolContext
private org.apache.velocity.context.Context userContext
private org.apache.velocity.context.Context styleContext
private DVSLContext baseContext
private Transformer transformer
private java.lang.ClassLoader classLoader
private boolean ready
private java.util.Map velConfig
private java.io.File logFile
private org.apache.velocity.runtime.log.LogChute logger
private java.util.Map appVals
private TemplateHandler templateHandler
boolean validate
Constructor Detail |
---|
public DVSL()
Method Detail |
---|
public void setLogFile(java.io.File logFile)
lets the user specify a filename for logging.
public void setLogSystem(org.apache.velocity.runtime.log.LogSystem logger)
lets the user specify a class instance for logging.
public void setLogChute(org.apache.velocity.runtime.log.LogChute logger)
lets the user specify a class instance for logging.
public void setVelocityConfig(java.util.Map map)
lets the user pass a java.util.Properties containing properties for the configuration of the VelocityEngine used by DVSL
public void setUserContext(org.apache.velocity.context.Context ctx)
Sets the user context. The user context is a Velocity Context containing user-supplied objects and data that are to be made available in the template
ctx
- User context of datapublic void setValidatingParser(boolean validate)
Uses a validating parser on all input documents
validate
- public void setClassLoader(java.lang.ClassLoader classLoader)
Specify a classloader for loading the Toolbox classes. Setting to null resets to the default ClassLoader.
classLoader
- ClassLoader or null for default ClassLoaderpublic void setToolbox(java.util.Properties p) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
Loads the toolbox from the input Properties.
Currently supports specification of the Toolbox name in the context, creating classes, and string and integer values. Ex :
toolbox.contextname = floyd toolbox.tool.footool = Footool toolbox.string.mystring = Hello there! toolbox.integer.myint = 7 toolbox.string.sourcebase = ./xdocs/
So in template, this toolbox and it's values would be accessed as :
$context.floyd.footool.getFoo() $context.floyd.mystring $context.floyd.myint
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
public void setStylesheet(java.lang.String stylesheet) throws java.lang.Exception
java.lang.Exception
public void setStylesheet(java.io.File stylesheet) throws java.lang.Exception
java.lang.Exception
public void setStylesheet(java.io.File stylesheet, java.lang.String stylesheetEncoding) throws java.lang.Exception
java.lang.Exception
public void setStylesheet(java.io.Reader styleReader) throws java.lang.Exception
Sets the stylesheet for this transformation set
Note that don't need this for each document you want to transform. Just do it once, and transform away...
styleReader
- Reader with stylesheet char stream
java.lang.Exception
private void configureVelocityEngine(org.apache.velocity.app.VelocityEngine ve, java.util.Map map)
Adds the allowed properties from the Properties to the velocity engine
So far, we support, in RuntimeConstant parlance :
If you are going to use this, ensure you do it *before* setting the stylesheet, as that creates the VelocityEngine
protected void makeReady()
protected long xform(java.io.Reader reader, java.io.Writer writer) throws java.lang.Exception
java.lang.Exception
protected long xform(org.dom4j.Document dom4jdoc, java.io.Writer writer) throws java.lang.Exception
java.lang.Exception
public long transform(java.io.File f, java.io.Writer writer) throws java.lang.Exception
java.lang.Exception
public long transform(java.io.Reader reader, java.io.Writer writer) throws java.lang.Exception
java.lang.Exception
public long transform(java.io.InputStream is, java.io.Writer writer) throws java.lang.Exception
java.lang.Exception
public long transform(org.dom4j.Document dom4jdoc, java.io.Writer writer) throws java.lang.Exception
dom4jdoc
- dom4j Document objectwriter
- Writer for output
java.lang.Exception
public long transform(java.lang.String infile, java.io.Writer writer) throws java.lang.Exception
java.lang.Exception
public java.lang.Object getAppValue(java.lang.Object key)
key
- key to use to retrieve value
public java.lang.Object putAppValue(java.lang.Object key, java.lang.Object value)
key
- key to use to store valuevalue
- value to be stored
public static void main(java.lang.String[] args) throws java.lang.Exception
Allows command-line access.
Usage : java -jar dvsl.jar -STYLE stylesheeet [-IN infile] [-OUT outfile] [-TOOL toolboxname]
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |