felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r737915 - in /felix/trunk/framework/src/main/java/org/apache/felix/framework: Felix.java FelixResolverState.java
Date Mon, 26 Jan 2009 22:57:20 GMT
Author: rickhall
Date: Mon Jan 26 22:57:20 2009
New Revision: 737915

URL: http://svn.apache.org/viewvc?rev=737915&view=rev
Log:
Added back in support for extension bundle exports. (FELIX-851)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/FelixResolverState.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?rev=737915&r1=737914&r2=737915&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Mon Jan 26 22:57:20
2009
@@ -1598,8 +1598,9 @@
                             bundle.getCurrentModule().getHeaders()))
                     {
                         m_extensionManager.addExtensionBundle(this, bundle);
-// TODO: REFACTOR - REFRESH RESOLVER STATE.
-//                        m_factory.refreshModule(m_sbi.getCurrentModule());
+// TODO: REFACTOR - Perhaps we could move this into extension manager.
+                        m_resolverState.refreshSystemBundleModule(bundle.getCurrentModule());
+// TODO: REFACTOR - Not clear why this is here. We should look at all of these steps more
closely.
                         bundle.setState(Bundle.RESOLVED);
                     }
                     else if (bundle.isExtension())
@@ -2052,8 +2053,7 @@
                 else
                 {
                     m_extensionManager.addExtensionBundle(this, bundle);
-// TODO: REFACTOR - REFRESH RESOLVER STATE.
-//                    m_factory.refreshModule(m_sbi.getCurrentModule());
+                    m_resolverState.refreshSystemBundleModule(m_extensionManager.getModule());
                 }
             }
             catch (Throwable ex)

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/FelixResolverState.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/FelixResolverState.java?rev=737915&r1=737914&r2=737915&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/FelixResolverState.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/FelixResolverState.java
Mon Jan 26 22:57:20 2009
@@ -49,8 +49,6 @@
     // Maps a module to an array of capabilities.
     private final Map m_resolvedCapMap = new HashMap();
 
-    private final Map m_moduleDataMap = new HashMap();
-
     // Reusable empty array.
     private static final IModule[] m_emptyModules = new IModule[0];
     private static final PackageSource[] m_emptySources = new PackageSource[0];
@@ -136,45 +134,40 @@
         ((ModuleImpl) module).close();
 
         // Remove the module from the "resolved" map.
-// TODO: RB - Maybe this can be merged with ModuleData.
         m_resolvedCapMap.remove(module);
-        // Finally, remove module data.
-        m_moduleDataMap.remove(module);
     }
 
-/* TODO: RESOLVER - We need to figure out what to do with this.
-    public void moduleRefreshed(ModuleEvent event)
+    /**
+     * This method is used for installing system bundle extensions. It actually
+     * refreshes the system bundle module's capabilities in the resolver state
+     * to capture additional capabilities.
+     * @param module The module being refresh, which should always be the system bundle.
+    **/
+    synchronized void refreshSystemBundleModule(IModule module)
     {
-        synchronized (m_factory)
+        // The system bundle module should always be resolved, so we only need
+        // to update the resolved capability map.
+        ICapability[] caps = module.getCapabilities();
+        for (int i = 0; (caps != null) && (i < caps.length); i++)
         {
-            IModule module = event.getModule();
-            // Remove exports from package maps.
-            ICapability[] caps = event.getModule().getDefinition().getCapabilities();
-            // Add exports to unresolved package map.
-            for (int i = 0; (caps != null) && (i < caps.length); i++)
+            ICapability[] resolvedCaps = (ICapability[]) m_resolvedCapMap.get(module);
+            resolvedCaps = addCapabilityToArray(resolvedCaps, caps[i]);
+            m_resolvedCapMap.put(module, resolvedCaps);
+
+            // If the capability is a package, then add the exporter module
+            // of the wire to the "resolved" package index and remove it
+            // from the "unresolved" package index.
+            if (caps[i].getNamespace().equals(ICapability.PACKAGE_NAMESPACE))
             {
-                ICapability[] resolvedCaps = (ICapability[]) m_resolvedCapMap.get(module);
-                resolvedCaps = addCapabilityToArray(resolvedCaps, caps[i]);
-                m_resolvedCapMap.put(module, resolvedCaps);
-
-                // If the capability is a package, then add the exporter module
-                // of the wire to the "resolved" package index and remove it
-                // from the "unresolved" package index.
-                if (caps[i].getNamespace().equals(ICapability.PACKAGE_NAMESPACE))
-                {
-                    // Get package name.
-                    String pkgName = (String)
-                        caps[i].getProperties().get(ICapability.PACKAGE_PROPERTY);
-                    // Add to "resolved" package index.
-                    indexPackageCapability(
-                        m_resolvedPkgIndexMap,
-                        module,
-                        caps[i]);
-                }
+                // Add to "resolved" package index.
+                indexPackageCapability(
+                    m_resolvedPkgIndexMap,
+                    module,
+                    caps[i]);
             }
         }
     }
-*/
+
     private void dumpPackageIndexMap(Map pkgIndexMap)
     {
         for (Iterator i = pkgIndexMap.entrySet().iterator(); i.hasNext(); )



Mime
View raw message