Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.velocity.context
Class InternalContextBase

    java.lang.Object
      |
      +--org.apache.velocity.context.InternalContextBase

All Implemented Interfaces:
  InternalEventContext, InternalHousekeepingContext, java.io.Serializable

Direct Known Subclasses:
  AbstractContext

class InternalContextBase
extends java.lang.Object
implements InternalHousekeepingContext, InternalEventContext, java.io.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 2001/05/20 19:44:34 geirm Exp $
Author:
  Geir Magnusson Jr.
See Also:
  Serialized Form

Field Summary
`private Resource` | `currentResource` Current resource - used for carrying encoding and other information down into the rendering process
`private EventCartridge` | `eventCartridge` EventCartridge we are to carry.
`private java.util.HashMap` | `introspectionCache` cache for node/context specific introspection information
`private java.util.Stack` | `templateNameStack` Template name stack.

Constructor Summary
`(package private)` | `InternalContextBase()`

Method Summary
`EventCartridge` | `attachEventCartridge(EventCartridge ec)`
`Resource` | `getCurrentResource()` temporary fix to enable #include() to figure out current encoding.
`java.lang.String` | `getCurrentTemplateName()` get the current template name
`EventCartridge` | `getEventCartridge()`
`java.lang.Object[]` | `getTemplateNameStack()` get the current template name stack
`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` | `setCurrentResource(Resource r)`

Methods inherited from class java.lang.Object
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Field Detail

### introspectionCache

    private java.util.HashMap introspectionCache

  cache for node/context specific introspection information

### templateNameStack

    private java.util.Stack templateNameStack

  Template name stack. The stack top contains the current template name.

### eventCartridge

    private EventCartridge eventCartridge

  EventCartridge we are to carry. Set by application

### currentResource

    private Resource currentResource

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

Constructor Detail

### InternalContextBase

    InternalContextBase()

Method Detail

### pushCurrentTemplateName

    public void pushCurrentTemplateName(java.lang.String s)

  set the current template name on top of stack
  Specified by:
    `pushCurrentTemplateName` in interface `InternalHousekeepingContext`
  Parameters:
    `s` - current template name

### popCurrentTemplateName

    public void popCurrentTemplateName()

  remove the current template name from stack
  Specified by:
    `popCurrentTemplateName` in interface `InternalHousekeepingContext`

### getCurrentTemplateName

    public java.lang.String getCurrentTemplateName()

  get the current template name
  Specified by:
    `getCurrentTemplateName` in interface `InternalHousekeepingContext`
  Returns:
    String current template name

### getTemplateNameStack

    public java.lang.Object[] getTemplateNameStack()

  get the current template name stack
  Specified by:
    `getTemplateNameStack` in interface `InternalHousekeepingContext`
  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
  Specified by:
    `icacheGet` in interface `InternalHousekeepingContext`
  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
  Specified by:
    `icachePut` in interface `InternalHousekeepingContext`
  Parameters:
    `key` - key
    `o` - IntrospectionCacheData object to place in cache

### setCurrentResource

    public void setCurrentResource(Resource r)

  Specified by:
    `setCurrentResource` in interface `InternalHousekeepingContext`

### getCurrentResource

    public Resource getCurrentResource()

  Description copied from interface: `InternalHousekeepingContext`
  temporary fix to enable #include() to figure out current encoding.
  Specified by:
    `getCurrentResource` in interface `InternalHousekeepingContext`

### attachEventCartridge

    public EventCartridge attachEventCartridge(EventCartridge ec)

  Specified by:
    `attachEventCartridge` in interface `InternalEventContext`

### getEventCartridge

    public EventCartridge getEventCartridge()

  Specified by:
    `getEventCartridge` in interface `InternalEventContext`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003 Apache Software Foundation. All Rights Reserved.