[jboss-cvs] JBossAS SVN: r92604 - in projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main: java/org/jboss/osgi/jbossmc/framework and 1 other directories.

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


Author: thomas.diesler at jboss.com
Date: 2009-08-20 04:40:11 -0400 (Thu, 20 Aug 2009)
New Revision: 92604

Added:
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/AbstractPlugin.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleEventsPlugin.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleFactoryPlugin.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleLifecyclePlugin.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleRegistryPlugin.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleResolverPlugin.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleStoragePlugin.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/api/FrameworkEventsPlugin.java
   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/ServiceEventsPlugin.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceRegistryPlugin.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/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/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
Removed:
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleClassLoader.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleEventManager.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleFactory.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleLifecycle.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundlePersistentStorage.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleRegistry.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleResolver.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkBootstrap.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkEventManager.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceEventManager.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceRegistry.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleClassLoaderImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventManagerImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleFactoryImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleLifecycleImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundlePersistentStorageImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleRegistryImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleResolverImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkBootstrapImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventManagerImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventManagerImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryImpl.java
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/BundleImpl.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/FrameworkImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistrationImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/resources/META-INF/jboss-osgi-framework.xml
Log:
Use framework plugins

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/AbstractPlugin.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/AbstractPlugin.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/AbstractPlugin.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,41 @@
+/*
+ * 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.launch.Framework;
+
+/**
+ * The base of all framework plugins
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 20-Aug-2009
+ */
+public interface AbstractPlugin 
+{
+   Framework getFramework();
+   
+   void setFramework(Framework framework);
+
+   <T extends AbstractPlugin> T getPlugin(Class<T> pluginClass);
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleClassLoader.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleClassLoader.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleClassLoader.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,43 +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;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-
-// $Id: $
-
-/**
- * An abstraction of a bundle class loader.
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public interface BundleClassLoader
-{
-   Class<?> loadClass(String name) throws ClassNotFoundException;
-
-   URL getResource(String name);
-
-   Enumeration<URL> getResources(String name) throws IOException;
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleEventManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleEventManager.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleEventManager.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,44 +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;
-
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-
-//$Id: $
-
-/**
- * An abstraction of a bundle event manager.
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public interface BundleEventManager
-{
-   void fireBundleEvent(BundleEvent event);
-
-   void addBundleListener(BundleListener listener);
-
-   void removeBundleListener(BundleListener listener);
-
-   void setEnabled(boolean enabled);
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleEventsPlugin.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleEventManager.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleEventsPlugin.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleEventsPlugin.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,44 @@
+/*
+ * 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.BundleEvent;
+import org.osgi.framework.BundleListener;
+
+//$Id: $
+
+/**
+ * An abstraction of a bundle event manager.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface BundleEventsPlugin extends AbstractPlugin
+{
+   void fireBundleEvent(BundleEvent event);
+
+   void addBundleListener(BundleListener listener);
+
+   void removeBundleListener(BundleListener listener);
+
+   void setEnabled(boolean enabled);
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleFactory.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleFactory.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleFactory.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,42 +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.jboss.virtual.VirtualFile;
-import org.osgi.framework.Bundle;
-
-/**
- * An abstraction of a bundle factory.
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public interface BundleFactory 
-{
-   String getVirtualLocation(String location);
-   
-   VirtualFile getVirtualFile(String location);
-   
-   Bundle createBundle(String location);
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleFactoryPlugin.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleFactory.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleFactoryPlugin.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleFactoryPlugin.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,42 @@
+/*
+ * 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.jboss.virtual.VirtualFile;
+import org.osgi.framework.Bundle;
+
+/**
+ * An abstraction of a bundle factory.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface BundleFactoryPlugin extends AbstractPlugin 
+{
+   String getVirtualLocation(String location);
+   
+   VirtualFile getVirtualFile(String location);
+   
+   Bundle createBundle(String location);
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleLifecycle.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleLifecycle.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleLifecycle.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,41 +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.BundleException;
-
-/**
- * An abstraction the OSGi bundle lifecycle
- * 
- * @author thomas.diesler at jboss.com
- * @since 29-Jul-2009
- */
-public interface BundleLifecycle 
-{
-   void start(int options) throws BundleException;
-
-   void stop(int options) throws BundleException;
-
-   void uninstall() throws BundleException;
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleLifecyclePlugin.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleLifecycle.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleLifecyclePlugin.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleLifecyclePlugin.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,42 @@
+/*
+ * 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;
+import org.osgi.framework.BundleException;
+
+/**
+ * An abstraction the OSGi bundle lifecycle
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 29-Jul-2009
+ */
+public interface BundleLifecyclePlugin extends AbstractPlugin 
+{
+   void start(Bundle bundle, int options) throws BundleException;
+
+   void stop(Bundle bundle, int options) throws BundleException;
+
+   void uninstall(Bundle bundle) throws BundleException;
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundlePersistentStorage.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundlePersistentStorage.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundlePersistentStorage.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,39 +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 java.io.File;
-
-import org.osgi.framework.Bundle;
-
-/**
- * An abstraction of a bundle persistent storage system.
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public interface BundlePersistentStorage 
-{
-   File getDataFile(Bundle bundle, String filename);
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleRegistry.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleRegistry.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleRegistry.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,47 +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 java.util.List;
-
-import org.osgi.framework.Bundle;
-
-/**
- * An abstraction of a bundle registry.
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public interface BundleRegistry 
-{
-   long registerBundle(Bundle bundle);
-   
-   void unregisterBundle(Bundle bundle);
-
-   Bundle getBundleById(long id);
-
-   Bundle getBundleByLocation(String location);
-   
-   List<Bundle> getBundles();
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleRegistryPlugin.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleRegistry.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleRegistryPlugin.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleRegistryPlugin.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,47 @@
+/*
+ * 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 java.util.List;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * An abstraction of a bundle registry.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface BundleRegistryPlugin extends AbstractPlugin
+{
+   long registerBundle(Bundle bundle);
+   
+   void unregisterBundle(Bundle bundle);
+
+   Bundle getBundleById(long id);
+
+   Bundle getBundleByLocation(String location);
+   
+   List<Bundle> getBundles();
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleResolver.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleResolver.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleResolver.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,38 +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;
-import org.osgi.framework.BundleException;
-
-/**
- * An abstraction of a bundle resolver.
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public interface BundleResolver 
-{
-   void resolveBundle(Bundle bundle) throws BundleException;
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleResolverPlugin.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleResolver.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleResolverPlugin.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleResolverPlugin.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,38 @@
+/*
+ * 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;
+import org.osgi.framework.BundleException;
+
+/**
+ * An abstraction of a bundle resolver.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface BundleResolverPlugin extends AbstractPlugin 
+{
+   void resolveBundle(Bundle bundle) throws BundleException;
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleStoragePlugin.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundlePersistentStorage.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleStoragePlugin.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleStoragePlugin.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,39 @@
+/*
+ * 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 java.io.File;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * An abstraction of a bundle persistent storage system.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface BundleStoragePlugin extends AbstractPlugin 
+{
+   File getDataFile(Bundle bundle, String filename);
+}
\ No newline at end of file

Added: 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 08:40:11 UTC (rev 92604)
@@ -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

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkBootstrap.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkBootstrap.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkBootstrap.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,39 +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.launch.Framework;
-
-/**
- * An abstration of a bootstrap bean that can provide an OSGi Framework. 
- * 
- * @author thomas.diesler at jboss.com
- * @since 29-Jul-2009
- */
-public interface FrameworkBootstrap
-{
-   public static final String BEAN_FRAMEWORK_BOOTSTRAP = "jboss.osgi:service=FrameworkBootstrap";
-
-   Framework getFramework();
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkEventManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkEventManager.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkEventManager.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,44 +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.FrameworkEvent;
-import org.osgi.framework.FrameworkListener;
-
-/**
- * An abstraction of a framework event manager.
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public interface FrameworkEventManager
-{
-   void fireFrameworkEvent(FrameworkEvent event);
-
-   void addFrameworkListener(FrameworkListener listener);
-
-   void removeFrameworkListener(FrameworkListener listener);
-
-   void setEnabled(boolean enabled);
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkEventsPlugin.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkEventManager.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkEventsPlugin.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkEventsPlugin.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,44 @@
+/*
+ * 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.FrameworkEvent;
+import org.osgi.framework.FrameworkListener;
+
+/**
+ * An abstraction of a framework event manager.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface FrameworkEventsPlugin extends AbstractPlugin
+{
+   void fireFrameworkEvent(FrameworkEvent event);
+
+   void addFrameworkListener(FrameworkListener listener);
+
+   void removeFrameworkListener(FrameworkListener listener);
+
+   void setEnabled(boolean enabled);
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/RuntimeClassLoader.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleClassLoader.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/RuntimeClassLoader.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/RuntimeClassLoader.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,43 @@
+/*
+ * 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 java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+
+// $Id: $
+
+/**
+ * An abstraction of a bundle class loader.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface RuntimeClassLoader 
+{
+   Class<?> loadClass(String name) throws ClassNotFoundException;
+
+   URL getResource(String name);
+
+   Enumeration<URL> getResources(String name) throws IOException;
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceEventManager.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceEventManager.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceEventManager.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,46 +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.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-
-/**
- * An abstraction of a service event manager.
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public interface ServiceEventManager
-{
-   void fireServiceEvent(ServiceEvent event);
-
-   void addServiceListener(ServiceListener listener);
-
-   void addServiceListener(ServiceListener listener, String filter);
-
-   void removeServiceListener(ServiceListener listener);
-   
-   void setEnabled(boolean enabled);
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceEventsPlugin.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceEventManager.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceEventsPlugin.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceEventsPlugin.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,46 @@
+/*
+ * 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.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+
+/**
+ * An abstraction of a service event manager.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface ServiceEventsPlugin extends AbstractPlugin
+{
+   void fireServiceEvent(ServiceEvent event);
+
+   void addServiceListener(ServiceListener listener);
+
+   void addServiceListener(ServiceListener listener, String filter);
+
+   void removeServiceListener(ServiceListener listener);
+   
+   void setEnabled(boolean enabled);
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceRegistry.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceRegistry.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceRegistry.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,54 +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 java.util.Dictionary;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * An abstraction of a service registry.
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public interface ServiceRegistry 
-{
-   ServiceRegistration registerService(Bundle bundle, String[] clazzes, Object service, Dictionary<String, Object> properties);
-   
-   ServiceRegistration registerService(Bundle bundle, String clazz, Object service, Dictionary<String, Object> properties);
-
-   void unregisterService(ServiceRegistration registration);
-
-   ServiceReference getServiceReference(String clazz);
-
-   ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException;
-
-   Object getService(Bundle bundle, ServiceReference sref);
-
-   boolean ungetService(Bundle bundle, ServiceReference reference);
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceRegistryPlugin.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceRegistry.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceRegistryPlugin.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceRegistryPlugin.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,54 @@
+/*
+ * 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 java.util.Dictionary;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * An abstraction of a service registry.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface ServiceRegistryPlugin extends AbstractPlugin
+{
+   ServiceRegistration registerService(Bundle bundle, String[] clazzes, Object service, Dictionary<String, Object> properties);
+   
+   ServiceRegistration registerService(Bundle bundle, String clazz, Object service, Dictionary<String, Object> properties);
+
+   void unregisterService(ServiceRegistration registration);
+
+   ServiceReference getServiceReference(String clazz);
+
+   ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException;
+
+   Object getService(Bundle bundle, ServiceReference sref);
+
+   boolean ungetService(Bundle bundle, ServiceReference reference);
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/AbstractPluginImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,54 @@
+/*
+ * 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> pluginClass)
+   {
+      FrameworkImpl frameworkImpl = (FrameworkImpl)framework;
+      return frameworkImpl.getPlugin(pluginClass);
+   }
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleClassLoaderImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleClassLoaderImpl.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleClassLoaderImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -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.BundleClassLoader;
-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 BundleClassLoaderImpl implements BundleClassLoader
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(BundleClassLoaderImpl.class);
-
-   private VirtualFile virtualFile;
-   private ClassLoader loader;
-
-   public BundleClassLoaderImpl(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

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 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleContextImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -32,13 +32,13 @@
 import java.util.List;
 
 import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.BundleEventManager;
-import org.jboss.osgi.jbossmc.api.BundleFactory;
-import org.jboss.osgi.jbossmc.api.BundlePersistentStorage;
-import org.jboss.osgi.jbossmc.api.BundleRegistry;
-import org.jboss.osgi.jbossmc.api.FrameworkEventManager;
-import org.jboss.osgi.jbossmc.api.ServiceEventManager;
-import org.jboss.osgi.jbossmc.api.ServiceRegistry;
+import org.jboss.osgi.jbossmc.api.BundleEventsPlugin;
+import org.jboss.osgi.jbossmc.api.BundleFactoryPlugin;
+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.ServiceEventsPlugin;
+import org.jboss.osgi.jbossmc.api.ServiceRegistryPlugin;
 import org.jboss.osgi.spi.NotImplementedException;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -52,6 +52,7 @@
 import org.osgi.framework.ServiceListener;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.launch.Framework;
 
 /**
  * An implementation of an OSGi BundleContext
@@ -64,14 +65,14 @@
    // Provide logging
    final Logger log = Logger.getLogger(BundleContextImpl.class);
 
-   private FrameworkImpl framework;
+   private Framework framework;
    private Bundle bundle;
    
    private List<EventListener> registeredListeners = new ArrayList<EventListener>();
    private List<ServiceRegistration> registeredServices = new ArrayList<ServiceRegistration>();
    private List<ServiceReference> usedServices = new ArrayList<ServiceReference>();
    
-   public BundleContextImpl(FrameworkImpl framework, Bundle bundle)
+   public BundleContextImpl(Framework framework, Bundle bundle)
    {
       this.framework = framework;
       this.bundle = bundle;
@@ -79,54 +80,54 @@
 
    public FrameworkImpl getFramework()
    {
-      return framework;
+      return (FrameworkImpl)framework;
    }
-
+   
    public void addBundleListener(BundleListener listener)
    {
-      BundleEventManager eventManager = getFramework().getBundleEventManager();
+      BundleEventsPlugin eventManager = getFramework().getPlugin(BundleEventsPlugin.class);
       eventManager.addBundleListener(listener);
       registeredListeners.add(listener);
    }
 
    public void removeBundleListener(BundleListener listener)
    {
-      BundleEventManager eventManager = getFramework().getBundleEventManager();
+      BundleEventsPlugin eventManager = getFramework().getPlugin(BundleEventsPlugin.class);
       eventManager.removeBundleListener(listener);
       registeredListeners.remove(listener);
    }
 
    public void addFrameworkListener(FrameworkListener listener)
    {
-      FrameworkEventManager eventManager = getFramework().getFrameworkEventManager();
+      FrameworkEventsPlugin eventManager = getFramework().getPlugin(FrameworkEventsPlugin.class);
       eventManager.addFrameworkListener(listener);
       registeredListeners.add(listener);
    }
 
    public void removeFrameworkListener(FrameworkListener listener)
    {
-      FrameworkEventManager eventManager = getFramework().getFrameworkEventManager();
+      FrameworkEventsPlugin eventManager = getFramework().getPlugin(FrameworkEventsPlugin.class);
       eventManager.removeFrameworkListener(listener);
       registeredListeners.remove(listener);
    }
 
    public void addServiceListener(ServiceListener listener)
    {
-      ServiceEventManager eventManager = getFramework().getServiceEventManager();
+      ServiceEventsPlugin eventManager = getFramework().getPlugin(ServiceEventsPlugin.class);
       eventManager.addServiceListener(listener);
       registeredListeners.add(listener);
    }
 
    public void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException
    {
-      ServiceEventManager eventManager = getFramework().getServiceEventManager();
+      ServiceEventsPlugin eventManager = getFramework().getPlugin(ServiceEventsPlugin.class);
       eventManager.addServiceListener(listener, filter);
       registeredListeners.add(listener);
    }
 
    public void removeServiceListener(ServiceListener listener)
    {
-      ServiceEventManager eventManager = getFramework().getServiceEventManager();
+      ServiceEventsPlugin eventManager = getFramework().getPlugin(ServiceEventsPlugin.class);
       eventManager.removeServiceListener(listener);
       registeredListeners.remove(listener);
    }
@@ -143,13 +144,13 @@
 
    public Bundle getBundle(long id)
    {
-      BundleRegistry bundleRegistry = getFramework().getBundleRegistry();
+      BundleRegistryPlugin bundleRegistry = getFramework().getPlugin(BundleRegistryPlugin.class);
       return bundleRegistry.getBundleById(id);
    }
 
    public Bundle[] getBundles()
    {
-      BundleRegistry bundleRegistry = getFramework().getBundleRegistry();
+      BundleRegistryPlugin bundleRegistry = getFramework().getPlugin(BundleRegistryPlugin.class);
       List<Bundle> bundleList = bundleRegistry.getBundles();
       Bundle[] bundles = new Bundle[bundleList.size()];
       return bundleList.toArray(bundles);
@@ -157,7 +158,7 @@
 
    public File getDataFile(String filename)
    {
-      BundlePersistentStorage bundleStorage = getFramework().getBundlePersistentStorage();
+      BundleStoragePlugin bundleStorage = getFramework().getPlugin(BundleStoragePlugin.class);
       return bundleStorage.getDataFile(bundle, filename);
    }
 
@@ -172,7 +173,7 @@
 
    public Object getService(ServiceReference reference)
    {
-      ServiceRegistry serviceRegistry = getFramework().getServiceRegistry();
+      ServiceRegistryPlugin serviceRegistry = getFramework().getPlugin(ServiceRegistryPlugin.class);
       Object service = serviceRegistry.getService(bundle, reference);
       if (service != null)
       {
@@ -183,19 +184,19 @@
 
    public boolean ungetService(ServiceReference reference)
    {
-      ServiceRegistry serviceRegistry = getFramework().getServiceRegistry();
+      ServiceRegistryPlugin serviceRegistry = getFramework().getPlugin(ServiceRegistryPlugin.class);
       return serviceRegistry.ungetService(bundle, reference);
    }
    
    public ServiceReference getServiceReference(String clazz)
    {
-      ServiceRegistry serviceRegistry = getFramework().getServiceRegistry();
+      ServiceRegistryPlugin serviceRegistry = getFramework().getPlugin(ServiceRegistryPlugin.class);
       return serviceRegistry.getServiceReference(clazz);
    }
 
    public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException
    {
-      ServiceRegistry serviceRegistry = getFramework().getServiceRegistry();
+      ServiceRegistryPlugin serviceRegistry = getFramework().getPlugin(ServiceRegistryPlugin.class);
       return serviceRegistry.getServiceReferences(clazz, filter);
    }
 
@@ -208,11 +209,11 @@
    public Bundle installBundle(String location) throws BundleException
    {
       // Convert location to a virtual file URL
-      BundleFactory bundleFactory = getFramework().getBundleFactory();
+      BundleFactoryPlugin bundleFactory = getFramework().getPlugin(BundleFactoryPlugin.class);
       location = bundleFactory.getVirtualLocation(location); 
       
       // 1.  If a bundle containing the same location identifier is already installed, the Bundle object for that bundle is returned.
-      BundleRegistry bundleRegistry = getFramework().getBundleRegistry();
+      BundleRegistryPlugin bundleRegistry = getFramework().getPlugin(BundleRegistryPlugin.class);
       Bundle bundle = bundleRegistry.getBundleByLocation(location);
       if (bundle != null)
          return bundle;
@@ -227,7 +228,7 @@
       bundleImpl.setState(Bundle.INSTALLED);
       
       // 5. A bundle event of type BundleEvent.INSTALLED is fired.
-      BundleEventManager eventManager = getFramework().getBundleEventManager();
+      BundleEventsPlugin eventManager = getFramework().getPlugin(BundleEventsPlugin.class);
       eventManager.fireBundleEvent(new BundleEvent(BundleEvent.INSTALLED, bundle));
       
       // 6. The Bundle object for the newly or previously installed bundle is returned. 
@@ -243,8 +244,8 @@
    @SuppressWarnings("unchecked")
    public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties)
    {
-      ServiceRegistry registry = getFramework().getServiceRegistry();
-      ServiceRegistration sreg = registry.registerService(bundle, clazzes, service, properties);
+      ServiceRegistryPlugin serviceRegistry = getFramework().getPlugin(ServiceRegistryPlugin.class);
+      ServiceRegistration sreg = serviceRegistry.registerService(bundle, clazzes, service, properties);
       registeredServices.add(sreg);
       return sreg;
    }
@@ -252,8 +253,8 @@
    @SuppressWarnings("unchecked")
    public ServiceRegistration registerService(String clazz, Object service, Dictionary properties)
    {
-      ServiceRegistry registry = getFramework().getServiceRegistry();
-      ServiceRegistration sreg = registry.registerService(bundle, clazz, service, properties);
+      ServiceRegistryPlugin serviceRegistry = getFramework().getPlugin(ServiceRegistryPlugin.class);
+      ServiceRegistration sreg = serviceRegistry.registerService(bundle, clazz, service, properties);
       registeredServices.add(sreg);
       return sreg;
    }

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventManagerImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventManagerImpl.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventManagerImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,87 +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.BundleEventManager;
-import org.jboss.osgi.spi.util.ConstantsHelper;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-
-/**
- * A simple implementation of a BundleEventManager
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class BundleEventManagerImpl implements BundleEventManager
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(BundleEventManagerImpl.class);
-   
-   private List<BundleListener> listeners = new ArrayList<BundleListener>();
-   private boolean enabled = true;
-
-   public BundleEventManagerImpl(FrameworkImpl 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/BundleEventsPluginImpl.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventManagerImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventsPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventsPluginImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -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;
+
+//$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/BundleFactoryImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleFactoryImpl.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleFactoryImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,89 +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.BundleFactory;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Bundle;
-
-/**
- * A simple implementation of a BundleFactory
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class BundleFactoryImpl implements BundleFactory
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(BundleFactoryImpl.class);
-   
-   private FrameworkImpl framework;
-
-   public BundleFactoryImpl(FrameworkImpl framework)
-   {
-      this.framework = framework;
-   }
-
-   public Bundle createBundle(String location)
-   {
-      VirtualFile vfsRoot = getVirtualFile(location);
-      BundleImpl bundle = new BundleImpl(vfsRoot);
-      bundle.setBundleContext(new BundleContextImpl(framework, 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/BundleFactoryPluginImpl.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleFactoryImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleFactoryPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleFactoryPluginImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -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;
+
+//$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 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -37,14 +37,16 @@
 import java.util.jar.Manifest;
 
 import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.BundleClassLoader;
-import org.jboss.osgi.jbossmc.api.BundleLifecycle;
-import org.jboss.osgi.jbossmc.api.BundleResolver;
-import org.jboss.osgi.jbossmc.api.FrameworkEventManager;
+import org.jboss.osgi.jbossmc.api.ClassLoaderFactoryPlugin;
+import org.jboss.osgi.jbossmc.api.RuntimeClassLoader;
+import org.jboss.osgi.jbossmc.api.BundleLifecyclePlugin;
+import org.jboss.osgi.jbossmc.api.BundleResolverPlugin;
+import org.jboss.osgi.jbossmc.api.FrameworkEventsPlugin;
 import org.jboss.osgi.spi.NotImplementedException;
 import org.jboss.virtual.VirtualFile;
 import org.jboss.virtual.VirtualFileFilter;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
@@ -71,22 +73,19 @@
    private long bundleId;
    private BundleContext context;
    private Dictionary<String, String> headers;
-   private BundleLifecycle bundleLifecycle;
-   private BundleClassLoader classLoader;
+   private RuntimeClassLoader runtimeLoader;
+   private BundleActivator activator;
    private String toStringCache;
    
    public BundleImpl()
    {
       // ctor used by the framework
       // [TODO] remove when we have a VFS root for the framework
-
-      this.bundleLifecycle = new BundleLifecycleImpl(this);
    }
 
    public BundleImpl(VirtualFile vFile)
    {
       this.vFile = vFile;
-      this.bundleLifecycle = new BundleLifecycleImpl(this);
    }
 
    public VirtualFile getVirtualFile()
@@ -131,24 +130,35 @@
       return getHeader(Constants.BUNDLE_SYMBOLICNAME);
    }
 
-   public BundleClassLoader getClassLoader()
+   public void start() throws BundleException
    {
-      return classLoader;
+      start(0);
    }
 
-   public void setClassLoader(BundleClassLoader classLoader)
+   public BundleActivator getBundleActivator()
    {
-      this.classLoader = classLoader;
+      return activator;
    }
 
-   public void start() throws BundleException
+   public void setBundleActivator(BundleActivator activator)
    {
-      start(0);
+      this.activator = activator;
    }
 
+   private RuntimeClassLoader getClassLoader()
+   {
+      if (runtimeLoader == null)
+      {
+         ClassLoaderFactoryPlugin factory = getFramework().getPlugin(ClassLoaderFactoryPlugin.class);
+         runtimeLoader = factory.createClassLoader(this);
+      }
+      return runtimeLoader;
+   }
+
    public void start(int options) throws BundleException
    {
-      bundleLifecycle.start(options);
+      BundleLifecyclePlugin bundleLifecycle = getFramework().getPlugin(BundleLifecyclePlugin.class);
+      bundleLifecycle.start(this, options);
    }
 
    public void stop() throws BundleException
@@ -158,12 +168,14 @@
 
    public void stop(int options) throws BundleException
    {
-      bundleLifecycle.stop(options);
+      BundleLifecyclePlugin bundleLifecycle = getFramework().getPlugin(BundleLifecyclePlugin.class);
+      bundleLifecycle.stop(this, options);
    }
 
    public void uninstall() throws BundleException
    {
-      bundleLifecycle.uninstall();
+      BundleLifecyclePlugin bundleLifecycle = getFramework().getPlugin(BundleLifecyclePlugin.class);
+      bundleLifecycle.uninstall(this);
    }
 
    public void update() throws BundleException
@@ -367,7 +379,7 @@
       // before attempting to load the class.
       if (state == Bundle.INSTALLED)
       {
-         BundleResolver resolver = getFramework().getBundleResolver();
+         BundleResolverPlugin resolver = getFramework().getPlugin(BundleResolverPlugin.class);
          try
          {
             resolver.resolveBundle(this);
@@ -375,7 +387,7 @@
          catch (BundleException ex)
          {
             // If this bundle cannot be resolved, a Framework event of type FrameworkEvent.ERROR is fired
-            FrameworkEventManager eventManager = getFramework().getFrameworkEventManager();
+            FrameworkEventsPlugin eventManager = getFramework().getPlugin(FrameworkEventsPlugin.class);
             eventManager.fireFrameworkEvent(new FrameworkEvent(FrameworkEvent.ERROR, this, ex));
 
             throw new ClassNotFoundException("Cannot load class: " + name, ex);

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleLifecycleImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleLifecycleImpl.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleLifecycleImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,258 +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.BundleEventManager;
-import org.jboss.osgi.jbossmc.api.BundleLifecycle;
-import org.jboss.osgi.jbossmc.api.BundleRegistry;
-import org.jboss.osgi.jbossmc.api.BundleResolver;
-import org.jboss.osgi.jbossmc.api.FrameworkEventManager;
-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;
-
-/**
- * An implementation of the OSGi bundle lifecycle
- * 
- * @author thomas.diesler at jboss.com
- * @since 29-Jul-2009
- */
-public class BundleLifecycleImpl implements BundleLifecycle
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(BundleLifecycleImpl.class);
-
-   private Bundle bundle;
-   private BundleActivator activator;
-
-   public BundleLifecycleImpl(Bundle bundle)
-   {
-      this.bundle = bundle;
-   }
-   
-   public void start(int options) throws BundleException
-   {
-      // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
-      if (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 (getState() == Bundle.STARTING || 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 (getState() != Bundle.RESOLVED)
-      {
-         BundleResolver resolver = getFramework().getBundleResolver();
-         resolver.resolveBundle(bundle);
-         
-         BundleEventManager eventManager = getFramework().getBundleEventManager();
-         eventManager.fireBundleEvent(new BundleEvent(BundleEvent.RESOLVED, bundle));
-      }
-
-      // [TODO] Lazy bundle activation
-
-      // This bundle's state is set to STARTING. 
-      setState(Bundle.STARTING);
-
-      // A bundle event of type BundleEvent.STARTING is fired.
-      BundleEventManager eventManager = getFramework().getBundleEventManager();
-      eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STARTING, bundle));
-
-      // The BundleActivator is called
-      String activatorClass = (String)bundle.getHeaders().get(Constants.BUNDLE_ACTIVATOR);
-      if (activatorClass != null)
-      {
-         try
-         {
-            activator = (BundleActivator)bundle.loadClass(activatorClass).newInstance();
-            activator.start(bundle.getBundleContext());
-         }
-         catch (Exception ex)
-         {
-            // This bundle's state is set to STOPPING.
-            setState(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.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 (getState() == Bundle.UNINSTALLED)
-         throw new IllegalStateException("Bundle already uninstalled: " + bundle);
-
-      // This bundle's state is set to ACTIVE
-      setState(Bundle.ACTIVE);
-
-      // A bundle event of type BundleEvent.STARTED is fired
-      eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STARTED, bundle));
-   }
-
-   public void stop(int options) throws BundleException
-   {
-      // 1. If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
-      if (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 (!(getState() == Bundle.STARTING || getState() == Bundle.ACTIVE))
-         return;
-         
-      // 5. This bundle's state is set to STOPPING.
-      int statePriorToStopping = getState();
-      setState(Bundle.STOPPING);
-      
-      // 6. A bundle event of type BundleEvent.STOPPING is fired.
-      BundleEventManager eventManager = getFramework().getBundleEventManager();
-      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;
-      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 (getState() == Bundle.UNINSTALLED)
-         throw new IllegalStateException("Bundle already unistalled: " + bundle);
-      
-      // 12. This bundle's state is set to RESOLVED.
-      setState(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() throws BundleException
-   {
-      // 1. If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
-      if (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 (getState() == Bundle.ACTIVE || getState() == Bundle.STARTING || getState() == Bundle.STOPPING)
-      {
-         try
-         {
-            stop(0);
-         }
-         catch (Exception ex)
-         {
-            // If Bundle.stop throws an exception, a Framework event of type FrameworkEvent.ERROR is fired containing the exception.
-            FrameworkEventManager eventManager = getFramework().getFrameworkEventManager();
-            eventManager.fireFrameworkEvent(new FrameworkEvent(FrameworkEvent.ERROR, bundle, ex));
-         }
-      }
-
-      // 3. This bundle's state is set to UNINSTALLED.
-      setState(Bundle.UNINSTALLED);
-
-      // 4. A bundle event of type BundleEvent.UNINSTALLED is fired.
-      BundleEventManager eventManager = getFramework().getBundleEventManager();
-      eventManager.fireBundleEvent(new BundleEvent(BundleEvent.UNINSTALLED, bundle));
-
-      // 5. This bundle and any persistent storage area provided for this bundle by the Framework are removed.
-      BundleRegistry bundleRegistry = getFramework().getBundleRegistry();
-      bundleRegistry.unregisterBundle(bundle);
-
-      // [TODO] Any persistent storage area provided for this bundle are removed.
-   }
-
-   private int getState()
-   {
-      return bundle.getState();
-   }
-
-   private void setState(int state)
-   {
-      BundleImpl bundleImpl = (BundleImpl)bundle;
-      bundleImpl.setState(state);
-   }
-
-   private FrameworkImpl getFramework()
-   {
-      BundleContextImpl context = (BundleContextImpl)bundle.getBundleContext();
-      return context.getFramework();
-   }
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleLifecyclePluginImpl.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleLifecycleImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleLifecyclePluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleLifecyclePluginImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,254 @@
+/*
+ * 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/BundlePersistentStorageImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundlePersistentStorageImpl.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundlePersistentStorageImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,81 +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.BundlePersistentStorage;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-
-/**
- * A simple implementation of a BundleStorage
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class BundlePersistentStorageImpl implements BundlePersistentStorage
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(BundlePersistentStorageImpl.class);
-   
-   private FrameworkImpl framework;
-
-   public BundlePersistentStorageImpl(FrameworkImpl framework)
-   {
-      this.framework = 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)
-   {
-      String dirName = (String)framework.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/BundleRegistryImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleRegistryImpl.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleRegistryImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,100 +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.BundleRegistry;
-import org.osgi.framework.Bundle;
-
-/**
- * A simple implementation of a BundleRegistry
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class BundleRegistryImpl implements BundleRegistry
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(BundleRegistryImpl.class);
-   
-   private long globalId;
-   private Map<String, Bundle> registry = new LinkedHashMap<String, Bundle>();
-
-   public BundleRegistryImpl(FrameworkImpl 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/BundleRegistryPluginImpl.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleRegistryImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleRegistryPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleRegistryPluginImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,106 @@
+/*
+ * 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/BundleResolverImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleResolverImpl.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleResolverImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,57 +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.BundleClassLoader;
-import org.jboss.osgi.jbossmc.api.BundleResolver;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-/**
- * A simple implementation of a BundleResolver
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class BundleResolverImpl implements BundleResolver
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(BundleResolverImpl.class);
-   
-   public BundleResolverImpl(FrameworkImpl framework)
-   {
-   }
-
-   public void resolveBundle(Bundle bundle) throws BundleException
-   {
-      // [TODO] resolve bundle properly
-      
-      BundleImpl bundleImpl = (BundleImpl)bundle;
-      BundleClassLoader loader = new BundleClassLoaderImpl(bundleImpl);
-      bundleImpl.setClassLoader(loader);
-      
-      bundleImpl.setState(Bundle.RESOLVED);
-   }
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleResolverPluginImpl.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleResolverImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleResolverPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleResolverPluginImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,60 @@
+/*
+ * 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

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleStoragePluginImpl.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundlePersistentStorageImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleStoragePluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleStoragePluginImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -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;
+
+//$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

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ClassLoaderFactoryPluginImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,52 @@
+/*
+ * 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/FrameworkBootstrapImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkBootstrapImpl.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkBootstrapImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,139 +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.logging.Logger;
-import org.jboss.osgi.jbossmc.api.BundleEventManager;
-import org.jboss.osgi.jbossmc.api.BundleFactory;
-import org.jboss.osgi.jbossmc.api.BundlePersistentStorage;
-import org.jboss.osgi.jbossmc.api.BundleRegistry;
-import org.jboss.osgi.jbossmc.api.BundleResolver;
-import org.jboss.osgi.jbossmc.api.FrameworkBootstrap;
-import org.jboss.osgi.jbossmc.api.FrameworkEventManager;
-import org.jboss.osgi.jbossmc.api.ServiceEventManager;
-import org.jboss.osgi.jbossmc.api.ServiceRegistry;
-import org.osgi.framework.launch.Framework;
-
-/**
- * An implementation of a bootstrap bean that can provide an OSGi Framework. 
- * 
- * @author thomas.diesler at jboss.com
- * @since 29-Jul-2009
- */
-public class FrameworkBootstrapImpl implements FrameworkBootstrap
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(FrameworkBootstrapImpl.class);
-
-   private Map<String, Object> properties;
-   private List<URL> autoInstall;
-   private List<URL> autoStart;
-   private Framework framework;
-
-   private BundleRegistry bundleRegistry;
-   private BundleFactory bundleFactory;
-   private BundleResolver bundleResolver;
-   private BundleEventManager bundleEventManager;
-   private BundlePersistentStorage bundlePersistentStorage;
-   private FrameworkEventManager frameworkEventManager;
-   private ServiceEventManager serviceEventManager;
-   private ServiceRegistry serviceRegistry;
-   
-   public void setProperties(Map<String, Object> properties)
-   {
-      this.properties = properties;
-   }
-
-   public void setAutoInstall(List<URL> autoInstall)
-   {
-      this.autoInstall = autoInstall;
-   }
-
-   public void setAutoStart(List<URL> autoStart)
-   {
-      this.autoStart = autoStart;
-   }
-
-   public void setBundleRegistry(BundleRegistry bundleRegistry)
-   {
-      this.bundleRegistry = bundleRegistry;
-   }
-
-   public void setBundleFactory(BundleFactory bundleFactory)
-   {
-      this.bundleFactory = bundleFactory;
-   }
-
-   public void setBundleResolver(BundleResolver bundleResolver)
-   {
-      this.bundleResolver = bundleResolver;
-   }
-
-   public void setBundleEventManager(BundleEventManager bundleEventManager)
-   {
-      this.bundleEventManager = bundleEventManager;
-   }
-
-   public void setBundlePersistentStorage(BundlePersistentStorage bundlePersistentStorage)
-   {
-      this.bundlePersistentStorage = bundlePersistentStorage;
-   }
-
-   public void setServiceEventManager(ServiceEventManager serviceEventManager)
-   {
-      this.serviceEventManager = serviceEventManager;
-   }
-
-   public void setServiceRegistry(ServiceRegistry serviceRegistry)
-   {
-      this.serviceRegistry = serviceRegistry;
-   }
-
-   public void setFrameworkEventManager(FrameworkEventManager frameworkEventManager)
-   {
-      this.frameworkEventManager = frameworkEventManager;
-   }
-
-   public Framework getFramework()
-   {
-      if (framework == null)
-      {
-         FrameworkImpl frameworkImpl = new FrameworkImpl(properties);
-         frameworkImpl.setBundleFactory(bundleFactory);
-         frameworkImpl.setBundleResolver(bundleResolver);
-         frameworkImpl.setBundleRegistry(bundleRegistry);
-         frameworkImpl.setBundlePersistentStorage(bundlePersistentStorage);
-         frameworkImpl.setServiceRegistry(serviceRegistry);
-         frameworkImpl.setBundleEventManager(bundleEventManager);
-         frameworkImpl.setFrameworkEventManager(frameworkEventManager);
-         frameworkImpl.setServiceEventManager(serviceEventManager);
-         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/FrameworkEventManagerImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventManagerImpl.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventManagerImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -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.util.ArrayList;
-import java.util.List;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.FrameworkEventManager;
-import org.jboss.osgi.spi.util.ConstantsHelper;
-import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.FrameworkListener;
-
-/**
- * A simple implementation of a FrameworkEventManager
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class FrameworkEventManagerImpl implements FrameworkEventManager
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(FrameworkEventManagerImpl.class);
-   
-   private List<FrameworkListener> listeners = new ArrayList<FrameworkListener>();
-   private boolean enabled = true;
-
-   public FrameworkEventManagerImpl(FrameworkImpl 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/FrameworkEventsPluginImpl.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventManagerImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventsPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventsPluginImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -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;
+
+//$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/FrameworkFactoryBean.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkBootstrapImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkFactoryBean.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkFactoryBean.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,80 @@
+/*
+ * 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.logging.Logger;
+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<URL> autoInstall;
+   private List<URL> autoStart;
+   private Framework framework;
+
+   public void setProperties(Map<String, Object> properties)
+   {
+      this.properties = properties;
+   }
+
+   public void setAutoInstall(List<URL> autoInstall)
+   {
+      this.autoInstall = autoInstall;
+   }
+
+   public void setAutoStart(List<URL> autoStart)
+   {
+      this.autoStart = autoStart;
+   }
+
+   @SuppressWarnings("unchecked")
+   public Framework newFramework(Map configuration)
+   {
+      if (framework == null)
+      {
+         if (configuration != null)
+            properties.putAll(configuration);
+         
+         FrameworkImpl frameworkImpl = new FrameworkImpl(properties);
+         framework = frameworkImpl;
+      }
+      return framework;
+   }
+}
\ No newline at end of file

Modified: 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 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkFactoryImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -32,7 +32,6 @@
 import org.jboss.bootstrap.spi.mc.server.MCServer;
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.FrameworkBootstrap;
 import org.osgi.framework.launch.Framework;
 import org.osgi.framework.launch.FrameworkFactory;
 
@@ -69,12 +68,12 @@
          throw new IllegalStateException("Cannot bootstrap MC server", ex);
       }
 
-      ControllerContext context = server.getKernel().getController().getInstalledContext(FrameworkBootstrap.BEAN_FRAMEWORK_BOOTSTRAP);
+      ControllerContext context = server.getKernel().getController().getInstalledContext(FrameworkFactoryBean.BEAN_FRAMEWORK_FACTORY);
       if (context == null)
-         throw new IllegalStateException("Cannot obtain: " + FrameworkBootstrap.BEAN_FRAMEWORK_BOOTSTRAP);
+         throw new IllegalStateException("Cannot obtain: " + FrameworkFactoryBean.BEAN_FRAMEWORK_FACTORY);
       
-      FrameworkBootstrap frameworkBootstrap =  (FrameworkBootstrap)context.getTarget();
-      return frameworkBootstrap.getFramework();
+      FrameworkFactory frameworkBootstrap =  (FrameworkFactory)context.getTarget();
+      return frameworkBootstrap.newFramework(configuration);
    }
    
    private String getBootstrapHome()

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 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -31,14 +31,12 @@
 import java.util.Map;
 
 import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.BundleEventManager;
-import org.jboss.osgi.jbossmc.api.BundleFactory;
-import org.jboss.osgi.jbossmc.api.BundlePersistentStorage;
-import org.jboss.osgi.jbossmc.api.BundleRegistry;
-import org.jboss.osgi.jbossmc.api.BundleResolver;
-import org.jboss.osgi.jbossmc.api.FrameworkEventManager;
-import org.jboss.osgi.jbossmc.api.ServiceEventManager;
-import org.jboss.osgi.jbossmc.api.ServiceRegistry;
+import org.jboss.osgi.jbossmc.api.AbstractPlugin;
+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.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.FrameworkEvent;
@@ -60,96 +58,42 @@
    private Map<String, Object> properties = new HashMap<String, Object>();
    private int startLevel;
 
-   private BundleRegistry bundleRegistry;
-   private BundleFactory bundleFactory;
-   private BundleResolver bundleResolver;
-   private BundleEventManager bundleEventManager;
-   private BundlePersistentStorage bundlePersistentStorage;
-   private FrameworkEventManager frameworkEventManager;
-   private ServiceEventManager serviceEventManager;
-   private ServiceRegistry serviceRegistry;
+   private Map<Class<?>, AbstractPlugin> plugins = new HashMap<Class<?>, AbstractPlugin>();
 
    public FrameworkImpl(Map<String, Object> props)
    {
       if (props != null)
          properties.putAll(props);
-   }
+      
+      addPlugin(new BundleEventsPluginImpl(this));
+      addPlugin(new BundleFactoryPluginImpl(this));
+      addPlugin(new BundleLifecyclePluginImpl(this));
+      addPlugin(new BundleResolverPluginImpl(this));
+      addPlugin(new BundleRegistryPluginImpl(this));
+      addPlugin(new BundleStoragePluginImpl(this));
+      addPlugin(new ClassLoaderFactoryPluginImpl(this));
+      addPlugin(new FrameworkEventsPluginImpl(this));
+      addPlugin(new ServiceEventsPluginImpl(this));
+      addPlugin(new ServiceRegistryPluginImpl(this));
 
-   public BundleRegistry getBundleRegistry()
-   {
-      return bundleRegistry;
    }
 
-   public void setBundleRegistry(BundleRegistry bundleRegistry)
+   @SuppressWarnings("unchecked")
+   public <T extends AbstractPlugin> T getPlugin(Class<T> clazz)
    {
-      this.bundleRegistry = bundleRegistry;
+      return (T)plugins.get(clazz);
    }
-
-   public BundleFactory getBundleFactory()
+   
+   @SuppressWarnings("unchecked")
+   public void addPlugin(AbstractPlugin plugin)
    {
-      return bundleFactory;
+      for (Class<?> interf : plugin.getClass().getInterfaces())
+      {
+         if (AbstractPlugin.class.isAssignableFrom(interf))
+            plugins.put(interf, plugin);
+      }
    }
-
-   public void setBundleFactory(BundleFactory bundleFactory)
-   {
-      this.bundleFactory = bundleFactory;
-   }
-
-   public BundleResolver getBundleResolver()
-   {
-      return bundleResolver;
-   }
-
-   public void setBundleResolver(BundleResolver bundleResolver)
-   {
-      this.bundleResolver = bundleResolver;
-   }
-
-   public BundleEventManager getBundleEventManager()
-   {
-      return bundleEventManager;
-   }
-
-   public void setBundleEventManager(BundleEventManager bundleEventManager)
-   {
-      this.bundleEventManager = bundleEventManager;
-   }
-
-   public BundlePersistentStorage getBundlePersistentStorage()
-   {
-      return bundlePersistentStorage;
-   }
-
-   public void setBundlePersistentStorage(BundlePersistentStorage bundlePersistentStorage)
-   {
-      this.bundlePersistentStorage = bundlePersistentStorage;
-   }
-
-   public ServiceEventManager getServiceEventManager()
-   {
-      return serviceEventManager;
-   }
-
-   public void setServiceEventManager(ServiceEventManager serviceEventManager)
-   {
-      this.serviceEventManager = serviceEventManager;
-   }
-
-   public ServiceRegistry getServiceRegistry()
-   {
-      return serviceRegistry;
-   }
-
-   public void setServiceRegistry(ServiceRegistry serviceRegistry)
-   {
-      this.serviceRegistry = serviceRegistry;
-   }
-
-   public void setFrameworkEventManager(FrameworkEventManager frameworkEventManager)
-   {
-      this.frameworkEventManager = frameworkEventManager;
-   }
-
+   
    /**
     * Returns the Framework unique identifier. This Framework is assigned the unique identifier zero (0) since this Framework is also a System Bundle.
     */
@@ -275,19 +219,10 @@
       // Have a valid Bundle Context
       setBundleContext(new SystemBundleContext(this));
 
-      bundleFactory = new BundleFactoryImpl(this);
-      bundleResolver = new BundleResolverImpl(this);
-      bundleRegistry = new BundleRegistryImpl(this);
-      bundlePersistentStorage = new BundlePersistentStorageImpl(this);
-      serviceRegistry = new ServiceRegistryImpl(this);
-
       // Be at start level 0
       setStartLevel(0);
 
       // Have event handling enabled
-      bundleEventManager = new BundleEventManagerImpl(this);
-      frameworkEventManager = new FrameworkEventManagerImpl(this);
-      serviceEventManager = new ServiceEventManagerImpl(this);
 
       // [TODO] Have reified Bundle objects for all installed bundles
 
@@ -306,7 +241,8 @@
       setState(ACTIVE);
 
       // A framework event of type STARTED is fired
-      frameworkEventManager.fireFrameworkEvent(new FrameworkEvent(FrameworkEvent.STARTED, this, null));
+      FrameworkEventsPlugin frameworkEvents = getPlugin(FrameworkEventsPlugin.class);
+      frameworkEvents.fireFrameworkEvent(new FrameworkEvent(FrameworkEvent.STARTED, this, null));
    }
 
    private void stopInternal()
@@ -315,6 +251,7 @@
       setState(STOPPING);
 
       // All installed bundles must be stopped
+      BundleRegistryPlugin bundleRegistry = getPlugin(BundleRegistryPlugin.class);
       List<Bundle> reverseList = bundleRegistry.getBundles();
       Collections.reverse(reverseList);
       for (Bundle bundle : reverseList)
@@ -333,6 +270,7 @@
       ServiceReference[] srefs = null;
       try
       {
+         ServiceRegistryPlugin serviceRegistry = getPlugin(ServiceRegistryPlugin.class);
          srefs = serviceRegistry.getServiceReferences(null, null);
       }
       catch (InvalidSyntaxException ex)
@@ -356,9 +294,12 @@
       }
 
       // Event handling is disabled
-      bundleEventManager.setEnabled(false);
-      serviceEventManager.setEnabled(false);
-      frameworkEventManager.setEnabled(false);
+      ServiceEventsPlugin serviceEvents = getPlugin(ServiceEventsPlugin.class);
+      serviceEvents.setEnabled(false);
+      BundleEventsPlugin bundleEvents = getPlugin(BundleEventsPlugin.class);
+      bundleEvents.setEnabled(false);
+      FrameworkEventsPlugin frameworkEvents = getPlugin(FrameworkEventsPlugin.class);
+      frameworkEvents.setEnabled(false);
 
       // This Framework's state is set to RESOLVED
       setState(RESOLVED);
@@ -383,11 +324,6 @@
       return new FrameworkEvent(FrameworkEvent.STOPPED, this, null);
    }
 
-   public FrameworkEventManager getFrameworkEventManager()
-   {
-      return frameworkEventManager;
-   }
-
    @Override
    public String toString()
    {

Copied: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/RuntimeClassLoaderImpl.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleClassLoaderImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/RuntimeClassLoaderImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/RuntimeClassLoaderImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,95 @@
+/*
+ * 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/ServiceEventManagerImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventManagerImpl.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventManagerImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,143 +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.ServiceEventManager;
-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;
-
-/**
- * A simple implementation of a BundleEventManager
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class ServiceEventManagerImpl implements ServiceEventManager
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(ServiceEventManagerImpl.class);
-   
-   private Map<ServiceListener, ListenerRegistration> listeners = new LinkedHashMap<ServiceListener, ListenerRegistration>();
-   private boolean enabled = true;
-   
-   public ServiceEventManagerImpl(FrameworkImpl 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/ServiceEventsPluginImpl.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventManagerImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventsPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventsPluginImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -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;
+
+//$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

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistrationImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistrationImpl.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistrationImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -26,7 +26,7 @@
 import java.util.Dictionary;
 
 import org.jboss.logging.Logger;
-import org.jboss.osgi.jbossmc.api.ServiceRegistry;
+import org.jboss.osgi.jbossmc.api.ServiceRegistryPlugin;
 import org.jboss.osgi.spi.NotImplementedException;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
@@ -42,10 +42,10 @@
    // Provide logging
    final Logger log = Logger.getLogger(ServiceRegistrationImpl.class);
 
-   private ServiceRegistry serviceRegistry;
+   private ServiceRegistryPlugin serviceRegistry;
    private ServiceReferenceImpl serviceRef;
 
-   public ServiceRegistrationImpl(ServiceRegistry serviceRegistry, ServiceReferenceImpl serviceRef)
+   public ServiceRegistrationImpl(ServiceRegistryPlugin serviceRegistry, ServiceReferenceImpl serviceRef)
    {
       this.serviceRegistry = serviceRegistry;
       this.serviceRef = serviceRef;

Deleted: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryImpl.java	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -1,303 +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.ServiceEventManager;
-import org.jboss.osgi.jbossmc.api.ServiceRegistry;
-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;
-
-/**
- * A simple implementation of a BundleRegistry
- * 
- * @author thomas.diesler at jboss.com
- * @since 18-Aug-2009
- */
-public class ServiceRegistryImpl implements ServiceRegistry
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(ServiceRegistryImpl.class);
-   
-   private Map<String, List<ServiceReference>> registry = new HashMap<String, List<ServiceReference>>();
-   private FrameworkImpl framework;
-   private long serviceId; 
-
-   public ServiceRegistryImpl(FrameworkImpl framework)
-   {
-      this.framework = 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)
-   {
-      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)
-   {
-      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.
-      ServiceEventManager eventManager = framework.getServiceEventManager();
-      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/ServiceRegistryPluginImpl.java (from rev 92602, projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryPluginImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryPluginImpl.java	2009-08-20 08:40:11 UTC (rev 92604)
@@ -0,0 +1,307 @@
+/*
+ * 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)
+   {
+      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)
+   {
+      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

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/resources/META-INF/jboss-osgi-framework.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/resources/META-INF/jboss-osgi-framework.xml	2009-08-20 06:58:39 UTC (rev 92603)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/resources/META-INF/jboss-osgi-framework.xml	2009-08-20 08:40:11 UTC (rev 92604)
@@ -15,7 +15,7 @@
   -->
 
   <!-- The FrameworkBootstrap -->
-  <bean name="jboss.osgi:service=FrameworkBootstrap" class="org.jboss.osgi.jbossmc.framework.FrameworkBootstrapImpl">
+  <bean name="jboss.osgi:service=FrameworkFactory" class="org.jboss.osgi.jbossmc.framework.FrameworkFactoryBean">
     <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>




More information about the jboss-cvs-commits mailing list