org.apache.velocity.runtime
Class VelocimacroFactory

java.lang.Object
  extended by org.apache.velocity.runtime.VelocimacroFactory

public class VelocimacroFactory
extends Object

VelocimacroFactory.java manages the set of VMs in a running Velocity engine.

Version:
$Id: VelocimacroFactory.java 469919 2006-11-01 14:35:46Z henning $
Author:
Geir Magnusson Jr.

Constructor Summary
VelocimacroFactory(RuntimeServices rsvc)
          C'tor for the VelociMacro factory.
 
Method Summary
 boolean addVelocimacro(String name, String macroBody, String[] argArray, String sourceTemplate)
          adds a macro to the factory.
 boolean dumpVMNamespace(String namespace)
          tells the vmManager to dump the specified namespace
 Directive getVelocimacro(String vmName, String sourceTemplate)
          actual factory : creates a Directive that will behave correctly wrt getting the framework to dig out the correct # of args
 void initVelocimacro()
          initialize the factory - setup all permissions load all global libraries.
 boolean isVelocimacro(String vm, String sourceTemplate)
          Tells the world if a given directive string is a Velocimacro
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VelocimacroFactory

public VelocimacroFactory(RuntimeServices rsvc)
C'tor for the VelociMacro factory.

Parameters:
rsvc - Reference to a runtime services object.
Method Detail

initVelocimacro

public void initVelocimacro()
initialize the factory - setup all permissions load all global libraries.


addVelocimacro

public boolean addVelocimacro(String name,
                              String macroBody,
                              String[] argArray,
                              String sourceTemplate)
adds a macro to the factory.

Parameters:
name - Name of the Macro to add.
macroBody - String representation of the macro.
argArray - Macro arguments. First element is the macro name.
sourceTemplate - Source template from which the macro gets registered.
Returns:
True if Macro was registered successfully.

isVelocimacro

public boolean isVelocimacro(String vm,
                             String sourceTemplate)
Tells the world if a given directive string is a Velocimacro

Parameters:
vm - Name of the Macro.
sourceTemplate - Source template from which the macro should be loaded.
Returns:
True if the given name is a macro.

getVelocimacro

public Directive getVelocimacro(String vmName,
                                String sourceTemplate)
actual factory : creates a Directive that will behave correctly wrt getting the framework to dig out the correct # of args

Parameters:
vmName - Name of the Macro.
sourceTemplate - Source template from which the macro should be loaded.
Returns:
A directive representing the Macro.

dumpVMNamespace

public boolean dumpVMNamespace(String namespace)
tells the vmManager to dump the specified namespace

Parameters:
namespace - Namespace to dump.
Returns:
True if namespace has been dumped successfully.


Copyright © 2000-2007 The Apache Software Foundation. All Rights Reserved.