org.tm4j.vtl
Class TM4JVelocityConfigurationBase

java.lang.Object
  extended byorg.tm4j.vtl.TM4JVelocityConfigurationBase
All Implemented Interfaces:
TM4JVelocityConfiguration
Direct Known Subclasses:
TM4JXMLVelocityConfiguration

public abstract class TM4JVelocityConfigurationBase
extends java.lang.Object
implements TM4JVelocityConfiguration

A base class implementation of the TM4JVelocityConfiguration interface.


Nested Class Summary
 
Nested classes inherited from class org.tm4j.vtl.TM4JVelocityConfiguration
TM4JVelocityConfiguration.ConfigurationScope
 
Field Summary
 
Fields inherited from interface org.tm4j.vtl.TM4JVelocityConfiguration
SCOPE_INSTANCES, SCOPE_SELF, SCOPE_SUBCLASSES
 
Constructor Summary
TM4JVelocityConfigurationBase()
           
 
Method Summary
abstract  java.util.Properties getHelpers()
           
 PageInfo getPageInfo(org.tm4j.topicmap.TopicMap tm, java.lang.String pageInfoClass)
           
abstract  java.lang.String[] getPageInfoClassNames(java.lang.String tmName)
           
abstract  java.lang.Class getProviderClass(java.lang.String providerName)
           
abstract  java.util.Properties getProviderProps(java.lang.String providerName)
           
abstract  java.lang.String[] getProviders()
           
 RenderInfo getRenderInfo(org.tm4j.topicmap.Topic t)
          Returns the rendering information for the specified topic.
abstract  RenderInfo getRenderInfo(org.tm4j.topicmap.Topic t, TM4JVelocityConfiguration.ConfigurationScope scope)
           
 java.lang.String getTemplateAndPageInfo(org.tm4j.topicmap.Topic t, org.apache.velocity.context.Context ctxt)
          Processes the configuration to find the PageInfo implementation to extract context information for the specified topic and the template to use to render the topic.
abstract  TopicMapConfig[] getTopicMaps(java.lang.String providerName, java.io.File baseDir)
           
protected  void registerHelpers(org.apache.velocity.context.Context ctxt)
           
protected  void registerLoadedTopicMaps(org.apache.velocity.context.Context ctxt, java.io.File baseDir)
           
protected  void registerProviders(org.apache.velocity.context.Context context)
          Retrieves the TopicMapProvider instance specified by the web application configuration information.
 void setUpContext(org.apache.velocity.context.Context ctxt, java.io.File baseDir)
          Sets up the global application context which contains information about the providers, loadable topic maps and the default pre-configured helper objects.
 void topicmapLoaded(org.tm4j.topicmap.TopicMapProvider provider, java.lang.String tmName, org.tm4j.topicmap.TopicMap tm)
          Invoked when the application loads a new topic map.
 void topicmapUnloaded(org.tm4j.topicmap.TopicMapProvider provider, java.lang.String tmName, org.tm4j.topicmap.TopicMap tm)
          Invoked when the application unloads a topic map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.tm4j.vtl.TM4JVelocityConfiguration
getLoadable, getLoadables
 

Constructor Detail

TM4JVelocityConfigurationBase

public TM4JVelocityConfigurationBase()
Method Detail

topicmapLoaded

public void topicmapLoaded(org.tm4j.topicmap.TopicMapProvider provider,
                           java.lang.String tmName,
                           org.tm4j.topicmap.TopicMap tm)
Description copied from interface: TM4JVelocityConfiguration
Invoked when the application loads a new topic map. The implementation of this method can be used to ensure that PageInfo objects are created for the topic map in question.

Specified by:
topicmapLoaded in interface TM4JVelocityConfiguration

topicmapUnloaded

public void topicmapUnloaded(org.tm4j.topicmap.TopicMapProvider provider,
                             java.lang.String tmName,
                             org.tm4j.topicmap.TopicMap tm)
Description copied from interface: TM4JVelocityConfiguration
Invoked when the application unloads a topic map. The implementation of this method can be used to free up the PageInfo objects created when the topic map was loaded.

Specified by:
topicmapUnloaded in interface TM4JVelocityConfiguration

getPageInfo

public PageInfo getPageInfo(org.tm4j.topicmap.TopicMap tm,
                            java.lang.String pageInfoClass)
Specified by:
getPageInfo in interface TM4JVelocityConfiguration

getTemplateAndPageInfo

public java.lang.String getTemplateAndPageInfo(org.tm4j.topicmap.Topic t,
                                               org.apache.velocity.context.Context ctxt)
Description copied from interface: TM4JVelocityConfiguration
Processes the configuration to find the PageInfo implementation to extract context information for the specified topic and the template to use to render the topic.

Specified by:
getTemplateAndPageInfo in interface TM4JVelocityConfiguration
Parameters:
t - the topic to be rendered
ctxt - the Velocity context into which information extracted by the PageInfo for the topic should be placed.
Returns:
the name of the template to be used to render the topic.

getRenderInfo

public RenderInfo getRenderInfo(org.tm4j.topicmap.Topic t)
Description copied from interface: TM4JVelocityConfiguration
Returns the rendering information for the specified topic. This consists of the name of the template to use to render the topic and the PageInfo implementation used to extract a bean from the topic.

Specified by:
getRenderInfo in interface TM4JVelocityConfiguration
Parameters:
t -
Returns:
A RenderInfo object wrapping the name of the page information extractor class and the template name

setUpContext

public void setUpContext(org.apache.velocity.context.Context ctxt,
                         java.io.File baseDir)
Description copied from interface: TM4JVelocityConfiguration
Sets up the global application context which contains information about the providers, loadable topic maps and the default pre-configured helper objects.

Specified by:
setUpContext in interface TM4JVelocityConfiguration
Parameters:
ctxt - the Velocity Context to be loaded with information about providers, loadable topic maps and with pre-configured helper objects.
baseDir - the base directory to use when resolving paths in the configuration file

registerProviders

protected void registerProviders(org.apache.velocity.context.Context context)
Retrieves the TopicMapProvider instance specified by the web application configuration information.


registerLoadedTopicMaps

protected void registerLoadedTopicMaps(org.apache.velocity.context.Context ctxt,
                                       java.io.File baseDir)

registerHelpers

protected void registerHelpers(org.apache.velocity.context.Context ctxt)

getPageInfoClassNames

public abstract java.lang.String[] getPageInfoClassNames(java.lang.String tmName)

getRenderInfo

public abstract RenderInfo getRenderInfo(org.tm4j.topicmap.Topic t,
                                         TM4JVelocityConfiguration.ConfigurationScope scope)

getProviders

public abstract java.lang.String[] getProviders()

getProviderClass

public abstract java.lang.Class getProviderClass(java.lang.String providerName)

getProviderProps

public abstract java.util.Properties getProviderProps(java.lang.String providerName)

getTopicMaps

public abstract TopicMapConfig[] getTopicMaps(java.lang.String providerName,
                                              java.io.File baseDir)

getHelpers

public abstract java.util.Properties getHelpers()