Class DBContext

java.lang.Object
org.apache.velocity.context.AbstractContext
org.apache.velocity.example.DBContext
All Implemented Interfaces:
Context, InternalEventContext

public class DBContext extends AbstractContext
Example context impl that uses a database to store stuff :) yes, this is silly expects a mysql db test with table CREATE TABLE contextstore ( k varchar(100), val blob ); very fragile, crappy code.... just a demo!
Version:
$Id$
Author:
Geir Magnusson Jr.
  • Constructor Details

    • DBContext

      public DBContext()
    • DBContext

      public DBContext(Context inner)
  • Method Details

    • internalGet

      public Object internalGet(String key)
      retrieves a serialized object from the db and returns the living instance to the caller.
      Specified by:
      internalGet in class AbstractContext
    • internalPut

      public Object internalPut(String key, Object value)
      Serializes and stores an object in the database. This is really a hokey way to do it, and will cause problems. The right way is to use a prepared statement...
      Specified by:
      internalPut in class AbstractContext
    • internalContainsKey

      public boolean internalContainsKey(String key)
      Not implementing. Not required for Velocity core operation, so not bothering. As we say above : "very fragile, crappy code..."
      Specified by:
      internalContainsKey in class AbstractContext
    • internalGetKeys

      public String[] internalGetKeys()
      Not implementing. Not required for Velocity core operation, so not bothering. As we say above : "very fragile, crappy code..."
      Specified by:
      internalGetKeys in class AbstractContext
    • internalRemove

      public Object internalRemove(String key)
      Not implementing. Not required for Velocity core operation, so not bothering. As we say above : "very fragile, crappy code..."
      Specified by:
      internalRemove in class AbstractContext
    • pushCurrentTemplateName

      public void pushCurrentTemplateName(String arg0)
    • popCurrentTemplateName

      public void popCurrentTemplateName()
    • getCurrentTemplateName

      public String getCurrentTemplateName()
    • getTemplateNameStack

      public String[] getTemplateNameStack()
    • pushCurrentMacroName

      public void pushCurrentMacroName(String arg0)
    • popCurrentMacroName

      public void popCurrentMacroName()
    • getCurrentMacroName

      public String getCurrentMacroName()
    • getCurrentMacroCallDepth

      public int getCurrentMacroCallDepth()
    • getMacroNameStack

      public String[] getMacroNameStack()
    • icacheGet

      public IntrospectionCacheData icacheGet(Object arg0)
    • icachePut

      public void icachePut(Object arg0, IntrospectionCacheData arg1)
    • setCurrentResource

      public void setCurrentResource(Resource arg0)
    • getCurrentResource

      public Resource getCurrentResource()
    • setMacroLibraries

      public void setMacroLibraries(List<Template> arg0)
    • getMacroLibraries

      public List<Template> getMacroLibraries()
    • attachEventCartridge

      public EventCartridge attachEventCartridge(EventCartridge arg0)
      Specified by:
      attachEventCartridge in interface InternalEventContext
    • getEventCartridge

      public EventCartridge getEventCartridge()
      Specified by:
      getEventCartridge in interface InternalEventContext