felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r938241 - in /felix/trunk/framework/src/main/java/org/apache/felix/framework: capabilityset/CapabilitySet.java util/StringComparator.java util/StringMap.java
Date Mon, 26 Apr 2010 21:07:13 GMT
Author: rickhall
Date: Mon Apr 26 21:07:12 2010
New Revision: 938241

URL: http://svn.apache.org/viewvc?rev=938241&view=rev
Log:
CapabilitySet should ignore case when indexing attributes, since this
is necessary for service properties. (FELIX-2040)

Added:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/util/StringComparator.java
Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/util/StringMap.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java?rev=938241&r1=938240&r2=938241&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
Mon Apr 26 21:07:12 2010
@@ -29,11 +29,13 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.TreeMap;
+import org.apache.felix.framework.util.StringComparator;
 
 public class CapabilitySet
 {
     private final Map<String, Map<Object, Set<Capability>>> m_indices =
-        new HashMap<String, Map<Object, Set<Capability>>>();
+        new TreeMap<String, Map<Object, Set<Capability>>>(new StringComparator(false));
     private final Set<Capability> m_capList = new HashSet<Capability>();
 
     public CapabilitySet(List<String> indexProps)

Added: felix/trunk/framework/src/main/java/org/apache/felix/framework/util/StringComparator.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/StringComparator.java?rev=938241&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/util/StringComparator.java
(added)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/util/StringComparator.java
Mon Apr 26 21:07:12 2010
@@ -0,0 +1,48 @@
+/*
+ * 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
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.framework.util;
+
+import java.util.Comparator;
+
+public class StringComparator implements Comparator
+{
+    private final boolean m_isCaseSensitive;
+
+    public StringComparator(boolean b)
+    {
+        m_isCaseSensitive = b;
+    }
+
+    public int compare(Object o1, Object o2)
+    {
+        if (m_isCaseSensitive)
+        {
+            return o1.toString().compareTo(o2.toString());
+        }
+        else
+        {
+            return o1.toString().compareToIgnoreCase(o2.toString());
+        }
+    }
+
+    public boolean isCaseSensitive()
+    {
+        return m_isCaseSensitive;
+    }
+}
\ No newline at end of file

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/util/StringMap.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/StringMap.java?rev=938241&r1=938240&r2=938241&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/util/StringMap.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/util/StringMap.java Mon
Apr 26 21:07:12 2010
@@ -131,31 +131,4 @@ public class StringMap implements Map
     {
         return m_map.toString();
     }
-
-    private static class StringComparator implements Comparator
-    {
-        private final boolean m_isCaseSensitive;
-
-        public StringComparator(boolean b)
-        {
-            m_isCaseSensitive = b;
-        }
-
-        public int compare(Object o1, Object o2)
-        {
-            if (m_isCaseSensitive)
-            {
-                return o1.toString().compareTo(o2.toString());
-            }
-            else
-            {
-                return o1.toString().compareToIgnoreCase(o2.toString());
-            }
-        }
-
-        public boolean isCaseSensitive()
-        {
-            return m_isCaseSensitive;
-        }
-    }
 }
\ No newline at end of file



Mime
View raw message