felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r704976 - in /felix/trunk/framework/src/main/java/org/apache/felix: framework/BundleInfo.java framework/Felix.java framework/searchpolicy/R4SearchPolicyCore.java moduleloader/IModule.java moduleloader/ModuleImpl.java
Date Wed, 15 Oct 2008 18:05:20 GMT
Author: rickhall
Date: Wed Oct 15 11:05:20 2008
New Revision: 704976

URL: http://svn.apache.org/viewvc?rev=704976&view=rev
Log:
Modified the resolver to longer consider uninstalled fragments and hosts
when resolving dependencies; this required a new "stale" flag on modules
that gets set when their associated bundle is uninstalled. (FELIX-776)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleInfo.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
    felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModule.java
    felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleInfo.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleInfo.java?rev=704976&r1=704975&r2=704976&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleInfo.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleInfo.java Wed Oct
15 11:05:20 2008
@@ -134,6 +134,19 @@
         m_modules = dest;
     }
 
+    /**
+     * This marks all modules as stale when the associated bundle has
+     * been uninstalled. This is necessary since uninstalled bundles
+     * should not be used for fragments or fragment hosts.
+    **/
+    public synchronized void markModulesStale()
+    {
+        for (int i = 0; i < m_modules.length; i++)
+        {
+            ((ModuleImpl) m_modules[i]).setStale();
+        }
+    }
+
     public abstract String getSymbolicName();
 
     public abstract long getBundleId();
@@ -394,4 +407,4 @@
 
         return pd;
     }
-}
\ No newline at end of file
+}

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=704976&r1=704975&r2=704976&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 Wed Oct 15 11:05:20
2008
@@ -2134,10 +2134,11 @@
         if (target != null)
         {
             // Set the bundle's persistent state to uninstalled.
-            target.getInfo().setPersistentStateUninstalled();
+            info.setPersistentStateUninstalled();
 
             // Mark the bundle as removal pending.
-            target.getInfo().setRemovalPending(true);
+            info.setRemovalPending(true);
+            info.markModulesStale();
 
             // Put bundle in uninstalled bundle array.
             rememberUninstalledBundle(bundle);
@@ -4347,4 +4348,4 @@
             m_bundleLock.notifyAll();
         }
     }
-}
\ No newline at end of file
+}

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java?rev=704976&r1=704975&r2=704976&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
Wed Oct 15 11:05:20 2008
@@ -1192,7 +1192,8 @@
                 for (int capIdx = 0; (caps != null) && (capIdx < caps.length);
capIdx++)
                 {
                     if (caps[capIdx].getNamespace().equals(ICapability.HOST_NAMESPACE)
-                        && hostReq.isSatisfied(caps[capIdx]))
+                        && hostReq.isSatisfied(caps[capIdx])
+                        && !modules[modIdx].isStale())
                     {
                         hostList.add(modules[modIdx]);
                         break;
@@ -1235,7 +1236,8 @@
                 for (int reqIdx = 0; (reqs != null) && (reqIdx < reqs.length);
reqIdx++)
                 {
                     if (reqs[reqIdx].getNamespace().equals(ICapability.HOST_NAMESPACE)
-                        && reqs[reqIdx].isSatisfied(bundleCap))
+                        && reqs[reqIdx].isSatisfied(bundleCap)
+                        && !modules[modIdx].isStale())
                     {
                         indexFragment(fragmentMap, modules[modIdx]);
                         break;

Modified: felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModule.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModule.java?rev=704976&r1=704975&r2=704976&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModule.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/IModule.java Wed Oct
15 11:05:20 2008
@@ -31,4 +31,14 @@
     public Class getClass(String name) throws ClassNotFoundException;
     public URL getResource(String name);
     public Enumeration getResources(String name);
-}
\ No newline at end of file
+
+
+    /**
+     * Returns whether the module is associated with an uninstalled bundle.
+     * If so, then it should not be used when resolving fragments or fragment
+     * hosts. However, it still can be used for resolving imported packages.
+     * @return <tt>true</tt> if the module's bundle is uninstalled, otherwise
+     *         <tt>false</tt>.
+    **/
+    public boolean isStale();
+}

Modified: felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java?rev=704976&r1=704975&r2=704976&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java Wed
Oct 15 11:05:20 2008
@@ -36,6 +36,7 @@
     private IModule[] m_dependentHosts = new IModule[0];
     private IModule[] m_dependentImporters = new IModule[0];
     private IModule[] m_dependentRequirers = new IModule[0];
+    private volatile boolean m_isStale = false;
 
     ModuleImpl(Logger logger, String id, IModuleDefinition md)
     {
@@ -251,6 +252,16 @@
         return null;
     }
 
+    public boolean isStale()
+    {
+        return m_isStale;
+    }
+
+    public void setStale()
+    {
+        m_isStale = true;
+    }
+
     public String toString()
     {
         return m_id;
@@ -302,4 +313,4 @@
 
         return tmp;
     }
-}
\ No newline at end of file
+}



Mime
View raw message