[jboss-cvs] JBossAS SVN: r92613 - in projects/jboss-osgi/trunk: reactor/runtime/jbossmc/scripts and 12 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 20 12:35:20 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-08-20 12:35:19 -0400 (Thu, 20 Aug 2009)
New Revision: 92613

Added:
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/scripts/assembly-bundles.xml
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/AutoInstallPlugin.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ClassLoaderFactoryPlugin.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/launch/
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/launch/FrameworkBootstrapProvider.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/launch/FrameworkFactoryBean.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/launch/FrameworkFactoryImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/AbstractPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/AutoInstallPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleEventsPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleFactoryPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleLifecyclePluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleRegistryPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleStoragePluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/FrameworkEventsPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/ServiceEventsPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/ServiceRegistryPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/BundleResolverPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/ClassLoaderFactoryPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/FrameworkClassLoader.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/RuntimeClassLoaderImpl.java
Removed:
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ClassLoaderFactoryPlugin.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/AbstractPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventsPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleFactoryPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleLifecyclePluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleRegistryPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleResolverPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleStoragePluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ClassLoaderFactoryPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkBootstrapProvider.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventsPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkFactoryBean.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkFactoryImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/RuntimeClassLoaderImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventsPluginImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryPluginImpl.java
Modified:
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/pom.xml
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/RuntimeClassLoader.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleContextImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/resources/META-INF/services/org.osgi.framework.launch.FrameworkFactory
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/BundleInstallTestCase.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/META-INF/jboss-osgi-framework.xml
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
   projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-framework.xml
   projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
   projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
Add AutoInstallPlugin

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/pom.xml	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/pom.xml	2009-08-20 16:35:19 UTC (rev 92613)
@@ -30,6 +30,8 @@
   </parent>
 
   <properties>
+    <version.apache.felix.log>1.1.0-SNAPSHOT</version.apache.felix.log>
+    <version.jboss.osgi.common>1.0.1-SNAPSHOT</version.jboss.osgi.common>
     <version.jboss.osgi.spi>1.0.1-SNAPSHOT</version.jboss.osgi.spi>
     <version.jboss.bootsrap>2.0.0-alpha-2</version.jboss.bootsrap>
     <version.osgi>r4v42-20090728</version.osgi>
@@ -54,19 +56,64 @@
     <dependency>
       <groupId>org.osgi</groupId>
       <artifactId>org.osgi.core</artifactId>
-        <version>${version.osgi}</version>
+      <version>${version.osgi}</version>
     </dependency>
     <dependency>
       <groupId>org.osgi</groupId>
       <artifactId>org.osgi.compendium</artifactId>
-        <version>${version.osgi}</version>
+      <version>${version.osgi}</version>
+      <scope>provided</scope>
     </dependency>
+
+    <!-- Bundle Dependencies -->
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.log</artifactId>
+      <version>${version.apache.felix.log}</version>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.osgi.core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.osgi.compendium</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-common</artifactId>
+      <version>${version.jboss.osgi.common}</version>
+      <scope>provided</scope>
+    </dependency>
   </dependencies>
 
   <!-- Build -->
   <build>
     <plugins>
       <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>bundles</id>
+            <phase>test-compile</phase>
+            <goals>
+              <goal>directory-single</goal>
+            </goals>
+            <configuration>
+              <finalName>test-libs</finalName>
+              <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+              <appendAssemblyId>false</appendAssemblyId>
+              <descriptors>
+                <descriptor>scripts/assembly-bundles.xml</descriptor>
+              </descriptors>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <artifactId>maven-antrun-plugin</artifactId>
         <executions>
           <execution>
@@ -90,7 +137,7 @@
 
   <!-- Profiles -->
   <profiles>
-  
+
     <!--
       Name: framework-default 
       Descr: Setup for default framework integration testing
@@ -106,7 +153,7 @@
         <jboss.osgi.framework.properties>jboss-osgi-jbossmc.properties</jboss.osgi.framework.properties>
       </properties>
     </profile>
-    
+
   </profiles>
 
 </project>

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/scripts/assembly-bundles.xml	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/scripts/assembly-bundles.xml	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,28 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+
+  <id>deploy-artifacts</id>
+  <formats>
+    <format>dir</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+
+  <!-- Dependency Sets -->
+  <dependencySets>
+  
+    <!-- bundles -->
+    <dependencySet>
+      <outputDirectory>bundles</outputDirectory>
+      <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+      <includes>
+        <include>*:jboss-osgi-common:jar</include>
+        <include>*:org.apache.felix.log:jar</include>
+        <include>*:org.osgi.compendium:jar</include>
+      </includes>
+      <useStrictFiltering>true</useStrictFiltering>
+      <scope>provided</scope>
+      <unpack>false</unpack>
+    </dependencySet>
+    
+  </dependencySets>
+</assembly>

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/AutoInstallPlugin.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/AutoInstallPlugin.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/AutoInstallPlugin.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.api;
+
+import org.osgi.framework.BundleException;
+
+
+//$Id: $
+
+/**
+ * A plugin that installs/starts bundles on framework startup.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface AutoInstallPlugin extends AbstractPlugin
+{
+   void installBundles() throws BundleException;
+   
+   void startBundles() throws BundleException;
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ClassLoaderFactoryPlugin.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ClassLoaderFactoryPlugin.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ClassLoaderFactoryPlugin.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.api;
-
-// $Id: $
-
-import org.osgi.framework.Bundle;
-
-/**
- * An abstraction of a service event manager.
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public interface ClassLoaderFactoryPlugin extends AbstractPlugin
-{
-   RuntimeClassLoader createClassLoader(Bundle bundle);
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ClassLoaderFactoryPlugin.java (from rev 92604, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ClassLoaderFactoryPlugin.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ClassLoaderFactoryPlugin.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ClassLoaderFactoryPlugin.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.api;
+
+// $Id: $
+
+import org.osgi.framework.Bundle;
+
+/**
+ * An abstraction of a service event manager.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface ClassLoaderFactoryPlugin extends AbstractPlugin
+{
+   RuntimeClassLoader createClassLoader(Bundle bundle);
+}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/RuntimeClassLoader.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/RuntimeClassLoader.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/RuntimeClassLoader.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -28,8 +28,60 @@
 // $Id: $
 
 /**
- * An abstraction of a bundle class loader.
+ * Frameworks must adhere to the following rules for class or resource loading.
+ * When a bundle’s class loader is requested to load a class or find a
+ * resource, the search must be performed in the following order:
  * 
+ * 1 If the class or resource is in a java.* package, the request is delegated to
+ *   the parent class loader; otherwise, the search continues with the next
+ *   step. If the request is delegated to the parent class loader and the class or
+ *   resource is not found, then the search terminates and the request fails.
+ *   
+ * 2 If the class or resource is from a package included in the boot delegation
+ *   list (org.osgi.framework.bootdelegation), then the request is delegated
+ *   to the parent class loader. If the class or resource is found there, the
+ *   search ends.
+ *   
+ * 3 If the class or resource is in a package that is imported using Import-
+ *   Package or was imported dynamically in a previous load, then the
+ *   request is delegated to the exporting bundle’s class loader; otherwise the
+ *   search continues with the next step. If the request is delegated to an
+ *   exporting class loader and the class or resource is not found, then the
+ *   search terminates and the request fails.
+ *   
+ * 4 If the class or resource is in a package that is imported from one or more
+ *   other bundles using Require-Bundle, the request is delegated to the class
+ *   loaders of the other bundles, in the order in which they are specified in
+ *   this bundle’s manifest. This entails a depth-first strategy; all required
+ *   bundles are searched before the bundle classpath is used. If the class or
+ *   resource is not found, then the search continues with the next step.
+ *   
+ * 5 The bundle’s own internal bundle class path is searched. If the class or
+ *   resource is not found, then the search continues with the next step.
+ * 
+ * 6 Each attached fragment’s internal bundle class path is searched. The fragments
+ *   are searched in ascending bundle ID order. If the class or resource
+ *   is not found, then the search continues with the next step.
+ *   
+ * 7 If the class or resource is in a package that is exported by the bundle or
+ *   the package is imported by the bundle (using Import-Package or Require-
+ *   Bundle), then the search ends and the class or resource is not found.
+ *   
+ * 8 Otherwise, if the class or resource is in a package that is imported using
+ *   DynamicImport-Package, then a dynamic import of the package is now
+ *   attempted. An exporter must conform to any implied package constraints.
+ *   If an appropriate exporter is found, a wire is established so that
+ *   future loads of the package are handled in Step 3. If a dynamic wire is not
+ *   established, then the request fails.
+ * 
+ * 9 If the dynamic import of the package is established, the request is delegated
+ *   to the exporting bundle’s class loader. If the request is delegated to
+ *   an exporting class loader and the class or resource is not found, then the
+ *   search terminates and the request fails.
+ *   
+ * When delegating to another bundle class loader, the delegated request
+ * enters this algorithm at Step 4.
+ * 
  * @author thomas.diesler at jboss.com
  * @since 18-Aug-2009
  */

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/AbstractPluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/AbstractPluginImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/AbstractPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.framework;
-
-//$Id: $
-
-import org.jboss.osgi.jbossmc.api.AbstractPlugin;
-import org.osgi.framework.launch.Framework;
-
-/**
- * The base class of all framework plugins.
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public abstract class AbstractPluginImpl implements AbstractPlugin
-{
-   private Framework framework;
-
-   public Framework getFramework()
-   {
-      return framework;
-   }
-
-   public void setFramework(Framework framework)
-   {
-      this.framework = framework;
-   }
-   
-   public <T extends AbstractPlugin> T getPlugin(Class<T> clazz)
-   {
-      FrameworkImpl frameworkImpl = (FrameworkImpl)framework;
-      return frameworkImpl.getPlugin(clazz);
-   }
-   
-   public <T extends AbstractPlugin> T getOptionalPlugin(Class<T> clazz)
-   {
-      FrameworkImpl frameworkImpl = (FrameworkImpl)framework;
-      return frameworkImpl.getOptionalPlugin(clazz);
-   }
-}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleContextImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleContextImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleContextImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -38,6 +38,7 @@
 import org.jboss.osgi.jbossmc.api.BundleStoragePlugin;
 import org.jboss.osgi.jbossmc.api.BundleRegistryPlugin;
 import org.jboss.osgi.jbossmc.api.FrameworkEventsPlugin;
+import org.jboss.osgi.jbossmc.api.ClassLoaderFactoryPlugin;
 import org.jboss.osgi.jbossmc.api.ServiceEventsPlugin;
 import org.jboss.osgi.jbossmc.api.ServiceRegistryPlugin;
 import org.jboss.osgi.spi.NotImplementedException;
@@ -230,9 +231,13 @@
       // 3. The bundle's associated resources are allocated. The associated resources minimally consist of a unique identifier and a persistent storage area if the platform has file system support. 
       bundle = bundleFactory.createBundle(location);
       bundleRegistry.registerBundle(bundle);
+
+      // Initialize the bundle's runtime class loader
+      BundleImpl bundleImpl = (BundleImpl)bundle;
+      ClassLoaderFactoryPlugin factory = getPlugin(ClassLoaderFactoryPlugin.class);
+      bundleImpl.setRuntimeClassLoader(factory.createClassLoader(bundle));
       
       // 4. The bundle's state is set to INSTALLED.
-      BundleImpl bundleImpl = (BundleImpl)bundle;
       bundleImpl.setState(Bundle.INSTALLED);
       
       // 5. A bundle event of type BundleEvent.INSTALLED is fired.

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventsPluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventsPluginImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventsPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.framework;
-
-//$Id: $
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.BundleEventsPlugin;
-import org.jboss.osgi.spi.util.ConstantsHelper;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.launch.Framework;
-
-/**
- * A simple implementation of a BundleEventManager
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class BundleEventsPluginImpl extends AbstractPluginImpl implements BundleEventsPlugin
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(BundleEventsPluginImpl.class);
-   
-   private List<BundleListener> listeners = new ArrayList<BundleListener>();
-   private boolean enabled = true;
-
-   public BundleEventsPluginImpl()
-   {
-   }
-
-   public BundleEventsPluginImpl(Framework framework)
-   {
-      setFramework(framework);
-   }
-
-   public boolean isEnabled()
-   {
-      return enabled;
-   }
-
-   public void setEnabled(boolean enabled)
-   {
-      this.enabled = enabled;
-   }
-
-   public void fireBundleEvent(BundleEvent event)
-   {
-      if (enabled == false)
-         return;
-      
-      String typeStr = ConstantsHelper.bundleEvent(event.getType());
-      log.debug("BundleEvent " + typeStr + " " + event.getSource());
-      
-      // [TODO] When a BundleEvent is fired, it is asynchronously delivered to a BundleListener
-      
-      for (BundleListener listener : new ArrayList<BundleListener>(listeners))
-         listener.bundleChanged(event);
-   }
-
-   public void addBundleListener(BundleListener listener)
-   {
-      listeners.add(listener);
-   }
-
-   public void removeBundleListener(BundleListener listener)
-   {
-      listeners.remove(listener);
-   }
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleFactoryPluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleFactoryPluginImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleFactoryPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.framework;
-
-//$Id: $
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.BundleFactoryPlugin;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.launch.Framework;
-
-/**
- * A simple implementation of a BundleFactory
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class BundleFactoryPluginImpl extends AbstractPluginImpl implements BundleFactoryPlugin
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(BundleFactoryPluginImpl.class);
-   
-   public BundleFactoryPluginImpl()
-   {
-   }
-
-   public BundleFactoryPluginImpl(Framework framework)
-   {
-      setFramework(framework);
-   }
-
-   public Bundle createBundle(String location)
-   {
-      VirtualFile vfsRoot = getVirtualFile(location);
-      BundleImpl bundle = new BundleImpl(vfsRoot);
-      bundle.setBundleContext(new BundleContextImpl(getFramework(), bundle));
-      return bundle;
-   }
-
-   public String getVirtualLocation(String location)
-   {
-      try
-      {
-         VirtualFile vFile = getVirtualFile(location);
-         URL locationURL = vFile.toURL();
-         return locationURL.toExternalForm();
-      }
-      catch (Exception ex)
-      {
-         throw new IllegalStateException("Cannot obtain virtual bundle location", ex);
-      }
-   }
-   
-   public VirtualFile getVirtualFile(String location)
-   {
-      VirtualFile vfsRoot;
-      try
-      {
-         URL locationURL = new URL(location);
-         vfsRoot = VFS.createNewRoot(locationURL);
-      }
-      catch (IOException ex)
-      {
-         throw new IllegalArgumentException("Invalid bundle location URL: " + location);
-      }
-      return vfsRoot;
-   }
-}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -40,7 +40,6 @@
 import org.jboss.osgi.jbossmc.api.AbstractPlugin;
 import org.jboss.osgi.jbossmc.api.BundleLifecyclePlugin;
 import org.jboss.osgi.jbossmc.api.BundleResolverPlugin;
-import org.jboss.osgi.jbossmc.api.ClassLoaderFactoryPlugin;
 import org.jboss.osgi.jbossmc.api.FrameworkEventsPlugin;
 import org.jboss.osgi.jbossmc.api.RuntimeClassLoader;
 import org.jboss.osgi.spi.NotImplementedException;
@@ -78,12 +77,6 @@
    private BundleActivator activator;
    private String toStringCache;
    
-   public BundleImpl()
-   {
-      // ctor used by the framework
-      // [TODO] remove when we have a VFS root for the framework
-   }
-
    public BundleImpl(VirtualFile vFile)
    {
       this.vFile = vFile;
@@ -141,16 +134,16 @@
       this.activator = activator;
    }
 
-   private RuntimeClassLoader getClassLoader()
+   private RuntimeClassLoader getRuntimeClassLoader()
    {
-      if (runtimeLoader == null)
-      {
-         ClassLoaderFactoryPlugin factory = getPlugin(ClassLoaderFactoryPlugin.class);
-         runtimeLoader = factory.createClassLoader(this);
-      }
       return runtimeLoader;
    }
 
+   public void setRuntimeClassLoader(RuntimeClassLoader runtimeLoader)
+   {
+      this.runtimeLoader = runtimeLoader;
+   }
+
    public void start() throws BundleException
    {
       BundleLifecyclePlugin bundleLifecycle = getPlugin(BundleLifecyclePlugin.class);
@@ -348,12 +341,12 @@
 
    public URL getResource(String name)
    {
-      return getClassLoader().getResource(name);
+      return getRuntimeClassLoader().getResource(name);
    }
 
    public Enumeration<URL> getResources(String name) throws IOException
    {
-      return getClassLoader().getResources(name);
+      return getRuntimeClassLoader().getResources(name);
    }
 
    public Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int signersType)
@@ -397,7 +390,7 @@
          }
       }
 
-      return getClassLoader().loadClass(name);
+      return getRuntimeClassLoader().loadClass(name);
    }
 
    private String getHeader(String header)

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleLifecyclePluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleLifecyclePluginImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleLifecyclePluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,254 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.framework;
-
-//$Id$
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.BundleEventsPlugin;
-import org.jboss.osgi.jbossmc.api.BundleLifecyclePlugin;
-import org.jboss.osgi.jbossmc.api.BundleRegistryPlugin;
-import org.jboss.osgi.jbossmc.api.BundleResolverPlugin;
-import org.jboss.osgi.jbossmc.api.FrameworkEventsPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.launch.Framework;
-
-/**
- * An implementation of the OSGi bundle lifecycle
- * 
- * @author thomas.diesler at jboss.com
- * @since 29-Jul-2009
- */
-public class BundleLifecyclePluginImpl extends AbstractPluginImpl implements BundleLifecyclePlugin
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(BundleLifecyclePluginImpl.class);
-
-   public BundleLifecyclePluginImpl()
-   {
-   }
-
-   public BundleLifecyclePluginImpl(Framework framework)
-   {
-      setFramework(framework);
-   }
-
-   public void start(Bundle bundle, int options) throws BundleException
-   {
-      // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
-      if (bundle.getState() == Bundle.UNINSTALLED)
-         throw new IllegalStateException("Bundle already uninstalled: " + bundle);
-
-      // [TODO] Implement the optional Start Level service 
-
-      // [TODO] If this bundle is in the process of being activated or deactivated then this method must wait 
-      // for activation or deactivation to complete before continuing.
-      if (bundle.getState() == Bundle.STARTING || bundle.getState() == Bundle.STARTING)
-         throw new IllegalStateException("Bundle already staring/stopping: " + bundle);
-
-      // If this bundle's state is not RESOLVED, an attempt is made to resolve this bundle.
-      if (bundle.getState() != Bundle.RESOLVED)
-      {
-         BundleResolverPlugin resolver = getPlugin(BundleResolverPlugin.class);
-         resolver.resolveBundle(bundle);
-         
-         BundleEventsPlugin eventManager = getPlugin(BundleEventsPlugin.class);
-         eventManager.fireBundleEvent(new BundleEvent(BundleEvent.RESOLVED, bundle));
-      }
-
-      // [TODO] Lazy bundle activation
-
-      // This bundle's state is set to STARTING. 
-      setState(bundle, Bundle.STARTING);
-
-      // A bundle event of type BundleEvent.STARTING is fired.
-      BundleEventsPlugin eventManager = getPlugin(BundleEventsPlugin.class);
-      eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STARTING, bundle));
-
-      // The BundleActivator is called
-      String activatorClass = (String)bundle.getHeaders().get(Constants.BUNDLE_ACTIVATOR);
-      if (activatorClass != null)
-      {
-         try
-         {
-            BundleActivator activator = (BundleActivator)bundle.loadClass(activatorClass).newInstance();
-            activator.start(bundle.getBundleContext());
-            
-            BundleImpl bundleImpl = (BundleImpl)bundle;
-            bundleImpl.setBundleActivator(activator);
-         }
-         catch (Exception ex)
-         {
-            // This bundle's state is set to STOPPING.
-            setState(bundle, Bundle.STOPPING);
-
-            // A bundle event of type BundleEvent.STOPPING is fired
-            eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STOPPING, bundle));
-
-            // Any services registered by this bundle must be unregistered.
-            BundleContextImpl contextImpl = (BundleContextImpl)bundle.getBundleContext();
-            contextImpl.releaseRegisteredServices();
-
-            // Any services used by this bundle must be released.
-            contextImpl.releaseUsedServices();
-
-            // Any listeners registered by this bundle must be removed.
-            contextImpl.releaseRegisteredListeners();
-
-            // This bundle's state is set to RESOLVED.
-            setState(bundle, Bundle.RESOLVED);
-
-            // A bundle event of type BundleEvent.STOPPED is fired.
-            eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STOPPED, bundle));
-
-            // A BundleException is then thrown. 
-            throw new BundleException("Cannot call BundleActivator: " + activatorClass, ex);
-         }
-      }
-
-      // If this bundle's state is UNINSTALLED, because this bundle was uninstalled while 
-      // the BundleActivator.start was running 
-      if (bundle.getState() == Bundle.UNINSTALLED)
-         throw new IllegalStateException("Bundle already uninstalled: " + bundle);
-
-      // This bundle's state is set to ACTIVE
-      setState(bundle, Bundle.ACTIVE);
-
-      // A bundle event of type BundleEvent.STARTED is fired
-      eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STARTED, bundle));
-   }
-
-   public void stop(Bundle bundle, int options) throws BundleException
-   {
-      // 1. If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
-      if (bundle.getState() == Bundle.UNINSTALLED)
-         throw new IllegalStateException("Bundle already unistalled: " + bundle);
-      
-      // [TODO] 2. If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation to complete
-      
-      // [TODO] 3. If the STOP_TRANSIENT option is not set then then set this bundle's persistent autostart setting to to Stopped. When the Framework is restarted and this bundle's autostart setting is Stopped, this bundle must not be automatically started.
-      
-      // 4. If this bundle's state is not STARTING or ACTIVE then this method returns immediately.
-      if (!(bundle.getState() == Bundle.STARTING || bundle.getState() == Bundle.ACTIVE))
-         return;
-         
-      // 5. This bundle's state is set to STOPPING.
-      int statePriorToStopping = bundle.getState();
-      setState(bundle, Bundle.STOPPING);
-      
-      // 6. A bundle event of type BundleEvent.STOPPING is fired.
-      BundleEventsPlugin eventManager = getPlugin(BundleEventsPlugin.class);
-      eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STOPPING, bundle));
-      
-      // 7. If this bundle's state was ACTIVE prior to setting the state to STOPPING, the BundleActivator.stop(org.osgi.framework.BundleContext) method of this bundle's BundleActivator, if one is specified, is called.
-      Exception activatorStopException = null;
-      BundleImpl bundleImpl = (BundleImpl)bundle;
-      BundleActivator activator = bundleImpl.getBundleActivator();
-      if (statePriorToStopping == Bundle.ACTIVE && activator != null)
-      {
-         try
-         {
-            activator.stop(bundle.getBundleContext());
-         }
-         catch (Exception ex)
-         {
-            // This method must continue to stop this bundle and a BundleException must be thrown after completion of the remaining steps.
-            activatorStopException = ex;
-         }
-      }
-      
-      // 8. Any services registered by this bundle must be unregistered.
-      BundleContextImpl contextImpl = (BundleContextImpl)bundle.getBundleContext();
-      contextImpl.releaseRegisteredServices();
-      
-      // 9. Any services used by this bundle must be released.
-      contextImpl.releaseUsedServices();
-      
-      // 10. Any listeners registered by this bundle must be removed.
-      contextImpl.releaseRegisteredListeners();
-      
-      // 11. If this bundle's state is UNINSTALLED, because this bundle was uninstalled while the BundleActivator.stop method was running, a BundleException must be thrown.
-      if (bundle.getState() == Bundle.UNINSTALLED)
-         throw new IllegalStateException("Bundle already unistalled: " + bundle);
-      
-      // 12. This bundle's state is set to RESOLVED.
-      setState(bundle, Bundle.RESOLVED);
-      
-      // 13. A bundle event of type BundleEvent.STOPPED is fired.    
-      eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STOPPED, bundle));
-      
-      // A BundleException must be thrown after completion of the remaining steps
-      if (activatorStopException != null)
-      {
-         if (activatorStopException instanceof BundleException)
-            throw (BundleException)activatorStopException;
-         
-         throw new BundleException("Exception in BundleActivator.stop()", activatorStopException);
-      }
-   }
-
-   public void uninstall(Bundle bundle) throws BundleException
-   {
-      // 1. If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
-      if (bundle.getState() == Bundle.UNINSTALLED)
-         throw new IllegalStateException("Bundle already unistalled: " + bundle);
-
-      // 2. If this bundle's state is ACTIVE, STARTING or STOPPING, this bundle is stopped as described in the Bundle.stop method. 
-      if (bundle.getState() == Bundle.ACTIVE || bundle.getState() == Bundle.STARTING || bundle.getState() == Bundle.STOPPING)
-      {
-         try
-         {
-            stop(bundle, 0);
-         }
-         catch (Exception ex)
-         {
-            // If Bundle.stop throws an exception, a Framework event of type FrameworkEvent.ERROR is fired containing the exception.
-            FrameworkEventsPlugin eventManager = getPlugin(FrameworkEventsPlugin.class);
-            eventManager.fireFrameworkEvent(new FrameworkEvent(FrameworkEvent.ERROR, bundle, ex));
-         }
-      }
-
-      // 3. This bundle's state is set to UNINSTALLED.
-      setState(bundle, Bundle.UNINSTALLED);
-
-      // 4. A bundle event of type BundleEvent.UNINSTALLED is fired.
-      BundleEventsPlugin eventManager = getPlugin(BundleEventsPlugin.class);
-      eventManager.fireBundleEvent(new BundleEvent(BundleEvent.UNINSTALLED, bundle));
-
-      // 5. This bundle and any persistent storage area provided for this bundle by the Framework are removed.
-      BundleRegistryPlugin bundleRegistry = getPlugin(BundleRegistryPlugin.class);
-      bundleRegistry.unregisterBundle(bundle);
-
-      // [TODO] Any persistent storage area provided for this bundle are removed.
-   }
-
-   private void setState(Bundle bundle, int state)
-   {
-      BundleImpl bundleImpl = (BundleImpl)bundle;
-      bundleImpl.setState(state);
-   }
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleRegistryPluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleRegistryPluginImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleRegistryPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,106 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.framework;
-
-//$Id: $
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.BundleRegistryPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.launch.Framework;
-
-/**
- * A simple implementation of a BundleRegistry
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class BundleRegistryPluginImpl extends AbstractPluginImpl implements BundleRegistryPlugin
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(BundleRegistryPluginImpl.class);
-   
-   private long globalId;
-   private Map<String, Bundle> registry = new LinkedHashMap<String, Bundle>();
-
-   public BundleRegistryPluginImpl()
-   {
-   }
-
-   public BundleRegistryPluginImpl(Framework framework)
-   {
-      setFramework(framework);
-   }
-
-   public long registerBundle(Bundle bundle)
-   {
-      if (bundle == null)
-         throw new IllegalArgumentException("Cannot install null bundle");
-      
-      BundleImpl bundleImpl = (BundleImpl)bundle;
-      bundleImpl.setBundleId(globalId++);
-      
-      registry.put(bundle.getLocation(), bundle);
-      
-      return bundle.getBundleId();
-   }
-
-   public void unregisterBundle(Bundle bundle)
-   {
-      if (bundle == null)
-         throw new IllegalArgumentException("Cannot uninstall null bundle");
-      
-      if (registry.remove(bundle.getLocation()) == null)
-         throw new IllegalStateException("Cannot unregister bundle: " + bundle);
-   }
-
-   public Bundle getBundleById(long id)
-   {
-      Bundle bundle = null;
-      for (Bundle aux : new ArrayList<Bundle>(registry.values()))
-      {
-         if (id == aux.getBundleId())
-         {
-            bundle = aux;
-            break;
-         }
-      }
-      return bundle;
-   }
-
-   public Bundle getBundleByLocation(String location)
-   {
-      return registry.get(location);
-   }
-
-   public List<Bundle> getBundles()
-   {
-      ArrayList<Bundle> bundles = new ArrayList<Bundle>(registry.values());
-      return Collections.unmodifiableList(bundles);
-   }
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleResolverPluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleResolverPluginImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleResolverPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.framework;
-
-//$Id: $
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.BundleResolverPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.launch.Framework;
-
-/**
- * A simple implementation of a BundleResolver
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class BundleResolverPluginImpl extends AbstractPluginImpl implements BundleResolverPlugin
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(BundleResolverPluginImpl.class);
-   
-   public BundleResolverPluginImpl()
-   {
-   }
-
-   public BundleResolverPluginImpl(Framework framework)
-   {
-      setFramework(framework);
-   }
-
-   public void resolveBundle(Bundle bundle) throws BundleException
-   {
-      // [TODO] resolve bundle properly
-      
-      BundleImpl bundleImpl = (BundleImpl)bundle;
-      
-      bundleImpl.setState(Bundle.RESOLVED);
-   }
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleStoragePluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleStoragePluginImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleStoragePluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.framework;
-
-//$Id: $
-
-import java.io.File;
-import java.io.IOException;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.BundleStoragePlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.launch.Framework;
-
-/**
- * A simple implementation of a BundleStorage
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class BundleStoragePluginImpl extends AbstractPluginImpl implements BundleStoragePlugin
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(BundleStoragePluginImpl.class);
-   
-   public BundleStoragePluginImpl()
-   {
-   }
-
-   public BundleStoragePluginImpl(Framework framework)
-   {
-      setFramework(framework);
-   }
-
-   public File getDataFile(Bundle bundle, String filename)
-   {
-      File bundleDir = getBundleStorageDir(bundle);
-      File dataFile = new File(bundleDir.getAbsolutePath() + "/" + filename);
-      return dataFile;
-   }
-
-   private File getBundleStorageDir(Bundle bundle)
-   {
-      BundleContext context = getFramework().getBundleContext();
-      String dirName = context.getProperty(Constants.FRAMEWORK_STORAGE);
-      if (dirName == null)
-      {
-         try
-         {
-            File tmpFile = File.createTempFile("Constants.FRAMEWORK_STORAGE", null);
-            dirName = tmpFile.getParent();
-            tmpFile.delete();
-         }
-         catch (IOException ex)
-         {
-            throw new IllegalStateException("Cannot create temp storage file", ex);
-         }
-      }
-      
-      File bundleDir = new File(dirName + "/bundle-" + bundle.getBundleId());
-      if (bundleDir.exists() == false)
-         bundleDir.mkdirs();
-      return bundleDir;
-   }
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ClassLoaderFactoryPluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ClassLoaderFactoryPluginImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ClassLoaderFactoryPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.framework;
-
-//$Id: BundleLifecycleImpl.java 92578 2009-08-19 14:33:04Z thomas.diesler at jboss.com $
-
-import org.jboss.osgi.jbossmc.api.ClassLoaderFactoryPlugin;
-import org.jboss.osgi.jbossmc.api.RuntimeClassLoader;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.launch.Framework;
-
-/**
- * An implementation of bundle class loader factory
- * 
- * @author thomas.diesler at jboss.com
- * @since 29-Jul-2009
- */
-public class ClassLoaderFactoryPluginImpl extends AbstractPluginImpl implements ClassLoaderFactoryPlugin
-{
-   public ClassLoaderFactoryPluginImpl()
-   {
-   }
-
-   public ClassLoaderFactoryPluginImpl(Framework framework)
-   {
-      setFramework(framework);
-   }
-
-   public RuntimeClassLoader createClassLoader(Bundle bundle)
-   {
-      return new RuntimeClassLoaderImpl(bundle);
-   }
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkBootstrapProvider.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkBootstrapProvider.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.framework;
-
-//$Id: FrameworkFactoryBean.java 92605 2009-08-20 10:29:21Z thomas.diesler at jboss.com $
-
-import java.io.InputStream;
-import java.net.URL;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.spi.util.ServiceLoader;
-import org.osgi.framework.launch.Framework;
-import org.osgi.framework.launch.FrameworkFactory;
-
-/**
- * An implementation of a OSGiBootstrapProvider. 
- * 
- * @author thomas.diesler at jboss.com
- * @since 29-Jul-2009
- */
-public class FrameworkBootstrapProvider implements OSGiBootstrapProvider
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(FrameworkBootstrapProvider.class);
-
-   private Framework framework;
-   
-   public void configure()
-   {
-      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
-      framework = factory.newFramework(null);
-   }
-
-   public void configure(URL urlConfig)
-   {
-      configure();
-   }
-
-   public void configure(String resourceConfig)
-   {
-      configure();
-   }
-
-   public void configure(InputStream streamConfig)
-   {
-      configure();
-   }
-
-   public Framework getFramework()
-   {
-      return framework;
-   }
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventsPluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventsPluginImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventsPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,101 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.framework;
-
-//$Id: $
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.FrameworkEventsPlugin;
-import org.jboss.osgi.spi.util.ConstantsHelper;
-import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.FrameworkListener;
-import org.osgi.framework.launch.Framework;
-
-/**
- * A simple implementation of a FrameworkEventManager
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class FrameworkEventsPluginImpl extends AbstractPluginImpl implements FrameworkEventsPlugin
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(FrameworkEventsPluginImpl.class);
-   
-   private List<FrameworkListener> listeners = new ArrayList<FrameworkListener>();
-   private boolean enabled = true;
-
-   public FrameworkEventsPluginImpl()
-   {
-   }
-
-   public FrameworkEventsPluginImpl(Framework framework)
-   {
-      setFramework(framework);
-   }
-
-   public boolean isEnabled()
-   {
-      return enabled;
-   }
-
-   public void setEnabled(boolean enabled)
-   {
-      this.enabled = enabled;
-   }
-
-   public void fireFrameworkEvent(FrameworkEvent event)
-   {
-      if (enabled == false)
-         return;
-      
-      String typeStr = ConstantsHelper.frameworkEvent(event.getType());
-      String message = "FrameworkEvent " + typeStr + " " + event.getSource();
-      
-      if (event.getType() == FrameworkEvent.ERROR)
-         log.error(message);
-      else if (event.getType() == FrameworkEvent.WARNING)
-         log.warn(message);
-      else if (event.getType() == FrameworkEvent.INFO)
-         log.info(message);
-      else
-         log.debug(message);
-      
-      // [TODO] When a FrameworkEvent is fired, it is asynchronously delivered to a FrameworkListener.
-      
-      for (FrameworkListener listener : new ArrayList<FrameworkListener>(listeners))
-         listener.frameworkEvent(event);
-   }
-
-   public void addFrameworkListener(FrameworkListener listener)
-   {
-      listeners.add(listener);
-   }
-
-   public void removeFrameworkListener(FrameworkListener listener)
-   {
-      listeners.remove(listener);
-   }
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkFactoryBean.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkFactoryBean.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkFactoryBean.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,109 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.framework;
-
-//$Id$
-
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.kernel.Kernel;
-import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.AbstractPlugin;
-import org.osgi.framework.launch.Framework;
-import org.osgi.framework.launch.FrameworkFactory;
-
-/**
- * An implementation of a bootstrap bean that can provide an OSGi Framework. 
- * 
- * @author thomas.diesler at jboss.com
- * @since 29-Jul-2009
- */
-public class FrameworkFactoryBean implements FrameworkFactory
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(FrameworkFactoryBean.class);
-
-   public static final String BEAN_FRAMEWORK_FACTORY = "jboss.osgi:service=FrameworkFactory";
-   
-   private Map<String, Object> properties;
-   private List<AbstractPlugin> plugins;
-   private List<URL> autoInstall;
-   private List<URL> autoStart;
-   private Kernel kernel;
-
-   private Framework framework;
-   
-   public void setProperties(Map<String, Object> properties)
-   {
-      this.properties = properties;
-   }
-
-   public void setPlugins(List<AbstractPlugin> plugins)
-   {
-      this.plugins = plugins;
-   }
-
-   public void setAutoInstall(List<URL> autoInstall)
-   {
-      this.autoInstall = autoInstall;
-   }
-
-   public void setAutoStart(List<URL> autoStart)
-   {
-      this.autoStart = autoStart;
-   }
-
-   public void setKernel(Kernel kernel)
-   {
-      this.kernel = kernel;
-   }
-
-   @SuppressWarnings("unchecked")
-   public Framework newFramework(Map configuration)
-   {
-      if (framework == null)
-      {
-         if (properties == null)
-            throw new IllegalStateException("Cannot obtain framework properties");
-         
-         if (configuration != null)
-            properties.putAll(configuration);
-         
-         FrameworkImpl frameworkImpl = new FrameworkImpl(kernel, properties);
-         
-         // Copy the configured plugins
-         if (plugins != null)
-         {
-            for (AbstractPlugin plugin : plugins)
-            {
-               plugin.setFramework(frameworkImpl);
-               frameworkImpl.addPlugin(plugin);
-            }
-         }
-         
-         framework = frameworkImpl;
-      }
-      return framework;
-   }
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkFactoryImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkFactoryImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkFactoryImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,99 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.framework;
-
-//$Id$
-
-import java.net.URL;
-import java.util.Map;
-
-import org.jboss.bootstrap.impl.mc.config.BasicMCServerConfig;
-import org.jboss.bootstrap.impl.mc.server.MCServerImpl;
-import org.jboss.bootstrap.spi.mc.config.MCServerConfig;
-import org.jboss.bootstrap.spi.mc.server.MCServer;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.logging.Logger;
-import org.osgi.framework.launch.Framework;
-import org.osgi.framework.launch.FrameworkFactory;
-
-/**
- * An implementation of an OSGi FrameworkFactory
- * 
- * @author thomas.diesler at jboss.com
- * @since 29-Jul-2009
- */
-public class FrameworkFactoryImpl implements FrameworkFactory
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(FrameworkFactoryImpl.class);
-
-   private static final String BOOTSTRAP_NAME = "jboss-osgi-bootstrap.xml";
-   
-   @SuppressWarnings("unchecked")
-   public Framework newFramework(Map configuration)
-   {
-      // Create a configuration
-      MCServerConfig config = new BasicMCServerConfig();
-      config.bootstrapHome(getBootstrapHome());
-      config.bootstrapName(BOOTSTRAP_NAME);
-      
-      // Create the server
-      final MCServer server = new MCServerImpl(config);
-      try
-      {
-         server.start();
-      }
-      catch (RuntimeException rte)
-      {
-         throw rte;
-      }
-      catch (Exception ex)
-      {
-         throw new IllegalStateException("Cannot bootstrap MC server", ex);
-      }
-
-      ControllerContext context = server.getKernel().getController().getInstalledContext(FrameworkFactoryBean.BEAN_FRAMEWORK_FACTORY);
-      if (context == null)
-         throw new IllegalStateException("Cannot obtain: " + FrameworkFactoryBean.BEAN_FRAMEWORK_FACTORY);
-      
-      FrameworkFactory frameworkBootstrap =  (FrameworkFactory)context.getTarget();
-      return frameworkBootstrap.newFramework(configuration);
-   }
-   
-   private String getBootstrapHome()
-   {
-      String bootstrapHome = null;
-      URL homeUrl = getBootstrapUrl();
-      if (homeUrl != null)
-      {
-         String path = homeUrl.toExternalForm();
-         bootstrapHome = path.substring(0, path.lastIndexOf('/'));
-      }
-      return bootstrapHome;
-   }
-   
-   private URL getBootstrapUrl()
-   {
-      ClassLoader cl = getClass().getClassLoader();
-      return cl.getResource("META-INF/" + BOOTSTRAP_NAME);
-   }
-}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -25,6 +25,9 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URL;
+import java.security.CodeSource;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -33,11 +36,25 @@
 import org.jboss.kernel.Kernel;
 import org.jboss.logging.Logger;
 import org.jboss.osgi.jbossmc.api.AbstractPlugin;
+import org.jboss.osgi.jbossmc.api.AutoInstallPlugin;
 import org.jboss.osgi.jbossmc.api.BundleEventsPlugin;
 import org.jboss.osgi.jbossmc.api.BundleRegistryPlugin;
 import org.jboss.osgi.jbossmc.api.FrameworkEventsPlugin;
 import org.jboss.osgi.jbossmc.api.ServiceEventsPlugin;
 import org.jboss.osgi.jbossmc.api.ServiceRegistryPlugin;
+import org.jboss.osgi.jbossmc.framework.plugins.BundleEventsPluginImpl;
+import org.jboss.osgi.jbossmc.framework.plugins.BundleFactoryPluginImpl;
+import org.jboss.osgi.jbossmc.framework.plugins.BundleLifecyclePluginImpl;
+import org.jboss.osgi.jbossmc.framework.plugins.BundleRegistryPluginImpl;
+import org.jboss.osgi.jbossmc.framework.plugins.BundleStoragePluginImpl;
+import org.jboss.osgi.jbossmc.framework.plugins.FrameworkEventsPluginImpl;
+import org.jboss.osgi.jbossmc.framework.plugins.ServiceEventsPluginImpl;
+import org.jboss.osgi.jbossmc.framework.plugins.ServiceRegistryPluginImpl;
+import org.jboss.osgi.jbossmc.framework.resolver.BundleResolverPluginImpl;
+import org.jboss.osgi.jbossmc.framework.resolver.FrameworkClassLoader;
+import org.jboss.osgi.jbossmc.framework.resolver.ClassLoaderFactoryPluginImpl;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.FrameworkEvent;
@@ -57,21 +74,25 @@
    final Logger log = Logger.getLogger(FrameworkImpl.class);
 
    private Map<String, Object> properties = new HashMap<String, Object>();
+   private Map<Class<?>, AbstractPlugin> plugins = new HashMap<Class<?>, AbstractPlugin>();
+   private ClassLoader frameworkLoader;
    private int startLevel;
-
    private Kernel kernel;
-   private Map<Class<?>, AbstractPlugin> plugins = new HashMap<Class<?>, AbstractPlugin>();
 
    public FrameworkImpl(Kernel kernel, Map<String, Object> props)
    {
+      super(getFrameworkCodeSource());
+
       if (kernel == null)
          throw new IllegalArgumentException("Kernel cannot be null");
-      
+
       this.kernel = kernel;
-      
+
       if (props != null)
          properties.putAll(props);
       
+      frameworkLoader = new FrameworkClassLoader(this);
+
       // Initialize default plugins
       addPlugin(new BundleEventsPluginImpl(this));
       addPlugin(new BundleFactoryPluginImpl(this));
@@ -84,7 +105,7 @@
       addPlugin(new ServiceEventsPluginImpl(this));
       addPlugin(new ServiceRegistryPluginImpl(this));
    }
-
+   
    public Kernel getKernel()
    {
       return kernel;
@@ -96,16 +117,16 @@
       T plugin = (T)plugins.get(clazz);
       if (plugin == null)
          throw new IllegalStateException("Cannot obtain plugin for: " + clazz.getName());
-      
+
       return plugin;
    }
-   
+
    @SuppressWarnings("unchecked")
    public <T extends AbstractPlugin> T getOptionalPlugin(Class<T> clazz)
    {
       return (T)plugins.get(clazz);
    }
-   
+
    public void addPlugin(AbstractPlugin plugin)
    {
       Class<? extends AbstractPlugin> clazz = plugin.getClass();
@@ -118,7 +139,12 @@
          }
       }
    }
-   
+
+   public ClassLoader getFrameworkLoader()
+   {
+      return frameworkLoader;
+   }
+
    /**
     * Returns the Framework unique identifier. This Framework is assigned the unique identifier zero (0) since this Framework is also a System Bundle.
     */
@@ -254,13 +280,19 @@
       // [TODO] Have registered any framework services
    }
 
-   private void startInternal()
+   private void startInternal() throws BundleException
    {
       // If this Framework is not in the STARTING state, initialize this Framework
       if (getState() != STARTING)
          initInternal();
 
-      // [TODO] All installed bundles must be started
+      // All installed bundles must be started
+      AutoInstallPlugin autoInstall = getOptionalPlugin(AutoInstallPlugin.class);
+      if (autoInstall != null)
+      {
+         autoInstall.installBundles();
+         autoInstall.startBundles();
+      }
 
       // This Framework's state is set to ACTIVE
       setState(ACTIVE);
@@ -277,7 +309,7 @@
 
       // All installed bundles must be stopped
       BundleRegistryPlugin bundleRegistry = getPlugin(BundleRegistryPlugin.class);
-      List<Bundle> reverseList = bundleRegistry.getBundles();
+      List<Bundle> reverseList = new ArrayList<Bundle>(bundleRegistry.getBundles());
       Collections.reverse(reverseList);
       for (Bundle bundle : reverseList)
       {
@@ -334,7 +366,7 @@
       // [TODO] Notify all threads that are waiting at waitForStop(long)
    }
 
-   private void updateInternal()
+   private void updateInternal() throws BundleException
    {
       stopInternal();
 
@@ -349,6 +381,22 @@
       return new FrameworkEvent(FrameworkEvent.STOPPED, this, null);
    }
 
+   private static VirtualFile getFrameworkCodeSource()
+   {
+      CodeSource codeSource = FrameworkImpl.class.getProtectionDomain().getCodeSource();
+      URL locationURL = codeSource.getLocation();
+      VirtualFile vfsRoot;
+      try
+      {
+         vfsRoot = VFS.createNewRoot(locationURL);
+      }
+      catch (IOException ex)
+      {
+         throw new IllegalArgumentException("Invalid framework location URL: " + locationURL);
+      }
+      return vfsRoot;
+   }
+   
    @Override
    public String toString()
    {

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/RuntimeClassLoaderImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/RuntimeClassLoaderImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/RuntimeClassLoaderImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.framework;
-
-//$Id: $
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Enumeration;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.RuntimeClassLoader;
-import org.jboss.osgi.spi.NotImplementedException;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Bundle;
-
-/**
- * A simple implementation of a BundleClassLoader
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class RuntimeClassLoaderImpl implements RuntimeClassLoader
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(RuntimeClassLoaderImpl.class);
-
-   private VirtualFile virtualFile;
-   private ClassLoader loader;
-
-   public RuntimeClassLoaderImpl(Bundle bundle)
-   {
-      BundleImpl bundleImpl = (BundleImpl)bundle;
-      virtualFile = bundleImpl.getVirtualFile();
-
-      URL location;
-      try
-      {
-         location = virtualFile.toURL();
-      }
-      catch (Exception ex)
-      {
-         throw new IllegalStateException("Cannot obtain bundle location", ex);
-      }
-
-      loader = new URLClassLoader(new URL[] { location });
-   }
-
-   public Class<?> loadClass(String name) throws ClassNotFoundException
-   {
-      return loader.loadClass(name);
-   }
-
-   public URL getResource(String name)
-   {
-      URL resourceURL = null;
-      try
-      {
-         VirtualFile child = virtualFile.getChild(name);
-         if (child != null)
-            resourceURL = child.toURL();
-      }
-      catch (Exception ex)
-      {
-         // ignore
-      }
-      return resourceURL;
-   }
-
-   public Enumeration<URL> getResources(String name) throws IOException
-   {
-      // [TODO] Bundle.getResources(String name)
-      throw new NotImplementedException();
-   }
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventsPluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventsPluginImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventsPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,149 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.framework;
-
-//$Id: $
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.ServiceEventsPlugin;
-import org.jboss.osgi.spi.util.ConstantsHelper;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.launch.Framework;
-
-/**
- * A simple implementation of a BundleEventManager
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class ServiceEventsPluginImpl extends AbstractPluginImpl implements ServiceEventsPlugin
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(ServiceEventsPluginImpl.class);
-   
-   private Map<ServiceListener, ListenerRegistration> listeners = new LinkedHashMap<ServiceListener, ListenerRegistration>();
-   private boolean enabled = true;
-   
-   public ServiceEventsPluginImpl()
-   {
-   }
-
-   public ServiceEventsPluginImpl(Framework framework)
-   {
-      setFramework(framework);
-   }
-
-   public boolean isEnabled()
-   {
-      return enabled;
-   }
-
-   public void setEnabled(boolean enabled)
-   {
-      this.enabled = enabled;
-   }
-
-   public void fireServiceEvent(ServiceEvent event)
-   {
-      if (enabled == false)
-         return;
-      
-      String typeStr = ConstantsHelper.serviceEvent(event.getType());
-      log.debug("ServiceEvent " + typeStr + " " + event.getSource());
-      
-      ServiceReference sref = event.getServiceReference();
-      String[] clazzes = (String[])sref.getProperty(Constants.OBJECTCLASS);
-      if (clazzes == null)
-         throw new IllegalStateException("Cannot obtain property '" + Constants.OBJECTCLASS + "' from: " + sref);
-      
-      // When a ServiceEvent is fired, it is synchronously delivered to a ServiceListener.
-      for (ListenerRegistration reg : new ArrayList<ListenerRegistration>(listeners.values()))
-      {
-         ServiceListener listener = reg.getListener();
-         
-         // ServiceEvent object delivery to ServiceListener objects is filtered
-         Filter filter = reg.getFilter();
-         if (filter == null || filter.match(sref))
-            listener.serviceChanged(event);
-      }
-      
-      // [TODO] ServiceEvent object delivery to ServiceListener objects is further filtered according to package sources
-   }
-
-   public void addServiceListener(ServiceListener listener)
-   {
-      listeners.put(listener, new ListenerRegistration(listener, null));
-   }
-
-   public void addServiceListener(ServiceListener listener, String filter)
-   {
-      listeners.put(listener, new ListenerRegistration(listener, filter));
-   }
-   
-   public void removeServiceListener(ServiceListener listener)
-   {
-      listeners.remove(listener);
-   }
-   
-   private static class ListenerRegistration
-   {
-      ServiceListener listener; 
-      Filter filter;
-      
-      ListenerRegistration(ServiceListener listener, String filterStr) 
-      {
-         this.listener = listener;
-         
-         if (filterStr != null)
-         {
-            try
-            {
-               filter = FrameworkUtil.createFilter(filterStr);
-            }
-            catch (InvalidSyntaxException ex)
-            {
-               throw new IllegalArgumentException(ex);
-            }
-         }
-      }
-
-      public ServiceListener getListener()
-      {
-         return listener;
-      }
-
-      public Filter getFilter()
-      {
-         return filter;
-      }
-   }
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryPluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryPluginImpl.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,313 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jbossmc.framework;
-
-//$Id: $
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.ServiceEventsPlugin;
-import org.jboss.osgi.jbossmc.api.ServiceRegistryPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.framework.launch.Framework;
-
-/**
- * A simple implementation of a BundleRegistry
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class ServiceRegistryPluginImpl extends AbstractPluginImpl implements ServiceRegistryPlugin
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(ServiceRegistryPluginImpl.class);
-   
-   private Map<String, List<ServiceReference>> registry = new HashMap<String, List<ServiceReference>>();
-   private long serviceId; 
-
-   public ServiceRegistryPluginImpl()
-   {
-   }
-
-   public ServiceRegistryPluginImpl(Framework framework)
-   {
-      setFramework(framework);
-   }
-
-   public ServiceRegistration registerService(Bundle bundle, String clazz, Object service, Dictionary<String, Object> properties)
-   {
-      return registerServiceInternal(bundle, new String[] {clazz}, service, properties);
-   }
-
-   public ServiceRegistration registerService(Bundle bundle, String[] clazzes, Object service, Dictionary<String, Object> properties)
-   {
-      return registerServiceInternal(bundle, clazzes, service, properties);
-   }
-
-   public void unregisterService(ServiceRegistration registration)
-   {
-      ServiceReference sref = registration.getReference();
-      String[] clazzes = (String[])sref.getProperty(Constants.OBJECTCLASS);
-      for (String clazz : clazzes)
-      {
-         List<ServiceReference> srefs = registry.get(clazz);
-         if (srefs != null)
-         {
-            Iterator<ServiceReference> itRefs = srefs.iterator();
-            while (itRefs.hasNext())
-            {
-               ServiceReference next = itRefs.next();
-               if (sref == next)
-                  itRefs.remove();
-            }
-         }
-      }
-   }
-
-   public ServiceReference getServiceReference(String clazz)
-   {
-      ServiceReference srefBest = null;
-      
-      List<ServiceReference> srefs = registry.get(clazz);
-      if (srefs != null && srefs.size() > 0)
-      {
-         // If multiple such services exist, the service with the highest ranking is returned.
-         // If there is a tie in ranking, the service with the lowest service ID (i.e. the service that was registered first) is returned. 
-         for (ServiceReference sref : srefs)
-         {
-            if (srefBest != null)
-            {
-               Integer bestRanking = (Integer)srefBest.getProperty(Constants.SERVICE_RANKING);
-               Long bestId = (Long)srefBest.getProperty(Constants.SERVICE_ID);
-               
-               Integer thisRanking = (Integer)sref.getProperty(Constants.SERVICE_RANKING);
-               Long thisId = (Long)sref.getProperty(Constants.SERVICE_ID);
-               if (thisRanking != null)
-               {
-                  if (bestRanking == null)
-                     bestRanking = new Integer(0);
-                  
-                  if (bestRanking < thisRanking)
-                     srefBest = sref;
-                  
-                  if (bestRanking.equals(thisRanking) && bestId < thisId)
-                     srefBest = sref;
-               }
-            }
-            
-            if (srefBest == null)
-               srefBest = sref;
-         }
-      }
-      
-      return srefBest;
-   }
-   
-   public ServiceReference[] getServiceReferences(String clazz, String filterStr) throws InvalidSyntaxException
-   {
-      Set<ServiceReference> resultRefs = new LinkedHashSet<ServiceReference>();
-      
-      // If the specified class name, clazz, is not null, the service must have been registered with the specified class name.
-      if (clazz != null)
-      {
-         List<ServiceReference> srefs = registry.get(clazz);
-         if (srefs != null)
-            resultRefs.addAll(srefs);
-      }
-      
-      // null for all services
-      if (clazz == null)
-      {
-         for (String auxclazz : registry.keySet())
-         {
-            List<ServiceReference> srefs = registry.get(auxclazz);
-            if (srefs != null)
-               resultRefs.addAll(srefs);
-         }
-      }
-      
-      // If the specified filter is not null, the filter expression must match the service.
-      if (filterStr != null)
-      {
-         Filter filter = FrameworkUtil.createFilter(filterStr);
-         Iterator<ServiceReference> itref = resultRefs.iterator();
-         while (itref.hasNext())
-         {
-            ServiceReference sref = itref.next();
-            if (filter.match(sref) == false)
-               itref.remove();
-         }
-      }
-      
-      // [TODO] If the Java Runtime Environment supports permissions, the caller must have ServicePermission with the GET action for at least one of the class names under which the service was registered.
-      
-      // [TODO] For each class name with which the service was registered, calling ServiceReference.isAssignableTo(Bundle, String) with the context bundle and the class name on the service's ServiceReference object must return true
-      
-      // Return null if no services are registered which satisfy the search
-      if (resultRefs.size() == 0)
-         return null;
-      
-      ServiceReference[] srefArr = new ServiceReference[resultRefs.size()];
-      return resultRefs.toArray(srefArr);
-   }
-
-   public Object getService(Bundle bundle, ServiceReference sref)
-   {
-      if (sref == null)
-         throw new IllegalArgumentException("Cannot get service for null reference");
-      
-      ServiceReferenceImpl srefImpl = (ServiceReferenceImpl)sref;
-      
-      // If the service has been unregistered, null is returned.
-      if (srefImpl.isUnregistered())
-         return null;
-      
-      // The context bundle's use count for this service is incremented by one.
-      srefImpl.incrementUseCount(bundle);
-      
-      // The service was registered with an object implementing the ServiceFactory interface
-      Object service = srefImpl.getService();
-      if (service instanceof ServiceFactory)
-      {
-         if (srefImpl.getUseCount(bundle) == 1)
-         {
-            ServiceFactory factory = (ServiceFactory)service;
-            service = factory.getService(bundle, srefImpl.getServiceRegistration());
-            srefImpl.setCachedService(bundle, service);
-         }
-         else
-         {
-            service = srefImpl.getCachedService(bundle);
-         }
-      }
-      
-      // The service object for the service is returned.
-      return service;
-   }
-   
-   public boolean ungetService(Bundle bundle, ServiceReference sref)
-   {
-      if (sref == null)
-         throw new IllegalArgumentException("Cannot unget service for null reference");
-      
-      ServiceReferenceImpl srefImpl = (ServiceReferenceImpl)sref;
-      
-      // 1. If the context bundle's use count for the service is zero or the service has been unregistered, false is returned.
-      if (srefImpl.getUseCount(bundle) == 0 || srefImpl.isUnregistered())
-         return false;
-      
-      // 2. The context bundle's use count for this service is decremented by one.
-      srefImpl.decrementUseCount(bundle);
-      
-      // 3. If the context bundle's use count for the service is currently zero and the service was registered with a ServiceFactory object, 
-      // the ServiceFactory.ungetService(Bundle, ServiceRegistration, Object) method is called to release the service object for the context bundle.
-      Object service = srefImpl.getService();
-      if (srefImpl.getUseCount(bundle) == 0 && service instanceof ServiceFactory)
-      {
-         ServiceFactory factory = (ServiceFactory)service;
-         service = srefImpl.getCachedService(bundle);
-         factory.ungetService(bundle, srefImpl.getServiceRegistration(), service);
-         srefImpl.setCachedService(bundle, null);
-      }
-      
-      // 4. true is returned. 
-      return true;
-   }
-
-   private ServiceRegistration registerServiceInternal(Bundle bundle, String[] clazzes, Object service, Dictionary<String, Object> props)
-   {
-      // If service is not a ServiceFactory, an IllegalArgumentException is thrown if service 
-      // is not an instanceof all the specified class names.
-      if ((service instanceof ServiceFactory) == false)
-      {
-         for (String clazz : clazzes)
-         {
-            try
-            {
-               Class<?> interf = bundle.loadClass(clazz);
-               if (interf.isAssignableFrom(service.getClass()) == false)
-                  throw new IllegalArgumentException("Service is not assignable to: " + clazz);
-            }
-            catch (ClassNotFoundException ex)
-            {
-               throw new IllegalArgumentException("Cannot load service interface: " + clazz, ex);
-            }
-         }
-      }
-      
-      // 2. The Framework adds the following service properties to the service properties from the specified Dictionary (which may be null):
-      //    A property named Constants.SERVICE_ID identifying the registration number of the service
-      //    A property named Constants.OBJECTCLASS containing all the specified classes.
-      Dictionary<String, Object> properties = new Hashtable<String, Object>();
-      properties.put(Constants.SERVICE_ID, new Long(serviceId++));
-      properties.put(Constants.OBJECTCLASS, clazzes);
-      
-      if (props != null)
-      {
-         Enumeration<String> keys = props.keys();
-         while(keys.hasMoreElements())
-         {
-            String key = keys.nextElement();
-            Object value = props.get(key);
-            properties.put(key, value);
-         }
-      }
-      
-      // 3. The service is added to the Framework service registry and may now be used by other bundles.
-      ServiceReferenceImpl sref = new ServiceReferenceImpl(bundle, service, properties);
-      for (String clazz : clazzes)
-      {
-         List<ServiceReference> list = registry.get(clazz);
-         if (list == null)
-         {
-            list = new ArrayList<ServiceReference>();
-            registry.put(clazz, list);
-         }
-         list.add(sref);
-      }
-      
-      // 4. A service event of type ServiceEvent.REGISTERED is fired.
-      ServiceEventsPlugin eventManager = getPlugin(ServiceEventsPlugin.class);
-      eventManager.fireServiceEvent(new ServiceEvent(ServiceEvent.REGISTERED, sref));
-      
-      // 5. A ServiceRegistration object for this registration is returned.
-      return new ServiceRegistrationImpl(this, sref);
-   }
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/launch/FrameworkBootstrapProvider.java (from rev 92607, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkBootstrapProvider.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/launch/FrameworkBootstrapProvider.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/launch/FrameworkBootstrapProvider.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.launch;
+
+//$Id: FrameworkFactoryBean.java 92605 2009-08-20 10:29:21Z thomas.diesler at jboss.com $
+
+import java.io.InputStream;
+import java.net.URL;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.util.ServiceLoader;
+import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
+
+/**
+ * An implementation of a OSGiBootstrapProvider. 
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 29-Jul-2009
+ */
+public class FrameworkBootstrapProvider implements OSGiBootstrapProvider
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(FrameworkBootstrapProvider.class);
+
+   private Framework framework;
+   
+   public void configure()
+   {
+      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+      framework = factory.newFramework(null);
+   }
+
+   public void configure(URL urlConfig)
+   {
+      configure();
+   }
+
+   public void configure(String resourceConfig)
+   {
+      configure();
+   }
+
+   public void configure(InputStream streamConfig)
+   {
+      configure();
+   }
+
+   public Framework getFramework()
+   {
+      return framework;
+   }
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/launch/FrameworkFactoryBean.java (from rev 92605, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkFactoryBean.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/launch/FrameworkFactoryBean.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/launch/FrameworkFactoryBean.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.launch;
+
+//$Id$
+
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.AbstractPlugin;
+import org.jboss.osgi.jbossmc.framework.FrameworkImpl;
+import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
+
+/**
+ * An implementation of a bootstrap bean that can provide an OSGi Framework. 
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 29-Jul-2009
+ */
+public class FrameworkFactoryBean implements FrameworkFactory
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(FrameworkFactoryBean.class);
+
+   public static final String BEAN_FRAMEWORK_FACTORY = "jboss.osgi:service=FrameworkFactory";
+   
+   private Map<String, Object> properties;
+   private List<AbstractPlugin> plugins;
+   private Kernel kernel;
+
+   private Framework framework;
+   
+   public void setProperties(Map<String, Object> properties)
+   {
+      this.properties = properties;
+   }
+
+   public void setPlugins(List<AbstractPlugin> plugins)
+   {
+      this.plugins = plugins;
+   }
+
+   public void setKernel(Kernel kernel)
+   {
+      this.kernel = kernel;
+   }
+
+   @SuppressWarnings("unchecked")
+   public Framework newFramework(Map configuration)
+   {
+      if (framework == null)
+      {
+         if (properties == null)
+            throw new IllegalStateException("Cannot obtain framework properties");
+         
+         if (configuration != null)
+            properties.putAll(configuration);
+         
+         FrameworkImpl frameworkImpl = new FrameworkImpl(kernel, properties);
+         
+         // Copy the configured plugins
+         if (plugins != null)
+         {
+            for (AbstractPlugin plugin : plugins)
+            {
+               plugin.setFramework(frameworkImpl);
+               frameworkImpl.addPlugin(plugin);
+            }
+         }
+         
+         framework = frameworkImpl;
+      }
+      return framework;
+   }
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/launch/FrameworkFactoryImpl.java (from rev 92607, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkFactoryImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/launch/FrameworkFactoryImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/launch/FrameworkFactoryImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.launch;
+
+//$Id$
+
+import java.net.URL;
+import java.util.Map;
+
+import org.jboss.bootstrap.impl.mc.config.BasicMCServerConfig;
+import org.jboss.bootstrap.impl.mc.server.MCServerImpl;
+import org.jboss.bootstrap.spi.mc.config.MCServerConfig;
+import org.jboss.bootstrap.spi.mc.server.MCServer;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.logging.Logger;
+import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
+
+/**
+ * An implementation of an OSGi FrameworkFactory
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 29-Jul-2009
+ */
+public class FrameworkFactoryImpl implements FrameworkFactory
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(FrameworkFactoryImpl.class);
+
+   private static final String BOOTSTRAP_NAME = "jboss-osgi-bootstrap.xml";
+   
+   @SuppressWarnings("unchecked")
+   public Framework newFramework(Map configuration)
+   {
+      // Create a configuration
+      MCServerConfig config = new BasicMCServerConfig();
+      config.bootstrapHome(getBootstrapHome());
+      config.bootstrapName(BOOTSTRAP_NAME);
+      
+      // Create the server
+      final MCServer server = new MCServerImpl(config);
+      try
+      {
+         server.start();
+      }
+      catch (RuntimeException rte)
+      {
+         throw rte;
+      }
+      catch (Exception ex)
+      {
+         throw new IllegalStateException("Cannot bootstrap MC server", ex);
+      }
+
+      ControllerContext context = server.getKernel().getController().getInstalledContext(FrameworkFactoryBean.BEAN_FRAMEWORK_FACTORY);
+      if (context == null)
+         throw new IllegalStateException("Cannot obtain: " + FrameworkFactoryBean.BEAN_FRAMEWORK_FACTORY);
+      
+      FrameworkFactory frameworkBootstrap =  (FrameworkFactory)context.getTarget();
+      return frameworkBootstrap.newFramework(configuration);
+   }
+   
+   private String getBootstrapHome()
+   {
+      String bootstrapHome = null;
+      URL homeUrl = getBootstrapUrl();
+      if (homeUrl != null)
+      {
+         String path = homeUrl.toExternalForm();
+         bootstrapHome = path.substring(0, path.lastIndexOf('/'));
+      }
+      return bootstrapHome;
+   }
+   
+   private URL getBootstrapUrl()
+   {
+      ClassLoader cl = getClass().getClassLoader();
+      return cl.getResource("META-INF/" + BOOTSTRAP_NAME);
+   }
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/AbstractPluginImpl.java (from rev 92605, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/AbstractPluginImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/AbstractPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/AbstractPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.plugins;
+
+//$Id: $
+
+import org.jboss.osgi.jbossmc.api.AbstractPlugin;
+import org.jboss.osgi.jbossmc.framework.FrameworkImpl;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * The base class of all framework plugins.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public abstract class AbstractPluginImpl implements AbstractPlugin
+{
+   private Framework framework;
+
+   public AbstractPluginImpl()
+   {
+   }
+
+   public AbstractPluginImpl(Framework framework)
+   {
+      this.framework = framework;
+   }
+   
+   public Framework getFramework()
+   {
+      return framework;
+   }
+
+   public void setFramework(Framework framework)
+   {
+      this.framework = framework;
+   }
+   
+   public <T extends AbstractPlugin> T getPlugin(Class<T> clazz)
+   {
+      FrameworkImpl frameworkImpl = (FrameworkImpl)framework;
+      return frameworkImpl.getPlugin(clazz);
+   }
+   
+   public <T extends AbstractPlugin> T getOptionalPlugin(Class<T> clazz)
+   {
+      FrameworkImpl frameworkImpl = (FrameworkImpl)framework;
+      return frameworkImpl.getOptionalPlugin(clazz);
+   }
+}
\ No newline at end of file

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/AutoInstallPluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/AutoInstallPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/AutoInstallPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.plugins;
+
+//$Id: $
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.AutoInstallPlugin;
+import org.jboss.osgi.spi.logging.ExportedPackageHelper;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * A plugin that installs/starts bundles on framework startup.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public class AutoInstallPluginImpl extends AbstractPluginImpl implements AutoInstallPlugin
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(AutoInstallPluginImpl.class);
+   
+   private List<URL> autoInstall;
+   private List<URL> autoStart;
+   
+   private Map<URL, Bundle> autoBundles = new HashMap<URL, Bundle>();
+   
+   public AutoInstallPluginImpl()
+   {
+   }
+
+   public AutoInstallPluginImpl(Framework framework)
+   {
+      super(framework);
+   }
+
+   
+   public void setAutoInstall(List<URL> autoInstall)
+   {
+      this.autoInstall = autoInstall;
+   }
+
+   public void setAutoStart(List<URL> autoStart)
+   {
+      this.autoStart = autoStart;
+   }
+
+   public void installBundles() throws BundleException
+   {
+      // Add the autoStart bundles to autoInstall
+      for (URL bundleURL : autoStart)
+      {
+         autoInstall.add(bundleURL);
+      }
+
+      // Install autoInstall bundles
+      BundleContext context = getFramework().getBundleContext();
+      for (URL bundleURL : autoInstall)
+      {
+         Bundle bundle = context.installBundle(bundleURL.toString());
+         autoBundles.put(bundleURL, bundle);
+      }
+   }
+
+   public void startBundles() throws BundleException
+   {
+      // Start autoStart bundles
+      BundleContext context = getFramework().getBundleContext();
+      for (URL bundleURL : autoStart)
+      {
+         Bundle bundle = autoBundles.get(bundleURL);
+         if (bundle != null)
+         {
+            bundle.start();
+            ExportedPackageHelper packageHelper = new ExportedPackageHelper(context);
+            packageHelper.logExportedPackages(bundle);
+         }
+      }
+   }
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleEventsPluginImpl.java (from rev 92604, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventsPluginImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleEventsPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleEventsPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.plugins;
+
+//$Id: $
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.BundleEventsPlugin;
+import org.jboss.osgi.spi.util.ConstantsHelper;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * A simple implementation of a BundleEventManager
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public class BundleEventsPluginImpl extends AbstractPluginImpl implements BundleEventsPlugin
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(BundleEventsPluginImpl.class);
+   
+   private List<BundleListener> listeners = new ArrayList<BundleListener>();
+   private boolean enabled = true;
+
+   public BundleEventsPluginImpl()
+   {
+   }
+
+   public BundleEventsPluginImpl(Framework framework)
+   {
+      setFramework(framework);
+   }
+
+   public boolean isEnabled()
+   {
+      return enabled;
+   }
+
+   public void setEnabled(boolean enabled)
+   {
+      this.enabled = enabled;
+   }
+
+   public void fireBundleEvent(BundleEvent event)
+   {
+      if (enabled == false)
+         return;
+      
+      String typeStr = ConstantsHelper.bundleEvent(event.getType());
+      log.debug("BundleEvent " + typeStr + " " + event.getSource());
+      
+      // [TODO] When a BundleEvent is fired, it is asynchronously delivered to a BundleListener
+      
+      for (BundleListener listener : new ArrayList<BundleListener>(listeners))
+         listener.bundleChanged(event);
+   }
+
+   public void addBundleListener(BundleListener listener)
+   {
+      listeners.add(listener);
+   }
+
+   public void removeBundleListener(BundleListener listener)
+   {
+      listeners.remove(listener);
+   }
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleFactoryPluginImpl.java (from rev 92604, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleFactoryPluginImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleFactoryPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleFactoryPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.plugins;
+
+//$Id: $
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.BundleFactoryPlugin;
+import org.jboss.osgi.jbossmc.framework.BundleContextImpl;
+import org.jboss.osgi.jbossmc.framework.BundleImpl;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * A simple implementation of a BundleFactory
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public class BundleFactoryPluginImpl extends AbstractPluginImpl implements BundleFactoryPlugin
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(BundleFactoryPluginImpl.class);
+   
+   public BundleFactoryPluginImpl()
+   {
+   }
+
+   public BundleFactoryPluginImpl(Framework framework)
+   {
+      setFramework(framework);
+   }
+
+   public Bundle createBundle(String location)
+   {
+      VirtualFile vfsRoot = getVirtualFile(location);
+      BundleImpl bundle = new BundleImpl(vfsRoot);
+      bundle.setBundleContext(new BundleContextImpl(getFramework(), bundle));
+      return bundle;
+   }
+
+   public String getVirtualLocation(String location)
+   {
+      try
+      {
+         VirtualFile vFile = getVirtualFile(location);
+         URL locationURL = vFile.toURL();
+         return locationURL.toExternalForm();
+      }
+      catch (Exception ex)
+      {
+         throw new IllegalStateException("Cannot obtain virtual bundle location", ex);
+      }
+   }
+   
+   public VirtualFile getVirtualFile(String location)
+   {
+      VirtualFile vfsRoot;
+      try
+      {
+         URL locationURL = new URL(location);
+         vfsRoot = VFS.createNewRoot(locationURL);
+      }
+      catch (IOException ex)
+      {
+         throw new IllegalArgumentException("Invalid bundle location URL: " + location);
+      }
+      return vfsRoot;
+   }
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleLifecyclePluginImpl.java (from rev 92604, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleLifecyclePluginImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleLifecyclePluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleLifecyclePluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,256 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.plugins;
+
+//$Id$
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.BundleEventsPlugin;
+import org.jboss.osgi.jbossmc.api.BundleLifecyclePlugin;
+import org.jboss.osgi.jbossmc.api.BundleRegistryPlugin;
+import org.jboss.osgi.jbossmc.api.BundleResolverPlugin;
+import org.jboss.osgi.jbossmc.api.FrameworkEventsPlugin;
+import org.jboss.osgi.jbossmc.framework.BundleContextImpl;
+import org.jboss.osgi.jbossmc.framework.BundleImpl;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * An implementation of the OSGi bundle lifecycle
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 29-Jul-2009
+ */
+public class BundleLifecyclePluginImpl extends AbstractPluginImpl implements BundleLifecyclePlugin
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(BundleLifecyclePluginImpl.class);
+
+   public BundleLifecyclePluginImpl()
+   {
+   }
+
+   public BundleLifecyclePluginImpl(Framework framework)
+   {
+      setFramework(framework);
+   }
+
+   public void start(Bundle bundle, int options) throws BundleException
+   {
+      // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
+      if (bundle.getState() == Bundle.UNINSTALLED)
+         throw new IllegalStateException("Bundle already uninstalled: " + bundle);
+
+      // [TODO] Implement the optional Start Level service 
+
+      // [TODO] If this bundle is in the process of being activated or deactivated then this method must wait 
+      // for activation or deactivation to complete before continuing.
+      if (bundle.getState() == Bundle.STARTING || bundle.getState() == Bundle.STARTING)
+         throw new IllegalStateException("Bundle already staring/stopping: " + bundle);
+
+      // If this bundle's state is not RESOLVED, an attempt is made to resolve this bundle.
+      if (bundle.getState() != Bundle.RESOLVED)
+      {
+         BundleResolverPlugin resolver = getPlugin(BundleResolverPlugin.class);
+         resolver.resolveBundle(bundle);
+         
+         BundleEventsPlugin eventManager = getPlugin(BundleEventsPlugin.class);
+         eventManager.fireBundleEvent(new BundleEvent(BundleEvent.RESOLVED, bundle));
+      }
+
+      // [TODO] Lazy bundle activation
+
+      // This bundle's state is set to STARTING. 
+      setState(bundle, Bundle.STARTING);
+
+      // A bundle event of type BundleEvent.STARTING is fired.
+      BundleEventsPlugin eventManager = getPlugin(BundleEventsPlugin.class);
+      eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STARTING, bundle));
+
+      // The BundleActivator is called
+      String activatorClass = (String)bundle.getHeaders().get(Constants.BUNDLE_ACTIVATOR);
+      if (activatorClass != null)
+      {
+         try
+         {
+            BundleActivator activator = (BundleActivator)bundle.loadClass(activatorClass).newInstance();
+            activator.start(bundle.getBundleContext());
+            
+            BundleImpl bundleImpl = (BundleImpl)bundle;
+            bundleImpl.setBundleActivator(activator);
+         }
+         catch (Exception ex)
+         {
+            // This bundle's state is set to STOPPING.
+            setState(bundle, Bundle.STOPPING);
+
+            // A bundle event of type BundleEvent.STOPPING is fired
+            eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STOPPING, bundle));
+
+            // Any services registered by this bundle must be unregistered.
+            BundleContextImpl contextImpl = (BundleContextImpl)bundle.getBundleContext();
+            contextImpl.releaseRegisteredServices();
+
+            // Any services used by this bundle must be released.
+            contextImpl.releaseUsedServices();
+
+            // Any listeners registered by this bundle must be removed.
+            contextImpl.releaseRegisteredListeners();
+
+            // This bundle's state is set to RESOLVED.
+            setState(bundle, Bundle.RESOLVED);
+
+            // A bundle event of type BundleEvent.STOPPED is fired.
+            eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STOPPED, bundle));
+
+            // A BundleException is then thrown. 
+            throw new BundleException("Cannot call BundleActivator: " + activatorClass, ex);
+         }
+      }
+
+      // If this bundle's state is UNINSTALLED, because this bundle was uninstalled while 
+      // the BundleActivator.start was running 
+      if (bundle.getState() == Bundle.UNINSTALLED)
+         throw new IllegalStateException("Bundle already uninstalled: " + bundle);
+
+      // This bundle's state is set to ACTIVE
+      setState(bundle, Bundle.ACTIVE);
+
+      // A bundle event of type BundleEvent.STARTED is fired
+      eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STARTED, bundle));
+   }
+
+   public void stop(Bundle bundle, int options) throws BundleException
+   {
+      // 1. If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
+      if (bundle.getState() == Bundle.UNINSTALLED)
+         throw new IllegalStateException("Bundle already unistalled: " + bundle);
+      
+      // [TODO] 2. If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation to complete
+      
+      // [TODO] 3. If the STOP_TRANSIENT option is not set then then set this bundle's persistent autostart setting to to Stopped. When the Framework is restarted and this bundle's autostart setting is Stopped, this bundle must not be automatically started.
+      
+      // 4. If this bundle's state is not STARTING or ACTIVE then this method returns immediately.
+      if (!(bundle.getState() == Bundle.STARTING || bundle.getState() == Bundle.ACTIVE))
+         return;
+         
+      // 5. This bundle's state is set to STOPPING.
+      int statePriorToStopping = bundle.getState();
+      setState(bundle, Bundle.STOPPING);
+      
+      // 6. A bundle event of type BundleEvent.STOPPING is fired.
+      BundleEventsPlugin eventManager = getPlugin(BundleEventsPlugin.class);
+      eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STOPPING, bundle));
+      
+      // 7. If this bundle's state was ACTIVE prior to setting the state to STOPPING, the BundleActivator.stop(org.osgi.framework.BundleContext) method of this bundle's BundleActivator, if one is specified, is called.
+      Exception activatorStopException = null;
+      BundleImpl bundleImpl = (BundleImpl)bundle;
+      BundleActivator activator = bundleImpl.getBundleActivator();
+      if (statePriorToStopping == Bundle.ACTIVE && activator != null)
+      {
+         try
+         {
+            activator.stop(bundle.getBundleContext());
+         }
+         catch (Exception ex)
+         {
+            // This method must continue to stop this bundle and a BundleException must be thrown after completion of the remaining steps.
+            activatorStopException = ex;
+         }
+      }
+      
+      // 8. Any services registered by this bundle must be unregistered.
+      BundleContextImpl contextImpl = (BundleContextImpl)bundle.getBundleContext();
+      contextImpl.releaseRegisteredServices();
+      
+      // 9. Any services used by this bundle must be released.
+      contextImpl.releaseUsedServices();
+      
+      // 10. Any listeners registered by this bundle must be removed.
+      contextImpl.releaseRegisteredListeners();
+      
+      // 11. If this bundle's state is UNINSTALLED, because this bundle was uninstalled while the BundleActivator.stop method was running, a BundleException must be thrown.
+      if (bundle.getState() == Bundle.UNINSTALLED)
+         throw new IllegalStateException("Bundle already unistalled: " + bundle);
+      
+      // 12. This bundle's state is set to RESOLVED.
+      setState(bundle, Bundle.RESOLVED);
+      
+      // 13. A bundle event of type BundleEvent.STOPPED is fired.    
+      eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STOPPED, bundle));
+      
+      // A BundleException must be thrown after completion of the remaining steps
+      if (activatorStopException != null)
+      {
+         if (activatorStopException instanceof BundleException)
+            throw (BundleException)activatorStopException;
+         
+         throw new BundleException("Exception in BundleActivator.stop()", activatorStopException);
+      }
+   }
+
+   public void uninstall(Bundle bundle) throws BundleException
+   {
+      // 1. If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
+      if (bundle.getState() == Bundle.UNINSTALLED)
+         throw new IllegalStateException("Bundle already unistalled: " + bundle);
+
+      // 2. If this bundle's state is ACTIVE, STARTING or STOPPING, this bundle is stopped as described in the Bundle.stop method. 
+      if (bundle.getState() == Bundle.ACTIVE || bundle.getState() == Bundle.STARTING || bundle.getState() == Bundle.STOPPING)
+      {
+         try
+         {
+            stop(bundle, 0);
+         }
+         catch (Exception ex)
+         {
+            // If Bundle.stop throws an exception, a Framework event of type FrameworkEvent.ERROR is fired containing the exception.
+            FrameworkEventsPlugin eventManager = getPlugin(FrameworkEventsPlugin.class);
+            eventManager.fireFrameworkEvent(new FrameworkEvent(FrameworkEvent.ERROR, bundle, ex));
+         }
+      }
+
+      // 3. This bundle's state is set to UNINSTALLED.
+      setState(bundle, Bundle.UNINSTALLED);
+
+      // 4. A bundle event of type BundleEvent.UNINSTALLED is fired.
+      BundleEventsPlugin eventManager = getPlugin(BundleEventsPlugin.class);
+      eventManager.fireBundleEvent(new BundleEvent(BundleEvent.UNINSTALLED, bundle));
+
+      // 5. This bundle and any persistent storage area provided for this bundle by the Framework are removed.
+      BundleRegistryPlugin bundleRegistry = getPlugin(BundleRegistryPlugin.class);
+      bundleRegistry.unregisterBundle(bundle);
+
+      // [TODO] Any persistent storage area provided for this bundle are removed.
+   }
+
+   private void setState(Bundle bundle, int state)
+   {
+      BundleImpl bundleImpl = (BundleImpl)bundle;
+      bundleImpl.setState(state);
+   }
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleRegistryPluginImpl.java (from rev 92604, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleRegistryPluginImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleRegistryPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleRegistryPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.plugins;
+
+//$Id: $
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.BundleRegistryPlugin;
+import org.jboss.osgi.jbossmc.framework.BundleImpl;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * A simple implementation of a BundleRegistry
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public class BundleRegistryPluginImpl extends AbstractPluginImpl implements BundleRegistryPlugin
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(BundleRegistryPluginImpl.class);
+   
+   private long globalId;
+   private Map<String, Bundle> registry = new LinkedHashMap<String, Bundle>();
+
+   public BundleRegistryPluginImpl()
+   {
+   }
+
+   public BundleRegistryPluginImpl(Framework framework)
+   {
+      setFramework(framework);
+   }
+
+   public long registerBundle(Bundle bundle)
+   {
+      if (bundle == null)
+         throw new IllegalArgumentException("Cannot install null bundle");
+      
+      BundleImpl bundleImpl = (BundleImpl)bundle;
+      bundleImpl.setBundleId(globalId++);
+      
+      registry.put(bundle.getLocation(), bundle);
+      
+      return bundle.getBundleId();
+   }
+
+   public void unregisterBundle(Bundle bundle)
+   {
+      if (bundle == null)
+         throw new IllegalArgumentException("Cannot uninstall null bundle");
+      
+      if (registry.remove(bundle.getLocation()) == null)
+         throw new IllegalStateException("Cannot unregister bundle: " + bundle);
+   }
+
+   public Bundle getBundleById(long id)
+   {
+      Bundle bundle = null;
+      for (Bundle aux : new ArrayList<Bundle>(registry.values()))
+      {
+         if (id == aux.getBundleId())
+         {
+            bundle = aux;
+            break;
+         }
+      }
+      return bundle;
+   }
+
+   public Bundle getBundleByLocation(String location)
+   {
+      return registry.get(location);
+   }
+
+   public List<Bundle> getBundles()
+   {
+      ArrayList<Bundle> bundles = new ArrayList<Bundle>(registry.values());
+      return Collections.unmodifiableList(bundles);
+   }
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleStoragePluginImpl.java (from rev 92604, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleStoragePluginImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleStoragePluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/BundleStoragePluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.plugins;
+
+//$Id: $
+
+import java.io.File;
+import java.io.IOException;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.BundleStoragePlugin;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * A simple implementation of a BundleStorage
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public class BundleStoragePluginImpl extends AbstractPluginImpl implements BundleStoragePlugin
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(BundleStoragePluginImpl.class);
+   
+   public BundleStoragePluginImpl()
+   {
+   }
+
+   public BundleStoragePluginImpl(Framework framework)
+   {
+      setFramework(framework);
+   }
+
+   public File getDataFile(Bundle bundle, String filename)
+   {
+      File bundleDir = getBundleStorageDir(bundle);
+      File dataFile = new File(bundleDir.getAbsolutePath() + "/" + filename);
+      return dataFile;
+   }
+
+   private File getBundleStorageDir(Bundle bundle)
+   {
+      BundleContext context = getFramework().getBundleContext();
+      String dirName = context.getProperty(Constants.FRAMEWORK_STORAGE);
+      if (dirName == null)
+      {
+         try
+         {
+            File tmpFile = File.createTempFile("Constants.FRAMEWORK_STORAGE", null);
+            dirName = tmpFile.getParent();
+            tmpFile.delete();
+         }
+         catch (IOException ex)
+         {
+            throw new IllegalStateException("Cannot create temp storage file", ex);
+         }
+      }
+      
+      File bundleDir = new File(dirName + "/bundle-" + bundle.getBundleId());
+      if (bundleDir.exists() == false)
+         bundleDir.mkdirs();
+      return bundleDir;
+   }
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/FrameworkEventsPluginImpl.java (from rev 92604, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventsPluginImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/FrameworkEventsPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/FrameworkEventsPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.plugins;
+
+//$Id: $
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.FrameworkEventsPlugin;
+import org.jboss.osgi.spi.util.ConstantsHelper;
+import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.FrameworkListener;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * A simple implementation of a FrameworkEventManager
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public class FrameworkEventsPluginImpl extends AbstractPluginImpl implements FrameworkEventsPlugin
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(FrameworkEventsPluginImpl.class);
+   
+   private List<FrameworkListener> listeners = new ArrayList<FrameworkListener>();
+   private boolean enabled = true;
+
+   public FrameworkEventsPluginImpl()
+   {
+   }
+
+   public FrameworkEventsPluginImpl(Framework framework)
+   {
+      setFramework(framework);
+   }
+
+   public boolean isEnabled()
+   {
+      return enabled;
+   }
+
+   public void setEnabled(boolean enabled)
+   {
+      this.enabled = enabled;
+   }
+
+   public void fireFrameworkEvent(FrameworkEvent event)
+   {
+      if (enabled == false)
+         return;
+      
+      String typeStr = ConstantsHelper.frameworkEvent(event.getType());
+      String message = "FrameworkEvent " + typeStr + " " + event.getSource();
+      
+      if (event.getType() == FrameworkEvent.ERROR)
+         log.error(message);
+      else if (event.getType() == FrameworkEvent.WARNING)
+         log.warn(message);
+      else if (event.getType() == FrameworkEvent.INFO)
+         log.info(message);
+      else
+         log.debug(message);
+      
+      // [TODO] When a FrameworkEvent is fired, it is asynchronously delivered to a FrameworkListener.
+      
+      for (FrameworkListener listener : new ArrayList<FrameworkListener>(listeners))
+         listener.frameworkEvent(event);
+   }
+
+   public void addFrameworkListener(FrameworkListener listener)
+   {
+      listeners.add(listener);
+   }
+
+   public void removeFrameworkListener(FrameworkListener listener)
+   {
+      listeners.remove(listener);
+   }
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/ServiceEventsPluginImpl.java (from rev 92604, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventsPluginImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/ServiceEventsPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/ServiceEventsPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.plugins;
+
+//$Id: $
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.ServiceEventsPlugin;
+import org.jboss.osgi.spi.util.ConstantsHelper;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * A simple implementation of a BundleEventManager
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public class ServiceEventsPluginImpl extends AbstractPluginImpl implements ServiceEventsPlugin
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(ServiceEventsPluginImpl.class);
+   
+   private Map<ServiceListener, ListenerRegistration> listeners = new LinkedHashMap<ServiceListener, ListenerRegistration>();
+   private boolean enabled = true;
+   
+   public ServiceEventsPluginImpl()
+   {
+   }
+
+   public ServiceEventsPluginImpl(Framework framework)
+   {
+      setFramework(framework);
+   }
+
+   public boolean isEnabled()
+   {
+      return enabled;
+   }
+
+   public void setEnabled(boolean enabled)
+   {
+      this.enabled = enabled;
+   }
+
+   public void fireServiceEvent(ServiceEvent event)
+   {
+      if (enabled == false)
+         return;
+      
+      String typeStr = ConstantsHelper.serviceEvent(event.getType());
+      log.debug("ServiceEvent " + typeStr + " " + event.getSource());
+      
+      ServiceReference sref = event.getServiceReference();
+      String[] clazzes = (String[])sref.getProperty(Constants.OBJECTCLASS);
+      if (clazzes == null)
+         throw new IllegalStateException("Cannot obtain property '" + Constants.OBJECTCLASS + "' from: " + sref);
+      
+      // When a ServiceEvent is fired, it is synchronously delivered to a ServiceListener.
+      for (ListenerRegistration reg : new ArrayList<ListenerRegistration>(listeners.values()))
+      {
+         ServiceListener listener = reg.getListener();
+         
+         // ServiceEvent object delivery to ServiceListener objects is filtered
+         Filter filter = reg.getFilter();
+         if (filter == null || filter.match(sref))
+            listener.serviceChanged(event);
+      }
+      
+      // [TODO] ServiceEvent object delivery to ServiceListener objects is further filtered according to package sources
+   }
+
+   public void addServiceListener(ServiceListener listener)
+   {
+      listeners.put(listener, new ListenerRegistration(listener, null));
+   }
+
+   public void addServiceListener(ServiceListener listener, String filter)
+   {
+      listeners.put(listener, new ListenerRegistration(listener, filter));
+   }
+   
+   public void removeServiceListener(ServiceListener listener)
+   {
+      listeners.remove(listener);
+   }
+   
+   private static class ListenerRegistration
+   {
+      ServiceListener listener; 
+      Filter filter;
+      
+      ListenerRegistration(ServiceListener listener, String filterStr) 
+      {
+         this.listener = listener;
+         
+         if (filterStr != null)
+         {
+            try
+            {
+               filter = FrameworkUtil.createFilter(filterStr);
+            }
+            catch (InvalidSyntaxException ex)
+            {
+               throw new IllegalArgumentException(ex);
+            }
+         }
+      }
+
+      public ServiceListener getListener()
+      {
+         return listener;
+      }
+
+      public Filter getFilter()
+      {
+         return filter;
+      }
+   }
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/ServiceRegistryPluginImpl.java (from rev 92607, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryPluginImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/ServiceRegistryPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/plugins/ServiceRegistryPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,315 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.plugins;
+
+//$Id: $
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.ServiceEventsPlugin;
+import org.jboss.osgi.jbossmc.api.ServiceRegistryPlugin;
+import org.jboss.osgi.jbossmc.framework.ServiceReferenceImpl;
+import org.jboss.osgi.jbossmc.framework.ServiceRegistrationImpl;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * A simple implementation of a BundleRegistry
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public class ServiceRegistryPluginImpl extends AbstractPluginImpl implements ServiceRegistryPlugin
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(ServiceRegistryPluginImpl.class);
+   
+   private Map<String, List<ServiceReference>> registry = new HashMap<String, List<ServiceReference>>();
+   private long serviceId; 
+
+   public ServiceRegistryPluginImpl()
+   {
+   }
+
+   public ServiceRegistryPluginImpl(Framework framework)
+   {
+      setFramework(framework);
+   }
+
+   public ServiceRegistration registerService(Bundle bundle, String clazz, Object service, Dictionary<String, Object> properties)
+   {
+      return registerServiceInternal(bundle, new String[] {clazz}, service, properties);
+   }
+
+   public ServiceRegistration registerService(Bundle bundle, String[] clazzes, Object service, Dictionary<String, Object> properties)
+   {
+      return registerServiceInternal(bundle, clazzes, service, properties);
+   }
+
+   public void unregisterService(ServiceRegistration registration)
+   {
+      ServiceReference sref = registration.getReference();
+      String[] clazzes = (String[])sref.getProperty(Constants.OBJECTCLASS);
+      for (String clazz : clazzes)
+      {
+         List<ServiceReference> srefs = registry.get(clazz);
+         if (srefs != null)
+         {
+            Iterator<ServiceReference> itRefs = srefs.iterator();
+            while (itRefs.hasNext())
+            {
+               ServiceReference next = itRefs.next();
+               if (sref == next)
+                  itRefs.remove();
+            }
+         }
+      }
+   }
+
+   public ServiceReference getServiceReference(String clazz)
+   {
+      ServiceReference srefBest = null;
+      
+      List<ServiceReference> srefs = registry.get(clazz);
+      if (srefs != null && srefs.size() > 0)
+      {
+         // If multiple such services exist, the service with the highest ranking is returned.
+         // If there is a tie in ranking, the service with the lowest service ID (i.e. the service that was registered first) is returned. 
+         for (ServiceReference sref : srefs)
+         {
+            if (srefBest != null)
+            {
+               Integer bestRanking = (Integer)srefBest.getProperty(Constants.SERVICE_RANKING);
+               Long bestId = (Long)srefBest.getProperty(Constants.SERVICE_ID);
+               
+               Integer thisRanking = (Integer)sref.getProperty(Constants.SERVICE_RANKING);
+               Long thisId = (Long)sref.getProperty(Constants.SERVICE_ID);
+               if (thisRanking != null)
+               {
+                  if (bestRanking == null)
+                     bestRanking = new Integer(0);
+                  
+                  if (bestRanking < thisRanking)
+                     srefBest = sref;
+                  
+                  if (bestRanking.equals(thisRanking) && bestId < thisId)
+                     srefBest = sref;
+               }
+            }
+            
+            if (srefBest == null)
+               srefBest = sref;
+         }
+      }
+      
+      return srefBest;
+   }
+   
+   public ServiceReference[] getServiceReferences(String clazz, String filterStr) throws InvalidSyntaxException
+   {
+      Set<ServiceReference> resultRefs = new LinkedHashSet<ServiceReference>();
+      
+      // If the specified class name, clazz, is not null, the service must have been registered with the specified class name.
+      if (clazz != null)
+      {
+         List<ServiceReference> srefs = registry.get(clazz);
+         if (srefs != null)
+            resultRefs.addAll(srefs);
+      }
+      
+      // null for all services
+      if (clazz == null)
+      {
+         for (String auxclazz : registry.keySet())
+         {
+            List<ServiceReference> srefs = registry.get(auxclazz);
+            if (srefs != null)
+               resultRefs.addAll(srefs);
+         }
+      }
+      
+      // If the specified filter is not null, the filter expression must match the service.
+      if (filterStr != null)
+      {
+         Filter filter = FrameworkUtil.createFilter(filterStr);
+         Iterator<ServiceReference> itref = resultRefs.iterator();
+         while (itref.hasNext())
+         {
+            ServiceReference sref = itref.next();
+            if (filter.match(sref) == false)
+               itref.remove();
+         }
+      }
+      
+      // [TODO] If the Java Runtime Environment supports permissions, the caller must have ServicePermission with the GET action for at least one of the class names under which the service was registered.
+      
+      // [TODO] For each class name with which the service was registered, calling ServiceReference.isAssignableTo(Bundle, String) with the context bundle and the class name on the service's ServiceReference object must return true
+      
+      // Return null if no services are registered which satisfy the search
+      if (resultRefs.size() == 0)
+         return null;
+      
+      ServiceReference[] srefArr = new ServiceReference[resultRefs.size()];
+      return resultRefs.toArray(srefArr);
+   }
+
+   public Object getService(Bundle bundle, ServiceReference sref)
+   {
+      if (sref == null)
+         throw new IllegalArgumentException("Cannot get service for null reference");
+      
+      ServiceReferenceImpl srefImpl = (ServiceReferenceImpl)sref;
+      
+      // If the service has been unregistered, null is returned.
+      if (srefImpl.isUnregistered())
+         return null;
+      
+      // The context bundle's use count for this service is incremented by one.
+      srefImpl.incrementUseCount(bundle);
+      
+      // The service was registered with an object implementing the ServiceFactory interface
+      Object service = srefImpl.getService();
+      if (service instanceof ServiceFactory)
+      {
+         if (srefImpl.getUseCount(bundle) == 1)
+         {
+            ServiceFactory factory = (ServiceFactory)service;
+            service = factory.getService(bundle, srefImpl.getServiceRegistration());
+            srefImpl.setCachedService(bundle, service);
+         }
+         else
+         {
+            service = srefImpl.getCachedService(bundle);
+         }
+      }
+      
+      // The service object for the service is returned.
+      return service;
+   }
+   
+   public boolean ungetService(Bundle bundle, ServiceReference sref)
+   {
+      if (sref == null)
+         throw new IllegalArgumentException("Cannot unget service for null reference");
+      
+      ServiceReferenceImpl srefImpl = (ServiceReferenceImpl)sref;
+      
+      // 1. If the context bundle's use count for the service is zero or the service has been unregistered, false is returned.
+      if (srefImpl.getUseCount(bundle) == 0 || srefImpl.isUnregistered())
+         return false;
+      
+      // 2. The context bundle's use count for this service is decremented by one.
+      srefImpl.decrementUseCount(bundle);
+      
+      // 3. If the context bundle's use count for the service is currently zero and the service was registered with a ServiceFactory object, 
+      // the ServiceFactory.ungetService(Bundle, ServiceRegistration, Object) method is called to release the service object for the context bundle.
+      Object service = srefImpl.getService();
+      if (srefImpl.getUseCount(bundle) == 0 && service instanceof ServiceFactory)
+      {
+         ServiceFactory factory = (ServiceFactory)service;
+         service = srefImpl.getCachedService(bundle);
+         factory.ungetService(bundle, srefImpl.getServiceRegistration(), service);
+         srefImpl.setCachedService(bundle, null);
+      }
+      
+      // 4. true is returned. 
+      return true;
+   }
+
+   private ServiceRegistration registerServiceInternal(Bundle bundle, String[] clazzes, Object service, Dictionary<String, Object> props)
+   {
+      // If service is not a ServiceFactory, an IllegalArgumentException is thrown if service 
+      // is not an instanceof all the specified class names.
+      if ((service instanceof ServiceFactory) == false)
+      {
+         for (String clazz : clazzes)
+         {
+            try
+            {
+               Class<?> interf = bundle.loadClass(clazz);
+               if (interf.isAssignableFrom(service.getClass()) == false)
+                  throw new IllegalArgumentException("Service is not assignable to: " + clazz);
+            }
+            catch (ClassNotFoundException ex)
+            {
+               throw new IllegalArgumentException("Cannot load service interface: " + clazz, ex);
+            }
+         }
+      }
+      
+      // 2. The Framework adds the following service properties to the service properties from the specified Dictionary (which may be null):
+      //    A property named Constants.SERVICE_ID identifying the registration number of the service
+      //    A property named Constants.OBJECTCLASS containing all the specified classes.
+      Dictionary<String, Object> properties = new Hashtable<String, Object>();
+      properties.put(Constants.SERVICE_ID, new Long(serviceId++));
+      properties.put(Constants.OBJECTCLASS, clazzes);
+      
+      if (props != null)
+      {
+         Enumeration<String> keys = props.keys();
+         while(keys.hasMoreElements())
+         {
+            String key = keys.nextElement();
+            Object value = props.get(key);
+            properties.put(key, value);
+         }
+      }
+      
+      // 3. The service is added to the Framework service registry and may now be used by other bundles.
+      ServiceReferenceImpl sref = new ServiceReferenceImpl(bundle, service, properties);
+      for (String clazz : clazzes)
+      {
+         List<ServiceReference> list = registry.get(clazz);
+         if (list == null)
+         {
+            list = new ArrayList<ServiceReference>();
+            registry.put(clazz, list);
+         }
+         list.add(sref);
+      }
+      
+      // 4. A service event of type ServiceEvent.REGISTERED is fired.
+      ServiceEventsPlugin eventManager = getPlugin(ServiceEventsPlugin.class);
+      eventManager.fireServiceEvent(new ServiceEvent(ServiceEvent.REGISTERED, sref));
+      
+      // 5. A ServiceRegistration object for this registration is returned.
+      return new ServiceRegistrationImpl(this, sref);
+   }
+}
\ No newline at end of file

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/BundleResolverPluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/BundleResolverPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/BundleResolverPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.resolver;
+
+//$Id: $
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.BundleResolverPlugin;
+import org.jboss.osgi.jbossmc.framework.BundleImpl;
+import org.jboss.osgi.jbossmc.framework.plugins.AbstractPluginImpl;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * A simple implementation of a BundleResolver
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public class BundleResolverPluginImpl extends AbstractPluginImpl implements BundleResolverPlugin
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(BundleResolverPluginImpl.class);
+   
+   public BundleResolverPluginImpl()
+   {
+   }
+
+   public BundleResolverPluginImpl(Framework framework)
+   {
+      setFramework(framework);
+   }
+
+   public void resolveBundle(Bundle bundle) throws BundleException
+   {
+      // [TODO] resolve bundle properly
+      
+      BundleImpl bundleImpl = (BundleImpl)bundle;
+      
+      bundleImpl.setState(Bundle.RESOLVED);
+   }
+}
\ No newline at end of file

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/ClassLoaderFactoryPluginImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/ClassLoaderFactoryPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/ClassLoaderFactoryPluginImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.resolver;
+
+//$Id: BundleLifecycleImpl.java 92578 2009-08-19 14:33:04Z thomas.diesler at jboss.com $
+
+import org.jboss.osgi.jbossmc.api.ClassLoaderFactoryPlugin;
+import org.jboss.osgi.jbossmc.api.RuntimeClassLoader;
+import org.jboss.osgi.jbossmc.framework.plugins.AbstractPluginImpl;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * An implementation of bundle class loader factory
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 29-Jul-2009
+ */
+public class ClassLoaderFactoryPluginImpl extends AbstractPluginImpl implements ClassLoaderFactoryPlugin
+{
+   public ClassLoaderFactoryPluginImpl()
+   {
+   }
+
+   public ClassLoaderFactoryPluginImpl(Framework framework)
+   {
+      setFramework(framework);
+   }
+
+   public RuntimeClassLoader createClassLoader(Bundle bundle)
+   {
+      return new RuntimeClassLoaderImpl(getFramework(), bundle);
+   }
+}
\ No newline at end of file

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/FrameworkClassLoader.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/FrameworkClassLoader.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/FrameworkClassLoader.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.resolver;
+
+//$Id: FrameworkImpl.java 92607 2009-08-20 12:03:26Z thomas.diesler at jboss.com $
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.framework.FrameworkImpl;
+import org.osgi.framework.Constants;
+
+/**
+ * A ClassLoader that only loads system packages defined by the framework.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 29-Jul-2009
+ */
+public class FrameworkClassLoader extends ClassLoader
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(FrameworkClassLoader.class);
+
+   private List<String> sysPackagesFull = new ArrayList<String>();
+   private List<String> sysPackages = new ArrayList<String>();
+
+   public FrameworkClassLoader(FrameworkImpl framework)
+   {
+      // Initialize system packages
+      String sysPackageStr = (String)framework.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
+      if (sysPackageStr == null)
+      {
+         sysPackagesFull.add("org.osgi.framework");
+         sysPackagesFull.add("org.osgi.service.startlevel");
+         sysPackagesFull.add("org.osgi.service.packageadmin");
+         sysPackagesFull.add("org.osgi.util.tracker");
+      }
+      else
+      {
+         sysPackagesFull.clear();
+         sysPackagesFull.addAll(toList(sysPackageStr));
+      }
+
+      // Add extra system packages
+      String sysPackagesExtra = (String)framework.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA);
+      if (sysPackagesExtra != null)
+      {
+         sysPackagesFull.addAll(toList(sysPackagesExtra));
+      }
+
+      // Remove the version specifier 
+      for (String packName : sysPackagesFull)
+      {
+         int semicolon = packName.indexOf(';');
+         if (semicolon > 0)
+            packName = packName.substring(0, semicolon);
+
+         sysPackages.add(packName.trim());
+      }
+
+      log.debug("Framework System Packages");
+      ArrayList<String> sortedList = new ArrayList<String>(sysPackagesFull);
+      Collections.sort(sortedList);
+      for (String packName : sortedList)
+         log.debug("  [" + packName + "]");
+   }
+
+   @Override
+   public Class<?> loadClass(String name) throws ClassNotFoundException
+   {
+      String packPrefix = name.substring(0, name.lastIndexOf('.'));
+      if (sysPackages.contains(packPrefix) == false)
+         throw new ClassNotFoundException("Cannot load from system packages: " + name);
+
+      return super.loadClass(name);
+   }
+
+   private List<String> toList(String packagesStr)
+   {
+      List<String> list = new ArrayList<String>();
+      StringTokenizer st = new StringTokenizer(packagesStr, ",");
+      while (st.hasMoreTokens())
+      {
+         String token = st.nextToken();
+         list.add(token.trim());
+      }
+      return list;
+   }
+}
\ No newline at end of file

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/RuntimeClassLoaderImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/RuntimeClassLoaderImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/resolver/RuntimeClassLoaderImpl.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -0,0 +1,175 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework.resolver;
+
+//$Id: $
+
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Enumeration;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.RuntimeClassLoader;
+import org.jboss.osgi.jbossmc.framework.BundleImpl;
+import org.jboss.osgi.jbossmc.framework.FrameworkImpl;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * An implementation of a RuntimeClassLoader that uses a flat class
+ * space for all installed bundles.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public class RuntimeClassLoaderImpl implements RuntimeClassLoader
+{
+   // Provide logging
+   final static Logger log = Logger.getLogger(RuntimeClassLoaderImpl.class);
+
+   private static GlobalFrameworkLoader globalClassLoader;
+
+   private VirtualFile vFile;
+   private ClassLoader parentClassLoader;
+
+   public RuntimeClassLoaderImpl(Framework framework, Bundle bundle)
+   {
+      BundleImpl bundleImpl = (BundleImpl)bundle;
+      vFile = bundleImpl.getVirtualFile();
+
+      parentClassLoader = getClass().getClassLoader();
+      
+      if (globalClassLoader == null)
+      {
+         FrameworkImpl frameworkImpl = (FrameworkImpl)framework;
+         ClassLoader frameworkLoader = frameworkImpl.getFrameworkLoader();
+         globalClassLoader = new GlobalFrameworkLoader(frameworkLoader);
+      }
+
+      try
+      {
+         addClassLoaderURL(vFile);
+      }
+      catch (IOException ex)
+      {
+         throw new IllegalStateException("Cannot add bundle url", ex);
+      }
+   }
+
+   private void addClassLoaderURL(VirtualFile vFile) throws IOException
+   {
+      URL url = failsafeURL(vFile);
+      globalClassLoader.addURL(url);
+      for (VirtualFile child : vFile.getChildren())
+      {
+         if (child.isArchive())
+         {
+            addClassLoaderURL(child);
+         }
+      }
+   }
+
+   public Class<?> loadClass(String className) throws ClassNotFoundException
+   {
+      if (className == null)
+         throw new IllegalArgumentException("Cannot load null class");
+
+      // Step #1 - class or resource is in a java.* package
+      if (className.startsWith("java."))
+         return parentClassLoader.loadClass(className);
+
+      return globalClassLoader.loadClass(className);
+   }
+
+   public URL getResource(String name)
+   {
+      URL resourceURL = null;
+      try
+      {
+         VirtualFile child = vFile.getChild(name);
+         if (child != null)
+            resourceURL = child.toURL();
+      }
+      catch (Exception ex)
+      {
+         // ignore
+      }
+      return resourceURL;
+   }
+
+   public Enumeration<URL> getResources(String name) throws IOException
+   {
+      // [TODO] Bundle.getResources(String name)
+      throw new NotImplementedException();
+   }
+
+   static class GlobalFrameworkLoader extends URLClassLoader
+   {
+      private ClassLoader parent;
+
+      public GlobalFrameworkLoader(ClassLoader parent)
+      {
+         super(new URL[] {}, null);
+         this.parent = parent;
+      }
+
+      @Override
+      public void addURL(URL url)
+      {
+         log.debug("Add URL: " + url);
+         super.addURL(url);
+      }
+
+      @Override
+      public Class<?> loadClass(String name) throws ClassNotFoundException
+      {
+         Class<?> clazz;
+         try
+         {
+            clazz = super.loadClass(name);
+         }
+         catch (ClassNotFoundException ex)
+         {
+            clazz = parent.loadClass(name);
+         }
+
+         return clazz;
+      }
+   }
+
+   private URL failsafeURL(VirtualFile vFile)
+   {
+      URL url = null;
+      try
+      {
+         url = vFile.toURL();
+      }
+      catch (Exception ex)
+      {
+         log.error("Cannot get URL from: " + vFile, ex);
+      }
+      return url;
+   }
+}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/resources/META-INF/services/org.osgi.framework.launch.FrameworkFactory
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/resources/META-INF/services/org.osgi.framework.launch.FrameworkFactory	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/resources/META-INF/services/org.osgi.framework.launch.FrameworkFactory	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1 +1 @@
-org.jboss.osgi.jbossmc.framework.FrameworkFactoryImpl
\ No newline at end of file
+org.jboss.osgi.jbossmc.framework.launch.FrameworkFactoryImpl
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/BundleInstallTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/BundleInstallTestCase.java	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/BundleInstallTestCase.java	2009-08-20 16:35:19 UTC (rev 92613)
@@ -30,7 +30,6 @@
 import org.jboss.osgi.spi.testing.OSGiTestHelper;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/META-INF/jboss-osgi-framework.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/META-INF/jboss-osgi-framework.xml	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/META-INF/jboss-osgi-framework.xml	2009-08-20 16:35:19 UTC (rev 92613)
@@ -15,27 +15,28 @@
   -->
 
   <!-- The OSGi Framework Factory -->
-  <bean name="jboss.osgi:service=FrameworkFactory" class="org.jboss.osgi.jbossmc.framework.FrameworkFactoryBean">
+  <bean name="jboss.osgi:service=FrameworkFactory" class="org.jboss.osgi.jbossmc.framework.launch.FrameworkFactoryBean">
     <property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
     <property name="properties">
       <map keyClass="java.lang.String" valueClass="java.lang.String">
         <entry><key>org.osgi.framework.storage</key><value>${log4j.output.dir}/osgi-store</value></entry>
         <entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
+        <entry>
+          <key>org.osgi.framework.system.packages.extra</key>
+          <value>
+            <!-- jboss-osgi -->
+            org.jboss.osgi.spi.service;version=1.0,
+            org.jboss.osgi.spi.management;version=1.0,
+            org.jboss.osgi.spi.util;version=1.0,
+          </value>
+        </entry>
       </map>
     </property>
     <property name="plugins">
       <list elementClass="org.jboss.osgi.jbossmc.api.AbstractPlugin">
-        <inject bean="jboss.osgi:plugin=ClassLoaderFactory"/>
+        <inject bean="jboss.osgi:plugin=AutoInstall"/>
       </list>
     </property>
-    <property name="autoInstall">
-     <list elementClass="java.net.URL">
-     </list>
-    </property>
-    <property name="autoStart">
-     <list elementClass="java.net.URL">
-     </list>
-    </property>
   </bean>
 
   <!-- 
@@ -46,6 +47,18 @@
   ********************************
   -->
 
-  <bean name="jboss.osgi:plugin=ClassLoaderFactory" class="org.jboss.osgi.jbossmc.framework.ClassLoaderFactoryPluginImpl"/>
+  <bean name="jboss.osgi:plugin=AutoInstall" class="org.jboss.osgi.jbossmc.framework.plugins.AutoInstallPluginImpl">
+    <property name="autoInstall">
+     <list elementClass="java.net.URL">
+      <value>${test.archive.directory}/bundles/org.osgi.compendium.jar</value>
+     </list>
+    </property>
+    <property name="autoStart">
+     <list elementClass="java.net.URL">
+      <value>${test.archive.directory}/bundles/org.apache.felix.log.jar</value>
+      <value>${test.archive.directory}/bundles/jboss-osgi-common.jar</value>
+     </list>
+    </property>
+  </bean>
   
 </deployment>
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1 +1 @@
-org.jboss.osgi.jbossmc.framework.FrameworkBootstrapProvider
\ No newline at end of file
+org.jboss.osgi.jbossmc.framework.launch.FrameworkBootstrapProvider
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-framework.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-framework.xml	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-framework.xml	2009-08-20 16:35:19 UTC (rev 92613)
@@ -15,27 +15,59 @@
   -->
 
   <!-- The OSGi Framework Factory -->
-  <bean name="jboss.osgi:service=FrameworkFactory" class="org.jboss.osgi.jbossmc.framework.FrameworkFactoryBean">
+  <bean name="jboss.osgi:service=FrameworkFactory" class="org.jboss.osgi.jbossmc.framework.launch.FrameworkFactoryBean">
     <property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
     <property name="properties">
       <map keyClass="java.lang.String" valueClass="java.lang.String">
         <entry><key>org.osgi.framework.storage</key><value>${log4j.output.dir}/osgi-store</value></entry>
         <entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
+        <entry>
+          <key>org.osgi.framework.system.packages.extra</key>
+          <value>
+            <!-- system -->
+            javax.xml.bind.annotation;version=2.1,
+            org.apache.xerces.dom;version=2.9,
+            
+            <!-- jboss-osgi -->
+            org.jboss.osgi.jmx;version=1.0,
+            org.jboss.osgi.jndi;version=1.0,
+            org.jboss.osgi.microcontainer;version=1.0,
+            org.jboss.osgi.spi;version=1.0,
+            org.jboss.osgi.spi.capability;version=1.0,
+            org.jboss.osgi.spi.logging;version=1.0,
+            org.jboss.osgi.spi.management;version=1.0,
+            org.jboss.osgi.spi.service;version=1.0,
+            org.jboss.osgi.spi.testing;version=1.0,
+            org.jboss.osgi.spi.util;version=1.0, 
+            org.jboss.osgi.xml;version=1.0,
+            
+            <!-- jboss -->
+            org.jboss.beans.metadata.plugins;version=2.0,
+            org.jboss.beans.metadata.plugins.builder;version=2.0,
+            org.jboss.beans.metadata.spi.builder;version=2.0,
+            org.jboss.beans.metadata.spi;version=2.0,
+            org.jboss.dependency.spi;version=2.0,
+            org.jboss.kernel.spi.dependency;version=2.0,
+            org.jboss.logging,
+            org.jboss.reflect.spi;version=2.0,
+            org.jboss.util.xml;version=2.2,
+            org.jboss.virtual,
+            org.jboss.virtual.plugins.registry,
+            org.jboss.virtual.plugins.context.jar,
+            org.jboss.virtual.plugins.vfs.helpers,
+            org.jboss.virtual.protocol,
+            org.jboss.xb.annotations;version=2.0,
+            org.jboss.xb.binding;version=2.0,
+            org.jboss.xb.binding.sunday.unmarshalling;version=2.0,
+          </value>
+        </entry>
       </map>
     </property>
     <property name="plugins">
       <list elementClass="org.jboss.osgi.jbossmc.api.AbstractPlugin">
-        <inject bean="jboss.osgi:plugin=ClassLoaderFactory"/>
+        <inject bean="jboss.osgi:plugin=AutoInstall"/>
       </list>
     </property>
-    <property name="autoInstall">
-     <list elementClass="java.net.URL">
-     </list>
-    </property>
-    <property name="autoStart">
-     <list elementClass="java.net.URL">
-     </list>
-    </property>
   </bean>
 
   <!-- 
@@ -45,7 +77,19 @@
   *                              *
   ********************************
   -->
-
-  <bean name="jboss.osgi:plugin=ClassLoaderFactory" class="org.jboss.osgi.jbossmc.framework.ClassLoaderFactoryPluginImpl"/>
   
+  <bean name="jboss.osgi:plugin=AutoInstall" class="org.jboss.osgi.jbossmc.framework.plugins.AutoInstallPluginImpl">
+    <property name="autoInstall">
+     <list elementClass="java.net.URL">
+      <value>${test.archive.directory}/bundles/org.osgi.compendium.jar</value>
+     </list>
+    </property>
+    <property name="autoStart">
+     <list elementClass="java.net.URL">
+      <value>${test.archive.directory}/bundles/org.apache.felix.log.jar</value>
+      <value>${test.archive.directory}/bundles/jboss-osgi-common.jar</value>
+     </list>
+    </property>
+  </bean>
+  
 </deployment>
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	2009-08-20 16:35:19 UTC (rev 92613)
@@ -1,2 +1,2 @@
-org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
-org.jboss.osgi.jbossmc.framework.FrameworkBootstrapProvider
\ No newline at end of file
+org.jboss.osgi.jbossmc.framework.launch.FrameworkBootstrapProvider
+org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml	2009-08-20 15:20:10 UTC (rev 92612)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml	2009-08-20 16:35:19 UTC (rev 92613)
@@ -185,9 +185,6 @@
       </activation>
       
       <!-- default to jbossmc 
-      <properties>
-        <jboss.osgi.framework.properties>jboss-osgi-jbossmc.properties</jboss.osgi.framework.properties>
-      </properties>
       <dependencies>
         <dependency>
           <groupId>org.jboss.osgi.runtime</groupId>




More information about the jboss-cvs-commits mailing list