Class ComponentTemplateSourceImpl
- java.lang.Object
-
- org.apache.tapestry5.internal.event.InvalidationEventHubImpl
-
- org.apache.tapestry5.internal.services.ComponentTemplateSourceImpl
-
- All Implemented Interfaces:
InvalidationEventHub
,ComponentTemplateSource
,UpdateListener
public final class ComponentTemplateSourceImpl extends InvalidationEventHubImpl implements ComponentTemplateSource, UpdateListener
Service implementation that manages a cache of parsed component templates.
-
-
Constructor Summary
Constructors Constructor Description ComponentTemplateSourceImpl(boolean productionMode, boolean multipleClassLoaders, TemplateParser parser, ComponentResourceLocator locator, ClasspathURLConverter classpathURLConverter, ComponentRequestSelectorAnalyzer componentRequestSelectorAnalyzer, ThreadLocale threadLocale, org.slf4j.Logger logger)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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, java.util.Locale locale)
Resolves the component name to a localizedResource
(using theComponentTemplateLocator
chain of command service).ComponentTemplate
getTemplate(ComponentModel componentModel, ComponentResourceSelector selector)
Provides access to a template.void
registerAsUpdateListener(UpdateListenerHub hub)
void
setupReload(ReloadHelper helper)
-
Methods inherited from class org.apache.tapestry5.internal.event.InvalidationEventHubImpl
addInvalidationCallback, addInvalidationCallback, addInvalidationListener, clearOnInvalidation, fireInvalidationEvent, fireInvalidationEvent
-
-
-
-
Constructor Detail
-
ComponentTemplateSourceImpl
public ComponentTemplateSourceImpl(@Inject @Symbol("tapestry.production-mode") boolean productionMode, @Inject @Symbol("tapestry.multiple-classloaders") boolean multipleClassLoaders, TemplateParser parser, ComponentResourceLocator locator, ClasspathURLConverter classpathURLConverter, ComponentRequestSelectorAnalyzer componentRequestSelectorAnalyzer, ThreadLocale threadLocale, org.slf4j.Logger logger)
-
-
Method Detail
-
registerAsUpdateListener
@PostInjection public void registerAsUpdateListener(UpdateListenerHub hub)
-
setupReload
@PostInjection public void setupReload(ReloadHelper helper)
-
getTemplate
public ComponentTemplate getTemplate(ComponentModel componentModel, ComponentResourceSelector selector)
Description copied from interface:ComponentTemplateSource
Provides access to a template. The template will be parsed as necessary. If no template for the exact component is found, then the template for the component's parent is returned. In this way, it is possible for a component to extend the behavior of its super-class without duplicating the super-class component's template. In some cases, the empty template will be returned.- Specified by:
getTemplate
in interfaceComponentTemplateSource
- Parameters:
componentModel
- model for the component whose template is to be accessedselector
- defines locale and other information needed to locate template- Returns:
- the cached template instance
-
getTemplate
public ComponentTemplate getTemplate(ComponentModel componentModel, java.util.Locale locale)
Resolves the component name to a localizedResource
(using theComponentTemplateLocator
chain of command service). The localized resource is used as the key to a cache ofComponentTemplate
s. If a template doesn't exist, then the missing ComponentTemplate is returned.
-
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. Actually, TAP5-2742 did exactly that! :D- Specified by:
checkForUpdates
in interfaceUpdateListener
-
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 interfaceComponentTemplateSource
- See Also:
ComponentTemplates
-
-