karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [06/11] git commit: [KARAF-2875] Remove useless StringMap class from main
Date Tue, 01 Apr 2014 11:43:39 GMT
[KARAF-2875] Remove useless StringMap class from main


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/f692ea2f
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/f692ea2f
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/f692ea2f

Branch: refs/heads/master
Commit: f692ea2f2fa345c9ee51d8af1806fe3b293055e9
Parents: 9923448
Author: Guillaume Nodet <gnodet@gmail.com>
Authored: Mon Mar 31 22:51:04 2014 +0200
Committer: Guillaume Nodet <gnodet@gmail.com>
Committed: Tue Apr 1 10:14:57 2014 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/karaf/main/Main.java   |   3 +-
 .../org/apache/karaf/main/util/StringMap.java   | 103 -------------------
 .../apache/karaf/main/util/StringMapTest.java   |  39 -------
 3 files changed, 1 insertion(+), 144 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/f692ea2f/main/src/main/java/org/apache/karaf/main/Main.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/Main.java b/main/src/main/java/org/apache/karaf/main/Main.java
index 69ce6e2..313eea2 100644
--- a/main/src/main/java/org/apache/karaf/main/Main.java
+++ b/main/src/main/java/org/apache/karaf/main/Main.java
@@ -45,7 +45,6 @@ import org.apache.karaf.main.lock.NoLock;
 import org.apache.karaf.main.util.ArtifactResolver;
 import org.apache.karaf.main.util.BootstrapLogManager;
 import org.apache.karaf.main.util.SimpleMavenResolver;
-import org.apache.karaf.main.util.StringMap;
 import org.apache.karaf.main.util.Utils;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -237,7 +236,7 @@ public class Main {
         // Start up the OSGI framework
         ClassLoader classLoader = createClassLoader(resolver);
         FrameworkFactory factory = loadFrameworkFactory(classLoader);
-        framework = factory.newFramework(new StringMap(config.props, false));
+        framework = factory.newFramework(config.props);
 
         // Hack to set felix logger
         try {

http://git-wip-us.apache.org/repos/asf/karaf/blob/f692ea2f/main/src/main/java/org/apache/karaf/main/util/StringMap.java
----------------------------------------------------------------------
diff --git a/main/src/main/java/org/apache/karaf/main/util/StringMap.java b/main/src/main/java/org/apache/karaf/main/util/StringMap.java
deleted file mode 100644
index e322966..0000000
--- a/main/src/main/java/org/apache/karaf/main/util/StringMap.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.karaf.main.util;
-
-import java.util.Comparator;
-import java.util.Map;
-import java.util.TreeMap;
-
-/**
- * Simple utility class that creates a map for string-based keys by
- * extending <tt>TreeMap</tt>. This map can be set to use case-sensitive
- * or case-insensitive comparison when searching for the key.
- * Any keys put into this map will be converted to
- * a <tt>String</tt> using the <tt>toString()</tt> method,
- * since it is only intended to compare strings.
-**/
-public class StringMap extends TreeMap<String, String>
-{
-    /**
-	 * 
-	 */
-	private static final long serialVersionUID = 1L;
-
-	public StringMap()
-    {
-        this(true);
-    }
-
-    public StringMap(boolean caseSensitive)
-    {
-        super(new StringComparator(caseSensitive));
-    }
-
-    @SuppressWarnings("unchecked")
-	public StringMap(Map<?, ?> map, boolean caseSensitive)
-    {
-        this(caseSensitive);
-        putAll((Map<? extends String, ? extends String>) map);
-    }
-
-    public String put(String key, String value)
-    {
-        return super.put(key.toString(), value);
-    }
-
-    public boolean isCaseSensitive()
-    {
-        return ((StringComparator) comparator()).isCaseSensitive();
-    }
-
-    public void setCaseSensitive(boolean b)
-    {
-        ((StringComparator) comparator()).setCaseSensitive(b);
-    }
-
-    private static class StringComparator implements Comparator<String>
-    {
-        private boolean m_isCaseSensitive = true;
-
-        public StringComparator(boolean b)
-        {
-            m_isCaseSensitive = b;
-        }
-
-        public int compare(String o1, String o2)
-        {
-            if (m_isCaseSensitive)
-            {
-                return o1.toString().compareTo(o2.toString());
-            }
-            else
-            {
-                return o1.toString().compareToIgnoreCase(o2.toString());
-            }
-        }
-
-        public boolean isCaseSensitive()
-        {
-            return m_isCaseSensitive;
-        }
-
-        public void setCaseSensitive(boolean b)
-        {
-            m_isCaseSensitive = b;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/f692ea2f/main/src/test/java/org/apache/karaf/main/util/StringMapTest.java
----------------------------------------------------------------------
diff --git a/main/src/test/java/org/apache/karaf/main/util/StringMapTest.java b/main/src/test/java/org/apache/karaf/main/util/StringMapTest.java
deleted file mode 100644
index 56f1379..0000000
--- a/main/src/test/java/org/apache/karaf/main/util/StringMapTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.karaf.main.util;
-
-import org.apache.karaf.main.util.StringMap;
-
-import junit.framework.TestCase;
-
-/**
- * Test cased for {@link org.apache.karaf.main.util.StringMap}
- */
-public class StringMapTest extends TestCase {
-
-    public void testCaseInsensitiveStringMap() throws Exception {
-        StringMap sm = new StringMap(false);
-        String value = new String("value");
-        sm.put("key", value);
-        Object result = sm.get("Key");
-        assertFalse(result == null);
-        assertTrue(result.equals(value));
-    }
-
-}


Mime
View raw message