This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-0.0.6 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git
commit eaf5500f389c580f2c69f51ccb3953acc590dfd3 Author: Oliver Lietz <[email protected]> AuthorDate: Sun Feb 8 15:54:05 2015 +0000 SLING-4396 make template mode handlers configuration driven * add configuration policy “require” * remove default patterns value git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/thymeleaf@1658198 13f79535-47bb-0310-9956-ffa450edef68 --- .../templatemodehandler/AbstractTemplateModeHandler.java | 2 +- .../templatemodehandler/Html5TemplateModeHandler.java | 12 ++++++------ .../templatemodehandler/LegacyHtml5TemplateModeHandler.java | 12 ++++++------ .../ValidatingXhtmlTemplateModeHandler.java | 12 ++++++------ .../ValidatingXmlTemplateModeHandler.java | 12 ++++++------ .../templatemodehandler/XhtmlTemplateModeHandler.java | 12 ++++++------ .../internal/templatemodehandler/XmlTemplateModeHandler.java | 12 ++++++------ 7 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/AbstractTemplateModeHandler.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/AbstractTemplateModeHandler.java index 9a3dfa9..f20d8ac 100644 --- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/AbstractTemplateModeHandler.java +++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/AbstractTemplateModeHandler.java @@ -73,7 +73,7 @@ public abstract class AbstractTemplateModeHandler implements SlingTemplateModeHa protected abstract void configure(final ComponentContext componentContext); - protected synchronized void configurePatternSpec(final String[] strings) { + protected void configurePatternSpec(final String[] strings) { final Set<String> set = new HashSet<String>(); Collections.addAll(set, strings); final PatternSpec patternSpec = new PatternSpec(); // isInitialized() is private, so create a new PatternSpec diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/Html5TemplateModeHandler.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/Html5TemplateModeHandler.java index 3f6a35b..fd68c1d 100644 --- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/Html5TemplateModeHandler.java +++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/Html5TemplateModeHandler.java @@ -21,6 +21,7 @@ package org.apache.sling.scripting.thymeleaf.internal.templatemodehandler; import java.util.Dictionary; import org.apache.felix.scr.annotations.Component; +import org.apache.felix.scr.annotations.ConfigurationPolicy; import org.apache.felix.scr.annotations.Properties; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.PropertyUnbounded; @@ -35,7 +36,8 @@ import org.thymeleaf.templatewriter.XhtmlHtml5TemplateWriter; label = "Apache Sling Scripting Thymeleaf “HTML5 Template Mode Handler”", description = "HTML5 template mode handler for Sling Scripting Thymeleaf", immediate = true, - metatype = true + metatype = true, + policy = ConfigurationPolicy.REQUIRE ) @Service @Properties({ @@ -46,18 +48,16 @@ public class Html5TemplateModeHandler extends AbstractTemplateModeHandler { public static final String TEMPLATE_MODE_NAME = "HTML5"; - public static final String DEFAULT_PATTERN = "*.html"; - - @Property(value = {DEFAULT_PATTERN}, unbounded = PropertyUnbounded.ARRAY) + @Property(unbounded = PropertyUnbounded.ARRAY) public static final String PATTERNS_PARAMETER = "org.apache.sling.scripting.thymeleaf.internal.templatemodehandler.Html5TemplateModeHandler.patterns"; public Html5TemplateModeHandler() { super(TEMPLATE_MODE_NAME, new XhtmlAndHtml5NonValidatingSAXTemplateParser(poolSize()), new XhtmlHtml5TemplateWriter()); } - protected synchronized void configure(final ComponentContext componentContext) { + protected void configure(final ComponentContext componentContext) { final Dictionary properties = componentContext.getProperties(); - final String[] strings = PropertiesUtil.toStringArray(properties.get(PATTERNS_PARAMETER), new String[]{DEFAULT_PATTERN}); + final String[] strings = PropertiesUtil.toStringArray(properties.get(PATTERNS_PARAMETER), new String[]{}); configurePatternSpec(strings); } diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/LegacyHtml5TemplateModeHandler.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/LegacyHtml5TemplateModeHandler.java index cfb91b9..dc92716 100644 --- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/LegacyHtml5TemplateModeHandler.java +++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/LegacyHtml5TemplateModeHandler.java @@ -21,6 +21,7 @@ package org.apache.sling.scripting.thymeleaf.internal.templatemodehandler; import java.util.Dictionary; import org.apache.felix.scr.annotations.Component; +import org.apache.felix.scr.annotations.ConfigurationPolicy; import org.apache.felix.scr.annotations.Properties; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.PropertyUnbounded; @@ -35,7 +36,8 @@ import org.thymeleaf.templatewriter.XmlTemplateWriter; label = "Apache Sling Scripting Thymeleaf “Legacy HTML5 Template Mode Handler”", description = "legacy HTML5 template mode handler for Sling Scripting Thymeleaf", immediate = true, - metatype = true + metatype = true, + policy = ConfigurationPolicy.REQUIRE ) @Service @Properties({ @@ -46,18 +48,16 @@ public class LegacyHtml5TemplateModeHandler extends AbstractTemplateModeHandler public static final String TEMPLATE_MODE_NAME = "LEGACYHTML5"; - public static final String DEFAULT_PATTERN = "*.html"; - - @Property(value = {DEFAULT_PATTERN}, unbounded = PropertyUnbounded.ARRAY) + @Property(unbounded = PropertyUnbounded.ARRAY) public static final String PATTERNS_PARAMETER = "org.apache.sling.scripting.thymeleaf.internal.templatemodehandler.LegacyHtml5TemplateModeHandler.patterns"; public LegacyHtml5TemplateModeHandler() { super(TEMPLATE_MODE_NAME, new LegacyHtml5TemplateParser(TEMPLATE_MODE_NAME, poolSize()), new XmlTemplateWriter()); } - protected synchronized void configure(final ComponentContext componentContext) { + protected void configure(final ComponentContext componentContext) { final Dictionary properties = componentContext.getProperties(); - final String[] strings = PropertiesUtil.toStringArray(properties.get(PATTERNS_PARAMETER), new String[]{DEFAULT_PATTERN}); + final String[] strings = PropertiesUtil.toStringArray(properties.get(PATTERNS_PARAMETER), new String[]{}); configurePatternSpec(strings); } diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/ValidatingXhtmlTemplateModeHandler.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/ValidatingXhtmlTemplateModeHandler.java index 72e511f..8c4bc59 100644 --- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/ValidatingXhtmlTemplateModeHandler.java +++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/ValidatingXhtmlTemplateModeHandler.java @@ -21,6 +21,7 @@ package org.apache.sling.scripting.thymeleaf.internal.templatemodehandler; import java.util.Dictionary; import org.apache.felix.scr.annotations.Component; +import org.apache.felix.scr.annotations.ConfigurationPolicy; import org.apache.felix.scr.annotations.Properties; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.PropertyUnbounded; @@ -35,7 +36,8 @@ import org.thymeleaf.templatewriter.XhtmlHtml5TemplateWriter; label = "Apache Sling Scripting Thymeleaf “Validating XHTML Template Mode Handler”", description = "validating XHTML template mode handler for Sling Scripting Thymeleaf", immediate = true, - metatype = true + metatype = true, + policy = ConfigurationPolicy.REQUIRE ) @Service @Properties({ @@ -46,18 +48,16 @@ public class ValidatingXhtmlTemplateModeHandler extends AbstractTemplateModeHand public static final String TEMPLATE_MODE_NAME = "VALIDXHTML"; - public static final String DEFAULT_PATTERN = "*.xhtml"; - - @Property(value = {DEFAULT_PATTERN}, unbounded = PropertyUnbounded.ARRAY) + @Property(unbounded = PropertyUnbounded.ARRAY) public static final String PATTERNS_PARAMETER = "org.apache.sling.scripting.thymeleaf.internal.templatemodehandler.ValidatingXhtmlTemplateModeHandler.patterns"; public ValidatingXhtmlTemplateModeHandler() { super(TEMPLATE_MODE_NAME, new XhtmlAndHtml5NonValidatingSAXTemplateParser(poolSize()), new XhtmlHtml5TemplateWriter()); } - protected synchronized void configure(final ComponentContext componentContext) { + protected void configure(final ComponentContext componentContext) { final Dictionary properties = componentContext.getProperties(); - final String[] strings = PropertiesUtil.toStringArray(properties.get(PATTERNS_PARAMETER), new String[]{DEFAULT_PATTERN}); + final String[] strings = PropertiesUtil.toStringArray(properties.get(PATTERNS_PARAMETER), new String[]{}); configurePatternSpec(strings); } diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/ValidatingXmlTemplateModeHandler.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/ValidatingXmlTemplateModeHandler.java index 496b609..c92fe86 100644 --- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/ValidatingXmlTemplateModeHandler.java +++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/ValidatingXmlTemplateModeHandler.java @@ -21,6 +21,7 @@ package org.apache.sling.scripting.thymeleaf.internal.templatemodehandler; import java.util.Dictionary; import org.apache.felix.scr.annotations.Component; +import org.apache.felix.scr.annotations.ConfigurationPolicy; import org.apache.felix.scr.annotations.Properties; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.PropertyUnbounded; @@ -35,7 +36,8 @@ import org.thymeleaf.templatewriter.XmlTemplateWriter; label = "Apache Sling Scripting Thymeleaf “Validating XML Template Mode Handler”", description = "validating XML template mode handler for Sling Scripting Thymeleaf", immediate = true, - metatype = true + metatype = true, + policy = ConfigurationPolicy.REQUIRE ) @Service @Properties({ @@ -46,18 +48,16 @@ public class ValidatingXmlTemplateModeHandler extends AbstractTemplateModeHandle public static final String TEMPLATE_MODE_NAME = "VALIDXML"; - public static final String DEFAULT_PATTERN = "*.xml"; - - @Property(value = {DEFAULT_PATTERN}, unbounded = PropertyUnbounded.ARRAY) + @Property(unbounded = PropertyUnbounded.ARRAY) public static final String PATTERNS_PARAMETER = "org.apache.sling.scripting.thymeleaf.internal.templatemodehandler.ValidatingXmlTemplateModeHandler.patterns"; public ValidatingXmlTemplateModeHandler() { super(TEMPLATE_MODE_NAME, new XmlValidatingSAXTemplateParser(poolSize()), new XmlTemplateWriter()); } - protected synchronized void configure(final ComponentContext componentContext) { + protected void configure(final ComponentContext componentContext) { final Dictionary properties = componentContext.getProperties(); - final String[] strings = PropertiesUtil.toStringArray(properties.get(PATTERNS_PARAMETER), new String[]{DEFAULT_PATTERN}); + final String[] strings = PropertiesUtil.toStringArray(properties.get(PATTERNS_PARAMETER), new String[]{}); configurePatternSpec(strings); } diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/XhtmlTemplateModeHandler.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/XhtmlTemplateModeHandler.java index 6f8a9ed..9d0cd2f 100644 --- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/XhtmlTemplateModeHandler.java +++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/XhtmlTemplateModeHandler.java @@ -21,6 +21,7 @@ package org.apache.sling.scripting.thymeleaf.internal.templatemodehandler; import java.util.Dictionary; import org.apache.felix.scr.annotations.Component; +import org.apache.felix.scr.annotations.ConfigurationPolicy; import org.apache.felix.scr.annotations.Properties; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.PropertyUnbounded; @@ -35,7 +36,8 @@ import org.thymeleaf.templatewriter.XhtmlHtml5TemplateWriter; label = "Apache Sling Scripting Thymeleaf “XHTML Template Mode Handler”", description = "XHTML template mode handler for Sling Scripting Thymeleaf", immediate = true, - metatype = true + metatype = true, + policy = ConfigurationPolicy.REQUIRE ) @Service @Properties({ @@ -46,18 +48,16 @@ public class XhtmlTemplateModeHandler extends AbstractTemplateModeHandler { public static final String TEMPLATE_MODE_NAME = "XHTML"; - public static final String DEFAULT_PATTERN = "*.xhtml"; - - @Property(value = {DEFAULT_PATTERN}, unbounded = PropertyUnbounded.ARRAY) + @Property(unbounded = PropertyUnbounded.ARRAY) public static final String PATTERNS_PARAMETER = "org.apache.sling.scripting.thymeleaf.internal.templatemodehandler.XhtmlTemplateModeHandler.patterns"; public XhtmlTemplateModeHandler() { super(TEMPLATE_MODE_NAME, new XhtmlAndHtml5NonValidatingSAXTemplateParser(poolSize()), new XhtmlHtml5TemplateWriter()); } - protected synchronized void configure(final ComponentContext componentContext) { + protected void configure(final ComponentContext componentContext) { final Dictionary properties = componentContext.getProperties(); - final String[] strings = PropertiesUtil.toStringArray(properties.get(PATTERNS_PARAMETER), new String[]{DEFAULT_PATTERN}); + final String[] strings = PropertiesUtil.toStringArray(properties.get(PATTERNS_PARAMETER), new String[]{}); configurePatternSpec(strings); } diff --git a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/XmlTemplateModeHandler.java b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/XmlTemplateModeHandler.java index 2b27e71..d55c8a9 100644 --- a/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/XmlTemplateModeHandler.java +++ b/src/main/java/org/apache/sling/scripting/thymeleaf/internal/templatemodehandler/XmlTemplateModeHandler.java @@ -21,6 +21,7 @@ package org.apache.sling.scripting.thymeleaf.internal.templatemodehandler; import java.util.Dictionary; import org.apache.felix.scr.annotations.Component; +import org.apache.felix.scr.annotations.ConfigurationPolicy; import org.apache.felix.scr.annotations.Properties; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.PropertyUnbounded; @@ -35,7 +36,8 @@ import org.thymeleaf.templatewriter.XmlTemplateWriter; label = "Apache Sling Scripting Thymeleaf “XML Template Mode Handler”", description = "XML template mode handler for Sling Scripting Thymeleaf", immediate = true, - metatype = true + metatype = true, + policy = ConfigurationPolicy.REQUIRE ) @Service @Properties({ @@ -46,18 +48,16 @@ public class XmlTemplateModeHandler extends AbstractTemplateModeHandler { public static final String TEMPLATE_MODE_NAME = "XML"; - public static final String DEFAULT_PATTERN = "*.xml"; - - @Property(value = {DEFAULT_PATTERN}, unbounded = PropertyUnbounded.ARRAY) + @Property(unbounded = PropertyUnbounded.ARRAY) public static final String PATTERNS_PARAMETER = "org.apache.sling.scripting.thymeleaf.internal.templatemodehandler.XmlTemplateModeHandler.patterns"; public XmlTemplateModeHandler() { super(TEMPLATE_MODE_NAME, new XmlNonValidatingSAXTemplateParser(poolSize()), new XmlTemplateWriter()); } - protected synchronized void configure(final ComponentContext componentContext) { + protected void configure(final ComponentContext componentContext) { final Dictionary properties = componentContext.getProperties(); - final String[] strings = PropertiesUtil.toStringArray(properties.get(PATTERNS_PARAMETER), new String[]{DEFAULT_PATTERN}); + final String[] strings = PropertiesUtil.toStringArray(properties.get(PATTERNS_PARAMETER), new String[]{}); configurePatternSpec(strings); } -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
