org.apache.velocity.context

Class VMContext

public class VMContext extends Object implements InternalContextAdapter

This is a special, internal-use-only context implementation to be used for the new Velocimacro implementation. The main distinguishing feature is the management of the VMProxyArg objects in the put() and get() methods. Further, this context also supports the 'VM local context' mode, where any get() or put() of references that aren't args to the VM are considered local to the vm, protecting the global context.

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

Author: Geir Magnusson Jr.

Field Summary
InternalContextAdapterinnerContext
the base context store.
HashMaplocalcontext
container for any local or constant VMProxy items
booleanlocalcontextscope
support for local context scope feature, where all references are local
HashMapvmproxyhash
container for our VMProxy Objects
InternalContextAdapterwrappedContext
context that we are wrapping
Constructor Summary
VMContext(InternalContextAdapter inner, RuntimeServices rsvc)
CTOR, wraps an ICA
Method Summary
voidaddVMProxyArg(VMProxyArg vmpa)
Used to put VMProxyArgs into this context.
EventCartridgeattachEventCartridge(EventCartridge ec)
booleancontainsKey(Object key)
not yet impl
Objectget(String key)
Impl of the Context.gut() method.
InternalContextAdaptergetBaseContext()
ResourcegetCurrentResource()
StringgetCurrentTemplateName()
EventCartridgegetEventCartridge()
ContextgetInternalUserContext()
return the inner / user context
Object[]getKeys()
impl badly
Object[]getTemplateNameStack()
IntrospectionCacheDataicacheGet(Object key)
voidicachePut(Object key, IntrospectionCacheData o)
voidpopCurrentTemplateName()
voidpushCurrentTemplateName(String s)
Objectput(String key, Object value)
Impl of the Context.put() method.
Objectremove(Object key)
impl badly
voidsetCurrentResource(Resource r)

Field Detail

innerContext

InternalContextAdapter innerContext
the base context store. This is the 'global' context

localcontext

HashMap localcontext
container for any local or constant VMProxy items

localcontextscope

private boolean localcontextscope
support for local context scope feature, where all references are local

vmproxyhash

HashMap vmproxyhash
container for our VMProxy Objects

wrappedContext

InternalContextAdapter wrappedContext
context that we are wrapping

Constructor Detail

VMContext

public VMContext(InternalContextAdapter inner, RuntimeServices rsvc)
CTOR, wraps an ICA

Method Detail

addVMProxyArg

public void addVMProxyArg(VMProxyArg vmpa)
Used to put VMProxyArgs into this context. It separates the VMProxyArgs into constant and non-constant types pulling out the value of the constant types so they can be modified w/o damaging the VMProxyArg, and leaving the dynamic ones, as they modify context rather than their own state

Parameters: vmpa VMProxyArg to add

attachEventCartridge

public EventCartridge attachEventCartridge(EventCartridge ec)

containsKey

public boolean containsKey(Object key)
not yet impl

get

public Object get(String key)
Impl of the Context.gut() method.

Parameters: key name of item to get

Returns: stored object or null

getBaseContext

public InternalContextAdapter getBaseContext()

getCurrentResource

public Resource getCurrentResource()

getCurrentTemplateName

public String getCurrentTemplateName()

getEventCartridge

public EventCartridge getEventCartridge()

getInternalUserContext

public Context getInternalUserContext()
return the inner / user context

getKeys

public Object[] getKeys()
impl badly

getTemplateNameStack

public Object[] getTemplateNameStack()

icacheGet

public IntrospectionCacheData icacheGet(Object key)

icachePut

public void icachePut(Object key, IntrospectionCacheData o)

popCurrentTemplateName

public void popCurrentTemplateName()

pushCurrentTemplateName

public void pushCurrentTemplateName(String s)

put

public Object put(String key, Object value)
Impl of the Context.put() method.

Parameters: key name of item to set value object to set to key

Returns: old stored object

remove

public Object remove(Object key)
impl badly

setCurrentResource

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