FELIX-5072 : Support optional property "pattern" in @SlingFilter annotation. Apply patch from  Georg Henzler

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1708830 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tools/org.apache.felix.scr.annotations/changelog.txt b/tools/org.apache.felix.scr.annotations/changelog.txt
index 3f404bb..35b1dd7 100644
--- a/tools/org.apache.felix.scr.annotations/changelog.txt
+++ b/tools/org.apache.felix.scr.annotations/changelog.txt
@@ -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
diff --git a/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilter.java b/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilter.java
index 32f6b3a..541e651 100644
--- a/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilter.java
+++ b/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilter.java
@@ -52,6 +52,12 @@
     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
diff --git a/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java b/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java
index 9ae20a3..d67655e 100644
--- a/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java
+++ b/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java
@@ -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.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 @@
         }
         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");