org.apache.velocity.context

Class InternalContextAdapterImpl

public final class InternalContextAdapterImpl extends Object implements InternalContextAdapter

This adapter class is the container for all context types for internal use. The AST now uses this class rather than the app-level Context interface to allow flexibility in the future. Currently, we have two context interfaces which must be supported : This class implements the two interfaces to ensure that all methods are supported. When adding to the interfaces, or adding more context functionality, the interface is the primary definition, so alter that first and then all classes as necessary. As of this writing, this would be the only class affected by changes to InternalContext This class ensures that an InternalContextBase is available for internal use. If an application constructs their own Context-implementing object w/o subclassing AbstractContext, it may be that support for InternalContext is not available. Therefore, InternalContextAdapter will create an InternalContextBase if necessary for this support. Note that if this is necessary, internal information such as node-cache data will be lost from use to use of the context. This may or may not be important, depending upon application.

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

Author: Geir Magnusson Jr.

Field Summary
Contextcontext
the user data Context that we are wrapping
InternalHousekeepingContexticb
the ICB we are wrapping.
InternalEventContextiec
The InternalEventContext that we are wrapping.
Constructor Summary
InternalContextAdapterImpl(Context c)
CTOR takes a Context and wraps it, delegating all 'data' calls to it.
Method Summary
EventCartridgeattachEventCartridge(EventCartridge ec)
booleancontainsKey(Object key)
Objectget(String key)
InternalContextAdaptergetBaseContext()
Returns the base context that we are wrapping.
ResourcegetCurrentResource()
StringgetCurrentTemplateName()
EventCartridgegetEventCartridge()
ContextgetInternalUserContext()
returns the user data context that we are wrapping
Object[]getKeys()
Object[]getTemplateNameStack()
IntrospectionCacheDataicacheGet(Object key)
voidicachePut(Object key, IntrospectionCacheData o)
voidpopCurrentTemplateName()
voidpushCurrentTemplateName(String s)
Objectput(String key, Object value)
Objectremove(Object key)
voidsetCurrentResource(Resource r)

Field Detail

context

Context context
the user data Context that we are wrapping

icb

InternalHousekeepingContext icb
the ICB we are wrapping. We may need to make one if the user data context implementation doesn't support one. The default AbstractContext-derived VelocityContext does, and it's recommended that people derive new contexts from AbstractContext rather than piecing things together

iec

InternalEventContext iec
The InternalEventContext that we are wrapping. If the context passed to us doesn't support it, no biggie. We don't make it for them - since its a user context thing, nothing gained by making one for them now

Constructor Detail

InternalContextAdapterImpl

public InternalContextAdapterImpl(Context c)
CTOR takes a Context and wraps it, delegating all 'data' calls to it. For support of internal contexts, it will create an InternalContextBase if need be.

Method Detail

attachEventCartridge

public EventCartridge attachEventCartridge(EventCartridge ec)

containsKey

public boolean containsKey(Object key)

get

public Object get(String key)

getBaseContext

public InternalContextAdapter getBaseContext()
Returns the base context that we are wrapping. Here, its this, but for other thing like VM related context contortions, it can be something else

getCurrentResource

public Resource getCurrentResource()

getCurrentTemplateName

public String getCurrentTemplateName()

getEventCartridge

public EventCartridge getEventCartridge()

getInternalUserContext

public Context getInternalUserContext()
returns the user data context that we are wrapping

getKeys

public Object[] getKeys()

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)

remove

public Object remove(Object key)

setCurrentResource

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