incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r815667 - in /sling/trunk/contrib/extensions/rewriter: pom.xml src/main/java/org/apache/sling/rewriter/impl/FactoryCache.java
Date Wed, 16 Sep 2009 08:40:57 GMT
Author: cziegeler
Date: Wed Sep 16 08:40:57 2009
New Revision: 815667

URL: http://svn.apache.org/viewvc?rev=815667&view=rev
Log:
Allow global transformers to specify conditions when they apply

Modified:
    sling/trunk/contrib/extensions/rewriter/pom.xml
    sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/FactoryCache.java

Modified: sling/trunk/contrib/extensions/rewriter/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/rewriter/pom.xml?rev=815667&r1=815666&r2=815667&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/rewriter/pom.xml (original)
+++ sling/trunk/contrib/extensions/rewriter/pom.xml Wed Sep 16 08:40:57 2009
@@ -89,6 +89,12 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.osgi</artifactId>
+            <version>2.0.4-incubator</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.commons.html</artifactId>
             <version>0.9.0-SNAPSHOT</version>
             <scope>provided</scope>

Modified: sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/FactoryCache.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/FactoryCache.java?rev=815667&r1=815666&r2=815667&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/FactoryCache.java
(original)
+++ sling/trunk/contrib/extensions/rewriter/src/main/java/org/apache/sling/rewriter/impl/FactoryCache.java
Wed Sep 16 08:40:57 2009
@@ -421,36 +421,7 @@
         public static ServiceReferenceComparator INSTANCE = new ServiceReferenceComparator();
 
         public int compare(ServiceReference o1, ServiceReference o2) {
-
-            Long id = (Long) o1.getProperty(Constants.SERVICE_ID);
-            Long otherId = (Long) o2.getProperty(Constants.SERVICE_ID);
-
-            if (id.equals(otherId)) {
-                return 0; // same service
-            }
-
-            Object rankObj = o1.getProperty(Constants.SERVICE_RANKING);
-            Object otherRankObj = o2.getProperty(Constants.SERVICE_RANKING);
-
-            // If no rank, then spec says it defaults to zero.
-            rankObj = (rankObj == null) ? new Integer(0) : rankObj;
-            otherRankObj = (otherRankObj == null) ? new Integer(0) : otherRankObj;
-
-            // If rank is not Integer, then spec says it defaults to zero.
-            Integer rank = !(rankObj instanceof Integer)
-                ? new Integer(0) : (Integer) rankObj;
-            Integer otherRank = !(otherRankObj instanceof Integer)
-                ? new Integer(0) : (Integer) otherRankObj;
-
-            // Sort by rank in ascending order.
-            if (rank.compareTo(otherRank) < 0) {
-                return -1; // lower rank
-            } else if (rank.compareTo(otherRank) > 0) {
-                return 1; // higher rank
-            }
-
-            // If ranks are equal, then sort by service id in descending order.
-            return (id.compareTo(otherId) < 0) ? 1 : -1;
+            return o1.compareTo(o2);
         }
     }
 



Mime
View raw message