| java.lang.Object org.apache.velocity.runtime.VelocimacroManager
VelocimacroManager | public class VelocimacroManager (Code) | | Manages VMs in namespaces. Currently, two namespace modes are
supported:
- flat - all allowable VMs are in the global namespace
- local - inline VMs are added to it's own template namespace
Thanks to Jose Alberto Fernandez
for some ideas incorporated here.
author: Geir Magnusson Jr. author: Jose Alberto Fernandez version: $Id: VelocimacroManager.java 463298 2006-10-12 16:10:32Z henning $ |
Method Summary | |
public boolean | addVM(String vmName, String macroBody, String argArray, String namespace) Adds a VM definition to the cache.
Parameters: vmName - Name of the new VelociMacro. Parameters: macroBody - String representation of the macro body. Parameters: argArray - Array of macro parameters, first parameter is the macro name. Parameters: namespace - The namespace/template from which this macro has been loaded. | public boolean | dumpNamespace(String namespace) Removes the VMs and the namespace from the manager. | public VelocimacroProxy | get(String vmName, String namespace) gets a new living VelocimacroProxy object by the
name / source template duple
Parameters: vmName - Name of the VelocityMacro to look up. Parameters: namespace - Namespace in which to look up the macro. | public String | getLibraryName(String vmName, String namespace) Return the library name for a given macro.
Parameters: vmName - Name of the Macro to look up. Parameters: namespace - Namespace to look the macro up. | public void | setNamespaceUsage(boolean namespaceOn) public switch to let external user of manager to control namespace
usage indep of properties. | public void | setRegisterFromLib(boolean registerFromLib) | public void | setTemplateLocalInlineVM(boolean inlineLocalMode) |
addVM | public boolean addVM(String vmName, String macroBody, String argArray, String namespace)(Code) | | Adds a VM definition to the cache.
Parameters: vmName - Name of the new VelociMacro. Parameters: macroBody - String representation of the macro body. Parameters: argArray - Array of macro parameters, first parameter is the macro name. Parameters: namespace - The namespace/template from which this macro has been loaded. Whether everything went okay. |
dumpNamespace | public boolean dumpNamespace(String namespace)(Code) | | Removes the VMs and the namespace from the manager.
Used when a template is reloaded to avoid
losing memory.
Parameters: namespace - namespace to dump boolean representing success |
get | public VelocimacroProxy get(String vmName, String namespace)(Code) | | gets a new living VelocimacroProxy object by the
name / source template duple
Parameters: vmName - Name of the VelocityMacro to look up. Parameters: namespace - Namespace in which to look up the macro. A proxy representing the Macro. |
getLibraryName | public String getLibraryName(String vmName, String namespace)(Code) | | Return the library name for a given macro.
Parameters: vmName - Name of the Macro to look up. Parameters: namespace - Namespace to look the macro up. The name of the library which registered this macro in a namespace. |
setNamespaceUsage | public void setNamespaceUsage(boolean namespaceOn)(Code) | | public switch to let external user of manager to control namespace
usage indep of properties. That way, for example, at startup the
library files are loaded into global namespace
Parameters: namespaceOn - True if namespaces should be used. |
setRegisterFromLib | public void setRegisterFromLib(boolean registerFromLib)(Code) | | Should macros registered from Libraries be marked special?
Parameters: registerFromLib - True if macros from Libs should be marked. |
setTemplateLocalInlineVM | public void setTemplateLocalInlineVM(boolean inlineLocalMode)(Code) | | Should macros from the same template be inlined?
Parameters: inlineLocalMode - True if macros should be inlined on the same template. |
|
|