org.apache.velocity.tools
Class ToolManager
java.lang.Object
org.apache.velocity.tools.ToolManager
- Direct Known Subclasses:
- ViewToolManager
public class ToolManager
- extends Object
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
velocity
protected VelocityEngine velocity
factory
protected ToolboxFactory factory
ToolManager
public ToolManager()
- Constructs an instance already configured to use the
ConfigurationUtils.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)
autoConfigure
public void autoConfigure(boolean includeDefaults)
configure
public void configure(FactoryConfiguration config)
configure
public void configure(String path)
findConfig
protected FactoryConfiguration findConfig(String path)
getToolboxFactory
public ToolboxFactory getToolboxFactory()
- Returns the underlying
ToolboxFactory
being used.
setToolboxFactory
public void setToolboxFactory(ToolboxFactory factory)
- Sets the underlying ToolboxFactory being used.
If you use this, be sure that your ToolboxFactory
is already properly configured.
setVelocityEngine
public void setVelocityEngine(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 VelocityEngine getVelocityEngine()
setUserCanOverwriteTools
public void setUserCanOverwriteTools(boolean overwrite)
getUserCanOverwriteTools
public boolean getUserCanOverwriteTools()
getLog
public Log getLog()
debug
protected final void debug(String msg,
Object... args)
createContext
public ToolContext createContext()
createContext
public ToolContext createContext(Map<String,Object> toolProps)
prepareContext
protected void prepareContext(ToolContext context)
addToolboxes
protected void addToolboxes(ToolContext context)
hasTools
protected boolean hasTools(String scope)
createToolbox
protected Toolbox createToolbox(String scope)
hasRequestTools
protected boolean hasRequestTools()
getRequestToolbox
protected Toolbox getRequestToolbox()
hasApplicationTools
protected boolean hasApplicationTools()
getApplicationToolbox
protected Toolbox getApplicationToolbox()
Copyright © 2002-2010 Apache Software Foundation. All Rights Reserved.