diff --git a/framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java b/framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java
index 07d0cab..3d92ecc 100644
--- a/framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java
@@ -18,7 +18,7 @@
  */
 package org.apache.felix.framework;
 
-import org.apache.felix.framework.util.manifestparser.R4Export;
+import org.apache.felix.framework.util.manifestparser.Capability;
 import org.apache.felix.moduleloader.IModule;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Version;
@@ -29,12 +29,12 @@
     private Felix m_felix = null;
     private BundleImpl m_exportingBundle = null;
     private IModule m_exportingModule = null;
-    private R4Export m_export = null;
+    private Capability m_export = null;
     private String m_toString = null;
     private String m_versionString = null;
 
     public ExportedPackageImpl(
-        Felix felix, BundleImpl exporter, IModule module, R4Export export)
+        Felix felix, BundleImpl exporter, IModule module, Capability export)
     {
         m_felix = felix;
         m_exportingBundle = exporter;
@@ -64,25 +64,25 @@
 
     public String getName()
     {
-        return m_export.getName();
+        return m_export.getPackageName();
     }
 
     public String getSpecificationVersion()
     {
         if (m_versionString == null)
         {
-            m_versionString = (m_export.getVersion() == null)
+            m_versionString = (m_export.getPackageVersion() == null)
                 ? Version.emptyVersion.toString()
-                : m_export.getVersion().toString();
+                : m_export.getPackageVersion().toString();
         }
         return m_versionString;
     }
 
     public Version getVersion()
     {
-        return (m_export.getVersion() == null)
+        return (m_export.getPackageVersion() == null)
             ? Version.emptyVersion
-            : m_export.getVersion();
+            : m_export.getPackageVersion();
     }
 
     public boolean isRemovalPending()
@@ -94,7 +94,7 @@
     {
         if (m_toString == null)
         {
-            m_toString = m_export.getName()
+            m_toString = m_export.getPackageName()
                 + "; version=" + getSpecificationVersion();
         }
         return m_toString;
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index 24aaab2..853d7f7 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -387,7 +387,7 @@
                 // This should never happen.
                 throw new BundleException(
                         "Unresolved package in System Bundle:"
-                        + ex.getPackage());
+                        + ex.getRequirement());
             }
 
             // Start the system bundle; this will set its state
@@ -456,6 +456,7 @@
             {
 // TODO: RB - Should this be system bundle, since bundle could be null?
 //                fireFrameworkEvent(FrameworkEvent.ERROR, systembundle, ex);
+ex.printStackTrace();
                 fireFrameworkEvent(FrameworkEvent.ERROR, bundle, ex);
                 try
                 {
@@ -1347,39 +1348,50 @@
         // to import the necessary packages.
         if (System.getSecurityManager() != null)
         {
-
             ProtectionDomain pd = (ProtectionDomain)
                 bundle.getInfo().getCurrentModule().getSecurityContext();
 
-            R4Import[] imports =
-                bundle.getInfo().getCurrentModule().getDefinition().getImports();
+            IRequirement[] imports =
+                bundle.getInfo().getCurrentModule().getDefinition().getRequirements();
 
-            for (int i = 0;i < imports.length; i++)
+/*
+ TODO: RB - We need to fix this import check by looking at the wire
+            associated with it, not the import since we don't know the
+            package name associated with the import since it is a filter.
+
+            for (int i = 0; i < imports.length; i++)
             {
-                PackagePermission perm = new PackagePermission(imports[i].getName(),
-                    PackagePermission.IMPORT);
-
-                if (!pd.implies(perm))
+                if (imports[i].getNamespace().equals(ICapability.PACKAGE_NAMESPACE))
                 {
-                    throw new java.security.AccessControlException(
-                        "PackagePermission.IMPORT denied for import: " +
-                        imports[i].getName(), perm);
+                    PackagePermission perm = new PackagePermission(
+                        imports[i].???,
+                        PackagePermission.IMPORT);
+    
+                    if (!pd.implies(perm))
+                    {
+                        throw new java.security.AccessControlException(
+                            "PackagePermission.IMPORT denied for import: " +
+                            imports[i].getName(), perm);
+                    }
                 }
             }
+*/
             // Check export permission for all exports of the current module.
-            R4Export[] implicitImports =
-                bundle.getInfo().getCurrentModule().getDefinition().getExports();
-
-            for (int i = 0;i < implicitImports.length; i++)
+            ICapability[] exports =
+                bundle.getInfo().getCurrentModule().getDefinition().getCapabilities();
+            for (int i = 0; i < exports.length; i++)
             {
-                PackagePermission perm = new PackagePermission(
-                    implicitImports[i].getName(), PackagePermission.EXPORT);
-
-                if (!pd.implies(perm))
+                if (exports[i].getNamespace().equals(ICapability.PACKAGE_NAMESPACE))
                 {
-                    throw new java.security.AccessControlException(
-                        "PackagePermission.EXPORT denied for implicit export: " +
-                        implicitImports[i].getName(), perm);
+                    PackagePermission perm = new PackagePermission(
+                        (String) exports[i].getProperties().get(ICapability.PACKAGE_PROPERTY), PackagePermission.EXPORT);
+    
+                    if (!pd.implies(perm))
+                    {
+                        throw new java.security.AccessControlException(
+                            "PackagePermission.EXPORT denied for export: " +
+                            exports[i].getProperties().get(ICapability.PACKAGE_PROPERTY), perm);
+                    }
                 }
             }
         }
@@ -1396,7 +1408,7 @@
                 throw new BundleException(
                     "Unresolved package in bundle "
                     + Util.getBundleIdFromModuleId(ex.getModule().getId())
-                    + ": " + ex.getPackage());
+                    + ": " + ex.getRequirement());
             }
             else
             {
@@ -2311,14 +2323,23 @@
      * package name. This is used by the PackageAdmin service
      * implementation.
      *
-     * @param name The name of the exported package to find.
+     * @param pkgName The name of the exported package to find.
      * @return The exported package or null if no matching package was found.
     **/
-    protected ExportedPackage[] getExportedPackages(String name)
+    protected ExportedPackage[] getExportedPackages(String pkgName)
     {
-        // First, get all exporters of the package.
         ExportedPackage[] pkgs = null;
-        IModule[] exporters = m_policyCore.getInUseExporters(new R4Import(name, null, null), true);
+
+        // First, get all exporters of the package.
+        R4SearchPolicyCore.ResolverCandidate[] exporters =
+            m_policyCore.getInUseCandidates(
+                new Requirement(
+                    ICapability.PACKAGE_NAMESPACE,
+                    null,
+                    null,
+                    new R4Attribute[] { new R4Attribute(ICapability.PACKAGE_PROPERTY, pkgName, false) }),
+                true);
+
         if (exporters != null)
         {
             pkgs = new ExportedPackage[exporters.length];
@@ -2326,7 +2347,7 @@
             {
                 // Get the bundle associated with the current exporting module.
                 BundleImpl bundle = (BundleImpl) getBundle(
-                    Util.getBundleIdFromModuleId(exporters[pkgIdx].getId()));
+                    Util.getBundleIdFromModuleId(exporters[pkgIdx].m_module.getId()));
 
                 // We need to find the version of the exported package, but this
                 // is tricky since there may be multiple versions of the package
@@ -2341,12 +2362,19 @@
                 IModule[] modules = bundle.getInfo().getModules();
                 for (int modIdx = 0; modIdx < modules.length; modIdx++)
                 {
-                    R4Export export = Util.getExportPackage(modules[modIdx], name);
-                    if (export != null)
+                    Capability ec = (Capability)
+                        Util.getSatisfyingCapability(
+                            modules[modIdx],
+                            new Requirement(
+                                ICapability.PACKAGE_NAMESPACE,
+                                null,
+                                null,
+                                new R4Attribute[] { new R4Attribute(ICapability.PACKAGE_PROPERTY, pkgName, false) }));
+
+                    if (ec != null)
                     {
                         pkgs[pkgIdx] =
-                            new ExportedPackageImpl(
-                                this, bundle, modules[modIdx], export);
+                            new ExportedPackageImpl(this, bundle, modules[modIdx], ec);
                     }
                 }
             }
@@ -2425,24 +2453,29 @@
         IModule[] modules = bundle.getInfo().getModules();
         for (int modIdx = 0; modIdx < modules.length; modIdx++)
         {
-            R4Export[] exports = modules[modIdx].getDefinition().getExports();
-            if ((exports != null) && (exports.length > 0))
+            ICapability[] caps = modules[modIdx].getDefinition().getCapabilities();
+            if ((caps != null) && (caps.length > 0))
             {
-                for (int expIdx = 0; expIdx < exports.length; expIdx++)
+                for (int capIdx = 0; capIdx < caps.length; capIdx++)
                 {
                     // See if the target bundle's module is one of the
                     // "in use" exporters of the package.
-                    IModule[] inUseModules =
-                        m_policyCore.getInUseExporters(
-                            new R4Import(exports[expIdx].getName(), null, null), true);
+                    R4SearchPolicyCore.ResolverCandidate[] inUseModules = m_policyCore.getInUseCandidates(
+                        new Requirement(
+                            ICapability.PACKAGE_NAMESPACE,
+                            null,
+                            null,
+                            new R4Attribute[] { new R4Attribute(ICapability.PACKAGE_PROPERTY, ((Capability) caps[capIdx]).getPackageName(), false) }),
+                        true);
+
                     // Search through the current providers to find the target
                     // module.
                     for (int i = 0; (inUseModules != null) && (i < inUseModules.length); i++)
                     {
-                        if (inUseModules[i] == modules[modIdx])
+                        if (inUseModules[i].m_module == modules[modIdx])
                         {
                             list.add(new ExportedPackageImpl(
-                                this, bundle, modules[modIdx], exports[expIdx]));
+                                this, bundle, modules[modIdx], (Capability) caps[capIdx]));
                         }
                     }
                 }
@@ -2505,6 +2538,7 @@
             // If there are targets, then resolve each one.
             if (bundles != null)
             {
+long time = System.currentTimeMillis();
                 for (int i = 0; i < bundles.length; i++)
                 {
                     try
@@ -2520,6 +2554,8 @@
                             ex);
                     }
                 }
+time = System.currentTimeMillis() - time;
+System.out.println("!!! ELAPSED RESOLVE TIME : " + time);
             }
 
             return result;
@@ -2692,9 +2728,9 @@
 
         // Create the module definition for the new module.
         IModuleDefinition md = new ModuleDefinition(
-            mp.getExports(),
-            mp.getImports(),
-            mp.getDynamicImports(),
+            mp.getCapabilities(),
+            mp.getRequirements(),
+            mp.getDynamicRequirements(),
             mp.getLibraries(m_cache.getArchive(targetId).getRevision(revision)));
 
         // Create the module using the module definition.
diff --git a/framework/src/main/java/org/apache/felix/framework/SystemBundle.java b/framework/src/main/java/org/apache/felix/framework/SystemBundle.java
index 7868fe5..a8fc45e 100644
--- a/framework/src/main/java/org/apache/felix/framework/SystemBundle.java
+++ b/framework/src/main/java/org/apache/felix/framework/SystemBundle.java
@@ -24,8 +24,9 @@
 import org.apache.felix.framework.cache.SystemBundleArchive;
 import org.apache.felix.framework.util.FelixConstants;
 import org.apache.felix.framework.util.StringMap;
+import org.apache.felix.framework.util.manifestparser.Capability;
 import org.apache.felix.framework.util.manifestparser.ManifestParser;
-import org.apache.felix.framework.util.manifestparser.R4Export;
+import org.apache.felix.moduleloader.ICapability;
 import org.apache.felix.moduleloader.IContentLoader;
 import org.osgi.framework.*;
 
@@ -34,7 +35,7 @@
     private List m_activatorList = null;
     private BundleActivator m_activator = null;
     private Thread m_shutdownThread = null;
-    private R4Export[] m_exports = null;
+    private ICapability[] m_exports = null;
     private IContentLoader m_contentLoader = null;
 
     protected SystemBundle(Felix felix, BundleInfo info, List activatorList)
@@ -64,31 +65,20 @@
 
         // Get system property that specifies which class path
         // packages should be exported by the system bundle.
-        R4Export[] classPathPkgs = null;
         try
         {
-            classPathPkgs = (R4Export[]) ManifestParser.parseImportExportHeader(
-                getFelix().getConfig().get(Constants.FRAMEWORK_SYSTEMPACKAGES), true);
+            m_exports = (ICapability[]) ManifestParser.parseExportHeader(
+                getFelix().getConfig().get(Constants.FRAMEWORK_SYSTEMPACKAGES));
         }
         catch (Exception ex)
         {
-            classPathPkgs = new R4Export[0];
+            m_exports = new ICapability[0];
             getFelix().getLogger().log(
                 Logger.LOG_ERROR,
                 "Error parsing system bundle export statement: "
                 + getFelix().getConfig().get(Constants.FRAMEWORK_SYSTEMPACKAGES), ex);
         }
 
-        // Now, create the list of standard framework exports for
-        // the system bundle.
-        m_exports = new R4Export[classPathPkgs.length];
-
-        // Copy the class path exported packages.
-        for (int i = 0; i < classPathPkgs.length; i++)
-        {
-            m_exports[i] = classPathPkgs[i];
-        }
-
         m_contentLoader = new SystemBundleContentLoader(getFelix().getLogger());
 
         StringBuffer exportSB = new StringBuffer("");
@@ -99,9 +89,9 @@
                 exportSB.append(", ");
             }
 
-            exportSB.append(m_exports[i].getName());
+            exportSB.append(((Capability) m_exports[i]).getPackageName());
             exportSB.append("; version=\"");
-            exportSB.append(m_exports[i].getVersion().toString());
+            exportSB.append(((Capability) m_exports[i]).getPackageVersion().toString());
             exportSB.append("\"");
         }
 
@@ -123,7 +113,7 @@
         // that will allow for them to be independently configured.
     }
 
-    public R4Export[] getExports()
+    public ICapability[] getExports()
     {
         return m_exports;
     }
