felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r953419 [1/2] - in /felix/sandbox/rickhall/framework-vb-2/src/main: java/org/apache/felix/framework/ java/org/apache/felix/framework/cache/ java/org/apache/felix/framework/ext/ java/org/apache/felix/framework/resolver/ java/org/apache/felix...
Date Thu, 10 Jun 2010 18:53:24 GMT
Author: rickhall
Date: Thu Jun 10 18:53:23 2010
New Revision: 953419

URL: http://svn.apache.org/viewvc?rev=953419&view=rev
Log:
Add "unmanaged module" concept.

Added:
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/AbstractModuleImpl.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/UnmanagedModuleImpl.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/VirtualModuleContextImpl.java
      - copied, changed from r952665, felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/cache/VirtualRevision.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ext/ResourceNotFoundException.java
      - copied, changed from r952665, felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ext/VBWire.java
      - copied, changed from r952665, felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ext/VirtualModule.java
      - copied, changed from r952665, felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ext/FelixBundleContext.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ext/VirtualModuleContext.java
      - copied, changed from r952665, felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java
Removed:
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/resolver/ResourceNotFoundException.java
Modified:
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/BundleContextImpl.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/BundleImpl.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/EntryFilterEnumeration.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ExtensionManager.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/Felix.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/FelixResolverState.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ModuleImpl.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/cache/BundleArchive.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/cache/BundleCache.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ext/FelixBundleContext.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/resolver/Module.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/resolver/Wire.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/resolver/WireImpl.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/resolver/WireModuleImpl.java
    felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/util/Util.java
    felix/sandbox/rickhall/framework-vb-2/src/main/resources/default.properties

Added: felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/AbstractModuleImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/AbstractModuleImpl.java?rev=953419&view=auto
==============================================================================
--- felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/AbstractModuleImpl.java (added)
+++ felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/AbstractModuleImpl.java Thu Jun 10 18:53:23 2010
@@ -0,0 +1,398 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.framework;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.security.ProtectionDomain;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.felix.framework.capabilityset.Capability;
+import org.apache.felix.framework.capabilityset.Directive;
+import org.apache.felix.framework.capabilityset.Requirement;
+import org.apache.felix.framework.capabilityset.SimpleFilter;
+import org.apache.felix.framework.ext.VBWire;
+import org.apache.felix.framework.resolver.Content;
+import org.apache.felix.framework.resolver.Module;
+import org.apache.felix.framework.resolver.Wire;
+import org.apache.felix.framework.util.SecureAction;
+import org.apache.felix.framework.util.manifestparser.ManifestParser;
+import org.apache.felix.framework.util.manifestparser.R4Library;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+
+abstract class AbstractModuleImpl implements Module
+{
+    private final Logger m_logger;
+    private final Map m_config;
+    private final String m_id;
+    private final Map m_headerMap;
+
+    private final String m_manifestVersion;
+    private final boolean m_isExtension;
+    private final String m_symbolicName;
+    private final Version m_version;
+
+    private final List<Capability> m_capabilities;
+    private final List<Requirement> m_requirements;
+    private final List<Requirement> m_dynamicRequirements;
+    private final List<R4Library> m_nativeLibraries;
+    private final int m_declaredActivationPolicy;
+    private final List<String> m_activationIncludes;
+    private final List<String> m_activationExcludes;
+
+    private final Bundle m_bundle;
+
+    private List<VBWire> m_wires = null;
+    private List<Module> m_dependentHosts = new ArrayList<Module>(0);
+    private List<Module> m_dependentImporters = new ArrayList<Module>(0);
+    private List<Module> m_dependentRequirers = new ArrayList<Module>(0);
+    private volatile boolean m_isResolved = false;
+
+    private ProtectionDomain m_protectionDomain = null;
+    private static SecureAction m_secureAction = new SecureAction();
+
+    public AbstractModuleImpl(
+        Logger logger, Map config, Bundle bundle, String id, Map headerMap)
+        throws BundleException
+    {
+        m_logger = logger;
+        m_config = config;
+        m_bundle = bundle;
+        m_id = id;
+        m_headerMap = headerMap;
+
+        ManifestParser mp = new ManifestParser(m_logger, m_config, this, m_headerMap);
+
+        // Record some of the parsed metadata. Note, if this is an extension
+        // bundle it's exports are removed, since they will be added to the
+        // system bundle directly later on.
+        m_manifestVersion = mp.getManifestVersion();
+        m_version = mp.getBundleVersion();
+        m_capabilities = mp.isExtension() ? null : mp.getCapabilities();
+        m_requirements = mp.getRequirements();
+        m_dynamicRequirements = mp.getDynamicRequirements();
+        m_nativeLibraries = mp.getLibraries();
+        m_declaredActivationPolicy = mp.getActivationPolicy();
+        m_activationExcludes = (mp.getActivationExcludeDirective() == null)
+            ? null
+            : ManifestParser.parseDelimitedString(mp.getActivationExcludeDirective(), ",");
+        m_activationIncludes = (mp.getActivationIncludeDirective() == null)
+            ? null
+            : ManifestParser.parseDelimitedString(mp.getActivationIncludeDirective(), ",");
+        m_symbolicName = mp.getSymbolicName();
+        m_isExtension = mp.isExtension();
+    }
+
+    Map getConfig()
+    {
+        return m_config;
+    }
+
+    Logger getLogger()
+    {
+        return m_logger;
+    }
+
+    List<String> getActivationIncludes()
+    {
+        return m_activationIncludes;
+    }
+
+    List<String> getActivationExcludes()
+    {
+        return m_activationExcludes;
+    }
+
+    //
+    // Metadata access methods.
+    //
+
+    public Map getHeaders()
+    {
+        return m_headerMap;
+    }
+
+    public boolean isExtension()
+    {
+        return m_isExtension;
+    }
+
+    public String getSymbolicName()
+    {
+        return m_symbolicName;
+    }
+
+    public String getManifestVersion()
+    {
+        return m_manifestVersion;
+    }
+
+    public Version getVersion()
+    {
+        return m_version;
+    }
+
+    public List<Capability> getCapabilities()
+    {
+        return m_capabilities;
+    }
+
+    public List<Requirement> getRequirements()
+    {
+        return m_requirements;
+    }
+
+    public List<Requirement> getDynamicRequirements()
+    {
+        return m_dynamicRequirements;
+    }
+
+    public List<R4Library> getNativeLibraries()
+    {
+        return m_nativeLibraries;
+    }
+
+    public int getDeclaredActivationPolicy()
+    {
+        return m_declaredActivationPolicy;
+    }
+
+    //
+    // Run-time data access.
+    //
+
+    public Bundle getBundle()
+    {
+        return m_bundle;
+    }
+
+    public String getId()
+    {
+        return m_id;
+    }
+
+    public synchronized List<VBWire> getWires()
+    {
+        return m_wires;
+    }
+
+    public synchronized void resolve(List<VBWire> wires)
+        throws BundleException
+    {
+        // Remove module from old wire modules' dependencies,
+        // since we are no longer dependent on any the moduels
+        // from the old wires.
+        for (int i = 0; (m_wires != null) && (i < m_wires.size()); i++)
+        {
+            if (((Wire) m_wires.get(i)).getCapability().getNamespace().equals(Capability.MODULE_NAMESPACE))
+            {
+                ((ModuleImpl) ((Wire) m_wires.get(i)).getExporter()).removeDependentRequirer(this);
+            }
+            else if (((Wire) m_wires.get(i)).getCapability().getNamespace().equals(Capability.PACKAGE_NAMESPACE))
+            {
+                ((ModuleImpl) ((Wire) m_wires.get(i)).getExporter()).removeDependentImporter(this);
+            }
+        }
+
+        m_wires = wires;
+
+        // Add ourself as a dependent to the new wires' modules.
+        for (int i = 0; (m_wires != null) && (i < m_wires.size()); i++)
+        {
+            if (((Wire) m_wires.get(i)).getCapability().getNamespace().equals(Capability.MODULE_NAMESPACE))
+            {
+                ((ModuleImpl) ((Wire) m_wires.get(i)).getExporter()).addDependentRequirer(this);
+            }
+            else if (((Wire) m_wires.get(i)).getCapability().getNamespace().equals(Capability.PACKAGE_NAMESPACE))
+            {
+                ((ModuleImpl) ((Wire) m_wires.get(i)).getExporter()).addDependentImporter(this);
+            }
+        }
+    }
+
+    public boolean isResolved()
+    {
+        return m_isResolved;
+    }
+
+    public void setResolved()
+    {
+        m_isResolved = true;
+    }
+
+    //
+    // Dependency management methods.
+    //
+
+    public synchronized List<Module> getDependentHosts()
+    {
+        return m_dependentHosts;
+    }
+
+    public synchronized void addDependentHost(Module module)
+    {
+        if (!m_dependentHosts.contains(module))
+        {
+            m_dependentHosts.add(module);
+        }
+    }
+
+    public synchronized void removeDependentHost(Module module)
+    {
+        m_dependentHosts.remove(module);
+    }
+
+    public synchronized List<Module> getDependentImporters()
+    {
+        return m_dependentImporters;
+    }
+
+    public synchronized void addDependentImporter(Module module)
+    {
+        if (!m_dependentImporters.contains(module))
+        {
+            m_dependentImporters.add(module);
+        }
+    }
+
+    public synchronized void removeDependentImporter(Module module)
+    {
+        m_dependentImporters.remove(module);
+    }
+
+    public synchronized List<Module> getDependentRequirers()
+    {
+        return m_dependentRequirers;
+    }
+
+    public synchronized void addDependentRequirer(Module module)
+    {
+        if (!m_dependentRequirers.contains(module))
+        {
+            m_dependentRequirers.add(module);
+        }
+    }
+
+    public synchronized void removeDependentRequirer(Module module)
+    {
+        m_dependentRequirers.remove(module);
+    }
+
+    public synchronized List<Module> getDependents()
+    {
+        List<Module> dependents = new ArrayList<Module>
+            (m_dependentHosts.size() + m_dependentImporters.size() + m_dependentRequirers.size());
+        dependents.addAll(m_dependentHosts);
+        dependents.addAll(m_dependentImporters);
+        dependents.addAll(m_dependentRequirers);
+        return dependents;
+    }
+
+    public synchronized void setSecurityContext(Object securityContext)
+    {
+        m_protectionDomain = (ProtectionDomain) securityContext;
+    }
+
+    public synchronized Object getSecurityContext()
+    {
+        return m_protectionDomain;
+    }
+
+    public String toString()
+    {
+        return m_id;
+    }
+
+    public abstract Content getContent();
+
+    public abstract Class loadClass(String name) throws ClassNotFoundException;
+
+    public abstract URL getResource(String name);
+
+    public abstract Enumeration<URL> getResources(String name);
+
+    public abstract URL getEntry(String name);
+
+    public abstract Enumeration<String> getEntryPaths(String path);
+
+    public abstract Enumeration<URL> findEntries(
+        String path, String filePattern, boolean recurse);
+
+    public abstract boolean hasInputStream(int index, String urlPath) throws IOException;
+
+    public abstract InputStream getInputStream(int index, String urlPath) throws IOException;
+
+    static class FragmentRequirement implements Requirement
+    {
+        private final Module m_owner;
+        private final Requirement m_fragmentReq;
+
+        public FragmentRequirement(Module owner, Requirement fragmentReq)
+        {
+            m_owner = owner;
+            m_fragmentReq = fragmentReq;
+        }
+
+        public Module getFragment()
+        {
+            return m_fragmentReq.getModule();
+        }
+
+        public Module getModule()
+        {
+            return m_owner;
+        }
+
+        public String getNamespace()
+        {
+            return m_fragmentReq.getNamespace();
+        }
+
+        public SimpleFilter getFilter()
+        {
+            return m_fragmentReq.getFilter();
+        }
+
+        public boolean isOptional()
+        {
+            return m_fragmentReq.isOptional();
+        }
+
+        public Directive getDirective(String name)
+        {
+            return m_fragmentReq.getDirective(name);
+        }
+
+        public List<Directive> getDirectives()
+        {
+            return m_fragmentReq.getDirectives();
+        }
+
+        public String toString()
+        {
+            return m_fragmentReq.toString();
+        }
+    }
+}
\ No newline at end of file

Modified: felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/BundleContextImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/BundleContextImpl.java?rev=953419&r1=953418&r2=953419&view=diff
==============================================================================
--- felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/BundleContextImpl.java (original)
+++ felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/BundleContextImpl.java Thu Jun 10 18:53:23 2010
@@ -21,8 +21,11 @@ package org.apache.felix.framework;
 import java.io.File;
 import java.io.InputStream;
 import java.util.Dictionary;
+import java.util.Map;
 
 import org.apache.felix.framework.ext.FelixBundleContext;
+import org.apache.felix.framework.ext.VirtualModule;
+import org.apache.felix.framework.ext.VirtualModuleContext;
 import org.osgi.framework.*;
 
 class BundleContextImpl implements FelixBundleContext
@@ -44,26 +47,6 @@ class BundleContextImpl implements Felix
         m_valid = false;
     }
 
-    public void addRequirement(String s) throws BundleException
-    {
-        throw new BundleException("Not implemented yet.");
-    }
-
-    public void removeRequirement() throws BundleException
-    {
-        throw new BundleException("Not implemented yet.");
-    }
-
-    public void addCapability() throws BundleException
-    {
-        throw new BundleException("Not implemented yet.");
-    }
-
-    public void removeCapability() throws BundleException
-    {
-        throw new BundleException("Not implemented yet.");
-    }
-
     public String getProperty(String name)
     {
         checkValidity();
@@ -132,6 +115,18 @@ class BundleContextImpl implements Felix
         return result;
     }
 
+    public VirtualModuleContext installBundle(String location, Map headers, VirtualModule vm)
+        throws BundleException
+    {
+        return m_felix.installBundle(location, headers, vm);
+    }
+
+    public VirtualModuleContext reinstallBundle(Bundle bundle, VirtualModule vm)
+        throws BundleException
+    {
+        return null;
+    }
+
     public Bundle getBundle(long id)
     {
         checkValidity();

Modified: felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/BundleImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/BundleImpl.java?rev=953419&r1=953418&r2=953419&view=diff
==============================================================================
--- felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/BundleImpl.java (original)
+++ felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/BundleImpl.java Thu Jun 10 18:53:23 2010
@@ -27,6 +27,7 @@ import java.util.*;
 import org.apache.felix.framework.cache.BundleArchive;
 import org.apache.felix.framework.resolver.Module;
 import org.apache.felix.framework.ext.SecurityProvider;
+import org.apache.felix.framework.ext.VirtualModule;
 import org.apache.felix.framework.util.StringMap;
 import org.osgi.framework.*;
 
@@ -66,7 +67,7 @@ class BundleImpl implements Bundle
         m_context = null;
     }
 
-    BundleImpl(Felix felix, BundleArchive archive) throws Exception
+    BundleImpl(Felix felix, BundleArchive archive, VirtualModule vm) throws Exception
     {
         __m_felix = felix;
         m_archive = archive;
@@ -76,7 +77,7 @@ class BundleImpl implements Bundle
         m_activator = null;
         m_context = null;
 
-        Module module = createModule();
+        Module module = createModule(vm);
         addModule(module);
     }
 
@@ -167,7 +168,7 @@ class BundleImpl implements Bundle
             // Lastly, we want to reset our bundle be reinitializing our state
             // and recreating a module for the newest revision.
             m_modules.clear();
-            final Module module = createModule();
+            final Module module = createModule(null);
             addModule(module);
             m_state = Bundle.INSTALLED;
             m_stale = false;
@@ -1061,7 +1062,7 @@ class BundleImpl implements Bundle
         m_archive.revise(location, is);
         try
         {
-            Module module = createModule();
+            Module module = createModule(null);
             addModule(module);
         }
         catch (Exception ex)
@@ -1086,8 +1087,12 @@ class BundleImpl implements Bundle
 
         // Set protection domain after adding the module to the bundle,
         // since this requires that the bundle has a module.
-        ((ModuleImpl) module).setSecurityContext(
-            new BundleProtectionDomain(getFramework(), this));
+// TODO: VB - We should probably inject into virtual modules too.
+        if (module instanceof ModuleImpl)
+        {
+            ((ModuleImpl) module).setSecurityContext(
+                new BundleProtectionDomain(getFramework(), this));
+        }
 
         SecurityProvider sp = getFramework().getSecurityProvider();
         if ((sp != null) && (System.getSecurityManager() != null))
@@ -1114,29 +1119,44 @@ class BundleImpl implements Bundle
         }
     }
 
-    private Module createModule() throws Exception
+    private Module createModule(VirtualModule vm) throws Exception
     {
         // Get and parse the manifest from the most recent revision to
         // create an associated module for it.
-        Map headerMap = m_archive.getRevision(
+        Map headers = m_archive.getRevision(
             m_archive.getRevisionCount() - 1).getManifestHeader();
 
         // Create the module instance.
         final int revision = m_archive.getRevisionCount() - 1;
-        ModuleImpl module = new ModuleImpl(
-            getFramework().getLogger(),
-            getFramework().getConfig(),
-            getFramework().getResolver(),
-            this,
-            Long.toString(getBundleId()) + "." + Integer.toString(revision),
-            headerMap,
-            m_archive.getRevision(revision).getContent(),
-            getFramework().getBundleStreamHandler(),
-            getFramework().getBootPackages(),
-            getFramework().getBootPackageWildcards());
+        Module module;
+        if (m_archive.getRevision(revision).getContent() == null)
+        {
+            module = new UnmanagedModuleImpl(
+                getFramework().getLogger(),
+                getFramework().getConfig(),
+                this,
+                Long.toString(getBundleId()) + "." + Integer.toString(revision),
+                headers,
+                vm);
+        }
+        else
+        {
+            module = new ModuleImpl(
+                getFramework().getLogger(),
+                getFramework().getConfig(),
+                getFramework().getResolver(),
+                this,
+                Long.toString(getBundleId()) + "." + Integer.toString(revision),
+                headers,
+                m_archive.getRevision(revision).getContent(),
+                getFramework().getBundleStreamHandler(),
+                getFramework().getBootPackages(),
+                getFramework().getBootPackageWildcards());
+        }
 
         // Verify that the bundle symbolic name + version is unique.
-        if (module.getManifestVersion().equals("2"))
+// TODO: VB - Fix manifest version check.
+//        if (module.getManifestVersion().equals("2"))
         {
             Version bundleVersion = module.getVersion();
             bundleVersion = (bundleVersion == null) ? Version.emptyVersion : bundleVersion;

Modified: felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/EntryFilterEnumeration.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/EntryFilterEnumeration.java?rev=953419&r1=953418&r2=953419&view=diff
==============================================================================
--- felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/EntryFilterEnumeration.java (original)
+++ felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/EntryFilterEnumeration.java Thu Jun 10 18:53:23 2010
@@ -26,7 +26,7 @@ import org.apache.felix.framework.resolv
 
 class EntryFilterEnumeration implements Enumeration
 {
-    private final BundleImpl m_bundle;
+    private final Module m_module;
     private final List<Enumeration> m_enumerations;
     private final List<Module> m_modules;
     private int m_moduleIndex = 0;
@@ -38,12 +38,11 @@ class EntryFilterEnumeration implements 
     private final List<Object> m_nextEntries = new ArrayList(2);
 
     public EntryFilterEnumeration(
-        BundleImpl bundle, boolean includeFragments, String path,
+        Module module, boolean includeFragments, String path,
         String filePattern, boolean recurse, boolean isURLValues)
     {
-        m_bundle = bundle;
-        Module bundleModule = m_bundle.getCurrentModule();
-        List<Module> fragmentModules = ((ModuleImpl) bundleModule).getFragments();
+        m_module = module;
+        List<Module> fragmentModules = ((ModuleImpl) module).getFragments();
         if (includeFragments && (fragmentModules != null))
         {
             m_modules = new ArrayList(fragmentModules.size() + 1);
@@ -53,7 +52,7 @@ class EntryFilterEnumeration implements 
         {
             m_modules = new ArrayList(1);
         }
-        m_modules.add(0, bundleModule);
+        m_modules.add(0, module);
         m_enumerations = new ArrayList(m_modules.size());
         for (int i = 0; i < m_modules.size(); i++)
         {
@@ -90,12 +89,12 @@ class EntryFilterEnumeration implements 
 
     public synchronized boolean hasMoreElements()
     {
-        return (m_nextEntries.size() != 0);
+        return (!m_nextEntries.isEmpty());
     }
 
     public synchronized Object nextElement()
     {
-        if (m_nextEntries.size() == 0)
+        if (m_nextEntries.isEmpty())
         {
             throw new NoSuchElementException("No more entries.");
         }
@@ -114,11 +113,11 @@ class EntryFilterEnumeration implements 
         {
             return;
         }
-        while ((m_moduleIndex < m_enumerations.size()) && (m_nextEntries.size() == 0))
+        while ((m_moduleIndex < m_enumerations.size()) && m_nextEntries.isEmpty())
         {
             while (m_enumerations.get(m_moduleIndex) != null
                 && m_enumerations.get(m_moduleIndex).hasMoreElements()
-                && m_nextEntries.size() == 0)
+                && m_nextEntries.isEmpty())
             {
                 // Get the current entry to determine if it should be filtered or not.
                 String entryName = (String) m_enumerations.get(m_moduleIndex).nextElement();
@@ -219,7 +218,7 @@ class EntryFilterEnumeration implements 
                     }
                 }
             }
-            if (m_nextEntries.size() == 0)
+            if (m_nextEntries.isEmpty())
             {
                 m_moduleIndex++;
             }

Modified: felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ExtensionManager.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ExtensionManager.java?rev=953419&r1=953418&r2=953419&view=diff
==============================================================================
--- felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ExtensionManager.java (original)
+++ felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ExtensionManager.java Thu Jun 10 18:53:23 2010
@@ -150,6 +150,7 @@ class ExtensionManager extends URLStream
      * @param systemBundleInfo the info to change if we need to add exports.
      */
     ExtensionManager(Logger logger, Felix felix)
+        throws BundleException
     {
         m_systemBundleModule = new ExtensionManagerModule(felix);
         m_extensions = null;
@@ -598,6 +599,7 @@ class ExtensionManager extends URLStream
     {
         private final Version m_version;
         ExtensionManagerModule(Felix felix)
+            throws BundleException
         {
             super(m_logger, felix.getConfig(), felix, "0",
                 felix.getBootPackages(), felix.getBootPackageWildcards());
@@ -631,7 +633,7 @@ class ExtensionManager extends URLStream
             return m_version;
         }
 
-        public Class getClassByDelegation(String name) throws ClassNotFoundException
+        public Class loadClass(String name) throws ClassNotFoundException
         {
             Class clazz = null;
             String pkgName = Util.getClassPackage(name);
@@ -674,12 +676,12 @@ class ExtensionManager extends URLStream
             return clazz;
         }
 
-        public URL getResourceByDelegation(String name)
+        public URL getResource(String name)
         {
             return getClass().getClassLoader().getResource(name);
         }
 
-        public Enumeration getResourcesByDelegation(String name)
+        public Enumeration getResources(String name)
         {
            try
            {

Modified: felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/Felix.java?rev=953419&r1=953418&r2=953419&view=diff
==============================================================================
--- felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/Felix.java Thu Jun 10 18:53:23 2010
@@ -37,6 +37,9 @@ import org.apache.felix.framework.capabi
 import org.apache.felix.framework.capabilityset.SimpleFilter;
 import org.apache.felix.framework.resolver.Wire;
 import org.apache.felix.framework.ext.SecurityProvider;
+import org.apache.felix.framework.ext.VBWire;
+import org.apache.felix.framework.ext.VirtualModule;
+import org.apache.felix.framework.ext.VirtualModuleContext;
 import org.apache.felix.framework.resolver.ResolveException;
 import org.apache.felix.framework.resolver.Resolver;
 import org.apache.felix.framework.resolver.ResolverImpl;
@@ -369,9 +372,9 @@ public class Felix extends BundleImpl im
 
         // Create the extension manager, which we will use as the module
         // definition for creating the system bundle module.
-        m_extensionManager = new ExtensionManager(m_logger, this);
         try
         {
+            m_extensionManager = new ExtensionManager(m_logger, this);
             addModule(m_extensionManager.getModule());
         }
         catch (Exception ex)
@@ -1462,7 +1465,7 @@ ex.printStackTrace();
         {
             return null;
         }
-        return bundle.getCurrentModule().getResourceByDelegation(name);
+        return bundle.getCurrentModule().getResource(name);
     }
 
     /**
@@ -1478,7 +1481,7 @@ ex.printStackTrace();
         {
             return null;
         }
-        return bundle.getCurrentModule().getResourcesByDelegation(name);
+        return bundle.getCurrentModule().getResources(name);
     }
 
     /**
@@ -1501,7 +1504,8 @@ ex.printStackTrace();
             // Use the entry filter enumeration to search the bundle content
             // recursively for matching entries and return URLs to them.
             Enumeration enumeration =
-                new EntryFilterEnumeration(bundle, false, name, "*", true, true);
+                new EntryFilterEnumeration(
+                    bundle.getCurrentModule(), false, name, "*", true, true);
             // If the enumeration has elements, then that means we need
             // to synthesize the directory entry.
             if (enumeration.hasMoreElements())
@@ -1530,12 +1534,7 @@ ex.printStackTrace();
             throw new IllegalStateException("The bundle is uninstalled.");
         }
 
-        // Get the entry enumeration from the module content and
-        // create a wrapper enumeration to filter it.
-        Enumeration enumeration =
-            new EntryFilterEnumeration(bundle, false, path, "*", false, false);
-
-        // Return the enumeration if it has elements.
+        Enumeration enumeration = bundle.getCurrentModule().getEntryPaths(path);
         return (!enumeration.hasMoreElements()) ? null : enumeration;
     }
 
@@ -1548,12 +1547,8 @@ ex.printStackTrace();
         // Try to resolve the bundle per the spec.
         resolveBundles(new Bundle[] { bundle });
 
-        // Get the entry enumeration from the module content and
-        // create a wrapper enumeration to filter it.
         Enumeration enumeration =
-            new EntryFilterEnumeration(bundle, true, path, filePattern, recurse, true);
-
-        // Return the enumeration if it has elements.
+            bundle.getCurrentModule().findEntries(path, filePattern, recurse);
         return (!enumeration.hasMoreElements()) ? null : enumeration;
     }
 
@@ -1636,7 +1631,7 @@ ex.printStackTrace();
                 throw new ClassNotFoundException(name, ex);
             }
         }
-        return bundle.getCurrentModule().getClassByDelegation(name);
+        return bundle.getCurrentModule().loadClass(name);
     }
 
     /**
@@ -2533,7 +2528,7 @@ ex.printStackTrace();
                 }
                 try
                 {
-                    bundle = new BundleImpl(this, ba);
+                    bundle = new BundleImpl(this, ba, null);
                 }
                 finally
                 {
@@ -2640,6 +2635,152 @@ ex.printStackTrace();
         return bundle;
     }
 
+    VirtualModuleContext installBundle(String location, Map headers, VirtualModule vm)
+        throws BundleException
+    {
+        BundleImpl bundle = null;
+
+        if ((location == null) || (headers == null) || (vm == null))
+        {
+            throw new BundleException(
+                "Must specify location, headers, and virtual module.");
+        }
+
+        // Acquire an install lock.
+        acquireInstallLock(location);
+
+        try
+        {
+            // Check to see if the framework is still running;
+            if ((getState() == Bundle.STOPPING) ||
+                (getState() == Bundle.UNINSTALLED))
+            {
+                throw new BundleException("The framework has been shutdown.");
+            }
+
+            // If bundle location is already installed, then throw exception.
+            bundle = (BundleImpl) getBundle(location);
+            if (bundle != null)
+            {
+                throw new BundleException(
+                    "Bundle location is not unique",
+                    BundleException.DUPLICATE_BUNDLE_ERROR);
+            }
+
+            // First generate an identifier for the bundle.
+            long id = getNextId();
+
+            // Next create a bundle archive for it.
+            BundleArchive ba = null;
+            try
+            {
+                ba = m_cache.create(id, location, headers);
+            }
+            catch (Exception ex)
+            {
+                throw new BundleException(
+                    "Unable to cache bundle: " + location, ex);
+            }
+
+            try
+            {
+                // Acquire the global lock to create the bundle,
+                // since this impacts the global state.
+                boolean locked = acquireGlobalLock();
+                if (!locked)
+                {
+                    throw new BundleException(
+                        "Unable to acquire the global lock to install the bundle.");
+                }
+                try
+                {
+                    bundle = new BundleImpl(this, ba, vm);
+                }
+                finally
+                {
+                    // Always release the global lock.
+                    releaseGlobalLock();
+                }
+
+                if (!bundle.isExtension())
+                {
+                    Object sm = System.getSecurityManager();
+                    if (sm != null)
+                    {
+                        ((SecurityManager) sm).checkPermission(
+                            new AdminPermission(bundle, AdminPermission.LIFECYCLE));
+                    }
+                }
+                else
+                {
+                    m_extensionManager.addExtensionBundle(this, bundle);
+                    m_resolverState.refreshSystemBundleModule(m_extensionManager.getModule());
+                }
+            }
+            catch (Throwable ex)
+            {
+                // If the bundle is new, then remove it from the cache.
+                // TODO: FRAMEWORK - Perhaps it should be removed if it is not new too.
+                try
+                {
+                    if (bundle != null)
+                    {
+                        bundle.closeAndDelete();
+                    }
+                    else if (ba != null)
+                    {
+                        ba.closeAndDelete();
+                    }
+                }
+                catch (Exception ex1)
+                {
+                    m_logger.log(
+                        Logger.LOG_ERROR,
+                        "Could not remove from cache.", ex1);
+                }
+                if (ex instanceof BundleException)
+                {
+                    throw (BundleException) ex;
+                }
+                else if (ex instanceof AccessControlException)
+                {
+                    throw (AccessControlException) ex;
+                }
+                else
+                {
+                    throw new BundleException("Could not create bundle object.", ex);
+                }
+            }
+
+            // Set the bundle's start level.
+            // This will persistently set the bundle's start level.
+            bundle.setStartLevel(getInitialBundleStartLevel());
+            bundle.setLastModified(System.currentTimeMillis());
+
+            synchronized (m_installedBundleLock_Priority2)
+            {
+                m_installedBundleMap.put(location, bundle);
+                m_installedBundleIndex.put(new Long(bundle.getBundleId()), bundle);
+            }
+
+            if (bundle.isExtension())
+            {
+                m_extensionManager.startExtensionBundle(this, bundle);
+            }
+        }
+        finally
+        {
+            // Always release install lock.
+            releaseInstallLock(location);
+        }
+
+        // Fire bundle event.
+        fireBundleEvent(BundleEvent.INSTALLED, bundle);
+
+        // Return virtual module context.
+        return new VirtualModuleContextImpl(bundle);
+    }
+
     /**
      * Retrieves a bundle from its location.
      *
@@ -3083,7 +3224,7 @@ ex.printStackTrace();
             // to be shown as coming from the system bundle.
             if (!clazz.getName().startsWith("java."))
             {
-                return (m_extensionManager.getModule().getClassByDelegation(clazz.getName()) == clazz)
+                return (m_extensionManager.getModule().loadClass(clazz.getName()) == clazz)
                     ? this : null;
             }
         }
@@ -3315,11 +3456,11 @@ ex.printStackTrace();
             List<Module> dependents = ((ModuleImpl) expModules.get(expIdx)).getDependentImporters();
             for (int depIdx = 0; (dependents != null) && (depIdx < dependents.size()); depIdx++)
             {
-                List<Wire> wires = dependents.get(depIdx).getWires();
+                List<? extends VBWire> wires = dependents.get(depIdx).getWires();
                 for (int wireIdx = 0; (wires != null) && (wireIdx < wires.size()); wireIdx++)
                 {
-                    if ((wires.get(wireIdx).getExporter() == expModules.get(expIdx))
-                        && (wires.get(wireIdx).hasPackage(ep.getName())))
+                    if ((((Wire) wires.get(wireIdx)).getExporter() == expModules.get(expIdx))
+                        && (((Wire) wires.get(wireIdx)).hasPackage(ep.getName())))
                     {
                         list.add(dependents.get(depIdx).getBundle());
                     }
@@ -3669,7 +3810,7 @@ ex.printStackTrace();
             Class clazz;
             try
             {
-                clazz = impl.getCurrentModule().getClassByDelegation(className);
+                clazz = impl.getCurrentModule().loadClass(className);
             }
             catch (ClassNotFoundException ex)
             {
@@ -4006,7 +4147,15 @@ ex.printStackTrace();
                                     m_resolver.resolve(m_resolverState, newRootModule);
 
                                 // Mark all modules as resolved.
-                                markResolvedModules(wireMap);
+                                try
+                                {
+                                    markResolvedModules(wireMap);
+                                }
+                                catch (BundleException ex)
+                                {
+                                    throw new ResolveException(
+                                        ex.getMessage(), rootModule, null);
+                                }
                             }
                             catch (ResolveException ex)
                             {
@@ -4061,12 +4210,12 @@ ex.printStackTrace();
                     // dynamically importing the package, which can happen if two
                     // threads are racing to do so. If we have an existing wire,
                     // then just return it instead.
-                    List<Wire> wires = module.getWires();
+                    List<VBWire> wires = module.getWires();
                     for (int i = 0; (wires != null) && (i < wires.size()); i++)
                     {
-                        if (wires.get(i).hasPackage(pkgName))
+                        if (((Wire) wires.get(i)).hasPackage(pkgName))
                         {
-                            return wires.get(i);
+                            return (Wire) wires.get(i);
                         }
                     }
 
@@ -4078,17 +4227,25 @@ ex.printStackTrace();
                         List<Wire> dynamicWires = wireMap.remove(module);
                         candidateWire = dynamicWires.get(0);
 
-                        // Mark all modules as resolved.
-                        markResolvedModules(wireMap);
-
-                        // Dynamically add new wire to importing module.
-                        if (candidateWire != null)
+                        try
                         {
-                            wires = new ArrayList(wires.size() + 1);
-                            wires.addAll(module.getWires());
-                            wires.add(candidateWire);
-                            ((ModuleImpl) module).setWires(wires);
+                            // Mark all modules as resolved.
+                            markResolvedModules(wireMap);
+
+                            // Dynamically add new wire to importing module.
+                            if (candidateWire != null)
+                            {
+                                wires = new ArrayList<VBWire>(wires.size() + 1);
+                                wires.addAll(module.getWires());
+                                wires.add(candidateWire);
+                                ((ModuleImpl) module).resolve(wires);
 m_logger.log(Logger.LOG_DEBUG, "DYNAMIC WIRE: " + wires.get(wires.size() - 1));
+                            }
+                        }
+                        catch (BundleException ex)
+                        {
+                            throw new ResolveException(
+                                ex.getMessage(), module, null);
                         }
                     }
                 }
@@ -4140,10 +4297,10 @@ m_logger.log(Logger.LOG_DEBUG, "DYNAMIC 
             }
             // If any of our wires have this package, then we cannot
             // attempt to dynamically import it.
-            List<Wire> wires = module.getWires();
+            List<? extends VBWire> wires = module.getWires();
             for (int i = 0; (wires != null) && (i < wires.size()); i++)
             {
-                if (wires.get(i).hasPackage(pkgName))
+                if (((Wire) wires.get(i)).hasPackage(pkgName))
                 {
                     return false;
                 }
@@ -4159,7 +4316,7 @@ m_logger.log(Logger.LOG_DEBUG, "DYNAMIC 
                 module, Capability.PACKAGE_NAMESPACE, dirs, attrs);
             Set<Capability> candidates = m_resolverState.getCandidates(module, req, false);
 
-            if (candidates.size() == 0)
+            if (candidates.isEmpty())
             {
                 return false;
             }
@@ -4168,6 +4325,7 @@ m_logger.log(Logger.LOG_DEBUG, "DYNAMIC 
         }
 
         private void markResolvedModules(Map<Module, List<Wire>> wireMap)
+            throws BundleException
         {
             if (wireMap != null)
             {
@@ -4188,21 +4346,26 @@ m_logger.log(Logger.LOG_DEBUG, "DYNAMIC 
                             Logger.LOG_DEBUG,
                             "WIRE: " + wires.get(wireIdx));
                     }
-                    ((ModuleImpl) module).setWires(wires);
+// TODO: VB - How to properly handle this generic crap?
+                    List<VBWire> vbWires = new ArrayList<VBWire>(wires);
+                    module.resolve(vbWires);
 
                     // Resolve all attached fragments.
-                    List<Module> fragments = ((ModuleImpl) module).getFragments();
-                    for (int i = 0; (fragments != null) && (i < fragments.size()); i++)
+                    if (module instanceof ModuleImpl)
                     {
-                        ((ModuleImpl) fragments.get(i)).setResolved();
-                        // Update the state of the module's bundle to resolved as well.
-                        markBundleResolved(fragments.get(i));
-                        m_logger.log(
-                            Logger.LOG_DEBUG,
-                            "FRAGMENT WIRE: " + fragments.get(i) + " -> hosted by -> " + module);
+                        List<Module> fragments = ((ModuleImpl) module).getFragments();
+                        for (int i = 0; (fragments != null) && (i < fragments.size()); i++)
+                        {
+                            ((ModuleImpl) fragments.get(i)).setResolved();
+                            // Update the state of the module's bundle to resolved as well.
+                            markBundleResolved(fragments.get(i));
+                            m_logger.log(
+                                Logger.LOG_DEBUG,
+                                "FRAGMENT WIRE: " + fragments.get(i) + " -> hosted by -> " + module);
+                        }
                     }
                     // Update the resolver state to show the module as resolved.
-                    ((ModuleImpl) module).setResolved();
+                    ((AbstractModuleImpl) module).setResolved();
                     m_resolverState.moduleResolved(module);
                     // Update the state of the module's bundle to resolved as well.
                     markBundleResolved(module);

Modified: felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/FelixResolverState.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/FelixResolverState.java?rev=953419&r1=953418&r2=953419&view=diff
==============================================================================
--- felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/FelixResolverState.java (original)
+++ felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/FelixResolverState.java Thu Jun 10 18:53:23 2010
@@ -32,12 +32,14 @@ import org.apache.felix.framework.capabi
 import org.apache.felix.framework.capabilityset.Directive;
 import org.apache.felix.framework.resolver.Module;
 import org.apache.felix.framework.capabilityset.Requirement;
+import org.apache.felix.framework.ext.VBWire;
 import org.apache.felix.framework.resolver.Wire;
 import org.apache.felix.framework.resolver.CandidateComparator;
 import org.apache.felix.framework.resolver.ResolveException;
 import org.apache.felix.framework.resolver.Resolver;
 import org.apache.felix.framework.util.Util;
 import org.apache.felix.framework.util.manifestparser.R4Library;
+import org.osgi.framework.BundleException;
 import org.osgi.framework.BundlePermission;
 import org.osgi.framework.PackagePermission;
 import org.osgi.framework.Constants;
@@ -542,7 +544,14 @@ public class FelixResolverState implemen
         }
         // Set wires to null, which will remove the module from all
         // of its dependent modules.
-        ((ModuleImpl) host).setWires(null);
+        try
+        {
+            ((ModuleImpl) host).resolve(null);
+        }
+        catch (BundleException ex)
+        {
+            // Shouldn't happen.
+        }
     }
 
     private List<Module> getMatchingFragments(Module host)
@@ -689,11 +698,11 @@ public class FelixResolverState implemen
             // If so, then the framework must have chosen to have the module
             // import rather than export the package, so we need to remove the
             // corresponding package capability from the package capability set.
-            List<Wire> wires = module.getWires();
+            List<? extends VBWire> wires = module.getWires();
             List<Capability> caps = module.getCapabilities();
             for (int wireIdx = 0; (wires != null) && (wireIdx < wires.size()); wireIdx++)
             {
-                Wire wire = wires.get(wireIdx);
+                Wire wire = (Wire) wires.get(wireIdx);
                 if (wire.getCapability().getNamespace().equals(Capability.PACKAGE_NAMESPACE))
                 {
                     for (int capIdx = 0;

Modified: felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ModuleImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ModuleImpl.java?rev=953419&r1=953418&r2=953419&view=diff
==============================================================================
--- felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ModuleImpl.java (original)
+++ felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ModuleImpl.java Thu Jun 10 18:53:23 2010
@@ -51,7 +51,8 @@ import org.apache.felix.framework.capabi
 import org.apache.felix.framework.resolver.Content;
 import org.apache.felix.framework.resolver.Module;
 import org.apache.felix.framework.resolver.ResolveException;
-import org.apache.felix.framework.resolver.ResourceNotFoundException;
+import org.apache.felix.framework.ext.ResourceNotFoundException;
+import org.apache.felix.framework.ext.VBWire;
 import org.apache.felix.framework.resolver.Wire;
 import org.apache.felix.framework.resolver.WireImpl;
 import org.apache.felix.framework.resolver.WireModuleImpl;
@@ -68,50 +69,25 @@ import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.BundleReference;
 import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
 
-public class ModuleImpl implements Module
+public class ModuleImpl extends AbstractModuleImpl
 {
-    private final Logger m_logger;
-    private final Map m_configMap;
     private final FelixResolver m_resolver;
-    private final String m_id;
     private final Content m_content;
-    private final Map m_headerMap;
     private final URLStreamHandler m_streamHandler;
 
-    private final String m_manifestVersion;
-    private final boolean m_isExtension;
-    private final String m_symbolicName;
-    private final Version m_version;
-
-    private final List<Capability> m_capabilities;
-    private List<Capability> m_cachedCapabilities = null;
-    private final List<Requirement> m_requirements;
-    private List<Requirement> m_cachedRequirements = null;
-    private final List<Requirement> m_dynamicRequirements;
-    private List<Requirement> m_cachedDynamicRequirements = null;
-    private final List<R4Library> m_nativeLibraries;
-    private final int m_declaredActivationPolicy;
-    private final List<String> m_activationIncludes;
-    private final List<String> m_activationExcludes;
-
-    private final Bundle m_bundle;
-
-    private List<Module> m_fragments = null;
-    private List<Wire> m_wires = null;
-    private List<Module> m_dependentHosts = new ArrayList<Module>(0);
-    private List<Module> m_dependentImporters = new ArrayList<Module>(0);
-    private List<Module> m_dependentRequirers = new ArrayList<Module>(0);
-    private volatile boolean m_isResolved = false;
-
     private Content[] m_contentPath;
+    private List<Module> m_fragments = null;
     private Content[] m_fragmentContents = null;
     private ModuleClassLoader m_classLoader;
     private boolean m_isActivationTriggered = false;
     private ProtectionDomain m_protectionDomain = null;
     private static SecureAction m_secureAction = new SecureAction();
 
+    private List<Capability> m_cachedCapabilities = null;
+    private List<Requirement> m_cachedRequirements = null;
+    private List<Requirement> m_cachedDynamicRequirements = null;
+
     // Bundle-specific class loader for boot delegation.
     private final ClassLoader m_bootClassLoader;
     // Default class loader for boot delegation.
@@ -168,30 +144,16 @@ public class ModuleImpl implements Modul
     public ModuleImpl(
         Logger logger, Map configMap, Bundle bundle, String id,
         String[] bootPkgs, boolean[] bootPkgWildcards)
+        throws BundleException
     {
-        m_logger = logger;
-        m_configMap = configMap;
+        super(logger, configMap, bundle, id, configMap);
         m_resolver = null;
-        m_bundle = bundle;
-        m_id = id;
-        m_headerMap = null;
         m_content = null;
         m_streamHandler = null;
         m_bootPkgs = bootPkgs;
         m_bootPkgWildcards = bootPkgWildcards;
-        m_manifestVersion = null;
-        m_symbolicName = null;
-        m_isExtension = false;
-        m_version = null;
-        m_capabilities = null;
-        m_requirements = null;
-        m_dynamicRequirements = null;
-        m_nativeLibraries = null;
-        m_declaredActivationPolicy = EAGER_ACTIVATION;
-        m_activationExcludes = null;
-        m_activationIncludes = null;
-        m_implicitBootDelegation = false;
         m_bootClassLoader = m_defBootClassLoader;
+        m_implicitBootDelegation = false;
     }
 
     public ModuleImpl(
@@ -201,25 +163,21 @@ public class ModuleImpl implements Modul
         boolean[] bootPkgWildcards)
         throws BundleException
     {
-        m_logger = logger;
-        m_configMap = configMap;
+        super(logger, configMap, bundle, id, headerMap);
         m_resolver = resolver;
-        m_bundle = bundle;
-        m_id = id;
-        m_headerMap = headerMap;
         m_content = content;
         m_streamHandler = streamHandler;
         m_bootPkgs = bootPkgs;
         m_bootPkgWildcards = bootPkgWildcards;
 
         m_implicitBootDelegation =
-            (m_configMap.get(FelixConstants.IMPLICIT_BOOT_DELEGATION_PROP) == null)
+            (getConfig().get(FelixConstants.IMPLICIT_BOOT_DELEGATION_PROP) == null)
             || Boolean.valueOf(
-                (String) m_configMap.get(
+                (String) getConfig().get(
                     FelixConstants.IMPLICIT_BOOT_DELEGATION_PROP)).booleanValue();
 
         ClassLoader bootLoader = m_defBootClassLoader;
-        Object map = m_configMap.get(FelixConstants.BOOT_CLASSLOADERS_PROP);
+        Object map = getConfig().get(FelixConstants.BOOT_CLASSLOADERS_PROP);
         if (map instanceof Map)
         {
             Object l = ((Map) map).get(bundle);
@@ -229,183 +187,6 @@ public class ModuleImpl implements Modul
             }
         }
         m_bootClassLoader = bootLoader;
-
-        ManifestParser mp = new ManifestParser(m_logger, m_configMap, this, m_headerMap);
-
-        // Record some of the parsed metadata. Note, if this is an extension
-        // bundle it's exports are removed, since they will be added to the
-        // system bundle directly later on.
-        m_manifestVersion = mp.getManifestVersion();
-        m_version = mp.getBundleVersion();
-        m_capabilities = mp.isExtension() ? null : mp.getCapabilities();
-        m_requirements = mp.getRequirements();
-        m_dynamicRequirements = mp.getDynamicRequirements();
-        m_nativeLibraries = mp.getLibraries();
-        m_declaredActivationPolicy = mp.getActivationPolicy();
-        m_activationExcludes = (mp.getActivationExcludeDirective() == null)
-            ? null
-            : ManifestParser.parseDelimitedString(mp.getActivationExcludeDirective(), ",");
-        m_activationIncludes = (mp.getActivationIncludeDirective() == null)
-            ? null
-            : ManifestParser.parseDelimitedString(mp.getActivationIncludeDirective(), ",");
-        m_symbolicName = mp.getSymbolicName();
-        m_isExtension = mp.isExtension();
-    }
-
-    //
-    // Metadata access methods.
-    //
-
-    public Map getHeaders()
-    {
-        return m_headerMap;
-    }
-
-    public boolean isExtension()
-    {
-        return m_isExtension;
-    }
-
-    public String getSymbolicName()
-    {
-        return m_symbolicName;
-    }
-
-    public String getManifestVersion()
-    {
-        return m_manifestVersion;
-    }
-
-    public Version getVersion()
-    {
-        return m_version;
-    }
-
-    public synchronized List<Capability> getCapabilities()
-    {
-        if (m_cachedCapabilities == null)
-        {
-            List capList = (m_capabilities == null)
-                ? new ArrayList<Capability>()
-                : new ArrayList<Capability>(m_capabilities);
-            for (int fragIdx = 0;
-                (m_fragments != null) && (fragIdx < m_fragments.size());
-                fragIdx++)
-            {
-                List<Capability> caps = m_fragments.get(fragIdx).getCapabilities();
-                for (int capIdx = 0;
-                    (caps != null) && (capIdx < caps.size());
-                    capIdx++)
-                {
-                    if (caps.get(capIdx).getNamespace().equals(Capability.PACKAGE_NAMESPACE))
-                    {
-                        capList.add(
-                            new CapabilityImpl(
-                                this,
-                                caps.get(capIdx).getNamespace(),
-                                caps.get(capIdx).getDirectives(),
-                                caps.get(capIdx).getAttributes()));
-                    }
-                }
-            }
-            m_cachedCapabilities = Collections.unmodifiableList(capList);
-        }
-        return m_cachedCapabilities;
-    }
-
-    public synchronized List<Requirement> getRequirements()
-    {
-        if (m_cachedRequirements == null)
-        {
-            List<Requirement> reqList = (m_requirements == null)
-                ? new ArrayList() : new ArrayList(m_requirements);
-            for (int fragIdx = 0;
-                (m_fragments != null) && (fragIdx < m_fragments.size());
-                fragIdx++)
-            {
-                List<Requirement> reqs = m_fragments.get(fragIdx).getRequirements();
-                for (int reqIdx = 0;
-                    (reqs != null) && (reqIdx < reqs.size());
-                    reqIdx++)
-                {
-                    if (reqs.get(reqIdx).getNamespace().equals(Capability.PACKAGE_NAMESPACE)
-                        || reqs.get(reqIdx).getNamespace().equals(Capability.MODULE_NAMESPACE))
-                    {
-                        reqList.add(
-                            new FragmentRequirement(
-                                this, reqs.get(reqIdx)));
-                    }
-                }
-            }
-            m_cachedRequirements = Collections.unmodifiableList(reqList);
-        }
-        return m_cachedRequirements;
-    }
-
-    public synchronized List<Requirement> getDynamicRequirements()
-    {
-        if (m_cachedDynamicRequirements == null)
-        {
-            List<Requirement> reqList = (m_dynamicRequirements == null)
-                ? new ArrayList() : new ArrayList(m_dynamicRequirements);
-            for (int fragIdx = 0;
-                (m_fragments != null) && (fragIdx < m_fragments.size());
-                fragIdx++)
-            {
-                List<Requirement> reqs = m_fragments.get(fragIdx).getDynamicRequirements();
-                for (int reqIdx = 0;
-                    (reqs != null) && (reqIdx < reqs.size());
-                    reqIdx++)
-                {
-                    if (reqs.get(reqIdx).getNamespace().equals(Capability.PACKAGE_NAMESPACE))
-                    {
-                        reqList.add(reqs.get(reqIdx));
-                    }
-                }
-            }
-            m_cachedDynamicRequirements = Collections.unmodifiableList(reqList);
-        }
-        return m_cachedDynamicRequirements;
-    }
-
-    public synchronized List<R4Library> getNativeLibraries()
-    {
-        List<R4Library> result = null;
-        if (m_isResolved)
-        {
-            List<R4Library> nativeList = (m_nativeLibraries == null)
-                ? new ArrayList() : new ArrayList(m_nativeLibraries);
-            for (int fragIdx = 0;
-                (m_fragments != null) && (fragIdx < m_fragments.size());
-                fragIdx++)
-            {
-                List<R4Library> libs = m_fragments.get(fragIdx).getNativeLibraries();
-                for (int reqIdx = 0;
-                    (libs != null) && (reqIdx < libs.size());
-                    reqIdx++)
-                {
-                    nativeList.add(libs.get(reqIdx));
-                }
-            }
-
-            // We need to return null here if we don't have any libraries, since a
-            // zero-length array is used to indicate that matching native libraries
-            // could not be found when resolving the bundle.
-            result = (nativeList.size() == 0)
-                ? null
-                : Collections.unmodifiableList(nativeList);
-        }
-        else
-        {
-            result = m_nativeLibraries;
-        }
-
-        return result;
-    }
-
-    public int getDeclaredActivationPolicy()
-    {
-        return m_declaredActivationPolicy;
     }
 
     synchronized boolean isActivationTriggered()
@@ -415,96 +196,36 @@ public class ModuleImpl implements Modul
 
     boolean isActivationTrigger(String pkgName)
     {
-        if ((m_activationIncludes == null) && (m_activationExcludes == null))
+        List<String> actIncludes = getActivationIncludes();
+        List<String> actExcludes = getActivationExcludes();
+        if ((actIncludes == null) && (actExcludes == null))
         {
             return true;
         }
 
         // If there are no include filters then all classes are included
         // by default, otherwise try to find one match.
-        boolean included = (m_activationIncludes == null);
+        boolean included = (actIncludes == null);
         for (int i = 0;
-            (!included) && (m_activationIncludes != null) && (i < m_activationIncludes.size());
+            (!included) && (actIncludes != null) && (i < actIncludes.size());
             i++)
         {
-            included = m_activationIncludes.get(i).equals(pkgName);
+            included = actIncludes.get(i).equals(pkgName);
         }
 
         // If there are no exclude filters then no classes are excluded
         // by default, otherwise try to find one match.
         boolean excluded = false;
         for (int i = 0;
-            (!excluded) && (m_activationExcludes != null) && (i < m_activationExcludes.size());
+            (!excluded) && (actExcludes != null) && (i < actExcludes.size());
             i++)
         {
-            excluded = m_activationExcludes.get(i).equals(pkgName);
+            excluded = actExcludes.get(i).equals(pkgName);
         }
         return included && !excluded;
     }
 
     //
-    // Run-time data access.
-    //
-
-    public Bundle getBundle()
-    {
-        return m_bundle;
-    }
-
-    public String getId()
-    {
-        return m_id;
-    }
-
-    public synchronized List<Wire> getWires()
-    {
-        return m_wires;
-    }
-
-    public synchronized void setWires(List<Wire> wires)
-    {
-        // Remove module from old wire modules' dependencies,
-        // since we are no longer dependent on any the moduels
-        // from the old wires.
-        for (int i = 0; (m_wires != null) && (i < m_wires.size()); i++)
-        {
-            if (m_wires.get(i).getCapability().getNamespace().equals(Capability.MODULE_NAMESPACE))
-            {
-                ((ModuleImpl) m_wires.get(i).getExporter()).removeDependentRequirer(this);
-            }
-            else if (m_wires.get(i).getCapability().getNamespace().equals(Capability.PACKAGE_NAMESPACE))
-            {
-                ((ModuleImpl) m_wires.get(i).getExporter()).removeDependentImporter(this);
-            }
-        }
-
-        m_wires = wires;
-
-        // Add ourself as a dependent to the new wires' modules.
-        for (int i = 0; (m_wires != null) && (i < m_wires.size()); i++)
-        {
-            if (m_wires.get(i).getCapability().getNamespace().equals(Capability.MODULE_NAMESPACE))
-            {
-                ((ModuleImpl) m_wires.get(i).getExporter()).addDependentRequirer(this);
-            }
-            else if (m_wires.get(i).getCapability().getNamespace().equals(Capability.PACKAGE_NAMESPACE))
-            {
-                ((ModuleImpl) m_wires.get(i).getExporter()).addDependentImporter(this);
-            }
-        }
-    }
-
-    public boolean isResolved()
-    {
-        return m_isResolved;
-    }
-
-    public void setResolved()
-    {
-        m_isResolved = true;
-    }
-
-    //
     // Content access methods.
     //
 
@@ -523,7 +244,7 @@ public class ModuleImpl implements Modul
             }
             catch (Exception ex)
             {
-                m_logger.log(Logger.LOG_ERROR, "Unable to get module class path.", ex);
+                getLogger().log(Logger.LOG_ERROR, "Unable to get module class path.", ex);
             }
         }
         return m_contentPath;
@@ -603,7 +324,7 @@ public class ModuleImpl implements Modul
                 {
 // TODO: FRAMEWORK - Per the spec, this should fire a FrameworkEvent.INFO event;
 //       need to create an "Eventer" class like "Logger" perhaps.
-                    m_logger.log(Logger.LOG_INFO,
+                    getLogger().log(Logger.LOG_INFO,
                         "Class path entry not found: "
                         + classPathStrings.get(i));
                 }
@@ -612,7 +333,7 @@ public class ModuleImpl implements Modul
 
         // If there is nothing on the class path, then include
         // "." by default, as per the spec.
-        if (localContentList.size() == 0)
+        if (localContentList.isEmpty())
         {
             localContentList.add(content);
         }
@@ -622,7 +343,7 @@ public class ModuleImpl implements Modul
         return contentList;
     }
 
-    public Class getClassByDelegation(String name) throws ClassNotFoundException
+    public Class loadClass(String name) throws ClassNotFoundException
     {
         // We do not call getClassLoader().loadClass() for arrays because
         // it does not correctly handle array types, which is necessary in
@@ -634,7 +355,7 @@ public class ModuleImpl implements Modul
         return getClassLoader().loadClass(name);
     }
 
-    public URL getResourceByDelegation(String name)
+    public URL getResource(String name)
     {
         try
         {
@@ -646,7 +367,7 @@ public class ModuleImpl implements Modul
         }
         catch (ResourceNotFoundException ex)
         {
-            m_logger.log(
+            getLogger().log(
                 Logger.LOG_DEBUG,
                 ex.getMessage());
         }
@@ -812,7 +533,7 @@ public class ModuleImpl implements Modul
         return url;
     }
 
-    public Enumeration getResourcesByDelegation(String name)
+    public Enumeration getResources(String name)
     {
         Set requestSet = (Set) m_cycleCheck.get();
         if (requestSet == null)
@@ -892,7 +613,7 @@ public class ModuleImpl implements Modul
 
         // Note that the search may be aborted if this method throws an
         // exception, otherwise it continues if a null is returned.
-        List<Wire> wires = getWires();
+        List<? extends VBWire> wires = getWires();
         for (int i = 0; (wires != null) && (i < wires.size()); i++)
         {
             if (wires.get(i) instanceof WireImpl)
@@ -1056,6 +777,16 @@ public class ModuleImpl implements Modul
         return url;
     }
 
+    public Enumeration<String> getEntryPaths(String path)
+    {
+        return new EntryFilterEnumeration(this, false, path, "*", false, false);
+    }
+
+    public Enumeration<URL> findEntries(String path, String filePattern, boolean recurse)
+    {
+        return new EntryFilterEnumeration(this, true, path, filePattern, recurse, true);
+    }
+
     public boolean hasInputStream(int index, String urlPath)
     {
         if (urlPath.startsWith("/"))
@@ -1097,11 +828,11 @@ public class ModuleImpl implements Modul
          {
              return m_secureAction.createURL(null,
                  FelixConstants.BUNDLE_URL_PROTOCOL + "://" +
-                 m_id + ":" + port + path, m_streamHandler);
+                 getId() + ":" + port + path, m_streamHandler);
          }
          catch (MalformedURLException ex)
          {
-             m_logger.log(
+             getLogger().log(
                  Logger.LOG_ERROR,
                  "Unable to create resource URL.",
                  ex);
@@ -1178,68 +909,129 @@ public class ModuleImpl implements Modul
         m_contentPath = initializeContentPath();
     }
 
-    public synchronized List<Module> getDependentHosts()
-    {
-        return m_dependentHosts;
-    }
-
-    public synchronized void addDependentHost(Module module)
+    @Override
+    public synchronized List<Capability> getCapabilities()
     {
-        if (!m_dependentHosts.contains(module))
+        if (m_cachedCapabilities == null)
         {
-            m_dependentHosts.add(module);
+            List capList = (super.getCapabilities() == null)
+                ? new ArrayList<Capability>()
+                : new ArrayList<Capability>(super.getCapabilities());
+            for (int fragIdx = 0;
+                (m_fragments != null) && (fragIdx < m_fragments.size());
+                fragIdx++)
+            {
+                List<Capability> caps = m_fragments.get(fragIdx).getCapabilities();
+                for (int capIdx = 0;
+                    (caps != null) && (capIdx < caps.size());
+                    capIdx++)
+                {
+                    if (caps.get(capIdx).getNamespace().equals(Capability.PACKAGE_NAMESPACE))
+                    {
+                        capList.add(
+                            new CapabilityImpl(
+                                this,
+                                caps.get(capIdx).getNamespace(),
+                                caps.get(capIdx).getDirectives(),
+                                caps.get(capIdx).getAttributes()));
+                    }
+                }
+            }
+            m_cachedCapabilities = Collections.unmodifiableList(capList);
         }
+        return m_cachedCapabilities;
     }
 
-    public synchronized void removeDependentHost(Module module)
-    {
-        m_dependentHosts.remove(module);
-    }
-
-    public synchronized List<Module> getDependentImporters()
-    {
-        return m_dependentImporters;
-    }
-
-    public synchronized void addDependentImporter(Module module)
+    @Override
+    public synchronized List<Requirement> getRequirements()
     {
-        if (!m_dependentImporters.contains(module))
+        if (m_cachedRequirements == null)
         {
-            m_dependentImporters.add(module);
+            List<Requirement> reqList = (super.getRequirements() == null)
+                ? new ArrayList() : new ArrayList(super.getRequirements());
+            for (int fragIdx = 0;
+                (m_fragments != null) && (fragIdx < m_fragments.size());
+                fragIdx++)
+            {
+                List<Requirement> reqs = m_fragments.get(fragIdx).getRequirements();
+                for (int reqIdx = 0;
+                    (reqs != null) && (reqIdx < reqs.size());
+                    reqIdx++)
+                {
+                    if (reqs.get(reqIdx).getNamespace().equals(Capability.PACKAGE_NAMESPACE)
+                        || reqs.get(reqIdx).getNamespace().equals(Capability.MODULE_NAMESPACE))
+                    {
+                        reqList.add(
+                            new FragmentRequirement(
+                                this, reqs.get(reqIdx)));
+                    }
+                }
+            }
+            m_cachedRequirements = Collections.unmodifiableList(reqList);
         }
+        return m_cachedRequirements;
     }
 
-    public synchronized void removeDependentImporter(Module module)
+    public synchronized List<Requirement> getDynamicRequirements()
     {
-        m_dependentImporters.remove(module);
+        if (m_cachedDynamicRequirements == null)
+        {
+            List<Requirement> reqList = (super.getDynamicRequirements() == null)
+                ? new ArrayList() : new ArrayList(super.getDynamicRequirements());
+            for (int fragIdx = 0;
+                (m_fragments != null) && (fragIdx < m_fragments.size());
+                fragIdx++)
+            {
+                List<Requirement> reqs = m_fragments.get(fragIdx).getDynamicRequirements();
+                for (int reqIdx = 0;
+                    (reqs != null) && (reqIdx < reqs.size());
+                    reqIdx++)
+                {
+                    if (reqs.get(reqIdx).getNamespace().equals(Capability.PACKAGE_NAMESPACE))
+                    {
+                        reqList.add(reqs.get(reqIdx));
+                    }
+                }
+            }
+            m_cachedDynamicRequirements = Collections.unmodifiableList(reqList);
+        }
+        return m_cachedDynamicRequirements;
     }
 
-    public synchronized List<Module> getDependentRequirers()
+    @Override
+    public synchronized List<R4Library> getNativeLibraries()
     {
-        return m_dependentRequirers;
-    }
+        List<R4Library> result = null;
+        if (isResolved())
+        {
+            List<R4Library> nativeList = (super.getNativeLibraries() == null)
+                ? new ArrayList() : new ArrayList(super.getNativeLibraries());
+            for (int fragIdx = 0;
+                (m_fragments != null) && (fragIdx < m_fragments.size());
+                fragIdx++)
+            {
+                List<R4Library> libs = m_fragments.get(fragIdx).getNativeLibraries();
+                for (int reqIdx = 0;
+                    (libs != null) && (reqIdx < libs.size());
+                    reqIdx++)
+                {
+                    nativeList.add(libs.get(reqIdx));
+                }
+            }
 
-    public synchronized void addDependentRequirer(Module module)
-    {
-        if (!m_dependentRequirers.contains(module))
+            // We need to return null here if we don't have any libraries, since a
+            // zero-length array is used to indicate that matching native libraries
+            // could not be found when resolving the bundle.
+            result = (nativeList.isEmpty())
+                ? null
+                : Collections.unmodifiableList(nativeList);
+        }
+        else
         {
-            m_dependentRequirers.add(module);
+            result = super.getNativeLibraries();
         }
-    }
 
-    public synchronized void removeDependentRequirer(Module module)
-    {
-        m_dependentRequirers.remove(module);
-    }
-
-    public synchronized List<Module> getDependents()
-    {
-        List<Module> dependents = new ArrayList<Module>
-            (m_dependentHosts.size() + m_dependentImporters.size() + m_dependentRequirers.size());
-        dependents.addAll(m_dependentHosts);
-        dependents.addAll(m_dependentImporters);
-        dependents.addAll(m_dependentRequirers);
-        return dependents;
+        return result;
     }
 
     public synchronized void close()
@@ -1256,21 +1048,6 @@ public class ModuleImpl implements Modul
         m_classLoader = null;
     }
 
-    public synchronized void setSecurityContext(Object securityContext)
-    {
-        m_protectionDomain = (ProtectionDomain) securityContext;
-    }
-
-    public synchronized Object getSecurityContext()
-    {
-        return m_protectionDomain;
-    }
-
-    public String toString()
-    {
-        return m_id;
-    }
-
     private synchronized ModuleClassLoader getClassLoader()
     {
         if (m_classLoader == null)
@@ -1305,7 +1082,7 @@ public class ModuleImpl implements Modul
         // Determine the class loader's parent based on the
         // configuration property; use boot class loader by
         // default.
-        String cfg = (String) m_configMap.get(Constants.FRAMEWORK_BUNDLE_PARENT);
+        String cfg = (String) getConfig().get(Constants.FRAMEWORK_BUNDLE_PARENT);
         cfg = (cfg == null) ? Constants.FRAMEWORK_BUNDLE_PARENT_BOOT : cfg;
         final ClassLoader parent;
         if (cfg.equalsIgnoreCase(Constants.FRAMEWORK_BUNDLE_PARENT_APP))
@@ -1338,7 +1115,7 @@ public class ModuleImpl implements Modul
         throws ClassNotFoundException, ResourceNotFoundException
     {
         // We delegate to the module's wires to find the class or resource.
-        List<Wire> wires = getWires();
+        List<? extends VBWire> wires = getWires();
         for (int i = 0; (wires != null) && (i < wires.size()); i++)
         {
             // If we find the class or resource, then return it.
@@ -1693,7 +1470,7 @@ public class ModuleImpl implements Modul
                 {
                     ClassNotFoundException ex = cnfe;
                     String msg = name;
-                    if (m_logger.getLogLevel() >= Logger.LOG_DEBUG)
+                    if (getLogger().getLogLevel() >= Logger.LOG_DEBUG)
                     {
                         msg = diagnoseClassLoadError(m_resolver, ModuleImpl.this, name);
                         ex = (msg != null)
@@ -1868,12 +1645,12 @@ public class ModuleImpl implements Modul
 
         private Object[] definePackage(String pkgName)
         {
-            String spectitle = (String) m_headerMap.get("Specification-Title");
-            String specversion = (String) m_headerMap.get("Specification-Version");
-            String specvendor = (String) m_headerMap.get("Specification-Vendor");
-            String impltitle = (String) m_headerMap.get("Implementation-Title");
-            String implversion = (String) m_headerMap.get("Implementation-Version");
-            String implvendor = (String) m_headerMap.get("Implementation-Vendor");
+            String spectitle = (String) getHeaders().get("Specification-Title");
+            String specversion = (String) getHeaders().get("Specification-Version");
+            String specvendor = (String) getHeaders().get("Specification-Vendor");
+            String impltitle = (String) getHeaders().get("Implementation-Title");
+            String implversion = (String) getHeaders().get("Implementation-Version");
+            String implvendor = (String) getHeaders().get("Implementation-Vendor");
             if ((spectitle != null)
                 || (specversion != null)
                 || (specvendor != null)
@@ -1934,7 +1711,7 @@ public class ModuleImpl implements Modul
 
         public URL getResource(String name)
         {
-            return ModuleImpl.this.getResourceByDelegation(name);
+            return ModuleImpl.this.getResource(name);
         }
 
         protected URL findResource(String name)
@@ -1949,7 +1726,7 @@ public class ModuleImpl implements Modul
         // can't. As a workaround, we make findResources() delegate instead.
         protected Enumeration findResources(String name)
         {
-            return getResourcesByDelegation(name);
+            return ModuleImpl.this.getResources(name);
         }
 
         protected String findLibrary(String name)
@@ -1982,7 +1759,7 @@ public class ModuleImpl implements Modul
                     List<R4Library> libs = getNativeLibraries();
                     for (int libIdx = 0; (libs != null) && (libIdx < libs.size()); libIdx++)
                     {
-                        if (libs.get(libIdx).match(m_configMap, name))
+                        if (libs.get(libIdx).match(getConfig(), name))
                         {
                             // Search bundle content first for native library.
                             result = getContent().getEntryAsNativeLibrary(
@@ -2036,13 +1813,13 @@ public class ModuleImpl implements Modul
         String importer = module.getBundle().toString();
 
         // Next, check to see if the module imports the package.
-        List<Wire> wires = module.getWires();
+        List<VBWire> wires = module.getWires();
         for (int i = 0; (wires != null) && (i < wires.size()); i++)
         {
-            if (wires.get(i).getCapability().getNamespace().equals(Capability.PACKAGE_NAMESPACE) &&
-                wires.get(i).getCapability().getAttribute(Capability.PACKAGE_ATTR).getValue().equals(pkgName))
+            if (((Wire) wires.get(i)).getCapability().getNamespace().equals(Capability.PACKAGE_NAMESPACE) &&
+                ((Wire) wires.get(i)).getCapability().getAttribute(Capability.PACKAGE_ATTR).getValue().equals(pkgName))
             {
-                String exporter = wires.get(i).getExporter().getBundle().toString();
+                String exporter = ((Wire) wires.get(i)).getExporter().getBundle().toString();
 
                 StringBuffer sb = new StringBuffer("*** Package '");
                 sb.append(pkgName);

Modified: felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java?rev=953419&r1=953418&r2=953419&view=diff
==============================================================================
--- felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java (original)
+++ felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/ServiceRegistrationImpl.java Thu Jun 10 18:53:23 2010
@@ -482,10 +482,10 @@ class ServiceRegistrationImpl implements
                 Util.getClassPackage(className);
             Module requesterModule = ((BundleImpl) requester).getCurrentModule();
             // Get package wiring from service requester.
-            Wire requesterWire = Util.getWire(requesterModule, pkgName);
+            Wire requesterWire = (Wire) Util.getWire(requesterModule, pkgName);
             // Get package wiring from service provider.
             Module providerModule = ((BundleImpl) m_bundle).getCurrentModule();
-            Wire providerWire = Util.getWire(providerModule, pkgName);
+            Wire providerWire = (Wire) Util.getWire(providerModule, pkgName);
 
             // There are four situations that may occur here:
             //   1. Neither the requester, nor provider have wires for the package.
@@ -513,7 +513,7 @@ class ServiceRegistrationImpl implements
                 // registration must have same class as requester.
                 try
                 {
-                    Class requestClass = requesterModule.getClassByDelegation(className);
+                    Class requestClass = requesterModule.loadClass(className);
                     allow = getRegistration().isClassAccessible(requestClass);
                 }
                 catch (Exception ex)
@@ -538,7 +538,7 @@ class ServiceRegistrationImpl implements
                     try
                     {
                         // Try to load class from requester.
-                        Class requestClass = requesterModule.getClassByDelegation(className);
+                        Class requestClass = requesterModule.loadClass(className);
                         try
                         {
                             // If requester has access to the class, verify it is the
@@ -576,7 +576,7 @@ class ServiceRegistrationImpl implements
                     try
                     {
                         // Load the class from the requesting bundle.
-                        Class requestClass = requesterModule.getClassByDelegation(className);
+                        Class requestClass = requesterModule.loadClass(className);
                         // Get the service registration and ask it to check
                         // if the service object is assignable to the requesting
                         // bundle's class.

Modified: felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java?rev=953419&r1=953418&r2=953419&view=diff
==============================================================================
--- felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java (original)
+++ felix/sandbox/rickhall/framework-vb-2/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java Thu Jun 10 18:53:23 2010
@@ -105,7 +105,7 @@ class URLHandlersBundleURLConnection ext
         }
         if (!modules.get(revision).hasInputStream(m_classPathIdx, url.getPath()))
         {
-            URL newurl = modules.get(revision).getResourceByDelegation(url.getPath());
+            URL newurl = modules.get(revision).getResource(url.getPath());
             if (newurl == null)
             {
                 throw new IOException("Resource does not exist: " + url);



Mime
View raw message