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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 18 09:45:41 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-08-18 09:45:40 -0400 (Tue, 18 Aug 2009)
New Revision: 92529

Added:
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/scripts/
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/scripts/antrun-test-jars.xml
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/
   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/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/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/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/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/ServiceReferenceImpl.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/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/BundleInstallTestCase.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/bundle/
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/bundle/SimpleActivator.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/bundle/SimpleService.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/jboss-osgi-jbossmc.properties
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/simple/
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/simple/simple.bnd
   projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-jbossmc.properties
Removed:
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/felix/
Modified:
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/pom.xml
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleContextImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkImpl.java
   projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/SystemBundleContext.java
Log:
Initial bundle install

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/pom.xml	2009-08-18 13:38:52 UTC (rev 92528)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/pom.xml	2009-08-18 13:45:40 UTC (rev 92529)
@@ -37,6 +37,10 @@
   <!-- Dependencies -->
   <dependencies>
     <dependency>
+      <groupId>biz.aQute</groupId>
+      <artifactId>bnd</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.jboss.osgi</groupId>
       <artifactId>jboss-osgi-spi</artifactId>
       <version>${version.jboss.osgi.spi}</version>
@@ -55,10 +59,48 @@
 
   <!-- Build -->
   <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>build-test-jars</id>
+            <phase>test-compile</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <tasks>
+                <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+                <property name="tests.output.dir" value="${project.build.directory}" />
+                <ant antfile="scripts/antrun-test-jars.xml" />
+              </tasks>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
   </build>
 
   <!-- Profiles -->
   <profiles>
+  
+    <!--
+      Name: framework-default 
+      Descr: Setup for default framework integration testing
+    -->
+    <profile>
+      <id>framework-default</id>
+      <activation>
+        <property>
+          <name>!framework</name>
+        </property>
+      </activation>
+      <properties>
+        <jboss.osgi.framework.properties>jboss-osgi-jbossmc.properties</jboss.osgi.framework.properties>
+      </properties>
+    </profile>
+    
   </profiles>
 
 </project>

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/scripts/antrun-test-jars.xml	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/scripts/antrun-test-jars.xml	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ============================================================ -->
+<!--  JBoss, the OpenSource J2EE webOS                            -->
+<!--  Distributable under LGPL license.                           -->
+<!--  See terms of license at http://www.gnu.org.                 -->
+<!-- ============================================================ -->
+
+<!-- $Id: antrun-example-jars.xml 87329 2009-04-15 10:34:21Z thomas.diesler at jboss.com $ -->
+
+<project default="build-test-jars">
+
+  <description>OSGi test archive builder</description>
+
+  <!-- ================================================================== -->
+  <!-- Init                                                               -->
+  <!-- ================================================================== -->
+
+  <target name="init">
+
+    <!-- Property override when not called from maven -->
+    <property name="maven.runtime.classpath" value="/usr/java/bnd.jar" />
+    <property name="tests.output.dir" value="${basedir}/../target" />
+
+    <mkdir dir="${tests.output.dir}/test-libs" />
+    <property name="tests.classes.dir" value="${tests.output.dir}/test-classes" />
+    <property name="tests.resources.dir" value="${tests.output.dir}/test-classes" />
+
+    <taskdef resource="aQute/bnd/ant/taskdef.properties">
+      <classpath>
+        <pathelement path="${maven.runtime.classpath}" />
+      </classpath>
+    </taskdef>
+
+  </target>
+
+  <!-- ================================================================== -->
+  <!-- Building                                                           -->
+  <!-- ================================================================== -->
+
+  <target name="build-test-jars" depends="init" description="Build the test deployments">
+
+    <!-- Please add alphabetically -->
+
+    <!-- simple -->
+    <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/simple-bundle.jar" files="${tests.resources.dir}/simple/simple.bnd" />
+  	
+    <!-- Please add alphabetically -->
+
+  </target>
+
+</project>

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleClassLoader.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,35 @@
+/*
+ * 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: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+/**
+ * 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;
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleEventManager.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -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;
+
+import org.osgi.framework.BundleEvent;
+
+//$Id: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+/**
+ * An abstraction of a bundle event manager.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface BundleEventManager
+{
+   void fireBundleEvent(BundleEvent event);
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleFactory.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -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;
+
+import org.osgi.framework.Bundle;
+
+//$Id: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+
+/**
+ * An abstraction of a bundle factory.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface BundleFactory 
+{
+   Bundle createBundle(String location);
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleRegistry.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.api;
+
+import org.osgi.framework.Bundle;
+
+//$Id: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+
+/**
+ * An abstraction of a bundle registry.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface BundleRegistry 
+{
+   long installBundle(Bundle bundle);
+   
+   void uninstallBundle(Bundle bundle);
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/BundleResolver.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -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;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+//$Id: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+
+/**
+ * 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

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/FrameworkEventManager.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -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;
+
+import org.osgi.framework.FrameworkEvent;
+
+//$Id: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+/**
+ * An abstraction of a framework event manager.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface FrameworkEventManager
+{
+   void fireFrameworkEvent(FrameworkEvent event);
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceEventManager.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -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;
+
+import org.osgi.framework.ServiceEvent;
+
+//$Id: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+/**
+ * An abstraction of a service event manager.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public interface ServiceEventManager
+{
+   void fireServiceEvent(ServiceEvent event);
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/api/ServiceRegistry.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -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: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+import java.util.Dictionary;
+
+import org.osgi.framework.Bundle;
+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 properties);
+   
+   ServiceRegistration registerService(Bundle bundle, String clazz, Object service, Dictionary properties);
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleClassLoaderImpl.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,74 @@
+/*
+ * 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: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.BundleClassLoader;
+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 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 ClassLoader loader;
+   
+   public BundleClassLoaderImpl(Bundle bundle)
+   {
+      BundleImpl bundleImpl = (BundleImpl)bundle;
+      
+      URL location;
+      try
+      {
+         location = bundleImpl.getVirtualFile().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);
+   }
+
+}
\ 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-18 13:38:52 UTC (rev 92528)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleContextImpl.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -28,6 +28,7 @@
 import java.util.Dictionary;
 
 import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.ServiceRegistry;
 import org.jboss.osgi.spi.NotImplementedException;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -51,16 +52,16 @@
    // Provide logging
    final Logger log = Logger.getLogger(BundleContextImpl.class);
 
-   private BundleContext sysContext;
+   private SystemBundleContext sysContext;
    private Bundle bundle;
    
-   public BundleContextImpl(BundleContext sysContext, Bundle bundle)
+   public BundleContextImpl(SystemBundleContext sysContext, Bundle bundle)
    {
       this.sysContext = sysContext;
       this.bundle = bundle;
    }
 
-   BundleContext getSystemContext()
+   SystemBundleContext getSystemContext()
    {
       return sysContext;
    }
@@ -139,7 +140,15 @@
 
    public Bundle installBundle(String location) throws BundleException
    {
-      throw new NotImplementedException();
+      SystemBundleContext sysContext = getSystemContext();
+      
+      // Create the bundle from the location
+      Bundle bundle = sysContext.getBundleFactory().createBundle(location);
+      
+      // Register the bundle 
+      sysContext.getBundleRegistry().installBundle(bundle);
+      
+      return bundle;
    }
 
    public Bundle installBundle(String location, InputStream input) throws BundleException
@@ -149,12 +158,14 @@
 
    public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties)
    {
-      throw new NotImplementedException();
+      ServiceRegistry registry = getSystemContext().getServiceRegistry();
+      return registry.registerService(getBundle(), clazzes, service, properties);
    }
 
    public ServiceRegistration registerService(String clazz, Object service, Dictionary properties)
    {
-      throw new NotImplementedException();
+      ServiceRegistry registry = getSystemContext().getServiceRegistry();
+      return registry.registerService(getBundle(), clazz, service, properties);
    }
 
    public void removeBundleListener(BundleListener listener)

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleEventManagerImpl.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,55 @@
+/*
+ * 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: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.BundleEventManager;
+import org.jboss.osgi.jbossmc.api.BundleResolver;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleEvent;
+
+/**
+ * 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 SystemBundleContext sysContext;
+
+   public BundleEventManagerImpl(SystemBundleContext sysContext)
+   {
+      this.sysContext = sysContext;
+   }
+
+   public void fireBundleEvent(BundleEvent event)
+   {
+      // [TODO] fire bundle event
+   }
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleFactoryImpl.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jbossmc.framework;
+
+//$Id: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+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 SystemBundleContext sysContext;
+
+   public BundleFactoryImpl(SystemBundleContext sysContext)
+   {
+      this.sysContext = sysContext;
+   }
+
+   public Bundle createBundle(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);
+      }
+      
+      BundleImpl bundle = new BundleImpl(vfsRoot);
+      bundle.setBundleContext(new BundleContextImpl(sysContext, bundle));
+      return bundle;
+   }
+}
\ 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-18 13:38:52 UTC (rev 92528)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleImpl.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -28,16 +28,29 @@
 import java.net.URL;
 import java.util.Dictionary;
 import java.util.Enumeration;
+import java.util.Hashtable;
 import java.util.Map;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
 
 import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.BundleClassLoader;
+import org.jboss.osgi.jbossmc.api.BundleEventManager;
+import org.jboss.osgi.jbossmc.api.BundleResolver;
+import org.jboss.osgi.jbossmc.api.FrameworkEventManager;
 import org.jboss.osgi.spi.NotImplementedException;
+import org.jboss.virtual.VirtualFile;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleException;
+import org.osgi.framework.FrameworkEvent;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.Version;
 
+import aQute.lib.osgi.Constants;
+
 /**
  * An implementation of an OSGi Bundle
  * 
@@ -50,13 +63,38 @@
    final Logger log = Logger.getLogger(BundleImpl.class);
 
    private int state; 
-   private BundleContext bndContext;
+   private VirtualFile vFile;
+   private long bundleId;
+   private BundleContextImpl context;
+   private Dictionary<String, String> headers;
+   private BundleClassLoader classLoader;
 
+   public BundleImpl()
+   {
+      // ctor used by the framework
+      // [TODO] remove when we have a VFS root for the framework 
+   }
+
+   public BundleImpl(VirtualFile vFile)
+   {
+      this.vFile = vFile;
+   }
+
+   public VirtualFile getVirtualFile()
+   {
+      return vFile;
+   }
+
    public long getBundleId()
    {
-      throw new NotImplementedException();
+      return bundleId;
    }
 
+   public void setBundleId(long bundleId)
+   {
+      this.bundleId = bundleId;
+   }
+
    public int getState()
    {
       return state;
@@ -69,22 +107,110 @@
 
    public String getLocation()
    {
-      throw new NotImplementedException();
+      try
+      {
+         return getVirtualFile().toURL().toExternalForm();
+      }
+      catch (Exception ex)
+      {
+         throw new IllegalStateException("Cannot obtain bundle location", ex);
+      }
    }
 
    public String getSymbolicName()
    {
-      throw new NotImplementedException();
+      return getHeader(Constants.BUNDLE_SYMBOLICNAME);
    }
 
+   public BundleClassLoader getClassLoader()
+   {
+      return classLoader;
+   }
+
+   public void setClassLoader(BundleClassLoader classLoader)
+   {
+      this.classLoader = classLoader;
+   }
+
    public void start() throws BundleException
    {
-      throw new NotImplementedException();
+      start(0);
    }
 
    public void start(int options) throws BundleException
    {
-      throw new NotImplementedException();
+      // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
+      if (state == Bundle.UNINSTALLED)
+         throw new IllegalStateException("Bundle already uninstalled: " + this);
+      
+      // [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 (state == Bundle.STARTING || state == Bundle.STARTING)
+         throw new IllegalStateException("Bundle already staring/stopping: " + this);
+      
+      // If this bundle's state is not RESOLVED, an attempt is made to resolve this bundle.
+      if (state != Bundle.RESOLVED)
+      {
+         BundleResolver resolver = getSystemContext().getBundleResolver();
+         resolver.resolveBundle(this);
+      }
+      
+      // [TODO] Lazy bundle activation
+      
+      // This bundle's state is set to STARTING. 
+      state = Bundle.STARTING;
+      
+      // A bundle event of type BundleEvent.STARTING is fired.
+      BundleEventManager eventManager = getSystemContext().getBundleEventManager();
+      eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STARTING, this));
+      
+      // The BundleActivator is called
+      String activatorClass = getHeader(Constants.BUNDLE_ACTIVATOR);
+      if (activatorClass != null)
+      {
+         BundleActivator activator;
+         try
+         {
+            activator = (BundleActivator)loadClass(activatorClass).newInstance();
+            activator.start(context);
+         }
+         catch (Exception ex)
+         {
+            // This bundle's state is set to STOPPING.
+            state = Bundle.STOPPING;
+            
+            // A bundle event of type BundleEvent.STOPPING is fired
+            eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STOPPING, this));
+            
+            // [TODO] Any services registered by this bundle must be unregistered.
+            
+            // [TODO] Any services used by this bundle must be released.
+            
+            // [TODO] Any listeners registered by this bundle must be removed.
+            
+            // This bundle's state is set to RESOLVED.
+            state = Bundle.RESOLVED;
+            
+            // A bundle event of type BundleEvent.STOPPED is fired.
+            eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STOPPED, this));
+            
+            // 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 (state == Bundle.UNINSTALLED)
+         throw new IllegalStateException("Bundle already uninstalled: " + this);
+
+      // This bundle's state is set to ACTIVE
+      state = Bundle.ACTIVE;
+      
+      // A bundle event of type BundleEvent.STARTED is fired
+      eventManager.fireBundleEvent(new BundleEvent(BundleEvent.STARTED, this));
    }
 
    public void stop() throws BundleException
@@ -119,9 +245,14 @@
 
    public BundleContext getBundleContext()
    {
-      return bndContext;
+      return context;
    }
 
+   public void setBundleContext(BundleContextImpl bndContext)
+   {
+      this.context = bndContext;
+   }
+
    public URL getEntry(String path)
    {
       throw new NotImplementedException();
@@ -134,7 +265,26 @@
 
    public Dictionary getHeaders()
    {
-      throw new NotImplementedException();
+      if (headers == null)
+      {
+         headers = new Hashtable<String, String>();
+         try
+         {
+            VirtualFile child = vFile.getChild("META-INF/MANIFEST.MF");
+            Manifest manifest = new Manifest(child.openStream());
+            Attributes attribs = manifest.getMainAttributes();
+            for (Object key : attribs.keySet())
+            {
+               Object value = attribs.get(key);
+               headers.put(key.toString(), value.toString());
+            }
+         }
+         catch (IOException ex)
+         {
+            throw new IllegalStateException("Cannot read bundle manifest", ex);
+         }
+      }
+      return headers;
    }
 
    public Dictionary getHeaders(String locale)
@@ -183,8 +333,39 @@
       throw new NotImplementedException();
    }
 
-   public Class loadClass(String name) throws ClassNotFoundException
+   public Class<?> loadClass(String name) throws ClassNotFoundException
    {
-      throw new NotImplementedException();
+      // [TODO] If this bundle is a fragment bundle then this method must throw a ClassNotFoundException
+      
+      // If this bundle's state is INSTALLED, this method must attempt to resolve this bundle 
+      // before attempting to load the class.
+      if (state == Bundle.INSTALLED)
+      {
+         BundleResolver resolver = getSystemContext().getBundleResolver();
+         try
+         {
+            resolver.resolveBundle(this);
+         }
+         catch (BundleException ex)
+         {
+            // If this bundle cannot be resolved, a Framework event of type FrameworkEvent.ERROR is fired
+            FrameworkEventManager eventManager = getSystemContext().getFrameworkEventManager();
+            eventManager.fireFrameworkEvent(new FrameworkEvent(FrameworkEvent.ERROR, this, ex));
+            
+            throw new ClassNotFoundException("Cannot load class: " + name, ex);
+         }
+      }
+      
+      return getClassLoader().loadClass(name);
    }
+
+   private String getHeader(String header)
+   {
+      return (String)getHeaders().get(header);
+   }
+
+   private SystemBundleContext getSystemContext()
+   {
+      return context.getSystemContext();
+   }
 }
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleRegistryImpl.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,79 @@
+/*
+ * 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: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+import java.util.HashMap;
+
+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 bundleId;
+   private SystemBundleContext sysContext;
+   private HashMap<String, Bundle> registry = new HashMap<String, Bundle>();
+
+   public BundleRegistryImpl(SystemBundleContext sysContext)
+   {
+      this.sysContext = sysContext;
+   }
+
+   public long installBundle(Bundle bundle)
+   {
+      String location = getBundleLocation(bundle);
+      registry.put(location, bundle);
+      
+      ((BundleImpl)bundle).setBundleId(bundleId++);
+      return bundle.getBundleId();
+   }
+
+   public void uninstallBundle(Bundle bundle)
+   {
+      String location = getBundleLocation(bundle);
+      if (registry.remove(location) == null)
+         throw new IllegalStateException("Cannot unregister bundle: " + bundle);
+   }
+
+   private String getBundleLocation(Bundle bundle)
+   {
+      if (bundle == null)
+         throw new IllegalArgumentException("Cannot unregister null bundle");
+      
+      String location = bundle.getLocation();
+      if (location == null)
+         throw new IllegalArgumentException("Cannot obtain bundle location");
+      
+      return location;
+   }
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/BundleResolverImpl.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,57 @@
+/*
+ * 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: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+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(SystemBundleContext sysContext)
+   {
+   }
+
+   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

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkEventManagerImpl.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,49 @@
+/*
+ * 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: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.FrameworkEventManager;
+import org.osgi.framework.FrameworkEvent;
+
+/**
+ * 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);
+   
+   public FrameworkEventManagerImpl(SystemBundleContext sysContext)
+   {
+   }
+
+   public void fireFrameworkEvent(FrameworkEvent event)
+   {
+      // [TODO] fire framework event
+   }
+}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkImpl.java	2009-08-18 13:38:52 UTC (rev 92528)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/FrameworkImpl.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -62,23 +62,19 @@
       return 0;
    }
 
-   /**
-    * Returns the symbolic name of this Framework.
-    */
    @Override
-   public String getSymbolicName()
+   public String getLocation()
    {
-      return "org.jboss.osgi.jbossmc";
+      return "System Bundle";
    }
 
    /**
-    * Returns the Framework location identifier. This Framework is assigned the unique location &quot;<code>System Bundle</code>&quot; since this Framework is also a
-    * System Bundle.
+    * Returns the symbolic name of this Framework.
     */
    @Override
-   public String getLocation()
+   public String getSymbolicName()
    {
-      return "System Bundle";
+      return "org.jboss.osgi.jbossmc";
    }
 
    int getStartLevel()

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceEventManagerImpl.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -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: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.ServiceEventManager;
+import org.osgi.framework.ServiceEvent;
+
+/**
+ * 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 SystemBundleContext sysContext;
+
+   public ServiceEventManagerImpl(SystemBundleContext sysContext)
+   {
+      this.sysContext = sysContext;
+   }
+
+   public void fireServiceEvent(ServiceEvent event)
+   {
+      // [TODO] fire service event
+   }
+}
\ No newline at end of file

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceReferenceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceReferenceImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceReferenceImpl.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,93 @@
+/*
+ * 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: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.List;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * A simple implementation of a ServiceReference
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public class ServiceReferenceImpl implements ServiceReference
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(ServiceReferenceImpl.class);
+
+   private Bundle bundle;
+   private Dictionary<String, String> properties;
+   
+   public ServiceReferenceImpl(Bundle bundle, Dictionary<String, String> properties)
+   {
+      this.bundle = bundle;
+      this.properties = properties;
+   }
+
+   public int compareTo(Object reference)
+   {
+      throw new NotImplementedException();
+   }
+
+   public Bundle getBundle()
+   {
+      return bundle;
+   }
+
+   public Object getProperty(String key)
+   {
+      return properties.get(key);
+   }
+
+   public String[] getPropertyKeys()
+   {
+      Enumeration<String> keysEnum = properties.keys();
+      List<String> keyList = new ArrayList<String>();
+      while (keysEnum.hasMoreElements())
+         keyList.add(keysEnum.nextElement());
+      
+      String[] keys = new String[keyList.size()];
+      keyList.toArray(keys);
+      
+      return keys;
+   }
+
+   public Bundle[] getUsingBundles()
+   {
+      throw new NotImplementedException();
+   }
+
+   public boolean isAssignableTo(Bundle bundle, String className)
+   {
+      throw new NotImplementedException();
+   }
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistrationImpl.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,65 @@
+/*
+ * 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: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+import java.util.Dictionary;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * A simple implementation of a ServiceRegistration
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public class ServiceRegistrationImpl implements ServiceRegistration
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(ServiceRegistrationImpl.class);
+
+   private ServiceReferenceImpl serviceRef;
+
+   public ServiceRegistrationImpl(ServiceReferenceImpl serviceRef)
+   {
+      this.serviceRef = serviceRef;
+   }
+
+   public ServiceReference getReference()
+   {
+      return serviceRef;
+   }
+
+   public void setProperties(Dictionary properties)
+   {
+      throw new NotImplementedException();
+   }
+
+   public void unregister()
+   {
+      throw new NotImplementedException();
+   }
+}
\ No newline at end of file

Added: 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	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/ServiceRegistryImpl.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,103 @@
+/*
+ * 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: SystemBundleContext.java 91789 2009-07-29 20:49:03Z thomas.diesler at jboss.com $
+
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jbossmc.api.ServiceEventManager;
+import org.jboss.osgi.jbossmc.api.ServiceRegistry;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.osgi.framework.Bundle;
+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 SystemBundleContext sysContext;
+   private Map<String, ServiceReference> registry = new HashMap<String, ServiceReference>();
+
+   public ServiceRegistryImpl(SystemBundleContext sysContext)
+   {
+      this.sysContext = sysContext;
+   }
+
+   public ServiceRegistration registerService(Bundle bundle, String clazz, Object service, Dictionary properties)
+   {
+      return registerServiceInternal(bundle, clazz, service, properties);
+   }
+
+   public ServiceRegistration registerService(Bundle bundle, String[] clazzes, Object service, Dictionary properties)
+   {
+      throw new NotImplementedException();
+   }
+
+   private ServiceRegistration registerServiceInternal(Bundle bundle, String clazz, Object service, Dictionary properties)
+   {
+      // 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)
+      {
+         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);
+         }
+      }
+      
+      ServiceReferenceImpl serviceRef = new ServiceReferenceImpl(bundle, properties);
+      
+      // 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.
+      
+      // 3. The service is added to the Framework service registry and may now be used by other bundles.
+      registry.put(clazz, serviceRef);
+      
+      // 4. A service event of type ServiceEvent.REGISTERED is fired.
+      ServiceEventManager eventManager = sysContext.getServiceEventManager();
+      eventManager.fireServiceEvent(new ServiceEvent(ServiceEvent.REGISTERED, serviceRef));
+      
+      // 5. A ServiceRegistration object for this registration is returned.
+      return new ServiceRegistrationImpl(serviceRef);
+   }
+}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/SystemBundleContext.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/SystemBundleContext.java	2009-08-18 13:38:52 UTC (rev 92528)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/main/java/org/jboss/osgi/jbossmc/framework/SystemBundleContext.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -24,7 +24,13 @@
 //$Id$
 
 import org.jboss.logging.Logger;
-import org.osgi.framework.BundleContext;
+import org.jboss.osgi.jbossmc.api.BundleEventManager;
+import org.jboss.osgi.jbossmc.api.BundleFactory;
+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.osgi.framework.launch.Framework;
 
 /**
@@ -38,14 +44,65 @@
    // Provide logging
    final Logger log = Logger.getLogger(SystemBundleContext.class);
 
+   private BundleRegistry bundleRegistry;
+   private BundleFactory bundleFactory;
+   private BundleResolver bundleResolver;
+   private BundleEventManager bundleEventManager;
+   private FrameworkEventManager frameworkEventManager;
+   private ServiceEventManager serviceEventManager;
+   private ServiceRegistry serviceRegistry;
+
    public SystemBundleContext(Framework framework)
    {
       super(null, framework);
+      
+      bundleFactory = new BundleFactoryImpl(this);
+      bundleResolver = new BundleResolverImpl(this);
+      bundleRegistry = new BundleRegistryImpl(this);
+      serviceRegistry = new ServiceRegistryImpl(this);
+      bundleEventManager = new BundleEventManagerImpl(this);
+      frameworkEventManager = new FrameworkEventManagerImpl(this);
+      serviceEventManager = new ServiceEventManagerImpl(this);
    }
 
    @Override
-   BundleContext getSystemContext()
+   SystemBundleContext getSystemContext()
    {
       return this;
    }
+
+   public BundleFactory getBundleFactory()
+   {
+      return bundleFactory;
+   }
+
+   public BundleRegistry getBundleRegistry()
+   {
+      return bundleRegistry;
+   }
+
+   public BundleResolver getBundleResolver()
+   {
+      return bundleResolver;
+   }
+
+   public ServiceRegistry getServiceRegistry()
+   {
+      return serviceRegistry;
+   }
+
+   public BundleEventManager getBundleEventManager()
+   {
+      return bundleEventManager;
+   }
+
+   public ServiceEventManager getServiceEventManager()
+   {
+      return serviceEventManager;
+   }
+
+   public FrameworkEventManager getFrameworkEventManager()
+   {
+      return frameworkEventManager;
+   }
 }
\ No newline at end of file

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/BundleInstallTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/BundleInstallTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/BundleInstallTestCase.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,83 @@
+/*
+ * 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.test.osgi.jbossmc.simple;
+
+//$Id: SimpleTestCase.java 91196 2009-07-14 09:41:15Z thomas.diesler at jboss.com $
+
+import static org.junit.Assert.assertEquals;
+
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.util.ServiceLoader;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
+
+/**
+ * A test that deployes a bundle and verifies its state
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 18-Aug-2009
+ */
+public class BundleInstallTestCase extends OSGiTest
+{
+   private static Framework framework;
+   
+   @BeforeClass
+   public static void beforeClass() throws BundleException
+   {
+      FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+      framework = factory.newFramework(null);
+      framework.start();
+   }
+   
+   @AfterClass
+   public static void afterClass() throws BundleException
+   {
+      framework.stop();
+   }
+   
+   @Test
+   public void testFrameworkBundle() throws Exception
+   {
+      assertEquals("BundleId", 0, framework.getBundleId());
+      assertEquals("Location", "System Bundle", framework.getLocation());
+      assertEquals("SymbolicName", "org.jboss.osgi.jbossmc", framework.getSymbolicName());
+   }
+   
+   @Test
+   public void testSimpleBundle() throws Exception
+   {
+      BundleContext context = framework.getBundleContext();
+      String location = getTestArchiveURL("simple-bundle.jar").toString();
+      Bundle bundle = context.installBundle(location);
+
+      assertEquals("simple-bundle", bundle.getSymbolicName());
+      
+      bundle.start();
+      assertEquals("Bundle active", Bundle.ACTIVE, bundle.getState());
+   }
+}
\ No newline at end of file

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/bundle/SimpleActivator.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/bundle/SimpleActivator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/bundle/SimpleActivator.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -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.test.osgi.jbossmc.simple.bundle;
+
+//$Id: SimpleActivator.java 91196 2009-07-14 09:41:15Z thomas.diesler at jboss.com $
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * A Service Activator
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 24-Apr-2009
+ */
+public class SimpleActivator implements BundleActivator
+{
+   public void start(BundleContext context)
+   {
+      // Register a service
+      SimpleService service = new SimpleService(context);
+      context.registerService(SimpleService.class.getName(), service, null);
+   }
+
+   public void stop(BundleContext context)
+   {
+   }
+}
\ No newline at end of file

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/bundle/SimpleService.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/bundle/SimpleService.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/java/org/jboss/test/osgi/jbossmc/simple/bundle/SimpleService.java	2009-08-18 13:45:40 UTC (rev 92529)
@@ -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.test.osgi.jbossmc.simple.bundle;
+
+//$Id: SimpleService.java 91196 2009-07-14 09:41:15Z thomas.diesler at jboss.com $
+
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
+
+/**
+ * A SimpleService
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 24-Apr-2009
+ */
+public class SimpleService 
+{
+   private LogService log;
+   
+   public SimpleService(BundleContext context)
+   {
+   }
+
+   public String echo(String msg)
+   {
+      return msg;
+   }
+}
\ No newline at end of file

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/jboss-osgi-jbossmc.properties
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/jboss-osgi-jbossmc.properties	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/jboss-osgi-jbossmc.properties	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,22 @@
+#
+# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
+# 
+# $Id: jboss-osgi-felix.properties 92430 2009-08-17 14:53:52Z thomas.diesler at jboss.com $
+#
+
+# Properties to configure the Framework
+org.osgi.framework.storage=${basedir}/target/osgi-store
+org.osgi.framework.storage.clean=onFirstInit
+
+# Extra System Packages
+org.osgi.framework.system.packages.extra=
+
+# Bundles that need to be installed with the Framework automatically 
+org.jboss.osgi.spi.framework.autoInstall=\
+	file://${test.archive.directory}/bundles/org.osgi.compendium.jar
+		
+
+# Bundles that need to be started automatically 
+org.jboss.osgi.spi.framework.autoStart=\
+	file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
+	file://${test.archive.directory}/bundles/jboss-osgi-common.jar 

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1 @@
+org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
\ No newline at end of file

Added: projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/simple/simple.bnd
===================================================================
--- projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/simple/simple.bnd	                        (rev 0)
+++ projects/jboss-osgi/trunk/reactor/runtime/jbossmc/src/test/resources/simple/simple.bnd	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,6 @@
+# bnd build -classpath target/test-classes -output target/test-libs/simple-bundle.jar src/test/resources/example/simple/simple.bnd
+
+Bundle-SymbolicName: simple-bundle
+
+Bundle-Activator: org.jboss.test.osgi.jbossmc.simple.bundle.SimpleActivator
+Export-Package: org.jboss.test.osgi.jbossmc.simple.bundle

Added: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-jbossmc.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-jbossmc.properties	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-jbossmc.properties	2009-08-18 13:45:40 UTC (rev 92529)
@@ -0,0 +1,22 @@
+#
+# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
+# 
+# $Id: jboss-osgi-felix.properties 92430 2009-08-17 14:53:52Z thomas.diesler at jboss.com $
+#
+
+# Properties to configure the Framework
+org.osgi.framework.storage=${basedir}/target/osgi-store
+org.osgi.framework.storage.clean=onFirstInit
+
+# Extra System Packages
+org.osgi.framework.system.packages.extra=
+
+# Bundles that need to be installed with the Framework automatically 
+org.jboss.osgi.spi.framework.autoInstall=\
+	file://${test.archive.directory}/bundles/org.osgi.compendium.jar
+		
+
+# Bundles that need to be started automatically 
+org.jboss.osgi.spi.framework.autoStart=\
+	file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
+	file://${test.archive.directory}/bundles/jboss-osgi-common.jar 




More information about the jboss-cvs-commits mailing list