Added a method to the system bundle activator to provide access to the
system bundle context, which was necessary to the new URL Handlers service
could gain access to a bundle context for querying services. Modified the
system bundle itself to export the URL Handlers service package.


git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@331746 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/org/apache/felix/framework/SystemBundle.java b/framework/src/org/apache/felix/framework/SystemBundle.java
index d0e101f..8718142 100644
--- a/framework/src/org/apache/felix/framework/SystemBundle.java
+++ b/framework/src/org/apache/felix/framework/SystemBundle.java
@@ -55,6 +55,9 @@
         // Add the bundle activator for the start level service.
         activatorList.add(new StartLevelActivator(felix));
 
+        // Add the bundle activator for the URL Handlers service.
+        activatorList.add(new URLHandlersActivator(felix));
+
         m_activatorList = activatorList;
 
         // The system bundle exports framework packages as well as
@@ -78,7 +81,7 @@
 
         // Now, create the list of standard framework exports for
         // the system bundle.
-        R4Package[] exports = new R4Package[classPathPkgs.length + 3];
+        R4Package[] exports = new R4Package[classPathPkgs.length + 4];
 
         exports[0] = new R4Package(
             "org.osgi.framework",
@@ -91,12 +94,17 @@
             new R4Attribute[] { new R4Attribute("version", "1.2.0", false) });
 
         exports[2] = new R4Package(
-            "org.osgi.service.startlevel",
-            new R4Directive[0],
-            new R4Attribute[] { new R4Attribute("version", "1.0.0", false) });
+                "org.osgi.service.startlevel",
+                new R4Directive[0],
+                new R4Attribute[] { new R4Attribute("version", "1.0.0", false) });
+
+        exports[3] = new R4Package(
+                "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, 3, classPathPkgs.length);
+        System.arraycopy(classPathPkgs, 0, exports, 4, classPathPkgs.length);
 
         m_attributes = new Object[][] {
             new Object[] { R4SearchPolicy.EXPORTS_ATTR, exports },
@@ -266,7 +274,6 @@
     }
 
     protected BundleActivator getActivator()
-        throws Exception
     {
         if (m_activator == null)
         {
diff --git a/framework/src/org/apache/felix/framework/SystemBundleActivator.java b/framework/src/org/apache/felix/framework/SystemBundleActivator.java
index bf2c6d9..aa4ac1e 100644
--- a/framework/src/org/apache/felix/framework/SystemBundleActivator.java
+++ b/framework/src/org/apache/felix/framework/SystemBundleActivator.java
@@ -58,4 +58,9 @@
             }
         }
     }
+
+    public BundleContext getBundleContext()
+    {
+        return m_context;
+    }
 }
\ No newline at end of file