You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2010/10/14 23:20:51 UTC

svn commit: r1022720 - in /felix/trunk/framework/src/main/java/org/apache/felix/framework: ModuleImpl.java ServiceRegistrationImpl.java resolver/ResolverImpl.java util/IteratorToEnumeration.java util/MapToDictionary.java util/Util.java

Author: rickhall
Date: Thu Oct 14 21:20:50 2010
New Revision: 1022720

URL: http://svn.apache.org/viewvc?rev=1022720&view=rev
Log:
Code cleanup (e.g., remove IteratorToEnumeration class).

Removed:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/util/IteratorToEnumeration.java
Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/util/MapToDictionary.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java?rev=1022720&r1=1022719&r2=1022720&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java Thu Oct 14 21:20:50 2010
@@ -56,7 +56,6 @@ import org.apache.felix.framework.resolv
 import org.apache.felix.framework.resolver.WireModuleImpl;
 import org.apache.felix.framework.util.CompoundEnumeration;
 import org.apache.felix.framework.util.FelixConstants;
-import org.apache.felix.framework.util.IteratorToEnumeration;
 import org.apache.felix.framework.util.SecureAction;
 import org.apache.felix.framework.util.SecurityManagerEx;
 import org.apache.felix.framework.util.Util;
@@ -1036,7 +1035,7 @@ public class ModuleImpl implements Modul
             }
         }
 
-        return new IteratorToEnumeration(l.iterator());
+        return Collections.enumeration(l);
     }
 
     // TODO: API: Investigate how to handle this better, perhaps we need
@@ -1730,7 +1729,7 @@ public class ModuleImpl implements Modul
                     }
                     localURLs.add(url);
                 }
-                urls = new IteratorToEnumeration(localURLs.iterator());
+                urls = Collections.enumeration(localURLs);
             }
             return urls;
         }
@@ -2284,7 +2283,7 @@ public class ModuleImpl implements Modul
                 wire = null;
             }
 
-            String exporter = (exporters.size() == 0)
+            String exporter = (exporters.isEmpty())
                 ? null : exporters.iterator().next().getModule().getBundle().toString();
 
             StringBuffer sb = new StringBuffer("*** Class '");

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java?rev=1022720&r1=1022719&r2=1022720&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java Thu Oct 14 21:20:50 2010
@@ -415,7 +415,7 @@ class ServiceRegistrationImpl implements
 
         public List<Directive> getDirectives()
         {
-            return Util.m_emptyList;
+            return Collections.EMPTY_LIST;
         }
 
         public Attribute getAttribute(String name)
@@ -426,12 +426,12 @@ class ServiceRegistrationImpl implements
 
         public List<Attribute> getAttributes()
         {
-            return Util.m_emptyList;
+            return Collections.EMPTY_LIST;
         }
 
         public List<String> getUses()
         {
-            return Util.m_emptyList;
+            return Collections.EMPTY_LIST;
         }
 
         public Object getProperty(String s)

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java?rev=1022720&r1=1022719&r2=1022720&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java Thu Oct 14 21:20:50 2010
@@ -43,9 +43,6 @@ public class ResolverImpl implements Res
 {
     private final Logger m_logger;
 
-    // Reusable empty array.
-    private static final List<Wire> m_emptyWires = Util.m_emptyList;
-
     // Holds candidate permutations based on permutating "uses" chains.
     // These permutations are given higher priority.
     private final List<Map<Requirement, Set<Capability>>> m_usesPermutations =
@@ -1263,7 +1260,7 @@ public class ResolverImpl implements Res
             return sources;
         }
 
-        return Util.m_emptyList;
+        return Collections.EMPTY_LIST;
     }
 
     private static List<Capability> getPackageSourcesInternal(
@@ -1328,7 +1325,7 @@ public class ResolverImpl implements Res
     {
         if (!module.isResolved() && !wireMap.containsKey(module))
         {
-            wireMap.put(module, m_emptyWires);
+            wireMap.put(module, (List<Wire>) Collections.EMPTY_LIST);
 
             List<Wire> packageWires = new ArrayList<Wire>();
             List<Wire> moduleWires = new ArrayList<Wire>();
@@ -1379,7 +1376,7 @@ public class ResolverImpl implements Res
         Module module, String pkgName, Map<Module, Packages> modulePkgMap,
         Map<Module, List<Wire>> wireMap, Map<Requirement, Set<Capability>> candidateMap)
     {
-        wireMap.put(module, m_emptyWires);
+        wireMap.put(module, (List<Wire>) Collections.EMPTY_LIST);
 
         List<Wire> packageWires = new ArrayList<Wire>();
 

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/util/MapToDictionary.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/MapToDictionary.java?rev=1022720&r1=1022719&r2=1022720&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/util/MapToDictionary.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/util/MapToDictionary.java Thu Oct 14 21:20:50 2010
@@ -43,7 +43,7 @@ public class MapToDictionary extends Dic
 
     public Enumeration elements()
     {
-        return new IteratorToEnumeration(m_map.values().iterator());
+        return Collections.enumeration(m_map.values());
     }
 
     public Object get(Object key)
@@ -58,7 +58,7 @@ public class MapToDictionary extends Dic
 
     public Enumeration keys()
     {
-        return new IteratorToEnumeration(m_map.keySet().iterator());
+        return Collections.enumeration(m_map.keySet());
     }
 
     public Object put(Object key, Object value)

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java?rev=1022720&r1=1022719&r2=1022720&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java Thu Oct 14 21:20:50 2010
@@ -23,7 +23,6 @@ import java.net.URL;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -41,8 +40,6 @@ import org.osgi.framework.ServiceReferen
 
 public class Util
 {
-    public static final List m_emptyList = Collections.unmodifiableList(new ArrayList());
-
     /**
      * The default name used for the default configuration properties file.
     **/