FELIX-2957 - Filter scope should be an array
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1124271 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/annotations/changelog.txt b/scrplugin/annotations/changelog.txt
index cfac5a0..5c60008 100644
--- a/scrplugin/annotations/changelog.txt
+++ b/scrplugin/annotations/changelog.txt
@@ -2,6 +2,7 @@
---------------------------
** Bug
+ * [FELIX-2957] - Filter scope should be an array
* [FELIX-2943] - Component generated by @SlingServlet does not match default settings of @Component
** Improvement
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilter.java b/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilter.java
index 2b7aec5..866fdc8 100644
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilter.java
+++ b/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilter.java
@@ -18,11 +18,7 @@
*/
package org.apache.felix.scr.annotations.sling;
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.lang.annotation.*;
/**
* Marks servlet classes as SCR component, and allows to add a
@@ -46,12 +42,12 @@
int order();
/**
- * The scope of a filter.
+ * 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
* component (rendering).
*/
- SlingFilterScope scope() default SlingFilterScope.REQUEST;
+ SlingFilterScope[] scope() default SlingFilterScope.REQUEST;
/**
* Whether to generate a default SCR component tag with. If
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilterScope.java b/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilterScope.java
index 8e6a9db..2befe53 100644
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilterScope.java
+++ b/scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilterScope.java
@@ -45,4 +45,10 @@
public String getScope() {
return this.scope;
}
+
+ @Override
+ public String toString() {
+ return this.getScope();
+ }
+
}
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingAnnotationTagProvider.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingAnnotationTagProvider.java
index 5f37691..1ef1fa9 100644
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingAnnotationTagProvider.java
+++ b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingAnnotationTagProvider.java
@@ -21,7 +21,8 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.felix.scr.annotations.sling.*;
+import org.apache.felix.scr.annotations.sling.SlingFilter;
+import org.apache.felix.scr.annotations.sling.SlingServlet;
import org.apache.felix.scrplugin.tags.JavaField;
import org.apache.felix.scrplugin.tags.JavaTag;
import org.apache.felix.scrplugin.tags.annotation.*;
@@ -144,8 +145,8 @@
tags.add(new SlingServletPropertyTag(annotation, "service.ranking", String.valueOf(order), description, "Integer", true));
// property scope
- final SlingFilterScope scope = Util.getEnumValue(annotation, "scope", SlingFilterScope.class, SlingFilter.class);
- tags.add(new SlingServletPropertyTag(annotation, "sling.filter.scope", scope.getScope(), description, null, true));
+ final String[] scopes = Util.getAnnotationValues(annotation, "scope", description);
+ tags.add(new SlingServletPropertyTag(annotation, "sling.filter.scope", scopes, description, true));
}
return tags;
diff --git a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingServletPropertyTag.java b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingServletPropertyTag.java
index e17533c..4064911 100644
--- a/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingServletPropertyTag.java
+++ b/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/tags/annotation/sling/SlingServletPropertyTag.java
@@ -52,6 +52,19 @@
/**
* @param name Property name
+ * @param values Property values
+ * @param desc Description
+ */
+ public SlingServletPropertyTag(Annotation annotation, String name, String[] values, JavaClassDescription desc, final boolean isPrivate) {
+ super(annotation, desc, null);
+ this.name = name;
+ this.values = values;
+ this.type = null;
+ this.isPrivate = isPrivate;
+ }
+
+ /**
+ * @param name Property name
* @param value Property value
* @param desc Description
*/