You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2015/10/15 16:49:36 UTC
svn commit: r1708830 - in
/felix/trunk/tools/org.apache.felix.scr.annotations: changelog.txt
src/main/java/org/apache/felix/scr/annotations/sling/SlingFilter.java
src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java
Author: cziegeler
Date: Thu Oct 15 14:49:36 2015
New Revision: 1708830
URL: http://svn.apache.org/viewvc?rev=1708830&view=rev
Log:
FELIX-5072 : Support optional property "pattern" in @SlingFilter annotation. Apply patch from Georg Henzler
Modified:
felix/trunk/tools/org.apache.felix.scr.annotations/changelog.txt
felix/trunk/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilter.java
felix/trunk/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java
Modified: felix/trunk/tools/org.apache.felix.scr.annotations/changelog.txt
URL: http://svn.apache.org/viewvc/felix/trunk/tools/org.apache.felix.scr.annotations/changelog.txt?rev=1708830&r1=1708829&r2=1708830&view=diff
==============================================================================
--- felix/trunk/tools/org.apache.felix.scr.annotations/changelog.txt (original)
+++ felix/trunk/tools/org.apache.felix.scr.annotations/changelog.txt Thu Oct 15 14:49:36 2015
@@ -1,3 +1,9 @@
+Changes from 1.10.0 to 1.9.12
+-----------------------------
+** Improvement
+ * [FELIX-5072] - Support optional property "pattern" in @SlingFilter annotation
+
+
Changes from 1.9.12 to 1.9.10
-----------------------------
** Improvement
Modified: felix/trunk/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilter.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilter.java?rev=1708830&r1=1708829&r2=1708830&view=diff
==============================================================================
--- felix/trunk/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilter.java (original)
+++ felix/trunk/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilter.java Thu Oct 15 14:49:36 2015
@@ -52,6 +52,12 @@ public @interface SlingFilter {
int order();
/**
+ * Restrict the filter to paths that match the supplied regular expression. Requires Sling Engine 2.4.0.
+ * @since 1.10.0
+ */
+ String pattern() default "";
+
+ /**
* The scopes of a filter.
* If the filter has request scope, it is run once for a request.
* If the filter has component scope, it is run once for every included
Modified: felix/trunk/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/felix/trunk/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java?rev=1708830&r1=1708829&r2=1708830&view=diff
==============================================================================
--- felix/trunk/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java (original)
+++ felix/trunk/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java Thu Oct 15 14:49:36 2015
@@ -1,5 +1,5 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
@@ -34,6 +34,7 @@ import org.apache.felix.scrplugin.descri
import org.apache.felix.scrplugin.description.PropertyDescription;
import org.apache.felix.scrplugin.description.PropertyType;
import org.apache.felix.scrplugin.description.ServiceDescription;
+import org.apache.felix.scrplugin.helper.StringUtils;
/**
* This is the processor for the Apache Felix Sling annotations.
@@ -187,6 +188,19 @@ public class SlingAnnotationProcessor im
}
classDescription.add(pd);
+ // property pattern = sling.filter.pattern
+ final String pattern = cad.getStringValue("pattern", "");
+ if(!StringUtils.isEmpty(pattern)) {
+ final PropertyDescription pdPattern = new PropertyDescription(cad);
+ pdPattern.setName("sling.filter.pattern");
+ pdPattern.setValue(pattern);
+ pdPattern.setType(PropertyType.String);
+ if (metatype) {
+ pdPattern.setPrivate(true);
+ }
+ classDescription.add(pdPattern);
+ }
+
// property scope
final String[] scopes;
final Object val = cad.getValue("scope");