incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1060344 - in /sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter: ServletFilterManager.java SlingFilterChainHelper.java
Date Tue, 18 Jan 2011 12:07:37 GMT
Author: cziegeler
Date: Tue Jan 18 12:07:36 2011
New Revision: 1060344

URL: http://svn.apache.org/viewvc?rev=1060344&view=rev
Log:
SLING-1735 : Properly support service.ranking, service.id and filter.order for filter ordering

Modified:
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/ServletFilterManager.java
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/SlingFilterChainHelper.java

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/ServletFilterManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/ServletFilterManager.java?rev=1060344&r1=1060343&r2=1060344&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/ServletFilterManager.java
(original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/ServletFilterManager.java
Tue Jan 18 12:07:36 2011
@@ -130,7 +130,6 @@ public class ServletFilterManager extend
 
     @Override
     public void modifiedService(ServiceReference reference, Object service) {
-        // TODO Auto-generated method stub
         if (service instanceof Filter) {
             destroyFilter(reference, (Filter) service);
             initFilter(reference, (Filter) service);
@@ -171,9 +170,19 @@ public class ServletFilterManager extend
                 // get the order, Integer.MAX_VALUE by default
                 Object orderObj = reference.getProperty(Constants.SERVICE_RANKING);
                 if (orderObj == null) {
+                    // filter order is defined as lower value has higher priority
+                    // while service ranking is the opposite
+                    // In addition we allow different types than Integer
                     orderObj = reference.getProperty(EngineConstants.FILTER_ORDER);
+                    if ( orderObj != null ) {
+                        // we can use 0 as the default as this will be applied in
+                        // the next step anyway if this props contains an invalid
+                        // value
+                        Integer order = OsgiUtil.toInteger(orderObj, 0);
+                        order = order * -1;
+                    }
                 }
-                int order = (orderObj instanceof Integer)
+                final int order = (orderObj instanceof Integer)
                         ? ((Integer) orderObj).intValue()
                         : 0;
 

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/SlingFilterChainHelper.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/SlingFilterChainHelper.java?rev=1060344&r1=1060343&r2=1060344&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/SlingFilterChainHelper.java
(original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/SlingFilterChainHelper.java
Tue Jan 18 12:07:36 2011
@@ -128,11 +128,11 @@ public class SlingFilterChainHelper {
 
     public static class FilterListEntry implements Comparable<FilterListEntry> {
 
-        private Filter filter;
+        private final Filter filter;
 
-        private Long filterId;
+        private final Long filterId;
 
-        private int order;
+        private final int order;
 
         FilterListEntry(Filter filter, Long filterId, int order) {
             this.filter = filter;



Mime
View raw message