This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
The following commit(s) were added to refs/heads/master by this push:
new c966c3bc Update to latest parent pom
c966c3bc is described below
commit c966c3bc8c85f8e07d80e68b91d0fdf4c7f94d2d
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Mon Oct 2 09:25:16 2023 +0200
Update to latest parent pom
---
mdresourcedecorator/pom.xml | 10 ++++-----
.../mdresource/impl/MarkdownResourceDecorator.java | 26 ++++++++++++++++------
sfsresourceprovider/pom.xml | 15 ++++++-------
3 files changed, 30 insertions(+), 21 deletions(-)
diff --git a/mdresourcedecorator/pom.xml b/mdresourcedecorator/pom.xml
index e10b07c0..c0dda10d 100644
--- a/mdresourcedecorator/pom.xml
+++ b/mdresourcedecorator/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling-bundle-parent</artifactId>
- <version>49</version>
+ <version>52</version>
<relativePath/>
</parent>
@@ -44,13 +44,11 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.component.annotations</artifactId>
- <version>1.5.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.metatype.annotations</artifactId>
- <version>1.4.1</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -61,13 +59,13 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
- <version>2.27.0</version>
+ <version>2.27.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>flexmark-osgi</artifactId>
- <version>0.62.2</version>
+ <version>0.64.8</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -85,7 +83,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
- <version>4.8.0</version>
+ <version>5.5.0</version>
<scope>test</scope>
</dependency>
diff --git
a/mdresourcedecorator/src/main/java/org/apache/sling/mdresource/impl/MarkdownResourceDecorator.java
b/mdresourcedecorator/src/main/java/org/apache/sling/mdresource/impl/MarkdownResourceDecorator.java
index eb972bec..a2028267 100644
---
a/mdresourcedecorator/src/main/java/org/apache/sling/mdresource/impl/MarkdownResourceDecorator.java
+++
b/mdresourcedecorator/src/main/java/org/apache/sling/mdresource/impl/MarkdownResourceDecorator.java
@@ -48,14 +48,17 @@ import org.slf4j.LoggerFactory;
@Designate(ocd = MarkdownResourceDecorator.Config.class, factory = true)
public class MarkdownResourceDecorator implements ResourceDecorator {
-
- @ObjectClassDefinition(name = "Apache Sling Markdown Resource
Decorator")
+ @ObjectClassDefinition(name = "Apache Sling Markdown Resource Decorator")
public @interface Config {
@AttributeDefinition(name = "Decoration Paths",
description = "Resources contained in the tree below these
paths are decorated. Patterns are supported, e.g. \"/content/**.md\".")
String[] decoration_paths();
+ @AttributeDefinition(name = "Decoration Extensions",
+ description = "Only resources with these extensions are
decorated. If set to \"*\" all resources match.")
+ String[] decoration_extensions() default {"md"};
+
@AttributeDefinition(name = "Decoration Resource Types",
description = "Only resources with these resource types are
decorated. If set to \"*\" all resources match.")
String[] decoration_types() default {RESOURCE_TYPE_FILE};
@@ -91,21 +94,28 @@ public class MarkdownResourceDecorator implements
ResourceDecorator {
@AttributeDefinition(name = "Rewrite Links",
description = "If enabled, links in the markdown are
rewritten.")
boolean rewrite_links() default true;
- }
+ }
- public static final Logger LOGGER =
LoggerFactory.getLogger(MarkdownResourceDecorator.class);
+ public static final Logger LOGGER =
LoggerFactory.getLogger(MarkdownResourceDecorator.class);
private static final String RESOURCE_TYPE_FILE = "nt:file";
private final PathSet paths;
private final Set<String> resourceTypes;
private final ResourceConfiguration config = new ResourceConfiguration();
+ private final Set<String> extensions;
@Activate
public MarkdownResourceDecorator(final Config cfg) {
this.paths =
PathSet.fromStringCollection(Arrays.stream(cfg.decoration_paths())
.map(path -> path.contains("*") ?
Path.GLOB_PREFIX.concat(path) : path)
.collect(Collectors.toList()));
+ final Set<String> exts = new
HashSet<>(Arrays.asList(cfg.decoration_extensions()));
+ if (exts.contains("*") ) {
+ this.extensions = null;
+ } else {
+ this.extensions = exts;
+ }
final Set<String> rts = new
HashSet<>(Arrays.asList(cfg.decoration_types()));
if (rts.contains("*") ) {
this.resourceTypes = null;
@@ -134,14 +144,16 @@ public class MarkdownResourceDecorator implements
ResourceDecorator {
if ( (this.resourceTypes == null ||
this.resourceTypes.contains(resource.getResourceType()))
&& this.paths.matches( resource.getPath() ) != null ) {
- return new MarkdownResourceWrapper(resource, this.config);
+ final int pos = resource.getName().lastIndexOf('.');
+ if ( this.extensions == null || (pos != -1 &&
this.extensions.contains(resource.getName().substring(pos + 1))) ) {
+ return new MarkdownResourceWrapper(resource, this.config);
+ }
}
return null;
}
-
@Override
- public @Nullable Resource decorate(@NotNull Resource resource, @NotNull
HttpServletRequest request) {
+ public @Nullable Resource decorate(final @NotNull Resource resource, final
@NotNull HttpServletRequest request) {
// This method is deprecated but just in case....
return this.decorate(null);
}
diff --git a/sfsresourceprovider/pom.xml b/sfsresourceprovider/pom.xml
index b0f193bb..4152184b 100644
--- a/sfsresourceprovider/pom.xml
+++ b/sfsresourceprovider/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling-bundle-parent</artifactId>
- <version>35</version>
+ <version>52</version>
<relativePath/>
</parent>
@@ -26,7 +26,7 @@
<name>Apache Sling Simple File System Resource Provider</name>
<properties>
- <sling.java.version>8</sling.java.version>
+ <sling.java.version>11</sling.java.version>
</properties>
<build>
@@ -45,23 +45,22 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
- <version>2.18.4</version>
+ <version>2.27.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.component.annotations</artifactId>
- <version>1.4.0</version>
- <scope>provided</scope>
+ <artifactId>org.osgi.service.component.annotations</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.metatype.annotations</artifactId>
- <version>1.4.0</version>
+ <artifactId>org.osgi.service.metatype.annotations</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>