org.apache.velocity.context

Class InternalContextBase

class InternalContextBase extends Object implements InternalHousekeepingContext, InternalEventContext, Serializable

class 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. Note that this is not a public class. It is for package access only to keep application code from accessing the internals, as AbstractContext is derived from this.

Version: $Id: InternalContextBase.java,v 1.8.12.1 2004/03/03 23:22:54 geirm Exp $

Author: Geir Magnusson Jr.

Field Summary
ResourcecurrentResource
Current resource - used for carrying encoding and other information down into the rendering process
EventCartridgeeventCartridge
EventCartridge we are to carry.
HashMapintrospectionCache
cache for node/context specific introspection information
StacktemplateNameStack
Template name stack.
Method Summary
EventCartridgeattachEventCartridge(EventCartridge ec)
ResourcegetCurrentResource()
StringgetCurrentTemplateName()
get the current template name
EventCartridgegetEventCartridge()
Object[]getTemplateNameStack()
get the current template name stack
IntrospectionCacheDataicacheGet(Object key)
returns an IntrospectionCache Data (@see IntrospectionCacheData) object if exists for the key
voidicachePut(Object key, IntrospectionCacheData o)
places an IntrospectionCache Data (@see IntrospectionCacheData) element in the cache for specified key
voidpopCurrentTemplateName()
remove the current template name from stack
voidpushCurrentTemplateName(String s)
set the current template name on top of stack
voidsetCurrentResource(Resource r)

Field Detail

currentResource

private Resource currentResource
Current resource - used for carrying encoding and other information down into the rendering process

eventCartridge

private EventCartridge eventCartridge
EventCartridge we are to carry. Set by application

introspectionCache

private HashMap introspectionCache
cache for node/context specific introspection information

templateNameStack

private Stack templateNameStack
Template name stack. The stack top contains the current template name.

Method Detail

attachEventCartridge

public EventCartridge attachEventCartridge(EventCartridge ec)

getCurrentResource

public Resource getCurrentResource()

getCurrentTemplateName

public String getCurrentTemplateName()
get the current template name

Returns: String current template name

getEventCartridge

public EventCartridge getEventCartridge()

getTemplateNameStack

public Object[] getTemplateNameStack()
get the current template name stack

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

icacheGet

public IntrospectionCacheData icacheGet(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(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

popCurrentTemplateName

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

pushCurrentTemplateName

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

Parameters: s current template name

setCurrentResource

public void setCurrentResource(Resource r)
Copyright B) 2002 Apache Software Foundation. All Rights Reserved.