felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1626545 - in /felix/trunk/scrplugin/annotations: changelog.txt src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java
Date Sun, 21 Sep 2014 09:14:47 GMT
Author: cziegeler
Date: Sun Sep 21 09:14:47 2014
New Revision: 1626545

URL: http://svn.apache.org/r1626545
Log:
FELIX-4648 : SlingAnnotationProcessor.processSlingFilter cannot deal with multiple scopes

Modified:
    felix/trunk/scrplugin/annotations/changelog.txt
    felix/trunk/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java

Modified: felix/trunk/scrplugin/annotations/changelog.txt
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/annotations/changelog.txt?rev=1626545&r1=1626544&r2=1626545&view=diff
==============================================================================
--- felix/trunk/scrplugin/annotations/changelog.txt (original)
+++ felix/trunk/scrplugin/annotations/changelog.txt Sun Sep 21 09:14:47 2014
@@ -1,3 +1,9 @@
+Changes from 1.9.10 to 1.9.8
+----------------------------
+** Bug
+    * [FELIX-4648] - SlingAnnotationProcessor.processSlingFilter cannot deal with multiple
scopes
+
+
 Changes from 1.9.8 to 1.9.6
 ---------------------------
 ** Improvement

Modified: felix/trunk/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java?rev=1626545&r1=1626544&r2=1626545&view=diff
==============================================================================
--- felix/trunk/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java
(original)
+++ felix/trunk/scrplugin/annotations/src/main/java/org/apache/felix/scrplugin/processing/SlingAnnotationProcessor.java
Sun Sep 21 09:14:47 2014
@@ -188,10 +188,41 @@ public class SlingAnnotationProcessor im
         classDescription.add(pd);
 
         // property scope
-        final String scope = cad.getEnumValue("scope", SlingFilterScope.REQUEST.getScope());
+        final String[] scopes;
+        final Object val = cad.getValue("scope");
+        if ( val != null ) {
+            if ( val instanceof String[] ) {
+                final String[] arr = (String[])val;
+                scopes = new String[arr.length / 2];
+                int i = 0;
+                int index = 0;
+                while ( i < arr.length) {
+                    scopes[index] = arr[i];
+                    i+=2;
+                    index++;
+                }
+            } else if ( val instanceof String[][] ) {
+                final String[][] arr = (String[][])val;
+                scopes = new String[arr.length];
+                int index = 0;
+                while ( index < arr.length) {
+                    scopes[index] = arr[index][1];
+                    index++;
+                }
+            } else {
+                scopes = new String[] { val.toString()};
+            }
+        } else {
+            scopes = new String[] {SlingFilterScope.REQUEST.getScope()};
+        }
+
         final PropertyDescription pd2 = new PropertyDescription(cad);
         pd2.setName("sling.filter.scope");
-        pd2.setValue(scope);
+        if ( scopes.length == 1 ) {
+            pd2.setValue(scopes[0]);
+        } else {
+            pd2.setMultiValue(scopes);
+        }
         pd2.setType(PropertyType.String);
         if (metatype) {
             pd2.setPrivate(true);



Mime
View raw message