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
ConstructorsConstructorDescriptionComponentTemplateSourceImpl
(boolean productionMode, boolean multipleClassLoaders, TemplateParser parser, ComponentResourceLocator locator, ClasspathURLConverter classpathURLConverter, ComponentRequestSelectorAnalyzer componentRequestSelectorAnalyzer, ThreadLocale threadLocale, org.slf4j.Logger logger) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks to see if any parsed resource has changed.Event hub used to notify listeners that underlying component template files have changed.getTemplate
(ComponentModel componentModel, Locale locale) Resolves the component name to a localizedResource
(using theComponentTemplateLocator
chain of command service).getTemplate
(ComponentModel componentModel, ComponentResourceSelector selector) Provides access to a template.void
void
setupReload
(ReloadHelper helper) Methods inherited from class org.apache.tapestry5.internal.event.InvalidationEventHubImpl
addInvalidationCallback, addInvalidationCallback, addInvalidationListener, clearOnInvalidation, fireInvalidationEvent, fireInvalidationEvent
-
Constructor Details
-
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 Details
-
registerAsUpdateListener
-
setupReload
-
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
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
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
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:
-