Package org.apache.velocity.tools
Class ToolManager
java.lang.Object
org.apache.velocity.tools.ToolManager
- Direct Known Subclasses:
ViewToolManager
Manages tools for non-web applications. This simplifies the process
of getting a tool-populated Velocity context for merging with templates.
It allows for both direct configuration by passing in a
FactoryConfiguration
as well as configuration via a tools.xml or tools.properties file in
either the classpath or the local file system.- Version:
- $Id: ToolManager.java 511959 2007-02-26 19:24:39Z nbubna $
- Author:
- Nathan Bubna
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Toolboxprotected ToolboxFactoryprivate booleanprotected org.apache.velocity.app.VelocityEngine -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an instance already configured to use theConfigurationUtils.getAutoLoaded()configuration and any configuration specified via a "org.apache.velocity.tools" system property.ToolManager(boolean includeDefaults) ToolManager(boolean autoConfig, boolean includeDefaults) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToolboxes(ToolContext context) voidautoConfigure(boolean includeDefaults) voidvoidconfigure(FactoryConfiguration config) createContext(Map<String, Object> toolProps) protected ToolboxcreateToolbox(String scope) protected final voidprotected FactoryConfigurationfindConfig(String path) protected Toolboxorg.apache.velocity.runtime.log.LoggetLog()protected ToolboxReturns the underlyingToolboxFactorybeing used.booleanorg.apache.velocity.app.VelocityEngineprotected booleanprotected booleanprotected booleanprotected voidprepareContext(ToolContext context) voidsetToolboxFactory(ToolboxFactory factory) Sets the underlying ToolboxFactory being used.voidsetUserCanOverwriteTools(boolean overwrite) voidsetVelocityEngine(org.apache.velocity.app.VelocityEngine engine) Sets the underlying VelocityEngine being used.
-
Field Details
-
velocity
protected org.apache.velocity.app.VelocityEngine velocity -
factory
-
application
-
userOverwrite
private boolean userOverwrite
-
-
Constructor Details
-
ToolManager
public ToolManager()Constructs an instance already configured to use theConfigurationUtils.getAutoLoaded()configuration and any configuration specified via a "org.apache.velocity.tools" system property. -
ToolManager
public ToolManager(boolean includeDefaults) -
ToolManager
public ToolManager(boolean autoConfig, boolean includeDefaults)
-
-
Method Details
-
autoConfigure
public void autoConfigure(boolean includeDefaults) -
configure
-
configure
-
findConfig
-
getToolboxFactory
Returns the underlyingToolboxFactorybeing used. -
setToolboxFactory
Sets the underlying ToolboxFactory being used. If you use this, be sure that your ToolboxFactory is already properly configured. -
setVelocityEngine
public void setVelocityEngine(org.apache.velocity.app.VelocityEngine engine) Sets the underlying VelocityEngine being used. If you use this, be sure that your VelocityEngine is already properly configured and initialized. -
getVelocityEngine
public org.apache.velocity.app.VelocityEngine getVelocityEngine() -
setUserCanOverwriteTools
public void setUserCanOverwriteTools(boolean overwrite) -
getUserCanOverwriteTools
public boolean getUserCanOverwriteTools() -
getLog
public org.apache.velocity.runtime.log.Log getLog() -
debug
-
createContext
-
createContext
-
prepareContext
-
addToolboxes
-
hasTools
-
createToolbox
-
hasRequestTools
protected boolean hasRequestTools() -
getRequestToolbox
-
hasApplicationTools
protected boolean hasApplicationTools() -
getApplicationToolbox
-