org.apache.velocity.context
Interface InternalHousekeepingContext

All Known Subinterfaces:
InternalContextAdapter
All Known Implementing Classes:
Foreach.NullHolderContext, InternalContextAdapterImpl, InternalContextBase, VMContext

interface InternalHousekeepingContext

interface to encapsulate the 'stuff' for internal operation of velocity. We use the context as a thread-safe storage : we take advantage of the fact that it's a visitor of sorts to all nodes (that matter) of the AST during init() and render(). Currently, it carries the template name for namespace support, as well as node-local context data introspection caching.

Version:
$Id: InternalHousekeepingContext.java 124214 2005-01-05 14:48:36Z wglass $
Author:
Geir Magnusson Jr., Christoph Reck

Method Summary
 boolean getAllowRendering()
          Checks to see if rendering should be allowed.
 Resource getCurrentResource()
          temporary fix to enable #include() to figure out current encoding.
 java.lang.String getCurrentTemplateName()
          get the current template name
 java.lang.Object[] getTemplateNameStack()
          Returns the template name stack in form of an array.
 IntrospectionCacheData icacheGet(java.lang.Object key)
          returns an IntrospectionCache Data (@see IntrospectionCacheData) object if exists for the key
 void icachePut(java.lang.Object key, IntrospectionCacheData o)
          places an IntrospectionCache Data (@see IntrospectionCacheData) element in the cache for specified key
 void popCurrentTemplateName()
          remove the current template name from stack
 void pushCurrentTemplateName(java.lang.String s)
          set the current template name on top of stack
 void setAllowRendering(boolean v)
          Set whether rendering is allowed.
 void setCurrentResource(Resource r)
           
 

Method Detail

pushCurrentTemplateName

public void pushCurrentTemplateName(java.lang.String s)
set the current template name on top of stack

Parameters:
s - current template name

popCurrentTemplateName

public void popCurrentTemplateName()
remove the current template name from stack


getCurrentTemplateName

public java.lang.String getCurrentTemplateName()
get the current template name

Returns:
String current template name

getTemplateNameStack

public java.lang.Object[] getTemplateNameStack()
Returns the template name stack in form of an array.

Returns:
Object[] with the template name stack contents.

icacheGet

public IntrospectionCacheData icacheGet(java.lang.Object key)
returns an IntrospectionCache Data (@see IntrospectionCacheData) object if exists for the key

Parameters:
key - key to find in cache
Returns:
cache object

icachePut

public void icachePut(java.lang.Object key,
                      IntrospectionCacheData o)
places an IntrospectionCache Data (@see IntrospectionCacheData) element in the cache for specified key

Parameters:
key - key
o - IntrospectionCacheData object to place in cache

getCurrentResource

public Resource getCurrentResource()
temporary fix to enable #include() to figure out current encoding.


setCurrentResource

public void setCurrentResource(Resource r)

getAllowRendering

public boolean getAllowRendering()
Checks to see if rendering should be allowed. Defaults to true but will return false after a #stop directive.

Returns:
true if rendering is allowed, false if no rendering should occur

setAllowRendering

public void setAllowRendering(boolean v)
Set whether rendering is allowed. Defaults to true but is set to false after a #stop directive.



Copyright ? 2002 Apache Software Foundation. All Rights Reserved.