org.xwiki.velocity
Interface VelocityEngine


@Role
public interface VelocityEngine

Initialize a Velocity Engine and make Velocity services available.

Version:
$Id$

Method Summary
 void clearMacroNamespace(String templateName)
          Clear the internal Velocity Macro cache for the passed namespace.
 boolean evaluate(org.apache.velocity.context.Context context, Writer out, String templateName, Reader source)
          Renders the input string using the context into the output writer.
 boolean evaluate(org.apache.velocity.context.Context context, Writer out, String templateName, String source)
          Renders the input string using the context into the output writer.
 void initialize(Properties properties)
          Initializes the Velocity engine by setting its configuration both from the component's configuration and from the passed properties.
 void startedUsingMacroNamespace(String namespace)
          Notify that a rendering action is starting in the given namespace.
 void stoppedUsingMacroNamespace(String namespace)
          Notify that a rendering action in the given namespace just finished.
 

Method Detail

initialize

void initialize(Properties properties)
                throws XWikiVelocityException
Initializes the Velocity engine by setting its configuration both from the component's configuration and from the passed properties. This method must be called before any other method from this class can be executed.

Parameters:
properties - the properties that will override the static properties defined in the component's configuration
Throws:
XWikiVelocityException - in case of error

evaluate

boolean evaluate(org.apache.velocity.context.Context context,
                 Writer out,
                 String templateName,
                 String source)
                 throws XWikiVelocityException
Renders the input string using the context into the output writer.

Parameters:
context - the Velocity context to use in rendering the input string
out - the writer in which to render the output
templateName - the string to be used as the template name for log messages in case of error
source - the input string containing the VTL to be rendered
Returns:
true if successful, false otherwise. If false, see the Velocity runtime log
Throws:
XWikiVelocityException - in case of error

evaluate

boolean evaluate(org.apache.velocity.context.Context context,
                 Writer out,
                 String templateName,
                 Reader source)
                 throws XWikiVelocityException
Renders the input string using the context into the output writer.

Parameters:
context - the Velocity context to use in rendering the input string
out - the writer in which to render the output
templateName - the string to be used as the template name for log messages in case of error
source - the input containing the VTL to be rendered, as a Reader
Returns:
true if successful, false otherwise. If false, see the Velocity runtime log
Throws:
XWikiVelocityException - in case of error

clearMacroNamespace

void clearMacroNamespace(String templateName)
Clear the internal Velocity Macro cache for the passed namespace.

Parameters:
templateName - the namespace for which to remove all cached Velocity macros
Since:
2.4M2

startedUsingMacroNamespace

void startedUsingMacroNamespace(String namespace)
Notify that a rendering action is starting in the given namespace.

Parameters:
namespace - the namespace being used
Since:
2.4RC1

stoppedUsingMacroNamespace

void stoppedUsingMacroNamespace(String namespace)
Notify that a rendering action in the given namespace just finished.

Parameters:
namespace - the namespace which was used
Since:
2.4RC1


Copyright © 2004-2012 XWiki. All Rights Reserved.