felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r374660 [1/2] - in /incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix: framework/ framework/cache/ framework/searchpolicy/ framework/util/ moduleloader/ moduleloader/search/
Date Fri, 03 Feb 2006 12:55:44 GMT
Author: rickhall
Date: Fri Feb  3 04:54:52 2006
New Revision: 374660

URL: http://svn.apache.org/viewcvs?rev=374660&view=rev
Log:
Merged sandbox/rickhall/framework-branch changes r370894:374616 into trunk.
These changes represent a refactoring of the Module Loader layer to provide
better abstractions for modules and search policy to more cleanly support
some R4 features, like Bundle.getEntry(), and future experimental features.

Added:
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Logger.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/Logger.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundleContentLoader.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/SystemBundleContentLoader.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentClassLoader.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ContentClassLoader.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/IR4SearchPolicy.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/IR4SearchPolicy.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Export.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Export.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Import.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Import.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Library.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4Library.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4LibraryHeader.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4LibraryHeader.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicy.java   (props changed)
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicy.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/ResolveException.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ResolveException.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/ResolveListener.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/ResolveListener.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/URLPolicyImpl.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/URLPolicyImpl.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IContent.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/IContent.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IContentLoader.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/IContentLoader.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IModule.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/IModule.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IModuleFactory.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/IModuleFactory.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/ISearchPolicy.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/ISearchPolicy.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IURLPolicy.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/IURLPolicy.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/JarContent.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/JarContent.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/ModuleFactoryImpl.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/ModuleFactoryImpl.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java
      - copied unchanged from r374634, incubator/felix/sandbox/rickhall/framework-branch/src/main/java/org/apache/felix/moduleloader/ModuleImpl.java
Removed:
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/LogWrapper.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/OSGiLibrarySource.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/OSGiURLPolicy.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Version.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/LibraryInfo.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/DefaultURLPolicy.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/JarResourceSource.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/LibrarySource.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/Module.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/ModuleClassLoader.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/ModuleManager.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/ModuleURLConnection.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/ModuleURLStreamHandler.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/ResourceSource.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/SearchPolicy.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/URLPolicy.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/Util.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/search/
Modified:
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleInfo.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/FilterImpl.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundle.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundleArchive.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/URLHandlers.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DefaultBundleArchive.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/DefaultBundleCache.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Package.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/DispatchQueue.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/FelixDispatchQueue.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/ObjectInputStreamX.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/SecureAction.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/Util.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/ModuleEvent.java
    incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/ModuleListener.java

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java?rev=374660&r1=374659&r2=374660&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java Fri Feb  3 04:54:52 2006
@@ -156,7 +156,7 @@
         }
         catch (InvalidSyntaxException ex)
         {
-            m_felix.getLogger().log(LogWrapper.LOG_ERROR, "BundleContextImpl: " + ex);
+            m_felix.getLogger().log(Logger.LOG_ERROR, "BundleContextImpl: " + ex);
         }
         return null;
     }

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleInfo.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleInfo.java?rev=374660&r1=374659&r2=374660&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleInfo.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/BundleInfo.java Fri Feb  3 04:54:52 2006
@@ -1,5 +1,5 @@
 /*
- *   Copyright 2005 The Apache Software Foundation
+ *   Copyright 2006 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -19,14 +19,14 @@
 import java.util.Map;
 
 import org.apache.felix.framework.cache.BundleArchive;
-import org.apache.felix.moduleloader.Module;
+import org.apache.felix.moduleloader.IModule;
 import org.osgi.framework.*;
 
 class BundleInfo
 {
-    private LogWrapper m_logger = null;
+    private Logger m_logger = null;
     private BundleArchive m_archive = null;
-    private Module[] m_modules = null;
+    private IModule[] m_modules = null;
     private int m_state = 0;
     private long m_modified = 0;
     private BundleActivator m_activator = null;
@@ -39,12 +39,12 @@
     private int m_lockCount = 0;
     private Thread m_lockThread = null;
 
-    protected BundleInfo(LogWrapper logger, BundleArchive archive, Module module)
+    protected BundleInfo(Logger logger, BundleArchive archive, IModule module)
         throws Exception
     {
         m_logger = logger;
         m_archive = archive;
-        m_modules = (module == null) ? new Module[0] : new Module[] { module };
+        m_modules = (module == null) ? new IModule[0] : new IModule[] { module };
 
         m_state = Bundle.INSTALLED;
         m_removalPending = false;
@@ -73,7 +73,7 @@
      * no limit on the potential number of bundle JAR file revisions.
      * @return array of modules corresponding to the bundle JAR file revisions.
     **/
-    public Module[] getModules()
+    public IModule[] getModules()
     {
         return m_modules;
     }
@@ -84,7 +84,7 @@
      * @return <tt>true</tt> if the specified module is in the array of modules
      *         associated with this bundle, <tt>false</tt> otherwise.
     **/
-    public boolean hasModule(Module module)
+    public boolean hasModule(IModule module)
     {
         for (int i = 0; i < m_modules.length; i++)
         {
@@ -101,7 +101,7 @@
      * in the module array.
      * @return the newest module.
     **/
-    public Module getCurrentModule()
+    public IModule getCurrentModule()
     {
         return m_modules[m_modules.length - 1];
     }
@@ -111,9 +111,9 @@
      * the bundle associated with this <tt>BundleInfo</tt> object.
      * @param module the module to add.
     **/
-    public void addModule(Module module)
+    public void addModule(IModule module)
     {
-        Module[] dest = new Module[m_modules.length + 1];
+        IModule[] dest = new IModule[m_modules.length + 1];
         System.arraycopy(m_modules, 0, dest, 0, m_modules.length);
         dest[m_modules.length] = module;
         m_modules = dest;
@@ -133,7 +133,7 @@
         catch (Exception ex)
         {
             m_logger.log(
-                LogWrapper.LOG_ERROR,
+                Logger.LOG_ERROR,
                 "Error reading location from bundle archive.",
                 ex);
             return null;
@@ -149,7 +149,7 @@
         catch (Exception ex)
         {
             m_logger.log(
-                LogWrapper.LOG_ERROR,
+                Logger.LOG_ERROR,
                 "Error reading start level from bundle archive.",
                 ex);
             return defaultLevel;
@@ -165,7 +165,7 @@
         catch (Exception ex)
         {
             m_logger.log(
-                LogWrapper.LOG_ERROR,
+                Logger.LOG_ERROR,
                 "Error writing start level to bundle archive.",
                 ex);
         }
@@ -182,7 +182,7 @@
         catch (Exception ex)
         {
             m_logger.log(
-                LogWrapper.LOG_ERROR,
+                Logger.LOG_ERROR,
                 "Error reading manifest from bundle archive.",
                 ex);
             return null;
@@ -218,7 +218,7 @@
         catch (Exception ex)
         {
             m_logger.log(
-                LogWrapper.LOG_ERROR,
+                Logger.LOG_ERROR,
                 "Error reading persistent state from bundle archive.",
                 ex);
             return Bundle.INSTALLED;
@@ -233,7 +233,7 @@
         }
         catch (Exception ex)
         {
-            m_logger.log(LogWrapper.LOG_ERROR,
+            m_logger.log(Logger.LOG_ERROR,
                 "Error writing persistent state to bundle archive.",
                 ex);
         }
@@ -248,7 +248,7 @@
         catch (Exception ex)
         {
             m_logger.log(
-                LogWrapper.LOG_ERROR,
+                Logger.LOG_ERROR,
                 "Error writing persistent state to bundle archive.",
                 ex);
         }
@@ -263,7 +263,7 @@
         catch (Exception ex)
         {
             m_logger.log(
-                LogWrapper.LOG_ERROR,
+                Logger.LOG_ERROR,
                 "Error writing persistent state to bundle archive.",
                 ex);
         }
@@ -341,43 +341,5 @@
     {
         m_lockCount = info.m_lockCount;
         m_lockThread = info.m_lockThread;
-    }
-
-    /**
-     * Converts a module identifier to a bundle identifier. Module IDs
-     * are typically <tt>&lt;bundle-id&gt;.&lt;revision&gt;</tt>; this
-     * method returns only the portion corresponding to the bundle ID.
-    **/
-    protected static long getBundleIdFromModuleId(String id)
-    {
-        try
-        {
-            String bundleId = (id.indexOf('.') >= 0)
-                ? id.substring(0, id.indexOf('.')) : id;
-            return Long.parseLong(bundleId);
-        }
-        catch (NumberFormatException ex)
-        {
-            return -1;
-        }
-    }
-
-    /**
-     * Converts a module identifier to a bundle identifier. Module IDs
-     * are typically <tt>&lt;bundle-id&gt;.&lt;revision&gt;</tt>; this
-     * method returns only the portion corresponding to the revision.
-    **/
-    protected static int getModuleRevisionFromModuleId(String id)
-    {
-        try
-        {
-            String rev = (id.indexOf('.') >= 0)
-                ? id.substring(id.indexOf('.') + 1) : id;
-            return Integer.parseInt(rev);
-        }
-        catch (NumberFormatException ex)
-        {
-            return -1;
-        }
     }
 }

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java?rev=374660&r1=374659&r2=374660&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ExportedPackageImpl.java Fri Feb  3 04:54:52 2006
@@ -1,5 +1,5 @@
 /*
- *   Copyright 2005 The Apache Software Foundation
+ *   Copyright 2006 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -16,8 +16,8 @@
  */
 package org.apache.felix.framework;
 
-import org.apache.felix.framework.searchpolicy.R4Version;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
 import org.osgi.service.packageadmin.ExportedPackage;
 
 class ExportedPackageImpl implements ExportedPackage
@@ -25,12 +25,12 @@
     private Felix m_felix = null;
     private BundleImpl m_exporter = null;
     private String m_name = null;
-    private R4Version m_version = null;
+    private Version m_version = null;
     private String m_toString = null;
     private String m_versionString = null;
 
     public ExportedPackageImpl(
-        Felix felix, BundleImpl exporter, String name, R4Version version)
+        Felix felix, BundleImpl exporter, String name, Version version)
     {
         m_felix = felix;
         m_exporter = exporter;

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java?rev=374660&r1=374659&r2=374660&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java Fri Feb  3 04:54:52 2006
@@ -1,5 +1,5 @@
 /*
- *   Copyright 2005 The Apache Software Foundation
+ *   Copyright 2006 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -27,22 +27,21 @@
 import org.apache.felix.framework.util.*;
 import org.apache.felix.framework.util.Util;
 import org.apache.felix.moduleloader.*;
-import org.apache.felix.moduleloader.search.ResolveException;
-import org.apache.felix.moduleloader.search.ResolveListener;
 import org.osgi.framework.*;
 import org.osgi.service.packageadmin.ExportedPackage;
 
 public class Felix
 {
     // Logging related member variables.
-    private LogWrapper m_logger = new LogWrapper();
+    private Logger m_logger = new Logger();
     // Config properties.
     private PropertyResolver m_config = new ConfigImpl();
     // Configuration properties passed into constructor.
     private MutablePropertyResolver m_configMutable = null;
 
-    // MODULE MANAGER.
-    private ModuleManager m_mgr = null;
+    // MODULE FACTORY.
+    private IModuleFactory m_factory = null;
+    private R4SearchPolicyCore m_policyCore = null;
 
     // Object used as a lock when calculating which bundles
     // when performing an operation on one or more bundles.
@@ -97,6 +96,9 @@
     // Service registry.
     private ServiceRegistry m_registry = null;
 
+    // Reusable bundle URL stream handler.
+    private URLStreamHandler m_bundleStreamHandler = null;
+
     // Reusable admin permission object for all instances
     // of the BundleImpl.
     private static AdminPermission m_adminPerm = new AdminPermission();
@@ -215,7 +217,7 @@
         m_frameworkStatus = STARTING_STATUS;
 
         // Initialize member variables.
-        m_mgr = null;
+        m_factory = null;
         m_configMutable = (configMutable == null)
             ? new MutablePropertyResolverImpl(new StringMap(false)) : configMutable;
         m_activeStartLevel = FelixConstants.FRAMEWORK_INACTIVE_STARTLEVEL;
@@ -225,6 +227,7 @@
         m_cache = null;
         m_nextId = 1L;
         m_dispatchQueue = null;
+        m_bundleStreamHandler = new URLHandlersBundleStreamHandler(this);
         m_registry = new ServiceRegistry(m_logger);
 
         // Add a listener to the service registry; this is
@@ -272,18 +275,18 @@
         }
 
         // Create search policy for module loader.
-        R4SearchPolicy searchPolicy = new R4SearchPolicy(m_logger);
+        m_policyCore = new R4SearchPolicyCore(m_logger);
 
         // Add a resolver listener to the search policy
         // so that we will be notified when modules are resolved
         // in order to update the bundle state.
-        searchPolicy.addResolverListener(new ResolveListener() {
+        m_policyCore.addResolverListener(new ResolveListener() {
             public void moduleResolved(ModuleEvent event)
             {
                 BundleImpl bundle = null;
                 try
                 {
-                    long id = BundleInfo.getBundleIdFromModuleId(
+                    long id = Util.getBundleIdFromModuleId(
                         event.getModule().getId());
                     if (id >= 0)
                     {
@@ -331,7 +334,8 @@
             }
         });
 
-        m_mgr = new ModuleManager(searchPolicy, new OSGiURLPolicy(this));
+        m_factory = new ModuleFactoryImpl(m_logger);
+        m_policyCore.setModuleFactory(m_factory);
 
         // Initialize dispatch queue.
         m_dispatchQueue = new FelixDispatchQueue(m_logger);
@@ -349,13 +353,16 @@
             BundleInfo info = new BundleInfo(
                 m_logger, new SystemBundleArchive(), null);
             systembundle = new SystemBundle(this, info, activatorList);
-            systembundle.getInfo().addModule(
-                m_mgr.addModule(
-                    "0", systembundle.getAttributes(),
-                    systembundle.getResourceSources(),
-                    systembundle.getLibrarySources(),
-                    true)); // HACK ALERT! This flag indicates that we will
-                            // use the parent class loader as a resource source.
+            systembundle.getInfo().addModule(m_factory.createModule("0"));
+            systembundle.getContentLoader().setSearchPolicy(
+                new R4SearchPolicy(
+                    m_policyCore, systembundle.getInfo().getCurrentModule()));
+            m_factory.setContentLoader(
+                systembundle.getInfo().getCurrentModule(),
+                systembundle.getContentLoader());
+            m_policyCore.setExports(
+                systembundle.getInfo().getCurrentModule(), systembundle.getExports());
+
             m_installedBundleMap.put(
                 systembundle.getInfo().getLocation(), systembundle);
 
@@ -363,7 +370,7 @@
             // state to be set to RESOLVED.
             try
             {
-                searchPolicy.resolve(systembundle.getInfo().getCurrentModule());
+                m_policyCore.resolve(systembundle.getInfo().getCurrentModule());
             }
             catch (ResolveException ex)
             {
@@ -380,9 +387,9 @@
         }
         catch (Exception ex)
         {
-            m_mgr = null;
+            m_factory = null;
             DispatchQueue.shutdown();
-            m_logger.log(LogWrapper.LOG_ERROR, "Unable to start system bundle.", ex);
+            m_logger.log(Logger.LOG_ERROR, "Unable to start system bundle.", ex);
             throw new RuntimeException("Unable to start system bundle.");
         }
         
@@ -397,7 +404,7 @@
         catch (Exception ex)
         {
             m_logger.log(
-                LogWrapper.LOG_ERROR,
+                Logger.LOG_ERROR,
                 "Unable to list saved bundles: " + ex, ex);
             archives = null;
         }
@@ -437,14 +444,14 @@
                 try
                 {
                     m_logger.log(
-                        LogWrapper.LOG_ERROR,
+                        Logger.LOG_ERROR,
                         "Unable to re-install " + archives[i].getLocation(),
                         ex);
                 }
                 catch (Exception ex2)
                 {
                     m_logger.log(
-                        LogWrapper.LOG_ERROR,
+                        Logger.LOG_ERROR,
                         "Unable to re-install bundle " + archives[i].getId(),
                         ex);
                 }
@@ -521,7 +528,7 @@
         catch (Exception ex)
         {
             fireFrameworkEvent(FrameworkEvent.ERROR, getBundle(0), ex);
-            m_logger.log(LogWrapper.LOG_ERROR, "Error stopping system bundle.", ex);
+            m_logger.log(Logger.LOG_ERROR, "Error stopping system bundle.", ex);
         }
 
         // Loop through all bundles and update any updated bundles.
@@ -538,7 +545,7 @@
                 catch (Exception ex)
                 {
                     fireFrameworkEvent(FrameworkEvent.ERROR, bundle, ex);
-                    m_logger.log(LogWrapper.LOG_ERROR, "Unable to purge bundle "
+                    m_logger.log(Logger.LOG_ERROR, "Unable to purge bundle "
                         + bundle.getInfo().getLocation(), ex);
                 }
             }
@@ -556,7 +563,7 @@
             catch (Exception ex)
             {
                 m_logger.log(
-                    LogWrapper.LOG_ERROR,
+                    Logger.LOG_ERROR,
                     "Unable to remove "
                     + m_uninstalledBundles[i].getInfo().getLocation(), ex);
             }
@@ -682,7 +689,7 @@
                 {
                     fireFrameworkEvent(FrameworkEvent.ERROR, impl, th);
                     m_logger.log(
-                        LogWrapper.LOG_ERROR,
+                        Logger.LOG_ERROR,
                         "Error starting " + impl.getInfo().getLocation(), th);
                 }
             }
@@ -698,7 +705,7 @@
                 {
                     fireFrameworkEvent(FrameworkEvent.ERROR, impl, th);
                     m_logger.log(
-                        LogWrapper.LOG_ERROR,
+                        Logger.LOG_ERROR,
                         "Error stopping " + impl.getInfo().getLocation(), th);
                 }
             }
@@ -810,7 +817,7 @@
         }
         catch (BundleException ex)
         {
-            m_logger.log(LogWrapper.LOG_ERROR, "Unable to acquire lock to set start level.", ex);
+            m_logger.log(Logger.LOG_ERROR, "Unable to acquire lock to set start level.", ex);
             return;
         }
         
@@ -847,12 +854,12 @@
                 catch (Throwable th)
                 {
                     rethrow = th;
-                    m_logger.log(LogWrapper.LOG_ERROR, "Error starting/stopping bundle.", th);
+                    m_logger.log(Logger.LOG_ERROR, "Error starting/stopping bundle.", th);
                 }
             }
             else
             {
-                m_logger.log(LogWrapper.LOG_WARNING, "Bundle start level must be greater than zero.");
+                m_logger.log(Logger.LOG_WARNING, "Bundle start level must be greater than zero.");
             }
         }
         finally
@@ -899,9 +906,18 @@
     **/
     protected boolean isBundleClass(Class clazz)
     {
-        if (clazz.getClassLoader() instanceof ModuleClassLoader)
+        if (clazz.getClassLoader() instanceof ContentClassLoader)
         {
-            return ((ModuleClassLoader) clazz.getClassLoader()).isModuleManagerEqual(m_mgr);
+            IContentLoader contentLoader =
+                ((ContentClassLoader) clazz.getClassLoader()).getContentLoader();
+            IModule[] modules = m_factory.getModules();
+            for (int i = 0; i < modules.length; i++)
+            {
+                if (modules[i].getContentLoader() == contentLoader)
+                {
+                    return true;
+                }
+            }
         }
         return false;
     }
@@ -916,13 +932,16 @@
      * @return an input stream to the bundle resource.
      * @throws IOException if the input stream could not be created.
     **/
+/*
+ This might note be needed due to changes in URLHandlersBundleURLConnection
+
     protected InputStream getBundleResourceInputStream(URL url)
         throws IOException
     {
         // The URL is constructed like this:
         // bundle://<module-id>/<source-idx>/<resource-path>
     
-        Module module = m_mgr.getModule(url.getHost());
+        IModule module = m_factory.getModule(url.getHost());
         if (module == null)
         {
             throw new IOException("Unable to find bundle's module.");
@@ -933,38 +952,22 @@
         {
             throw new IOException("Unable to find resource: " + url.toString());
         }
+
+        // Remove any leading slash.
         if (resource.startsWith("/"))
         {
             resource = resource.substring(1);
         }
-        int rsIdx = -1;
-        try
-        {
-            rsIdx = Integer.parseInt(resource.substring(0, resource.indexOf("/")));
-        }
-        catch (NumberFormatException ex)
-        {
-            new IOException("Error parsing resource index.");
-        }
-        resource = resource.substring(resource.indexOf("/") + 1);
 
         // Get the resource bytes from the resource source.
-        byte[] bytes = null;
-        ResourceSource[] resSources = module.getResourceSources();
-        if ((resSources != null) && (rsIdx < resSources.length))
-        {
-            if (resSources[rsIdx].hasResource(resource))
-            {
-                bytes = resSources[rsIdx].getBytes(resource);
-            }
-        }
+        byte[] bytes = module.getContentLoader().getResourceBytes(resource);
         if (bytes == null)
         {
             throw new IOException("Unable to find resource: " + url.toString());
         }
         return new ByteArrayInputStream(bytes);
     }
-
+*/
     //
     // Implementation of Bundle interface methods.
     //
@@ -1006,7 +1009,7 @@
         {
             AccessController.checkPermission(m_adminPerm);
         }
-        return bundle.getInfo().getCurrentModule().getClassLoader().getResource(name);
+        return bundle.getInfo().getCurrentModule().getContentLoader().getResource(name);
     }
 
     protected ServiceReference[] getBundleRegisteredServices(BundleImpl bundle)
@@ -1150,7 +1153,7 @@
             catch (Exception ex)
             {
                 m_logger.log(
-                    LogWrapper.LOG_WARNING,
+                    Logger.LOG_WARNING,
                     "Exception while evaluating the permission.",
                     ex);
                 return false; 
@@ -1165,18 +1168,20 @@
     **/
     protected Class loadBundleClass(BundleImpl bundle, String name) throws ClassNotFoundException
     {
-        try
-        {
-            return bundle.getInfo().getCurrentModule().getClassLoader().loadClass(name);
-        }
-        catch (ClassNotFoundException ex)
+        Class clazz = bundle.getInfo().getCurrentModule().getContentLoader().getClass(name);
+        if (clazz == null)
         {
+            // Throw exception.
+            ClassNotFoundException ex = new ClassNotFoundException(name);
+
             // The spec says we must fire a framework error.
             fireFrameworkEvent(
                 FrameworkEvent.ERROR, bundle,
                 new BundleException(ex.getMessage()));
+
             throw ex;
         }
+        return clazz;
     }
 
     /**
@@ -1366,13 +1371,10 @@
 //            }
         }
 
-        // Get the import search policy.
-        R4SearchPolicy search = (R4SearchPolicy) m_mgr.getSearchPolicy();
-
-        Module module = bundle.getInfo().getCurrentModule();
+        IModule module = bundle.getInfo().getCurrentModule();
         try
         {
-            search.resolve(module);
+            m_policyCore.resolve(module);
         }
         catch (ResolveException ex)
         {
@@ -1380,7 +1382,7 @@
             {
                 throw new BundleException(
                     "Unresolved package in bundle "
-                    + BundleInfo.getBundleIdFromModuleId(ex.getModule().getId())
+                    + Util.getBundleIdFromModuleId(ex.getModule().getId())
                     + ": " + ex.getPackage());
             }
             else
@@ -1478,7 +1480,7 @@
                 // Create a module for the new revision; the revision is
                 // base zero, so subtract one from the revision count to
                 // get the revision of the new update.
-                Module module = createModule(
+                IModule module = createModule(
                     info.getBundleId(),
                     archive.getRevisionCount() - 1,
                     info.getCurrentHeader());
@@ -1487,7 +1489,7 @@
             }
             catch (Exception ex)
             {
-                m_logger.log(LogWrapper.LOG_ERROR, "Unable to update the bundle.", ex);
+                m_logger.log(Logger.LOG_ERROR, "Unable to update the bundle.", ex);
                 rethrow = ex;
             }
 
@@ -1522,7 +1524,7 @@
             }
             catch (IOException ex)
             {
-                m_logger.log(LogWrapper.LOG_ERROR, "Unable to close input stream.", ex);
+                m_logger.log(Logger.LOG_ERROR, "Unable to close input stream.", ex);
             }
         }
     }
@@ -1614,7 +1616,7 @@
         }
         catch (Throwable th)
         {
-            m_logger.log(LogWrapper.LOG_ERROR, "Error stopping bundle.", th);
+            m_logger.log(Logger.LOG_ERROR, "Error stopping bundle.", th);
             rethrow = th;
         }
                   
@@ -1725,7 +1727,7 @@
         else
         {
             m_logger.log(
-                LogWrapper.LOG_ERROR, "Unable to remove bundle from installed map!");
+                Logger.LOG_ERROR, "Unable to remove bundle from installed map!");
         }
 
         // Set state to uninstalled.
@@ -1846,7 +1848,7 @@
                     catch (IOException ex)
                     {
                         m_logger.log(
-                            LogWrapper.LOG_ERROR,
+                            Logger.LOG_ERROR,
                             "Unable to close input stream.", ex);
                     }
                 }
@@ -1867,9 +1869,8 @@
                 }
                 catch (Exception ex)
                 {
-                    ex.printStackTrace();
                     m_logger.log(
-                        LogWrapper.LOG_ERROR,
+                        Logger.LOG_ERROR,
                         "Could not purge bundle.", ex);
                 }
             }
@@ -1892,10 +1893,11 @@
                     catch (Exception ex1)
                     {
                         m_logger.log(
-                            LogWrapper.LOG_ERROR,
+                            Logger.LOG_ERROR,
                             "Could not remove from cache.", ex1);
                     }
                 }
+ex.printStackTrace();
                 throw new BundleException("Could not create bundle object.", ex);
             }
 
@@ -1926,7 +1928,7 @@
             catch (IOException ex)
             {
                 m_logger.log(
-                    LogWrapper.LOG_ERROR,
+                    Logger.LOG_ERROR,
                     "Unable to close input stream.", ex);
                 // Not much else we can do.
             }
@@ -2367,7 +2369,7 @@
                         // We do not throw this exception since the bundle
                         // is not supposed to know about the service at all
                         // if it does not have permission.
-                        m_logger.log(LogWrapper.LOG_ERROR, ex.getMessage());
+                        m_logger.log(Logger.LOG_ERROR, ex.getMessage());
                     }
                 }
                 
@@ -2496,7 +2498,7 @@
         }
         catch (Exception ex)
         {
-            m_logger.log(LogWrapper.LOG_ERROR, ex.getMessage());
+            m_logger.log(Logger.LOG_ERROR, ex.getMessage());
             return null;
         }
     }
@@ -2517,14 +2519,13 @@
     {
         // First, find the bundle exporting the package.
         BundleImpl bundle = null;
-        R4SearchPolicy search = (R4SearchPolicy) m_mgr.getSearchPolicy();
-        Module[] exporters = search.getInUseExporters(new R4Package(pkgName, null, null));
+        IModule[] exporters = m_policyCore.getInUseExporters(new R4Import(pkgName, null, null));
         if (exporters != null)
         {
             // Since OSGi R4 there may be more than one exporting, so just
             // take the first one.
             bundle = (BundleImpl) getBundle(
-                BundleInfo.getBundleIdFromModuleId(exporters[0].getId()));
+                Util.getBundleIdFromModuleId(exporters[0].getId()));
         }
 
         // If we have found the exporting bundle, then return the
@@ -2541,13 +2542,13 @@
             // that the first module found to be exporting the package is the
             // provider of the package, which makes sense since it must have
             // been resolved first.
-            Module[] modules = bundle.getInfo().getModules();
+            IModule[] modules = bundle.getInfo().getModules();
             for (int modIdx = 0; modIdx < modules.length; modIdx++)
             {
-                R4Package pkg = R4SearchPolicy.getExportPackage(modules[modIdx], pkgName);
-                if (pkg != null)
+                R4Export export = Util.getExportPackage(modules[modIdx], pkgName);
+                if (export != null)
                 {
-                    return new ExportedPackageImpl(this, bundle, pkgName, pkg.getVersionLow());
+                    return new ExportedPackageImpl(this, bundle, pkgName, export.getVersion());
                 }
             }
         }
@@ -2619,26 +2620,32 @@
     **/
     private void getExportedPackages(BundleImpl bundle, List list)
     {
-        R4SearchPolicy policy = (R4SearchPolicy) m_mgr.getSearchPolicy();
-
         // Since a bundle may have many modules associated with it,
         // one for each revision in the cache, search each module
         // for each revision to get all exports.
-        Module[] modules = bundle.getInfo().getModules();
+        IModule[] modules = bundle.getInfo().getModules();
         for (int modIdx = 0; modIdx < modules.length; modIdx++)
         {
-            R4Package[] exports = R4SearchPolicy.getExportsAttr(modules[modIdx]);
-            if (exports.length > 0)
+            R4Export[] exports = m_policyCore.getExports(modules[modIdx]);
+            if ((exports != null) && (exports.length > 0))
             {
                 for (int expIdx = 0; expIdx < exports.length; expIdx++)
                 {
                     // See if the target bundle's module is one of the
                     // "in use" exporters of the package.
-                    Module[] inUseModules = policy.getInUseExporters(exports[expIdx]);
-                    if (R4SearchPolicy.isModuleInArray(inUseModules, modules[modIdx]))
+                    IModule[] inUseModules =
+                        m_policyCore.getInUseExporters(
+                            new R4Import(exports[expIdx].getName(), null, null));
+                    // Search through the current providers to find the target
+                    // module.
+                    for (int i = 0; (inUseModules != null) && (i < inUseModules.length); i++)
                     {
-                        list.add(new ExportedPackageImpl(
-                            this, bundle, exports[expIdx].getId(), exports[expIdx].getVersionLow()));
+                        if (inUseModules[i] == modules[modIdx])
+                        {
+                            list.add(new ExportedPackageImpl(
+                                this, bundle, exports[expIdx].getName(),
+                                exports[expIdx].getVersion()));
+                        }
                     }
                 }
             }
@@ -2667,15 +2674,15 @@
             if (exporter != importer)
             {
                 // Check the import wires of all modules for all bundles.
-                Module[] modules = importer.getInfo().getModules();
+                IModule[] modules = importer.getInfo().getModules();
                 for (int modIdx = 0; modIdx < modules.length; modIdx++)
                 {
-                    R4Wire wire = R4SearchPolicy.getWire(modules[modIdx], ep.getName());
+                    R4Wire wire = Util.getWire(modules[modIdx], ep.getName());
     
                     // If the resolving module is associated with the
                     // exporting bundle, then add current bundle to
                     // import list.
-                    if ((wire != null) && exporterInfo.hasModule(wire.m_module))
+                    if ((wire != null) && exporterInfo.hasModule(wire.getExportingModule()))
                     {
                         // Add the bundle to the list of importers.
                         list.add(bundles[bundleIdx]);
@@ -2808,7 +2815,7 @@
         // Create the module for the bundle; although there should only
         // ever be one revision at this point, create the module for
         // the current revision to be safe.
-        Module module = createModule(
+        IModule module = createModule(
             archive.getId(), archive.getRevisionCount() - 1, headerMap);
 
         // Finally, create an return the bundle info.
@@ -2824,7 +2831,7 @@
      * @param headers The headers map associated with the bundle.
      * @return The initialized and/or newly created module.
     **/
-    private Module createModule(long id, int revision, Map headerMap)
+    private IModule createModule(long id, int revision, Map headerMap)
         throws Exception
     {
         // Get the manifest version.
@@ -2835,31 +2842,14 @@
             throw new BundleException("Unknown 'Bundle-ManifestVersion' value: " + version);
         }
 
-        // Create the resource sources for the bundle. The resource sources
-        // are comprised of the bundle's class path values (as JarResourceSources).
-        ResourceSource[] resSources = null;
-        try
-        {
-            // Get bundle class path for the specified revision from cache.
-            String[] classPath = m_cache.getArchive(id).getClassPath(revision);
-
-            // Create resource sources for everything.
-            resSources = new ResourceSource[classPath.length];
-            for (int i = 0; i < classPath.length; i++)
-            {
-                resSources[i] = new JarResourceSource(classPath[i]);
-            }
-        }
-        catch (Exception ex)
-        {
-            ex.printStackTrace();
-            throw new BundleException("Error in class path: " + ex);
-        }
-
         // Get import packages from bundle manifest.
-        R4Package[] imports = R4Package.parseImportOrExportHeader(
+        R4Package[] pkgs = R4Package.parseImportOrExportHeader(
             (String) headerMap.get(Constants.IMPORT_PACKAGE));
-
+        R4Import[] imports = new R4Import[pkgs.length];
+        for (int i = 0; i < pkgs.length; i++)
+        {
+            imports[i] = new R4Import(pkgs[i]);
+        }
 
         // Check to make sure that R3 bundles have only specified
         // the 'specification-version' attribute and no directives.
@@ -2887,8 +2877,13 @@
         }
 
         // Get export packages from bundle manifest.
-        R4Package[] exports = R4Package.parseImportOrExportHeader(
+        pkgs = R4Package.parseImportOrExportHeader(
             (String) headerMap.get(Constants.EXPORT_PACKAGE));
+        R4Export[] exports = new R4Export[pkgs.length];
+        for (int i = 0; i < pkgs.length; i++)
+        {
+            exports[i] = new R4Export(pkgs[i]);
+        }
 
         // Check to make sure that R3 bundles have only specified
         // the 'specification-version' attribute and no directives.
@@ -2915,9 +2910,12 @@
                 }
             }
             
-            R4Package[] newImports = new R4Package[imports.length + exports.length];
+            R4Import[] newImports = new R4Import[imports.length + exports.length];
             System.arraycopy(imports, 0, newImports, 0, imports.length);
-            System.arraycopy(exports, 0, newImports, imports.length, exports.length);
+            for (int i = 0; i < exports.length; i++)
+            {
+                newImports[i + imports.length] = new R4Import(exports[i]);
+            }
             imports = newImports;
         }
 
@@ -2933,24 +2931,28 @@
             {
                 usesValue = usesValue
                     + ((usesValue.length() > 0) ? "," : "")
-                    + imports[i].getId();
+                    + imports[i].getName();
             }
             R4Directive uses = new R4Directive(
                 FelixConstants.USES_DIRECTIVE, usesValue);
             for (int i = 0; (exports != null) && (i < exports.length); i++)
             {
-                exports[i] = new R4Package(
-                    exports[i].getId(),
+                exports[i] = new R4Export(
+                    exports[i].getName(),
                     new R4Directive[] { uses },
                     exports[i].getAttributes());
             }
         }
 
 // TODO: CHECK FOR DUPLICATE IMPORTS/EXPORTS HERE.
-
         // Get dynamic import packages from bundle manifest.
-        R4Package[] dynamics = R4Package.parseImportOrExportHeader(
+        pkgs = R4Package.parseImportOrExportHeader(
             (String) headerMap.get(Constants.DYNAMICIMPORT_PACKAGE));
+        R4Import[] dynamics = new R4Import[pkgs.length];
+        for (int i = 0; i < pkgs.length; i++)
+        {
+            dynamics[i] = new R4Import(pkgs[i]);
+        }
 
         // Check to make sure that R3 bundles have no attributes or
         // directives.
@@ -2969,30 +2971,56 @@
             }
         }
 
-        Object[][] attributes = {
-            new Object[] { R4SearchPolicy.EXPORTS_ATTR, exports },
-            new Object[] { R4SearchPolicy.IMPORTS_ATTR, imports },
-            new Object[] { R4SearchPolicy.DYNAMICIMPORTS_ATTR, dynamics }
-        };
-
         // Get native library entry names for module library sources.
-        LibraryInfo[] libraries =
+        R4LibraryHeader[] libraryHeaders =
             Util.parseLibraryStrings(
+                m_logger,
                 Util.parseDelimitedString(
                     (String) headerMap.get(Constants.BUNDLE_NATIVECODE), ","));
-        LibrarySource[] libSources = {
-            new OSGiLibrarySource(
+        R4Library[] libraries = new R4Library[libraryHeaders.length];
+        for (int i = 0; i < libraries.length; i++)
+        {
+            libraries[i] = new R4Library(
                 m_logger, m_cache, id, revision,
                 getProperty(Constants.FRAMEWORK_OS_NAME),
                 getProperty(Constants.FRAMEWORK_PROCESSOR),
-                libraries)
-        };
+                libraryHeaders[i]);
+        }
+
+        // Now that we have all of the metadata associated with the
+        // module, we need to create the module itself. This is somewhat
+        // complicated because a module is constructed out of several
+        // interrelated pieces (e.g., content loader, search policy,
+        // url policy). We need to create all of these pieces and bind
+        // them together.
+
+        // First, create the module.
+        IModule module = m_factory.createModule(
+            Long.toString(id) + "." + Integer.toString(revision));
+        // Attach the R4 search policy metadata to the module.
+        m_policyCore.setExports(module, exports);
+        m_policyCore.setImports(module, imports);
+        m_policyCore.setDynamicImports(module, dynamics);
+        m_policyCore.setLibraries(module, libraries);
+
+        // Create the content loader associated with the module archive.
+        IContentLoader contentLoader = new ContentLoaderImpl(
+                m_logger,
+                m_cache.getArchive(id).getContent(revision),
+                m_cache.getArchive(id).getContentPath(revision));
+        // Set the content loader's search policy.
+        contentLoader.setSearchPolicy(
+                new R4SearchPolicy(m_policyCore, module));
+        // Set the content loader's URL policy.
+        contentLoader.setURLPolicy(
+// TODO: FIX - NEED URL POLICY PER MODULE.
+                new URLPolicyImpl(
+                    m_logger, m_bundleStreamHandler, module));
 
-        Module module =
-            m_mgr.addModule(
-                Long.toString(id) + "." + Integer.toString(revision),
-                attributes, resSources, libSources);
+        // Set the module's content loader to the created content loader.
+        m_factory.setContentLoader(module, contentLoader);
 
+        // Done, so return the module.
         return module;
     }
 
@@ -3013,7 +3041,7 @@
             {
                 activator =
                     m_cache.getArchive(info.getBundleId())
-                        .getActivator(info.getCurrentModule().getClassLoader());
+                        .getActivator(info.getCurrentModule().getContentLoader());
             }
             catch (Exception ex)
             {
@@ -3037,7 +3065,7 @@
             if (className != null)
             {
                 className = className.trim();
-                Class clazz = info.getCurrentModule().getClassLoader().loadClass(className);
+                Class clazz = info.getCurrentModule().getContentLoader().getClass(className);
                 if (clazz == null)
                 {
                     throw new BundleException("Not found: "
@@ -3070,10 +3098,10 @@
             // way to do this is to remove the bundle, but that
             // would be incorrect, because this is a refresh operation
             // and should not trigger bundle REMOVE events.
-            Module[] modules = info.getModules();
+            IModule[] modules = info.getModules();
             for (int i = 0; i < modules.length; i++)
             {
-                m_mgr.removeModule(modules[i]);
+                m_factory.removeModule(modules[i]);
             }
 
             // Purge all bundle revisions, but the current one.
@@ -3094,10 +3122,10 @@
 
         // Remove the bundle's associated modules from
         // the module manager.
-        Module[] modules = bundle.getInfo().getModules();
+        IModule[] modules = bundle.getInfo().getModules();
         for (int i = 0; i < modules.length; i++)
         {
-            m_mgr.removeModule(modules[i]);
+            m_factory.removeModule(modules[i]);
         }
 
         // Remove the bundle from the cache.
@@ -3209,11 +3237,11 @@
             System.getProperty("os.version"));
 
         String s = null;
-        s = OSGiLibrarySource.normalizePropertyValue(
+        s = R4Library.normalizePropertyValue(
             FelixConstants.FRAMEWORK_OS_NAME,
             System.getProperty("os.name"));
         m_configMutable.put(FelixConstants.FRAMEWORK_OS_NAME, s);
-        s = OSGiLibrarySource.normalizePropertyValue(
+        s = R4Library.normalizePropertyValue(
             FelixConstants.FRAMEWORK_PROCESSOR,
             System.getProperty("os.arch"));
         m_configMutable.put(FelixConstants.FRAMEWORK_PROCESSOR, s);
@@ -3243,7 +3271,7 @@
                 }
                 catch (NumberFormatException ex)
                 {
-                    m_logger.log(LogWrapper.LOG_ERROR, "Invalid property: " + keys[i]);
+                    m_logger.log(Logger.LOG_ERROR, "Invalid property: " + keys[i]);
                 }
                 StringTokenizer st = new StringTokenizer(m_config.get(keys[i]), "\" ",true);
                 if (st.countTokens() > 0)
@@ -3262,7 +3290,7 @@
                             catch (Exception ex)
                             {
                                 m_logger.log(
-                                    LogWrapper.LOG_ERROR, "Auto-properties install.", ex);
+                                    Logger.LOG_ERROR, "Auto-properties install.", ex);
                             }
                         }
                     }
@@ -3289,7 +3317,7 @@
                 }
                 catch (NumberFormatException ex)
                 {
-                    m_logger.log(LogWrapper.LOG_ERROR, "Invalid property: " + keys[i]);
+                    m_logger.log(Logger.LOG_ERROR, "Invalid property: " + keys[i]);
                 }
                 StringTokenizer st = new StringTokenizer(m_config.get(keys[i]), "\" ",true);
                 if (st.countTokens() > 0)
@@ -3307,7 +3335,7 @@
                             }
                             catch (Exception ex)
                             {
-                                m_logger.log(LogWrapper.LOG_ERROR, "Auto-properties install.", ex);
+                                m_logger.log(Logger.LOG_ERROR, "Auto-properties install.", ex);
                             }
                         }
                     }
@@ -3342,7 +3370,7 @@
                             catch (Exception ex)
                             {
                                 m_logger.log(
-                                    LogWrapper.LOG_ERROR, "Auto-properties start.", ex);
+                                    Logger.LOG_ERROR, "Auto-properties start.", ex);
                             }
                         }
                     }
@@ -3446,7 +3474,7 @@
     // Logging methods and inner classes.
     //
 
-    public LogWrapper getLogger()
+    public Logger getLogger()
     {
         return m_logger;
     }

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/FilterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/FilterImpl.java?rev=374660&r1=374659&r2=374660&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/FilterImpl.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/FilterImpl.java Fri Feb  3 04:54:52 2006
@@ -32,7 +32,7 @@
 **/
 public class FilterImpl implements Filter
 {
-    private LogWrapper m_logger = null;
+    private Logger m_logger = null;
     private String m_toString = null;
     private Evaluator m_evaluator = null;
     private SimpleMapper m_mapper = null;
@@ -47,7 +47,7 @@
      * Construct a filter for a given filter expression string.
      * @param expr the filter expression string for the filter.
     **/
-    public FilterImpl(LogWrapper logger, String expr) throws InvalidSyntaxException
+    public FilterImpl(Logger logger, String expr) throws InvalidSyntaxException
     {
         m_logger = logger;
         if (expr == null)
@@ -132,11 +132,11 @@
         }
         catch (AttributeNotFoundException ex)
         {
-            m_logger.log(LogWrapper.LOG_DEBUG, "FilterImpl: " + ex);
+            m_logger.log(Logger.LOG_DEBUG, "FilterImpl: " + ex);
         }
         catch (EvaluationException ex)
         {
-            m_logger.log(LogWrapper.LOG_ERROR, "FilterImpl: " + toString(), ex);
+            m_logger.log(Logger.LOG_ERROR, "FilterImpl: " + toString(), ex);
         }
         return false;
     }
@@ -158,11 +158,11 @@
         }
         catch (AttributeNotFoundException ex)
         {
-            m_logger.log(LogWrapper.LOG_DEBUG, "FilterImpl: " + ex);
+            m_logger.log(Logger.LOG_DEBUG, "FilterImpl: " + ex);
         }
         catch (EvaluationException ex)
         {
-            m_logger.log(LogWrapper.LOG_ERROR, "FilterImpl: " + toString(), ex);
+            m_logger.log(Logger.LOG_ERROR, "FilterImpl: " + toString(), ex);
         }
         return false;
     }
@@ -176,11 +176,11 @@
         }
         catch (AttributeNotFoundException ex)
         {
-            m_logger.log(LogWrapper.LOG_DEBUG, "FilterImpl: " + ex);
+            m_logger.log(Logger.LOG_DEBUG, "FilterImpl: " + ex);
         }
         catch (EvaluationException ex)
         {
-            m_logger.log(LogWrapper.LOG_ERROR, "FilterImpl: " + toString(), ex);        }
+            m_logger.log(Logger.LOG_ERROR, "FilterImpl: " + toString(), ex);        }
         return false;
     }
 

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java?rev=374660&r1=374659&r2=374660&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceReferenceImpl.java Fri Feb  3 04:54:52 2006
@@ -1,5 +1,5 @@
 /*
- *   Copyright 2005 The Apache Software Foundation
+ *   Copyright 2006 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -16,8 +16,8 @@
  */
 package org.apache.felix.framework;
 
-import org.apache.felix.framework.searchpolicy.R4SearchPolicy;
 import org.apache.felix.framework.searchpolicy.R4Wire;
+import org.apache.felix.framework.util.Util;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.ServiceReference;
 
@@ -31,7 +31,7 @@
         m_registration = reg;
         m_bundle = bundle;
     }
-
+    
     protected ServiceRegistrationImpl getServiceRegistration()
     {
         return m_registration;
@@ -117,11 +117,12 @@
         boolean allow = true;
         // Get the package.
         String pkgName =
-            org.apache.felix.moduleloader.Util.getClassPackage(className);
-        // Get package wiring from service provider and requester.
-        R4Wire requesterWire = R4SearchPolicy.getWire(
+            Util.getClassPackage(className);
+        // Get package wiring from service requester.
+        R4Wire requesterWire = Util.getWire(
             ((BundleImpl) requester).getInfo().getCurrentModule(), pkgName);
-        R4Wire providerWire = R4SearchPolicy.getWire(
+        // Get package wiring from service provider.
+        R4Wire providerWire = Util.getWire(
             ((BundleImpl) m_bundle).getInfo().getCurrentModule(), pkgName);
 
         // There are three situations that may occur here:
@@ -151,8 +152,8 @@
             {
                 // Load the class from the requesting bundle.
                 Class requestClass =
-                    ((BundleImpl) requester).getInfo().getCurrentModule().getClassLoader()
-                        .loadClass(className);
+                    ((BundleImpl) requester).getInfo().getCurrentModule().getContentLoader()
+                        .getClass(className);
                 // Get the service registration and ask it to check
                 // if the service object is assignable to the requesting
                 // bundle's class.
@@ -168,7 +169,7 @@
         // same source module.
         else
         {
-            allow = providerWire.m_module.equals(requesterWire.m_module);
+            allow = providerWire.getExportingModule().equals(requesterWire.getExportingModule());
         }
 
         return allow;

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java?rev=374660&r1=374659&r2=374660&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java Fri Feb  3 04:54:52 2006
@@ -174,7 +174,7 @@
             catch (Exception ex)
             {
                 m_registry.getLogger().log(
-                    LogWrapper.LOG_ERROR, "ServiceRegistrationImpl: Error getting service.", ex);
+                    Logger.LOG_ERROR, "ServiceRegistrationImpl: Error getting service.", ex);
                 return null;
             }
         }
@@ -205,7 +205,7 @@
             catch (Exception ex)
             {
                 m_registry.getLogger().log(
-                    LogWrapper.LOG_ERROR, "ServiceRegistrationImpl: Error ungetting service.", ex);
+                    Logger.LOG_ERROR, "ServiceRegistrationImpl: Error ungetting service.", ex);
             }
         }
     }

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java?rev=374660&r1=374659&r2=374660&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java Fri Feb  3 04:54:52 2006
@@ -23,7 +23,7 @@
 
 public class ServiceRegistry
 {
-    private LogWrapper m_logger = null;
+    private Logger m_logger = null;
     private long m_currentServiceId = 1L;
     // Maps bundle to an array of service registrations.
     private Map m_serviceRegsMap = new HashMap();
@@ -32,7 +32,7 @@
 
     private ServiceListener m_serviceListener = null;
 
-    public ServiceRegistry(LogWrapper logger)
+    public ServiceRegistry(Logger logger)
     {
         m_logger = logger;
     }
@@ -337,7 +337,7 @@
         fireServiceChanged(new ServiceEvent(ServiceEvent.MODIFIED, reg.getReference()));
     }
 
-    public LogWrapper getLogger()
+    public Logger getLogger()
     {
         return m_logger;
     }

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundle.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundle.java?rev=374660&r1=374659&r2=374660&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundle.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundle.java Fri Feb  3 04:54:52 2006
@@ -1,5 +1,5 @@
 /*
- *   Copyright 2005 The Apache Software Foundation
+ *   Copyright 2006 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -24,19 +24,16 @@
 import org.apache.felix.framework.searchpolicy.*;
 import org.apache.felix.framework.util.FelixConstants;
 import org.apache.felix.framework.util.StringMap;
-import org.apache.felix.moduleloader.LibrarySource;
-import org.apache.felix.moduleloader.ResourceSource;
+import org.apache.felix.moduleloader.IContentLoader;
 import org.osgi.framework.*;
 
-
 class SystemBundle extends BundleImpl
 {
     private List m_activatorList = null;
     private BundleActivator m_activator = null;
     private Thread m_shutdownThread = null;
-    private Object[][] m_attributes = null;
-    private ResourceSource[] m_resSources = null;
-    private LibrarySource[] m_libSources = null;
+    private R4Export[] m_exports = null;
+    private IContentLoader m_contentLoader = null;
 
     protected SystemBundle(Felix felix, BundleInfo info, List activatorList)
         throws BundleException
@@ -74,62 +71,59 @@
         }
         catch (Exception ex)
         {
+            classPathPkgs = new R4Package[0];
             getFelix().getLogger().log(
-                LogWrapper.LOG_ERROR,
+                Logger.LOG_ERROR,
                 "Error parsing system bundle export statement.", ex);
         }
 
         // Now, create the list of standard framework exports for
         // the system bundle.
-        R4Package[] exports = new R4Package[classPathPkgs.length + 4];
+        m_exports = new R4Export[classPathPkgs.length + 4];
 
-        exports[0] = new R4Package(
+        m_exports[0] = new R4Export(
             "org.osgi.framework",
             new R4Directive[0],
             new R4Attribute[] { new R4Attribute("version", "1.3.0", false) });
 
-        exports[1] = new R4Package(
+        m_exports[1] = new R4Export(
             "org.osgi.service.packageadmin",
             new R4Directive[0],
             new R4Attribute[] { new R4Attribute("version", "1.2.0", false) });
 
-        exports[2] = new R4Package(
+        m_exports[2] = new R4Export(
                 "org.osgi.service.startlevel",
                 new R4Directive[0],
                 new R4Attribute[] { new R4Attribute("version", "1.0.0", false) });
 
-        exports[3] = new R4Package(
+        m_exports[3] = new R4Export(
                 "org.osgi.service.url",
                 new R4Directive[0],
                 new R4Attribute[] { new R4Attribute("version", "1.0.0", false) });
 
         // Copy the class path exported packages.
-        System.arraycopy(classPathPkgs, 0, exports, 4, classPathPkgs.length);
-
-        m_attributes = new Object[][] {
-            new Object[] { R4SearchPolicy.EXPORTS_ATTR, exports },
-            new Object[] { R4SearchPolicy.IMPORTS_ATTR, new R4Package[0] }
-        };
-
-        m_resSources = new ResourceSource[0];
+        for (int i = 0; i < classPathPkgs.length; i++)
+        {
+            m_exports[i + 4] = new R4Export(classPathPkgs[i]);
+        }
 
-        m_libSources = null;
+        m_contentLoader = new SystemBundleContentLoader(getFelix().getLogger());
 
         String exportString = "";
-        for (int i = 0; i < exports.length; i++)
+        for (int i = 0; i < m_exports.length; i++)
         {
             exportString = exportString +
-            exports[i].getId()
+            m_exports[i].getName()
             + "; specification-version=\""
-            + exports[i].getVersionLow().toString() + "\"";
+            + m_exports[i].getVersion().toString() + "\"";
 
-            if (i < (exports.length - 1))
+            if (i < (m_exports.length - 1))
             {
                 exportString = exportString + ", ";
                 exportString = exportString +
-                    exports[i].getId()
+                    m_exports[i].getName()
                     + "; specification-version=\""
-                    + exports[i].getVersionLow().toString() + "\", ";
+                    + m_exports[i].getVersion().toString() + "\", ";
             }
         }
 
@@ -143,19 +137,14 @@
         ((SystemBundleArchive) getInfo().getArchive()).setManifestHeader(map);
     }
 
-    public Object[][] getAttributes()
-    {
-        return m_attributes;
-    }
-
-    public ResourceSource[] getResourceSources()
+    public R4Export[] getExports()
     {
-        return m_resSources;
+        return m_exports;
     }
 
-    public LibrarySource[] getLibrarySources()
+    public IContentLoader getContentLoader()
     {
-        return m_libSources;
+        return m_contentLoader;
     }
 
     public synchronized void start() throws BundleException
@@ -173,7 +162,6 @@
             getInfo().setContext(new BundleContextImpl(getFelix(), this));
             getActivator().start(getInfo().getContext());
         } catch (Throwable throwable) {
-throwable.printStackTrace();
             throw new BundleException(
                 "Unable to start system bundle.", throwable);
         }
@@ -205,7 +193,7 @@
                     catch (Exception ex)
                     {
                         getFelix().getLogger().log(
-                            LogWrapper.LOG_ERROR,
+                            Logger.LOG_ERROR,
                             "SystemBundle: Error while shutting down.", ex);
                     }
 

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundleArchive.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundleArchive.java?rev=374660&r1=374659&r2=374660&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundleArchive.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/SystemBundleArchive.java Fri Feb  3 04:54:52 2006
@@ -1,5 +1,5 @@
 /*
- *   Copyright 2005 The Apache Software Foundation
+ *   Copyright 2006 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@
 
 import org.apache.felix.framework.cache.BundleArchive;
 import org.apache.felix.framework.util.FelixConstants;
+import org.apache.felix.moduleloader.IContent;
+import org.apache.felix.moduleloader.IContentLoader;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleActivator;
 
@@ -67,7 +69,7 @@
         return null;
     }
 
-    public BundleActivator getActivator(ClassLoader loader)
+    public BundleActivator getActivator(IContentLoader contentLoader)
         throws Exception
     {
         return null;
@@ -95,7 +97,13 @@
         m_headerMap = headerMap;
     }
 
-    public String[] getClassPath(int revision)
+    public IContent getContent(int revision)
+        throws Exception
+    {
+        return null;
+    }
+
+    public IContent[] getContentPath(int revision)
         throws Exception
     {
         return null;

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/URLHandlers.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/URLHandlers.java?rev=374660&r1=374659&r2=374660&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/URLHandlers.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/URLHandlers.java Fri Feb  3 04:54:52 2006
@@ -19,8 +19,8 @@
 import java.net.*;
 import java.util.*;
 
+import org.apache.felix.framework.searchpolicy.ContentClassLoader;
 import org.apache.felix.framework.util.*;
-import org.apache.felix.moduleloader.ModuleClassLoader;
 import org.osgi.framework.BundleContext;
 
 /**
@@ -345,7 +345,7 @@
                 Class targetClass = null;
                 for (int i = 0; i < stack.length; i++)
                 {
-                    if (stack[i].getClassLoader() instanceof ModuleClassLoader)
+                    if (stack[i].getClassLoader() instanceof ContentClassLoader)
                     {
                         targetClass = stack[i];
                         break;

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java?rev=374660&r1=374659&r2=374660&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java Fri Feb  3 04:54:52 2006
@@ -1,5 +1,5 @@
 /*
- *   Copyright 2005 The Apache Software Foundation
+ *   Copyright 2006 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -22,6 +22,8 @@
 import java.net.URLConnection;
 import java.security.Permission;
 
+import org.apache.felix.framework.util.Util;
+
 class URLHandlersBundleURLConnection extends URLConnection
 {
     private Felix m_framework;
@@ -54,8 +56,18 @@
                 throw new IOException("Unable to find framework instance from context.");
             }
 
-            m_is = m_framework.getBundleResourceInputStream(url);
-            m_contentLength = m_is.available();
+            // The URL is constructed like this:
+            //     bundle://<module-id>/<resource-path>
+            // Where <module-id> = <bundle-id>.<revision>
+            long bundleId = Util.getBundleIdFromModuleId(url.getHost());
+            BundleImpl bundle = (BundleImpl) m_framework.getBundle(bundleId);
+            if (bundle == null)
+            {
+                throw new IOException("Unable to find bundle.");
+            }
+            int revision = Util.getModuleRevisionFromModuleId(url.getHost());
+            m_is = bundle.getInfo().getModules()[revision].getContentLoader().getResourceAsStream(url.getPath());
+            m_contentLength = (m_is == null) ? 0 : m_is.available();
             m_contentTime = 0L;
             m_contentType = URLConnection.guessContentTypeFromName(url.getFile());
             connected = true;

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java?rev=374660&r1=374659&r2=374660&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java Fri Feb  3 04:54:52 2006
@@ -1,5 +1,5 @@
 /*
- *   Copyright 2005 The Apache Software Foundation
+ *   Copyright 2006 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@
 import java.io.File;
 import java.util.Map;
 
+import org.apache.felix.moduleloader.IContent;
+import org.apache.felix.moduleloader.IContentLoader;
 import org.osgi.framework.BundleActivator;
 
 /**
@@ -117,7 +119,7 @@
      *         this archive.
      * @throws java.lang.Exception if any error occurs.
     **/
-    public BundleActivator getActivator(ClassLoader loader)
+    public BundleActivator getActivator(IContentLoader contentLoader)
         throws Exception;
 
     /**
@@ -162,19 +164,27 @@
 
     /**
      * <p>
-     * Returns an array of <tt>String</tt>s that represent the class path of
-     * the specified revision of the bundle associated with this archive.
-     * Currently, these values are restricted to absolute paths in the file
-     * system, but this may be lifted in the future (perhaps they should be
-     * <tt>ResourceSource</tt>s from the Module Loader.
+     * Returns a content object that is associated with the specified bundle
+     * revision's JAR file.
      * </p>
      * @param revision the specified revision.
-     * @return a <tt>String</tt> array of the absolute path names that
-     *         comprise the class path of the specified revision of the
-     *         bundle associated with this archive.
+     * @return A content object for the specified bundle revision's JAR file.
      * @throws java.lang.Exception if any error occurs.
     **/
-    public String[] getClassPath(int revision)
+    public IContent getContent(int revision)
+        throws Exception;
+
+    /**
+     * <p>
+     * Returns an array of content objects that are associated with the
+     * specified bundle revision's class path.
+     * </p>
+     * @param revision the specified revision.
+     * @return An array of content objects for the specified bundle revision's
+     *         class path.
+     * @throws java.lang.Exception if any error occurs.
+    **/
+    public IContent[] getContentPath(int revision)
         throws Exception;
 
     /**

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
URL: http://svn.apache.org/viewcvs/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java?rev=374660&r1=374659&r2=374660&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java Fri Feb  3 04:54:52 2006
@@ -18,7 +18,7 @@
 
 import java.io.InputStream;
 
-import org.apache.felix.framework.LogWrapper;
+import org.apache.felix.framework.Logger;
 import org.apache.felix.framework.util.PropertyResolver;
 
 /**
@@ -58,7 +58,7 @@
      * @param logger the logger to use for reporting errors.
      * @throws Exception if any error occurs.
     **/
-    public void initialize(PropertyResolver cfg, LogWrapper logger)
+    public void initialize(PropertyResolver cfg, Logger logger)
         throws Exception;
 
     /**



Mime
View raw message