org.apache.tapestry5.internal.services
Class ComponentTemplateSourceImpl

java.lang.Object
  extended by org.apache.tapestry5.internal.event.InvalidationEventHubImpl
      extended by org.apache.tapestry5.internal.services.ComponentTemplateSourceImpl
All Implemented Interfaces:
ComponentTemplateSource, InvalidationEventHub, UpdateListener

public final class ComponentTemplateSourceImpl
extends InvalidationEventHubImpl
implements ComponentTemplateSource, UpdateListener

Service implementation that manages a cache of parsed component templates.


Constructor Summary
ComponentTemplateSourceImpl(TemplateParser parser, PageTemplateLocator locator, ClasspathURLConverter classpathURLConverter)
           
 
Method Summary
 void checkForUpdates()
          Checks to see if any parsed resource has changed.
 InvalidationEventHub getInvalidationEventHub()
          Event hub used to notify listeners that underlying component template files have changed.
 ComponentTemplate getTemplate(ComponentModel componentModel, Locale locale)
          Resolves the component name to a Resource and finds the localization of that resource (the combination of component name and locale is resolved to a resource).
 
Methods inherited from class org.apache.tapestry5.internal.event.InvalidationEventHubImpl
addInvalidationListener, fireInvalidationEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentTemplateSourceImpl

public ComponentTemplateSourceImpl(TemplateParser parser,
                                   PageTemplateLocator locator,
                                   ClasspathURLConverter classpathURLConverter)
Method Detail

getTemplate

public ComponentTemplate getTemplate(ComponentModel componentModel,
                                     Locale locale)
Resolves the component name to a Resource and finds the localization of that resource (the combination of component name and locale is resolved to a resource). The localized resource is used as the key to a cache of ComponentTemplates.

If a template doesn't exist, then the missing ComponentTemplate is returned.

Specified by:
getTemplate in interface ComponentTemplateSource
Parameters:
componentModel - model for the component whose template is to be accessed
locale - the locale to find the template within
Returns:
the cached template instance

checkForUpdates

public void checkForUpdates()
Checks to see if any parsed resource has changed. If so, then all internal caches are cleared, and an invalidation event is fired. This is brute force ... a more targeted dependency management strategy may come later.

Specified by:
checkForUpdates in interface UpdateListener

getInvalidationEventHub

public InvalidationEventHub getInvalidationEventHub()
Description copied from interface: ComponentTemplateSource
Event hub used to notify listeners that underlying component template files have changed.

Specified by:
getInvalidationEventHub in interface ComponentTemplateSource
See Also:
ComponentTemplates


Copyright © 2006-2009 Apache Software Foundation. All Rights Reserved.