org.teatrove.tea.engine
Interface DynamicContextSource

All Superinterfaces:
ContextSource

public interface DynamicContextSource
extends ContextSource

Instances of this kind of ContextSource can support reloading their context class. Engines that support context reload will discover that the context class has changed by calling getContextType. This call will likely be initiated by a template reload request, since all templates may need to be recompiled if the context class has changed.

Because Tea engines may execute many templates concurrently, the two argument createContext method is called to inform the context source what specific context class is tied to the application request. The returned context instance must be of the requested type. DynamicContextSources must support instantiating the old context class(es) as well as the new context class.

The context source may release old context classes to free resources only when it is safe to do so. One way of achieving this is by using weak references.

Author:
Jonathan Colwell

Method Summary
 Object createContext(Class<?> contextClass, Object param)
          Creates a context instance that must be of the requested type.
 
Methods inherited from interface org.teatrove.tea.engine.ContextSource
createContext, getContextType
 

Method Detail

createContext

Object createContext(Class<?> contextClass,
                     Object param)
                     throws Exception
Creates a context instance that must be of the requested type.

Parameters:
contextClass - Expected type of returned context instance
param - engine specific parameter that may be used to create the context instance
Throws:
Exception


Copyright © 1997-2012 TeaTrove.org. All Rights Reserved.