felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject svn commit: r1103918 [1/12] - in /felix/trunk/framework: ./ src/main/java/org/apache/felix/framework/ src/main/java/org/apache/felix/framework/cache/ src/main/java/org/apache/felix/framework/capabilityset/ src/main/java/org/apache/felix/framework/resol...
Date Mon, 16 May 2011 21:49:05 GMT
Author: pauls
Date: Mon May 16 21:49:02 2011
New Revision: 1103918

URL: http://svn.apache.org/viewvc?rev=1103918&view=rev
Log:
Rollback after failed release.

Added:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java
      - copied unchanged from r1102022, felix/trunk/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/Attribute.java
      - copied unchanged from r1102022, felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/Attribute.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/Capability.java
      - copied unchanged from r1102022, felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/Capability.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/Directive.java
      - copied unchanged from r1102022, felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/Directive.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/Requirement.java
      - copied unchanged from r1102022, felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/Requirement.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Content.java
      - copied unchanged from r1102022, felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Content.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/HostModule.java
      - copied unchanged from r1102022, felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/HostModule.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Module.java
      - copied unchanged from r1102022, felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Module.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Wire.java
      - copied unchanged from r1102022, felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Wire.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WireImpl.java
      - copied unchanged from r1102022, felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WireImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WireModuleImpl.java
      - copied unchanged from r1102022, felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/WireModuleImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/CapabilityImpl.java
      - copied unchanged from r1102022, felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/CapabilityImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/RequirementImpl.java
      - copied unchanged from r1102022, felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/RequirementImpl.java
Removed:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionDependencies.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/Content.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/HostBundleRevision.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverWire.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverWireImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/
    felix/trunk/framework/src/main/java/org/osgi/framework/AdaptPermission.java
    felix/trunk/framework/src/main/java/org/osgi/framework/CapabilityPermission.java
    felix/trunk/framework/src/main/java/org/osgi/framework/startlevel/
    felix/trunk/framework/src/main/java/org/osgi/framework/wiring/
Modified:
    felix/trunk/framework/pom.xml
    felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleProtectionDomain.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/EntryFilterEnumeration.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/PackageAdminImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/RequiredBundleImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/ResolverStateImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleStreamHandler.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/ContentDirectoryContent.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryContent.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/CandidateComparator.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/HostedCapability.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/HostedRequirement.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolveException.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Resolver.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/Util.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ParsedHeaderClause.java
    felix/trunk/framework/src/main/java/org/osgi/framework/AdminPermission.java
    felix/trunk/framework/src/main/java/org/osgi/framework/AllServiceListener.java
    felix/trunk/framework/src/main/java/org/osgi/framework/Bundle.java
    felix/trunk/framework/src/main/java/org/osgi/framework/BundleActivator.java
    felix/trunk/framework/src/main/java/org/osgi/framework/BundleContext.java
    felix/trunk/framework/src/main/java/org/osgi/framework/BundleEvent.java
    felix/trunk/framework/src/main/java/org/osgi/framework/BundleException.java
    felix/trunk/framework/src/main/java/org/osgi/framework/BundleListener.java
    felix/trunk/framework/src/main/java/org/osgi/framework/BundlePermission.java
    felix/trunk/framework/src/main/java/org/osgi/framework/BundleReference.java
    felix/trunk/framework/src/main/java/org/osgi/framework/Configurable.java
    felix/trunk/framework/src/main/java/org/osgi/framework/Constants.java
    felix/trunk/framework/src/main/java/org/osgi/framework/Filter.java
    felix/trunk/framework/src/main/java/org/osgi/framework/FrameworkEvent.java
    felix/trunk/framework/src/main/java/org/osgi/framework/FrameworkListener.java
    felix/trunk/framework/src/main/java/org/osgi/framework/FrameworkUtil.java
    felix/trunk/framework/src/main/java/org/osgi/framework/InvalidSyntaxException.java
    felix/trunk/framework/src/main/java/org/osgi/framework/PackagePermission.java
    felix/trunk/framework/src/main/java/org/osgi/framework/ServiceEvent.java
    felix/trunk/framework/src/main/java/org/osgi/framework/ServiceException.java
    felix/trunk/framework/src/main/java/org/osgi/framework/ServiceFactory.java
    felix/trunk/framework/src/main/java/org/osgi/framework/ServiceListener.java
    felix/trunk/framework/src/main/java/org/osgi/framework/ServicePermission.java
    felix/trunk/framework/src/main/java/org/osgi/framework/ServiceReference.java
    felix/trunk/framework/src/main/java/org/osgi/framework/ServiceRegistration.java
    felix/trunk/framework/src/main/java/org/osgi/framework/SignerProperty.java
    felix/trunk/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java
    felix/trunk/framework/src/main/java/org/osgi/framework/Version.java

Modified: felix/trunk/framework/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/framework/pom.xml?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/pom.xml (original)
+++ felix/trunk/framework/pom.xml Mon May 16 21:49:02 2011
@@ -55,7 +55,7 @@
             <Bundle-Name>Apache Felix Framework</Bundle-Name>
             <Bundle-Description>OSGi R4 framework implementation.</Bundle-Description>
             <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
-            <Export-Package>org.osgi.framework.*;-split-package:=merge-first,org.osgi.service.packageadmin,org.osgi.service.url,org.osgi.service.startlevel,org.osgi.util.tracker</Export-Package>
+            <Export-Package>org.osgi.framework;-split-package:=merge-first,org.osgi.framework.launch,org.osgi.framework.hooks.service,org.osgi.service.packageadmin,org.osgi.service.url,org.osgi.service.startlevel,org.osgi.util.tracker</Export-Package>
             <Private-Package>org.apache.felix.framework.*</Private-Package>
             <Import-Package>!*</Import-Package>
             <Include-Resource>META-INF/LICENSE=LICENSE,META-INF/NOTICE=NOTICE,META-INF/DEPENDENCIES=DEPENDENCIES,{src/main/resources/}</Include-Resource> 

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java Mon May 16 21:49:02 2011
@@ -20,23 +20,10 @@ package org.apache.felix.framework;
 
 import java.io.File;
 import java.io.InputStream;
-import java.util.Collection;
 import java.util.Dictionary;
 
 import org.apache.felix.framework.ext.FelixBundleContext;
-import org.osgi.framework.AdminPermission;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkListener;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServicePermission;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.framework.SynchronousBundleListener;
+import org.osgi.framework.*;
 
 class BundleContextImpl implements FelixBundleContext
 {
@@ -178,18 +165,6 @@ class BundleContextImpl implements Felix
         return m_felix.getBundle(id);
     }
 
-    public Bundle getBundle(String location)
-    {
-        checkValidity();
-
-        // CONCURRENCY NOTE: This is a check-then-act situation,
-        // but we ignore it since the time window is small and
-        // the result is the same as if the calling thread had
-        // won the race condition.
-
-        return m_felix.getBundle(location);
-    }
-
     public Bundle[] getBundles()
     {
         checkValidity();
@@ -306,14 +281,14 @@ class BundleContextImpl implements Felix
         m_felix.removeFrameworkListener(m_bundle, l);
     }
 
-    public ServiceRegistration<?> registerService(
-        String clazz, Object svcObj, Dictionary<String, ? > dict)
+    public ServiceRegistration registerService(
+        String clazz, Object svcObj, Dictionary dict)
     {
         return registerService(new String[] { clazz }, svcObj, dict);
     }
 
-    public ServiceRegistration<?> registerService(
-        String[] clazzes, Object svcObj, Dictionary<String, ? > dict)
+    public ServiceRegistration registerService(
+        String[] clazzes, Object svcObj, Dictionary dict)
     {
         checkValidity();
 
@@ -338,13 +313,7 @@ class BundleContextImpl implements Felix
         return m_felix.registerService(m_bundle, clazzes, svcObj, dict);
     }
 
-    public <S> ServiceRegistration<S> registerService(
-        Class<S> clazz, S svcObj, Dictionary<String, ? > dict)
-    {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    public ServiceReference<?> getServiceReference(String clazz)
+    public ServiceReference getServiceReference(String clazz)
     {
         checkValidity();
 
@@ -365,11 +334,6 @@ class BundleContextImpl implements Felix
         return null;
     }
 
-    public <S> ServiceReference<S> getServiceReference(Class<S> clazz)
-    {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
     private ServiceReference getBestServiceReference(ServiceReference[] refs)
     {
         if (refs == null)
@@ -396,8 +360,7 @@ class BundleContextImpl implements Felix
         return bestRef;
     }
 
-    public ServiceReference<?>[] getAllServiceReferences(String clazz, String filter)
-        throws InvalidSyntaxException
+    public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException
     {
         checkValidity();
 
@@ -410,7 +373,7 @@ class BundleContextImpl implements Felix
 
     }
 
-    public ServiceReference<?>[] getServiceReferences(String clazz, String filter)
+    public ServiceReference[] getServiceReferences(String clazz, String filter)
         throws InvalidSyntaxException
     {
         checkValidity();
@@ -424,14 +387,7 @@ class BundleContextImpl implements Felix
 
     }
 
-    public <S> Collection<ServiceReference<S>> getServiceReferences(
-        Class<S> clazz, String filter)
-        throws InvalidSyntaxException
-    {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    public <S> S getService(ServiceReference<S> ref)
+    public Object getService(ServiceReference ref)
     {
         checkValidity();
 
@@ -455,7 +411,7 @@ class BundleContextImpl implements Felix
         return m_felix.getService(m_bundle, ref);
     }
 
-    public boolean ungetService(ServiceReference<?> ref)
+    public boolean ungetService(ServiceReference ref)
     {
         checkValidity();
 

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java Mon May 16 21:49:02 2011
@@ -18,7 +18,6 @@
  */
 package org.apache.felix.framework;
 
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
@@ -26,20 +25,12 @@ import java.security.ProtectionDomain;
 import java.util.*;
 
 import org.apache.felix.framework.cache.BundleArchive;
+import org.apache.felix.framework.resolver.Module;
 import org.apache.felix.framework.ext.SecurityProvider;
+import org.apache.felix.framework.resolver.Wire;
 import org.apache.felix.framework.util.StringMap;
 import org.apache.felix.framework.util.Util;
-import org.osgi.framework.AdminPermission;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServicePermission;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
-import org.osgi.framework.wiring.BundleRevision;
-import org.osgi.framework.wiring.BundleWire;
+import org.osgi.framework.*;
 
 class BundleImpl implements Bundle
 {
@@ -47,7 +38,7 @@ class BundleImpl implements Bundle
     private final Felix __m_felix;
 
     private final BundleArchive m_archive;
-    private final List<BundleRevision> m_revisions = new ArrayList<BundleRevision>(0);
+    private final List<Module> m_modules = new ArrayList<Module>(0);
     private volatile int m_state;
     private boolean m_useDeclaredActivationPolicy;
     private BundleActivator m_activator = null;
@@ -87,8 +78,8 @@ class BundleImpl implements Bundle
         m_activator = null;
         m_context = null;
 
-        BundleRevision revision = createRevision();
-        addRevision(revision);
+        Module module = createModule();
+        addModule(module);
     }
 
     // This method exists because the system bundle extends BundleImpl
@@ -105,10 +96,9 @@ class BundleImpl implements Bundle
         return m_archive;
     }
 
-// Only called when the framework is stopping. Don't need to clean up dependencies.
     synchronized void close()
     {
-        closeRevisions();
+        closeModules();
         try
         {
             m_archive.close();
@@ -122,35 +112,45 @@ class BundleImpl implements Bundle
         }
     }
 
-// Called when install fails, when stopping framework with uninstalled bundles,
-// and when refreshing an uninstalled bundle. Only need to clear up dependencies
-// for last case.
     synchronized void closeAndDelete() throws Exception
     {
         // Mark the bundle as stale, since it is being deleted.
         m_stale = true;
-        // Close all revisions.
-        closeRevisions();
+        // Close all modules.
+        closeModules();
         // Delete bundle archive, which will close revisions.
         m_archive.closeAndDelete();
     }
 
-// Called from BundleImpl.close(), BundleImpl.closeAndDelete(), and BundleImpl.refresh()
-    private void closeRevisions()
+    private void closeModules()
     {
-        // Remove the bundle's associated revisions from the resolver state
+        // Remove the bundle's associated modules from the resolver state
         // and close them.
-        for (BundleRevision br : m_revisions)
+        for (Module m : m_modules)
         {
-            // Remove the revision from the resolver state.
-            getFramework().getResolver().removeRevision(br);
+            // Remove the module from the resolver state.
+            getFramework().getResolver().removeModule(m);
 
-            // Close the revision's content.
-            ((BundleRevisionImpl) br).close();
+            // Set fragments to null, which will remove the module from all
+            // of its dependent fragment modules.
+            try
+            {
+                ((ModuleImpl) m).attachFragments(null);
+            }
+            catch (Exception ex)
+            {
+                getFramework().getLogger().log(
+                    m.getBundle(), Logger.LOG_ERROR, "Error detaching fragments.", ex);
+            }
+            // Set wires to null, which will remove the module from all
+            // of its dependent modules.
+            ((ModuleImpl) m).setWires(null);
+
+            // Close the module's content.
+            ((ModuleImpl) m).close();
         }
     }
 
-// Called when refreshing a bundle. Must clean up dependencies beforehand.
     synchronized void refresh() throws Exception
     {
         if (isExtension() && (getFramework().getState() != Bundle.STOPPING))
@@ -160,17 +160,17 @@ class BundleImpl implements Bundle
         }
         else
         {
-            // Dispose of the current revisions.
-            closeRevisions();
+            // Dispose of the current modules.
+            closeModules();
 
             // Now we will purge all old revisions, only keeping the newest one.
             m_archive.purge();
 
             // Lastly, we want to reset our bundle be reinitializing our state
-            // and recreating a revision object for the newest revision.
-            m_revisions.clear();
-            final BundleRevision br = createRevision();
-            addRevision(br);
+            // and recreating a module for the newest revision.
+            m_modules.clear();
+            final Module module = createModule();
+            addModule(module);
             m_state = Bundle.INSTALLED;
             m_stale = false;
             m_cachedHeaders.clear();
@@ -323,8 +323,7 @@ class BundleImpl implements Bundle
         // Spec says empty local returns raw headers.
         if (locale.length() == 0)
         {
-            result = new StringMap(
-                ((BundleRevisionImpl) getCurrentRevision()).getHeaders(), false);
+            result = new StringMap(getCurrentModule().getHeaders(), false);
         }
 
         // If we have no result, try to get it from the cached headers.
@@ -360,8 +359,7 @@ class BundleImpl implements Bundle
         if (result == null)
         {
             // Get a modifiable copy of the raw headers.
-            Map headers = new StringMap(
-                ((BundleRevisionImpl) getCurrentRevision()).getHeaders(), false);
+            Map headers = new StringMap(getCurrentModule().getHeaders(), false);
             // Assume for now that this will be the result.
             result = headers;
 
@@ -390,22 +388,23 @@ class BundleImpl implements Bundle
                     basename = Constants.BUNDLE_LOCALIZATION_DEFAULT_BASENAME;
                 }
 
-                // Create ordered list of revisions to search for localization
+                // Create ordered list of modules to search for localization
                 // property resources.
-                List<BundleRevision> revisionList = createLocalizationRevisionList(
-                    (BundleRevisionImpl) getCurrentRevision());
+                List moduleList = createLocalizationModuleList(
+                    (ModuleImpl) getCurrentModule());
 
                 // Create ordered list of files to load properties from
-                List<String> resourceList = createLocalizationResourceList(basename, locale);
+                List resourceList = createLocalizationResourceList(basename, locale);
 
                 // Create a merged props file with all available props for this locale
                 boolean found = false;
                 Properties mergedProperties = new Properties();
-                for (BundleRevision br : revisionList)
+                for (int modIdx = 0; modIdx < moduleList.size(); modIdx++)
                 {
-                    for (String res : resourceList)
+                    for (Iterator it = resourceList.iterator(); it.hasNext(); )
                     {
-                        URL temp = ((BundleRevisionImpl) br).getEntry(res + ".properties");
+                        URL temp = ((Module) moduleList.get(modIdx)).getEntry(
+                            it.next() + ".properties");
                         if (temp != null)
                         {
                             found = true;
@@ -467,39 +466,36 @@ class BundleImpl implements Bundle
         }
     }
 
-    private static List<BundleRevision> createLocalizationRevisionList(BundleRevision br)
+    private static List createLocalizationModuleList(ModuleImpl module)
     {
-        // If the revision is a fragment, then we actually need
+        // If the module is a fragment, then we actually need
         // to search its host and associated fragments for its
         // localization information. So, check to see if there
         // are any hosts and then use the one with the highest
         // version instead of the fragment itself. If there are
-        // no hosts, but the revision is a fragment, then just
-        // search the revision itself.
-        if (Util.isFragment(br))
+        // no hosts, but the module is a fragment, then just
+        // search the module itself.
+        if (Util.isFragment(module))
         {
-            if (br.getWiring() != null)
+            List<Wire> hostWires = module.getWires();
+            if ((hostWires != null) && (hostWires.size() > 0))
             {
-                List<BundleWire> hostWires = br.getWiring().getRequiredWires(null);
-                if ((hostWires != null) && (hostWires.size() > 0))
+                module = (ModuleImpl) hostWires.get(0).getExporter();
+                for (int hostIdx = 1; hostIdx < hostWires.size(); hostIdx++)
                 {
-                    br = hostWires.get(0).getProviderWiring().getRevision();
-                    for (int hostIdx = 1; hostIdx < hostWires.size(); hostIdx++)
+                    if (module.getVersion().compareTo(
+                        hostWires.get(hostIdx).getExporter().getVersion()) < 0)
                     {
-                        if (br.getVersion().compareTo(
-                            hostWires.get(hostIdx).getProviderWiring().getRevision().getVersion()) < 0)
-                        {
-                            br = hostWires.get(hostIdx).getProviderWiring().getRevision();
-                        }
+                        module = (ModuleImpl) hostWires.get(hostIdx).getExporter();
                     }
                 }
             }
         }
 
-        // Create a list of the revision and any attached fragment revisions.
-        List<BundleRevision> result = new ArrayList<BundleRevision>();
-        result.add(br);
-        List<BundleRevision> fragments = ((BundleWiringImpl) br.getWiring()).getFragments();
+        // Create a list of the module and any attached fragments.
+        List result = new ArrayList();
+        result.add(module);
+        List<Module> fragments = module.getFragments();
         if (fragments != null)
         {
             result.addAll(fragments);
@@ -507,9 +503,9 @@ class BundleImpl implements Bundle
         return result;
     }
 
-    private static List<String> createLocalizationResourceList(String basename, String locale)
+    private static List createLocalizationResourceList(String basename, String locale)
     {
-        List<String> result = new ArrayList(4);
+        List result = new ArrayList(4);
 
         StringTokenizer tokens;
         StringBuffer tempLocale = new StringBuffer(basename);
@@ -857,9 +853,9 @@ class BundleImpl implements Bundle
 
     synchronized boolean isExtension()
     {
-        for (int i = (m_revisions.size() - 1); i > -1; i--)
+        for (int i = (m_modules.size() - 1); i > -1; i--)
         {
-            if (((BundleRevisionImpl) m_revisions.get(i)).isExtension())
+            if (m_modules.get(i).isExtension())
             {
                 return true;
             }
@@ -869,12 +865,12 @@ class BundleImpl implements Bundle
 
     public String getSymbolicName()
     {
-        return getCurrentRevision().getSymbolicName();
+        return getCurrentModule().getSymbolicName();
     }
 
     public Version getVersion()
     {
-        return getCurrentRevision().getVersion();
+        return getCurrentModule().getVersion();
     }
 
     public boolean hasPermission(Object obj)
@@ -999,24 +995,9 @@ class BundleImpl implements Bundle
         getFramework().uninstallBundle(this);
     }
 
-    public <A> A adapt(Class<A> type)
-    {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    public File getDataFile(String filename)
-    {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    public int compareTo(Bundle t)
-    {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
     public String toString()
     {
-        String sym = getCurrentRevision().getSymbolicName();
+        String sym = getCurrentModule().getSymbolicName();
         if (sym != null)
         {
             return sym + " [" + getBundleId() +"]";
@@ -1026,11 +1007,11 @@ class BundleImpl implements Bundle
 
     synchronized boolean isRemovalPending()
     {
-        return (m_state == Bundle.UNINSTALLED) || (m_revisions.size() > 1)  || m_stale;
+        return (m_state == Bundle.UNINSTALLED) || (m_modules.size() > 1)  || m_stale;
     }
 
     //
-    // Revision management.
+    // Module management.
     //
 
     /**
@@ -1045,22 +1026,22 @@ class BundleImpl implements Bundle
      * no limit on the potential number of bundle JAR file revisions.
      * @return array of modules corresponding to the bundle JAR file revisions.
     **/
-    synchronized List<BundleRevision> getRevisions()
+    synchronized List<Module> getModules()
     {
-        return m_revisions;
+        return m_modules;
     }
 
     /**
      * Determines if the specified module is associated with this bundle.
-     * @param revision the module to determine if it is associate with this bundle.
+     * @param module the module to determine if it is associate with this bundle.
      * @return <tt>true</tt> if the specified module is in the array of modules
      *         associated with this bundle, <tt>false</tt> otherwise.
     **/
-    synchronized boolean hasRevision(BundleRevision revision)
+    synchronized boolean hasModule(Module module)
     {
-        for (int i = 0; i < m_revisions.size(); i++)
+        for (int i = 0; i < m_modules.size(); i++)
         {
-            if (m_revisions.get(i) == revision)
+            if (m_modules.get(i) == module)
             {
                 return true;
             }
@@ -1073,9 +1054,34 @@ class BundleImpl implements Bundle
      * in the module array.
      * @return the newest module.
     **/
-    synchronized BundleRevision getCurrentRevision()
+    synchronized Module getCurrentModule()
+    {
+        return m_modules.get(m_modules.size() - 1);
+    }
+
+    synchronized boolean isUsed()
     {
-        return m_revisions.get(m_revisions.size() - 1);
+        boolean unresolved = true;
+        for (int i = 0; unresolved && (i < m_modules.size()); i++)
+        {
+            if (m_modules.get(i).isResolved())
+            {
+                unresolved = false;
+            }
+        }
+        boolean used = false;
+        for (int i = 0; !unresolved && !used && (i < m_modules.size()); i++)
+        {
+            List<Module> dependents = ((ModuleImpl) m_modules.get(i)).getDependents();
+            for (int j = 0; (dependents != null) && (j < dependents.size()) && !used; j++)
+            {
+                if (dependents.get(j) != m_modules.get(i))
+                {
+                    used = true;
+                }
+            }
+        }
+        return used;
     }
 
     synchronized void revise(String location, InputStream is)
@@ -1085,8 +1091,8 @@ class BundleImpl implements Bundle
         m_archive.revise(location, is);
         try
         {
-            BundleRevision revision = createRevision();
-            addRevision(revision);
+            Module module = createModule();
+            addModule(module);
         }
         catch (Exception ex)
         {
@@ -1098,27 +1104,27 @@ class BundleImpl implements Bundle
     synchronized boolean rollbackRevise() throws Exception
     {
         boolean isExtension = isExtension();
-        BundleRevision br = m_revisions.remove(m_revisions.size() - 1);
+        Module m = m_modules.remove(m_modules.size() - 1);
         if (!isExtension)
         {
-            // Since revising a bundle adds a revision to the global
+            // Since revising a module adds the module to the global
             // state, we must remove it from the global state on rollback.
-            getFramework().getResolver().removeRevision(br);
+            getFramework().getResolver().removeModule(m);
         }
         return m_archive.rollbackRevise();
     }
 
     // This method should be private, but is visible because the
-    // system bundle needs to add its revision directly to the bundle,
-    // since it doesn't have an archive from which it will be created,
-    // which is the normal case.
-    synchronized void addRevision(BundleRevision revision) throws Exception
-    {
-        m_revisions.add(revision);
-
-        // Set protection domain after adding the revision to the bundle,
-        // since this requires that the bundle has a revision.
-        ((BundleRevisionImpl) revision).setSecurityContext(
+    // system bundle needs to add its module directly to the bundle,
+    // since it doesn't have an archive from which the module will
+    // be created, which is the normal case.
+    synchronized void addModule(Module module) throws Exception
+    {
+        m_modules.add(module);
+
+        // Set protection domain after adding the module to the bundle,
+        // since this requires that the bundle has a module.
+        ((ModuleImpl) module).setSecurityContext(
             new BundleProtectionDomain(getFramework(), this));
 
         SecurityProvider sp = getFramework().getSecurityProvider();
@@ -1130,29 +1136,30 @@ class BundleImpl implements Bundle
             }
             catch (Exception ex) 
             {
-                m_revisions.remove(m_revisions.size() - 1);
+                m_modules.remove(m_modules.size() - 1);
                 throw ex;
             }
         }
 
-        // TODO: REFACTOR - consider nulling capabilities for extension bundles
-        // so we don't need this check anymore.
+        // TODO: REFACTOR - consider moving ModuleImpl into the framework package
+        // so we can null module capabilities for extension bundles so we don't
+        // need this check anymore.
         if (!isExtension())
         {
-            // Now that the revision is added to the bundle, we can update
-            // the resolver's state to be aware of any new capabilities.
-            getFramework().getResolver().addRevision(revision);
+            // Now that the module is added to the bundle, we can update
+            // the resolver's module state.
+            getFramework().getResolver().addModule(module);
         }
     }
 
-    private BundleRevision createRevision() throws Exception
+    private Module createModule() throws Exception
     {
-        // Get and parse the manifest from the most recent revision and
-        // create an associated revision object for it.
+        // Get and parse the manifest from the most recent revision to
+        // create an associated module for it.
         Map headerMap = m_archive.getCurrentRevision().getManifestHeader();
 
-        // Create the bundle revision instance.
-        BundleRevisionImpl revision = new BundleRevisionImpl(
+        // Create the module instance.
+        ModuleImpl module = new ModuleImpl(
             getFramework().getLogger(),
             getFramework().getConfig(),
             getFramework().getResolver(),
@@ -1166,11 +1173,11 @@ class BundleImpl implements Bundle
             getFramework().getBootPackageWildcards());
 
         // Verify that the bundle symbolic name + version is unique.
-        if (revision.getManifestVersion().equals("2"))
+        if (module.getManifestVersion().equals("2"))
         {
-            Version bundleVersion = revision.getVersion();
+            Version bundleVersion = module.getVersion();
             bundleVersion = (bundleVersion == null) ? Version.emptyVersion : bundleVersion;
-            String symName = revision.getSymbolicName();
+            String symName = module.getSymbolicName();
 
             Bundle[] bundles = getFramework().getBundles();
             for (int i = 0; (bundles != null) && (i < bundles.length); i++)
@@ -1179,8 +1186,8 @@ class BundleImpl implements Bundle
                 if (id != getBundleId())
                 {
                     String sym = bundles[i].getSymbolicName();
-                    Version ver = ((BundleRevisionImpl)
-                        ((BundleImpl) bundles[i]).getCurrentRevision()).getVersion();
+                    Version ver = ((ModuleImpl)
+                        ((BundleImpl) bundles[i]).getCurrentModule()).getVersion();
                     if ((symName != null) && (sym != null) && symName.equals(sym) && bundleVersion.equals(ver))
                     {
                         throw new BundleException(
@@ -1191,17 +1198,16 @@ class BundleImpl implements Bundle
             }
         }
 
-        return revision;
+        return module;
     }
 
     synchronized ProtectionDomain getProtectionDomain()
     {
         ProtectionDomain pd = null;
 
-        for (int i = m_revisions.size() - 1; (i >= 0) && (pd == null); i--)
+        for (int i = m_modules.size() - 1; (i >= 0) && (pd == null); i--)
         {
-            pd = (ProtectionDomain)
-                ((BundleRevisionImpl) m_revisions.get(i)).getSecurityContext();
+            pd = (ProtectionDomain) m_modules.get(i).getSecurityContext();
         }
 
         return pd;
@@ -1252,4 +1258,4 @@ class BundleImpl implements Bundle
     {
         return m_context;
     }
-}
\ No newline at end of file
+}

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleProtectionDomain.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleProtectionDomain.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleProtectionDomain.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleProtectionDomain.java Mon May 16 21:49:02 2011
@@ -25,7 +25,7 @@ import java.security.Permission;
 import java.security.ProtectionDomain;
 import java.security.cert.Certificate;
 
-import org.osgi.framework.wiring.BundleRevision;
+import org.apache.felix.framework.resolver.Module;
 
 public class BundleProtectionDomain extends ProtectionDomain
 {
@@ -33,9 +33,9 @@ public class BundleProtectionDomain exte
     private final WeakReference m_bundle;
     private final int m_hashCode;
     private final String m_toString;
-    private final WeakReference m_revision;
+    private final WeakReference m_module;
 
-    // TODO: SECURITY - This should probably take a revision, not a bundle.
+    // TODO: SECURITY - This should probably take a module, not a bundle.
     BundleProtectionDomain(Felix felix, BundleImpl bundle)
         throws MalformedURLException
     {
@@ -50,14 +50,14 @@ public class BundleProtectionDomain exte
             null);
         m_felix = new WeakReference(felix);
         m_bundle = new WeakReference(bundle);
-        m_revision = new WeakReference(bundle.getCurrentRevision());
+        m_module = new WeakReference(bundle.getCurrentModule());
         m_hashCode = bundle.hashCode();
         m_toString = "[" + bundle + "]";
     }
 
-    BundleRevision getRevision() 
+    Module getModule() 
     {
-        return (BundleRevision) m_revision.get();
+        return (Module) m_module.get();
     }
 
     public boolean implies(Permission permission)

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/EntryFilterEnumeration.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/EntryFilterEnumeration.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/EntryFilterEnumeration.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/EntryFilterEnumeration.java Mon May 16 21:49:02 2011
@@ -22,14 +22,14 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.*;
 import org.apache.felix.framework.capabilityset.SimpleFilter;
-import org.osgi.framework.wiring.BundleRevision;
+import org.apache.felix.framework.resolver.Module;
 
 class EntryFilterEnumeration implements Enumeration
 {
     private final BundleImpl m_bundle;
     private final List<Enumeration> m_enumerations;
-    private final List<BundleRevision> m_revisions;
-    private int m_revisionIndex = 0;
+    private final List<Module> m_modules;
+    private int m_moduleIndex = 0;
     private final String m_path;
     private final List<String> m_filePattern;
     private final boolean m_recurse;
@@ -42,25 +42,23 @@ class EntryFilterEnumeration implements 
         String filePattern, boolean recurse, boolean isURLValues)
     {
         m_bundle = bundle;
-        BundleRevision br = m_bundle.getCurrentRevision();
-        if (includeFragments
-            && (br.getWiring() != null)
-            && (((BundleWiringImpl) br.getWiring()).getFragments() != null))
-        {
-            m_revisions = new ArrayList(
-                ((BundleWiringImpl) br.getWiring()).getFragments().size() + 1);
-            m_revisions.addAll(((BundleWiringImpl) br.getWiring()).getFragments());
+        Module bundleModule = m_bundle.getCurrentModule();
+        List<Module> fragmentModules = ((ModuleImpl) bundleModule).getFragments();
+        if (includeFragments && (fragmentModules != null))
+        {
+            m_modules = new ArrayList(fragmentModules.size() + 1);
+            m_modules.addAll(fragmentModules);
         }
         else
         {
-            m_revisions = new ArrayList(1);
+            m_modules = new ArrayList(1);
         }
-        m_revisions.add(0, br);
-        m_enumerations = new ArrayList(m_revisions.size());
-        for (int i = 0; i < m_revisions.size(); i++)
+        m_modules.add(0, bundleModule);
+        m_enumerations = new ArrayList(m_modules.size());
+        for (int i = 0; i < m_modules.size(); i++)
         {
-            m_enumerations.add(((BundleRevisionImpl) m_revisions.get(i)).getContent() != null ?
-                ((BundleRevisionImpl) m_revisions.get(i)).getContent().getEntries() : null);
+            m_enumerations.add(m_modules.get(i).getContent() != null ?
+                m_modules.get(i).getContent().getEntries() : null);
         }
         m_recurse = recurse;
         m_isURLValues = isURLValues;
@@ -116,19 +114,19 @@ class EntryFilterEnumeration implements 
         {
             return;
         }
-        while ((m_revisionIndex < m_enumerations.size()) && m_nextEntries.isEmpty())
+        while ((m_moduleIndex < m_enumerations.size()) && m_nextEntries.isEmpty())
         {
-            while (m_enumerations.get(m_revisionIndex) != null
-                && m_enumerations.get(m_revisionIndex).hasMoreElements()
+            while (m_enumerations.get(m_moduleIndex) != null
+                && m_enumerations.get(m_moduleIndex).hasMoreElements()
                 && m_nextEntries.isEmpty())
             {
                 // Get the current entry to determine if it should be filtered or not.
-                String entryName = (String) m_enumerations.get(m_revisionIndex).nextElement();
+                String entryName = (String) m_enumerations.get(m_moduleIndex).nextElement();
                 // Check to see if the current entry is a descendent of the specified path.
                 if (!entryName.equals(m_path) && entryName.startsWith(m_path))
                 {
                     // Cached entry URL. If we are returning URLs, we use this
-                    // cached URL to avoid doing multiple URL lookups from a revision
+                    // cached URL to avoid doing multiple URL lookups from a module
                     // when synthesizing directory URLs.
                     URL entryURL = null;
 
@@ -172,14 +170,11 @@ class EntryFilterEnumeration implements 
                                         if (m_isURLValues)
                                         {
                                             entryURL = (entryURL == null)
-                                                ? ((BundleRevisionImpl)
-                                                    m_revisions.get(m_revisionIndex))
-                                                        .getEntry(entryName)
+                                                ? m_modules.get(m_moduleIndex).getEntry(entryName)
                                                 : entryURL;
                                             try
                                             {
-                                                m_nextEntries.add(
-                                                    new URL(entryURL, "/" + dir));
+                                                m_nextEntries.add(new URL(entryURL, "/" + dir));
                                             }
                                             catch (MalformedURLException ex)
                                             {
@@ -214,8 +209,7 @@ class EntryFilterEnumeration implements 
                             if (m_isURLValues)
                             {
                                 entryURL = (entryURL == null)
-                                    ? ((BundleRevisionImpl)
-                                        m_revisions.get(m_revisionIndex)).getEntry(entryName)
+                                    ? m_modules.get(m_moduleIndex).getEntry(entryName)
                                     : entryURL;
                                 m_nextEntries.add(entryURL);
                             }
@@ -229,7 +223,7 @@ class EntryFilterEnumeration implements 
             }
             if (m_nextEntries.isEmpty())
             {
-                m_revisionIndex++;
+                m_moduleIndex++;
             }
         }
     }
@@ -244,4 +238,4 @@ class EntryFilterEnumeration implements 
             : entryName.lastIndexOf('/', endIdx) + 1;
         return entryName.substring(startIdx, endIdx);
     }
-}
+}
\ No newline at end of file

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java Mon May 16 21:49:02 2011
@@ -18,34 +18,33 @@
  */
 package org.apache.felix.framework;
 
-import java.util.Set;
-import org.apache.felix.framework.wiring.BundleCapabilityImpl;
+import java.util.List;
+import org.apache.felix.framework.capabilityset.Capability;
+import org.apache.felix.framework.resolver.Module;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Version;
-import org.osgi.framework.wiring.BundleCapability;
-import org.osgi.framework.wiring.BundleRevision;
 import org.osgi.service.packageadmin.ExportedPackage;
 
 class ExportedPackageImpl implements ExportedPackage
 {
     private final Felix m_felix;
     private final BundleImpl m_exportingBundle;
-    private final BundleRevision m_exportingRevision;
-    private final BundleCapability m_export;
+    private final Module m_exportingModule;
+    private final Capability m_export;
     private final String m_pkgName;
     private final Version m_version;
 
     public ExportedPackageImpl(
-        Felix felix, BundleImpl exporter, BundleRevision revision, BundleCapability export)
+        Felix felix, BundleImpl exporter, Module module, Capability export)
     {
         m_felix = felix;
         m_exportingBundle = exporter;
-        m_exportingRevision = revision;
+        m_exportingModule = module;
         m_export = export;
-        m_pkgName = (String) m_export.getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR);
-        m_version = (!m_export.getAttributes().containsKey(BundleCapabilityImpl.VERSION_ATTR))
+        m_pkgName = (String) m_export.getAttribute(Capability.PACKAGE_ATTR).getValue();
+        m_version = (m_export.getAttribute(Capability.VERSION_ATTR) == null)
             ? Version.emptyVersion
-            : (Version) m_export.getAttributes().get(BundleCapabilityImpl.VERSION_ATTR);
+            : (Version) m_export.getAttribute(Capability.VERSION_ATTR).getValue();
     }
 
     public Bundle getExportingBundle()
@@ -65,8 +64,8 @@ class ExportedPackageImpl implements Exp
         {
             return null;
         }
-        Set<Bundle> set = m_felix.getImportingBundles(m_exportingBundle, m_export);
-        return set.toArray(new Bundle[set.size()]);
+        List<Bundle> list = m_felix.getImportingBundles(this);
+        return list.toArray(new Bundle[list.size()]);
     }
 
     public String getName()

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java Mon May 16 21:49:02 2011
@@ -27,26 +27,26 @@ import java.net.URLStreamHandler;
 import java.security.AccessControlException;
 import java.security.AllPermission;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.NoSuchElementException;
 import java.util.Set;
-import org.apache.felix.framework.Felix.StatefulResolver;
 
-import org.apache.felix.framework.resolver.ResolverWire;
+import org.apache.felix.framework.Felix.StatefulResolver;
+import org.apache.felix.framework.capabilityset.Attribute;
+import org.apache.felix.framework.capabilityset.Capability;
+import org.apache.felix.framework.capabilityset.Directive;
+import org.apache.felix.framework.resolver.Module;
 import org.apache.felix.framework.util.FelixConstants;
 import org.apache.felix.framework.util.StringMap;
 import org.apache.felix.framework.util.Util;
+import org.apache.felix.framework.util.manifestparser.CapabilityImpl;
 import org.apache.felix.framework.util.manifestparser.ManifestParser;
-import org.apache.felix.framework.cache.Content;
-import org.apache.felix.framework.util.manifestparser.R4Library;
-import org.apache.felix.framework.wiring.BundleCapabilityImpl;
+import org.apache.felix.framework.resolver.Content;
 import org.osgi.framework.AdminPermission;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleActivator;
@@ -54,10 +54,6 @@ import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
-import org.osgi.framework.wiring.BundleCapability;
-import org.osgi.framework.wiring.BundleRevision;
-import org.osgi.framework.wiring.BundleWire;
-import org.osgi.framework.wiring.BundleWiring;
 
 /**
  * The ExtensionManager class is used in several ways.
@@ -120,10 +116,9 @@ class ExtensionManager extends URLStream
     }
 
     private final Logger m_logger;
-    private final Map m_configMap;
     private final Map m_headerMap = new StringMap(false);
-    private final BundleRevision m_systemBundleRevision;
-    private List<BundleCapability> m_capabilities = null;
+    private final Module m_systemBundleModule;
+    private List<Capability> m_capabilities = null;
     private Set m_exportNames = null;
     private Object m_securityContext = null;
     private final List m_extensions;
@@ -136,8 +131,7 @@ class ExtensionManager extends URLStream
     private ExtensionManager()
     {
         m_logger = null;
-        m_configMap = null;
-        m_systemBundleRevision = null;
+        m_systemBundleModule = null;
         m_extensions = new ArrayList();
         m_extensionsCache = new Bundle[0];
         m_names = new HashSet();
@@ -155,20 +149,19 @@ class ExtensionManager extends URLStream
      * @param config the configuration to read properties from.
      * @param systemBundleInfo the info to change if we need to add exports.
      */
-    ExtensionManager(Logger logger, Map configMap, Felix felix)
+    ExtensionManager(Logger logger, Felix felix)
     {
-        m_logger = logger;
-        m_configMap = configMap;
-        m_systemBundleRevision = new ExtensionManagerRevision(felix);
+        m_systemBundleModule = new ExtensionManagerModule(felix);
         m_extensions = null;
         m_extensionsCache = null;
         m_names = null;
         m_sourceToExtensions = null;
+        m_logger = logger;
 
 // TODO: FRAMEWORK - Not all of this stuff really belongs here, probably only exports.
         // Populate system bundle header map.
         m_headerMap.put(FelixConstants.BUNDLE_VERSION,
-            m_configMap.get(FelixConstants.FELIX_VERSION_PROPERTY));
+            felix.getConfig().get(FelixConstants.FELIX_VERSION_PROPERTY));
         m_headerMap.put(FelixConstants.BUNDLE_SYMBOLICNAME,
             FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME);
         m_headerMap.put(FelixConstants.BUNDLE_NAME, "System Bundle");
@@ -184,27 +177,27 @@ class ExtensionManager extends URLStream
         // We must construct the system bundle's export metadata.
         // Get configuration property that specifies which class path
         // packages should be exported by the system bundle.
-        String syspkgs = (String) m_configMap.get(FelixConstants.FRAMEWORK_SYSTEMPACKAGES);
+        String syspkgs = (String) felix.getConfig().get(FelixConstants.FRAMEWORK_SYSTEMPACKAGES);
         // If no system packages were specified, load our default value.
         syspkgs = (syspkgs == null)
             ? Util.getDefaultProperty(logger, Constants.FRAMEWORK_SYSTEMPACKAGES)
             : syspkgs;
         syspkgs = (syspkgs == null) ? "" : syspkgs;
         // If any extra packages are specified, then append them.
-        String extra = (String) m_configMap.get(FelixConstants.FRAMEWORK_SYSTEMPACKAGES_EXTRA);
+        String extra = (String) felix.getConfig().get(FelixConstants.FRAMEWORK_SYSTEMPACKAGES_EXTRA);
         syspkgs = (extra == null) ? syspkgs : syspkgs + "," + extra;
         m_headerMap.put(FelixConstants.BUNDLE_MANIFESTVERSION, "2");
         m_headerMap.put(FelixConstants.EXPORT_PACKAGE, syspkgs);
         try
         {
             ManifestParser mp = new ManifestParser(
-                m_logger, m_configMap, m_systemBundleRevision, m_headerMap);
-            List<BundleCapability> caps = aliasSymbolicName(mp.getCapabilities());
+                m_logger, felix.getConfig(), m_systemBundleModule, m_headerMap);
+            List<Capability> caps = aliasSymbolicName(mp.getCapabilities());
             setCapabilities(caps);
         }
         catch (Exception ex)
         {
-            m_capabilities = new ArrayList<BundleCapability>(0);
+            m_capabilities = new ArrayList<Capability>(0);
             m_logger.log(
                 Logger.LOG_ERROR,
                 "Error parsing system bundle export statement: "
@@ -212,36 +205,36 @@ class ExtensionManager extends URLStream
         }
     }
 
-    private static List<BundleCapability> aliasSymbolicName(List<BundleCapability> caps)
+    private static List<Capability> aliasSymbolicName(List<Capability> caps)
     {
         if (caps == null)
         {
-            return new ArrayList<BundleCapability>(0);
+            return new ArrayList<Capability>(0);
         }
 
-        List<BundleCapability> aliasCaps = new ArrayList<BundleCapability>(caps);
+        List<Capability> aliasCaps = new ArrayList<Capability>(caps);
 
         for (int capIdx = 0; capIdx < aliasCaps.size(); capIdx++)
         {
             // Get the attributes and search for bundle symbolic name.
-            for (Entry<String, Object> entry : aliasCaps.get(capIdx).getAttributes().entrySet())
+            List<Attribute> attrs = aliasCaps.get(capIdx).getAttributes();
+            for (int i = 0; i < attrs.size(); i++)
             {
                 // If there is a bundle symbolic name attribute, add the
                 // standard alias as a value.
-                if (entry.getKey().equalsIgnoreCase(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE))
+                if (attrs.get(i).getName().equalsIgnoreCase(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE))
                 {
                     // Make a copy of the attribute array.
-                    Map<String, Object> aliasAttrs =
-                        new HashMap<String, Object>(aliasCaps.get(capIdx).getAttributes());
+                    List<Attribute> aliasAttrs = new ArrayList<Attribute>(attrs);
                     // Add the aliased value.
-                    aliasAttrs.put(
+                    aliasAttrs.set(i, new Attribute(
                         Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE,
                         new String[] {
-                            (String) entry.getValue(),
-                            Constants.SYSTEM_BUNDLE_SYMBOLICNAME});
+                            (String) attrs.get(i).getValue(), Constants.SYSTEM_BUNDLE_SYMBOLICNAME},
+                        false));
                     // Create the aliased capability to replace the old capability.
-                    aliasCaps.set(capIdx, new BundleCapabilityImpl(
-                        caps.get(capIdx).getRevision(),
+                    aliasCaps.set(capIdx, new CapabilityImpl(
+                        caps.get(capIdx).getModule(),
                         caps.get(capIdx).getNamespace(),
                         caps.get(capIdx).getDirectives(),
                         aliasAttrs));
@@ -254,9 +247,9 @@ class ExtensionManager extends URLStream
         return aliasCaps;
     }
 
-    public BundleRevision getRevision()
+    public Module getModule()
     {
-        return m_systemBundleRevision;
+        return m_systemBundleModule;
     }
 
     public synchronized Object getSecurityContext()
@@ -306,29 +299,27 @@ class ExtensionManager extends URLStream
             throw new SecurityException("Extension Bundles must have AllPermission");
         }
 
-        String directive = ManifestParser.parseExtensionBundleHeader((String)
-            ((BundleRevisionImpl) bundle.getCurrentRevision())
-                .getHeaders().get(Constants.FRAGMENT_HOST));
+        Directive dir = ManifestParser.parseExtensionBundleHeader((String)
+            bundle.getCurrentModule().getHeaders().get(Constants.FRAGMENT_HOST));
 
         // We only support classpath extensions (not bootclasspath).
-        if (!Constants.EXTENSION_FRAMEWORK.equals(directive))
+        if (!Constants.EXTENSION_FRAMEWORK.equals(dir.getValue()))
         {
             throw new BundleException("Unsupported Extension Bundle type: " +
-                directive, new UnsupportedOperationException(
+                dir.getValue(), new UnsupportedOperationException(
                 "Unsupported Extension Bundle type!"));
         }
 
         try
         {
             // Merge the exported packages with the exported packages of the systembundle.
-            List<BundleCapability> exports = null;
+            List<Capability> exports = null;
             try
             {
                 exports = ManifestParser.parseExportHeader(
-                    m_logger, m_systemBundleRevision,
-                    (String) ((BundleRevisionImpl) bundle.getCurrentRevision())
-                        .getHeaders().get(Constants.EXPORT_PACKAGE),
-                    m_systemBundleRevision.getSymbolicName(), m_systemBundleRevision.getVersion());
+                    m_logger, m_systemBundleModule,
+                    (String) bundle.getCurrentModule().getHeaders().get(Constants.EXPORT_PACKAGE),
+                    m_systemBundleModule.getSymbolicName(), m_systemBundleModule.getVersion());
                 exports = aliasSymbolicName(exports);
             }
             catch (Exception ex)
@@ -337,8 +328,7 @@ class ExtensionManager extends URLStream
                     bundle,
                     Logger.LOG_ERROR,
                     "Error parsing extension bundle export statement: "
-                    + ((BundleRevisionImpl) bundle.getCurrentRevision())
-                        .getHeaders().get(Constants.EXPORT_PACKAGE), ex);
+                    + bundle.getCurrentModule().getHeaders().get(Constants.EXPORT_PACKAGE), ex);
                 return;
             }
 
@@ -356,8 +346,7 @@ class ExtensionManager extends URLStream
                 throw new UnsupportedOperationException(
                     "Unable to add extension bundle to FrameworkClassLoader - Maybe not an URLClassLoader?");
             }
-            List<BundleCapability> temp =
-                new ArrayList<BundleCapability>(m_capabilities.size() + exports.size());
+            List<Capability> temp = new ArrayList<Capability>(m_capabilities.size() + exports.size());
             temp.addAll(m_capabilities);
             temp.addAll(exports);
             setCapabilities(temp);
@@ -380,8 +369,8 @@ class ExtensionManager extends URLStream
     void startExtensionBundle(Felix felix, BundleImpl bundle)
     {
         String activatorClass = (String)
-            ((BundleRevisionImpl) bundle.getCurrentRevision())
-                .getHeaders().get(FelixConstants.FELIX_EXTENSION_ACTIVATOR);
+        bundle.getCurrentModule().getHeaders().get(
+            FelixConstants.FELIX_EXTENSION_ACTIVATOR);
 
         if (activatorClass != null)
         {
@@ -427,7 +416,7 @@ class ExtensionManager extends URLStream
         }
     }
 
-    private void setCapabilities(List<BundleCapability> capabilities)
+    private void setCapabilities(List<Capability> capabilities)
     {
         m_capabilities = capabilities;
         m_headerMap.put(Constants.EXPORT_PACKAGE, convertCapabilitiesToHeaders(m_headerMap));
@@ -440,7 +429,7 @@ class ExtensionManager extends URLStream
 
         for (int i = 0; (m_capabilities != null) && (i < m_capabilities.size()); i++)
         {
-            if (m_capabilities.get(i).getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+            if (m_capabilities.get(i).getNamespace().equals(Capability.PACKAGE_NAMESPACE))
             {
                 // Add a comma separate if there is an existing package.
                 if (exportSB.length() > 0)
@@ -449,35 +438,31 @@ class ExtensionManager extends URLStream
                 }
 
                 // Append exported package information.
-                exportSB.append(m_capabilities.get(i)
-                    .getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR));
-                for (Entry<String, String> entry
-                    : m_capabilities.get(i).getDirectives().entrySet())
+                exportSB.append(m_capabilities.get(i).getAttribute(Capability.PACKAGE_ATTR).getValue());
+                for (Directive dir : m_capabilities.get(i).getDirectives())
                 {
                     exportSB.append("; ");
-                    exportSB.append(entry.getKey());
+                    exportSB.append(dir.getName());
                     exportSB.append(":=\"");
-                    exportSB.append(entry.getValue());
+                    exportSB.append(dir.getValue());
                     exportSB.append("\"");
                 }
-                for (Entry<String, Object> entry
-                    : m_capabilities.get(i).getAttributes().entrySet())
+                for (Attribute attr : m_capabilities.get(i).getAttributes())
                 {
-                    if (!entry.getKey().equals(BundleCapabilityImpl.PACKAGE_ATTR)
-                        && !entry.getKey().equals(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE)
-                        && !entry.getKey().equals(Constants.BUNDLE_VERSION_ATTRIBUTE))
+                    if (!attr.getName().equals(Capability.PACKAGE_ATTR)
+                        && !attr.getName().equals(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE)
+                        && !attr.getName().equals(Constants.BUNDLE_VERSION_ATTRIBUTE))
                     {
                         exportSB.append("; ");
-                        exportSB.append(entry.getKey());
+                        exportSB.append(attr.getName());
                         exportSB.append("=\"");
-                        exportSB.append(entry.getValue());
+                        exportSB.append(attr.getValue());
                         exportSB.append("\"");
                     }
                 }
 
                 // Remember exported packages.
-                exportNames.add(m_capabilities.get(i)
-                    .getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR));
+                exportNames.add(m_capabilities.get(i).getAttribute(Capability.PACKAGE_ATTR).getValue());
             }
         }
 
@@ -509,8 +494,7 @@ class ExtensionManager extends URLStream
         {
             try
             {
-                result = ((BundleRevisionImpl) ((BundleImpl)
-                    extBundle).getCurrentRevision()).getResourceLocal(path);
+                result = ((ModuleImpl) ((BundleImpl) extBundle).getCurrentModule()).getResourceLocal(path);
             }
             catch (Exception ex)
             {
@@ -640,20 +624,17 @@ class ExtensionManager extends URLStream
     // Utility methods.
     //
 
-    class ExtensionManagerRevision extends BundleRevisionImpl
+    class ExtensionManagerModule extends ModuleImpl
     {
         private final Version m_version;
-        private volatile BundleWiring m_wiring;
-
-        ExtensionManagerRevision(Felix felix)
+        ExtensionManagerModule(Felix felix)
         {
-            super(m_logger, m_configMap, felix, "0",
+            super(m_logger, felix.getConfig(), felix, "0",
                 felix.getBootPackages(), felix.getBootPackageWildcards());
             m_version = new Version((String)
-                m_configMap.get(FelixConstants.FELIX_VERSION_PROPERTY));
+                felix.getConfig().get(FelixConstants.FELIX_VERSION_PROPERTY));
         }
 
-        @Override
         public Map getHeaders()
         {
             synchronized (ExtensionManager.this)
@@ -662,8 +643,7 @@ class ExtensionManager extends URLStream
             }
         }
 
-        @Override
-        public List<BundleCapability> getDeclaredCapabilities(String namespace)
+        public List<Capability> getCapabilities()
         {
             synchronized (ExtensionManager.this)
             {
@@ -671,102 +651,16 @@ class ExtensionManager extends URLStream
             }
         }
 
-        @Override
         public String getSymbolicName()
         {
             return FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME;
         }
 
-        @Override
         public Version getVersion()
         {
             return m_version;
         }
 
-        @Override
-        public void close()
-        {
-            // Nothing needed here.
-        }
-
-        @Override
-        public Content getContent()
-        {
-            return ExtensionManager.this;
-        }
-
-        @Override
-        public URL getEntry(String name)
-        {
-            // There is no content for the system bundle, so return null.
-            return null;
-        }
-
-        @Override
-        public boolean hasInputStream(int index, String urlPath)
-        {
-            return (getClass().getClassLoader().getResource(urlPath) != null);
-        }
-
-        @Override
-        public InputStream getInputStream(int index, String urlPath)
-        {
-            return getClass().getClassLoader().getResourceAsStream(urlPath);
-        }
-
-        @Override
-        public URL getLocalURL(int index, String urlPath)
-        {
-            return getClass().getClassLoader().getResource(urlPath);
-        }
-
-        @Override
-        public void resolve(BundleWiringImpl wire)
-        {
-            try
-            {
-                m_wiring = new ExtensionManagerWiring(
-                    m_logger, m_configMap, this);
-            }
-            catch (Exception ex)
-            {
-                // This should never happen.
-            }
-        }
-
-        @Override
-        public BundleWiring getWiring()
-        {
-            return m_wiring;
-        }
-    }
-
-    class ExtensionManagerWiring extends BundleWiringImpl
-    {
-        ExtensionManagerWiring(
-            Logger logger, Map configMap, BundleRevisionImpl revision)
-            throws Exception
-        {
-            super(logger, configMap, null, revision,
-                null, Collections.EMPTY_LIST, null, null);
-        }
-
-        @Override
-        public List<BundleCapability> getCapabilities(String namespace)
-        {
-            synchronized (ExtensionManager.this)
-            {
-                return m_capabilities;
-            }
-        }
-
-        @Override
-        public List<R4Library> getNativeLibraries()
-        {
-            return Collections.EMPTY_LIST;
-        }
-
-        @Override
         public Class getClassByDelegation(String name) throws ClassNotFoundException
         {
             Class clazz = null;
@@ -810,13 +704,11 @@ class ExtensionManager extends URLStream
             return clazz;
         }
 
-        @Override
         public URL getResourceByDelegation(String name)
         {
             return getClass().getClassLoader().getResource(name);
         }
 
-        @Override
         public Enumeration getResourcesByDelegation(String name)
         {
            try
@@ -829,10 +721,56 @@ class ExtensionManager extends URLStream
            }
         }
 
-        @Override
-        public void dispose()
+        public Logger getLogger()
+        {
+            return m_logger;
+        }
+
+        public Map getConfig()
+        {
+            return null;
+        }
+
+        public StatefulResolver getResolver()
+        {
+            return null;
+        }
+
+        public void attachFragmentContents(Content[] fragmentContents)
+            throws Exception
+        {
+            throw new UnsupportedOperationException("Should not be used!");
+        }
+
+        public void close()
         {
             // Nothing needed here.
         }
+
+        public Content getContent()
+        {
+            return ExtensionManager.this;
+        }
+
+        public URL getEntry(String name)
+        {
+            // There is no content for the system bundle, so return null.
+            return null;
+        }
+
+        public boolean hasInputStream(int index, String urlPath)
+        {
+            return (getClass().getClassLoader().getResource(urlPath) != null);
+        }
+
+        public InputStream getInputStream(int index, String urlPath)
+        {
+            return getClass().getClassLoader().getResourceAsStream(urlPath);
+        }
+
+        public URL getLocalURL(int index, String urlPath)
+        {
+            return getClass().getClassLoader().getResource(urlPath);
+        }
     }
-}
\ No newline at end of file
+}



Mime
View raw message