Merge branch 'master' into bug324991-eclipse-structure

Conflicts:
	build-kernel/bin/dmk.bat
	build-kernel/build.xml
	build-kernel/lib/org.eclipse.virgo.kernel.launch.properties
	build.versions
	org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java
diff --git a/.gitignore b/.gitignore
index 2f4a727..671b0cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
 ivy-cache
 derby.log
 .ant-targets-build.xml
+com.cenqua.clover.core.prefs
\ No newline at end of file
diff --git a/build-kernel/bin/dmk.bat b/build-kernel/bin/dmk.bat
index 96a6e3e..1862ff3 100755
--- a/build-kernel/bin/dmk.bat
+++ b/build-kernel/bin/dmk.bat
@@ -204,6 +204,7 @@
   set CONFIG_DIR=%KERNEL_HOME%\config
   if not defined TRUSTSTORE_PATH set TRUSTSTORE_PATH=%KERNEL_HOME%\config\keystore
   if not defined TRUSTSTORE_PASSWORD set TRUSTSTORE_PASSWORD=changeit
+  if not defined JMX_PORT set JMX_PORT=9875
   set OTHER_ARGS=
 
   rem Loop through options
@@ -212,8 +213,9 @@
   if "%~1"=="" goto endStopOptionLoop
   if "%~1"=="-truststore" goto truststoreStop
   if "%~1"=="-truststorePassword" goto truststorePasswordStop
-  if "%~1"=="-configDir" goto configDirStop
-
+  if "%~1"=="-configDir" goto configDirStop 
+  if "%~1"=="-jmxport" goto jmxportStop
+  
   set OTHER_ARGS=%OTHER_ARGS% "%~1"
 
   :continueStopOptionLoop
@@ -240,6 +242,11 @@
     shift
     goto continueStopOptionLoop
 
+  :jmxportStop
+  set JMX_PORT=%~2
+  shift
+  goto continueStopOptionLoop
+
   :endStopOptionLoop
 
   rem Call shutdown client
@@ -247,6 +254,7 @@
     rem Extend JMX options
     set JMX_OPTS=%JMX_OPTS% -Djavax.net.ssl.trustStore="%TRUSTSTORE_PATH%"
     set JMX_OPTS=%JMX_OPTS% -Djavax.net.ssl.trustStorePassword=%TRUSTSTORE_PASSWORD%
+    set OTHER_ARGS=%OTHER_ARGS% -jmxport %JMX_PORT%
 
     rem Marshall parameters
     set SHUTDOWN_PARMS= %JAVA_OPTS% %JMX_OPTS%
diff --git a/build-kernel/bin/dmk.sh b/build-kernel/bin/dmk.sh
index 277cfbe..4651ac0 100755
--- a/build-kernel/bin/dmk.sh
+++ b/build-kernel/bin/dmk.sh
@@ -198,6 +198,11 @@
 		TRUSTSTORE_PASSWORD=changeit
 	fi
 
+	if [ -z "$JMX_PORT" ]
+	then
+		JMX_PORT=9875
+	fi
+
 	shopt -s extglob
 
 	while (($# > 0))
@@ -215,6 +220,10 @@
 				CONFIG_DIR=$2
 				shift;
 				;;
+		-jmxport)
+				JMX_PORT=$2
+				shift;
+				;;
 		*)
 			OTHER_ARGS+=" $1"
 			;;
@@ -227,6 +236,8 @@
 		-Djavax.net.ssl.trustStore=${TRUSTSTORE_PATH} \
 		-Djavax.net.ssl.trustStorePassword=${TRUSTSTORE_PASSWORD}"
 
+	OTHER_ARGS+=" -jmxport $JMX_PORT"
+
 	$JAVA_HOME/bin/java $JAVA_OPTS $JMX_OPTS \
 		-classpath $CLASSPATH \
 		-Dorg.eclipse.virgo.kernel.home=$KERNEL_HOME \
diff --git a/build-kernel/build.xml b/build-kernel/build.xml
index 6981e8a..7389f91 100644
--- a/build-kernel/build.xml
+++ b/build-kernel/build.xml
@@ -9,6 +9,7 @@
 		<pathelement location="../org.eclipse.virgo.kernel.services"/>
 		<pathelement location="../org.eclipse.virgo.kernel.osgi"/>
 		<pathelement location="../org.eclipse.virgo.kernel.deployer"/>
+        <pathelement location="../org.eclipse.virgo.kernel.userregionfactory"/>
 		<pathelement location="../org.eclipse.virgo.kernel.userregion"/>
 		<pathelement location="../org.eclipse.virgo.kernel.agent.dm"/>
 		<pathelement location="../org.eclipse.virgo.kernel.kerneldmfragment"/>
@@ -74,6 +75,22 @@
 
 		<copy todir="${package.output.dir}/lib" failonerror="false">
 			<fileset dir="${basedir}/lib"/>
+			<filterset>
+				<filter token="ASPECTJ.VERSION" value="${org.aspectj}"/>
+				<filter token="OSGI.SERVICES.VERSION" value="${org.eclipse.osgi.services}"/>
+				<filter token="EQUINOX.EVENT.VERSION" value="${org.eclipse.equinox.event}"/>
+				<filter token="EQUINOX.CONFIGADMIN.VERSION" value="${org.eclipse.equinox.cm}"/>
+				<filter token="EQUINOX.DS.VERSION" value="${org.eclipse.equinox.ds}"/>
+				<filter token="EQUINOX.UTIL.VERSION" value="${org.eclipse.equinox.util}"/>
+				<filter token="KERNEL.VERSION" value="${bundle.version}"/>
+				<filter token="MEDIC.VERSION" value="${org.eclipse.virgo.medic}"/>
+				<filter token="REPOSITORY.VERSION" value="${org.eclipse.virgo.repository}"/>
+				<filter token="SLF4J.VERSION" value="${org.slf4j}"/>
+				<filter token="SPRING.DM.VERSION" value="${org.springframework.osgi}"/>	
+				<filter token="SPRING.VERSION" value="${org.springframework}"/>
+				<filter token="UTIL.VERSION" value="${org.eclipse.virgo.util}"/>
+				<filter token="OSGI.EXTENSIONS.VERSION" value="${org.eclipse.virgo.osgi}"/>
+			</filterset>
 		</copy>
 
 		<copy todir="${package.output.dir}/config" failonerror="false">
@@ -83,9 +100,10 @@
 				<filter token="ASPECTJ.VERSION" value="${org.aspectj}"/>
 				<filter token="OSGI.FRAMEWORK.VERSION" value="${org.eclipse.osgi}"/>
 				<filter token="OSGI.SERVICES.VERSION" value="${org.eclipse.osgi.services}"/>
+				<filter token="EQUINOX.EVENT.VERSION" value="${org.eclipse.equinox.event}"/>
 				<filter token="EQUINOX.CONFIGADMIN.VERSION" value="${org.eclipse.equinox.cm}"/>
-				<filter token="EQUINOX.SIMPLECONFIGURATOR.VERSION" value="${org.eclipse.equinox.simpleconfigurator}"/>
-				<filter token="FELIX.EVENTADMIN.VERSION" value="${org.apache.felix.eventadmin}"/>
+				<filter token="EQUINOX.DS.VERSION" value="${org.eclipse.equinox.ds}"/>
+				<filter token="EQUINOX.UTIL.VERSION" value="${org.eclipse.equinox.util}"/>
 				<filter token="KERNEL.VERSION" value="${bundle.version}"/>
 				<filter token="MEDIC.VERSION" value="${org.eclipse.virgo.medic}"/>
 				<filter token="REPOSITORY.VERSION" value="${org.eclipse.virgo.repository}"/>
diff --git a/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties b/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties
index 52de1dc..5ac3150 100644
--- a/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties
+++ b/build-kernel/config/org.eclipse.virgo.kernel.userregion.properties
@@ -4,6 +4,8 @@
  file:org.eclipse.virgo.kernel.userregion-@KERNEL.VERSION@.jar@start,\
  file:org.eclipse.virgo.kernel.osgicommand-@KERNEL.VERSION@.jar@start
 
+bundleImports = org.eclipse.osgi;bundle-version="0"
+
 packageImports =\
  org.eclipse.virgo.kernel.artifact.*;version="0",\
  org.eclipse.virgo.kernel.core;version="0",\
@@ -11,6 +13,7 @@
  org.eclipse.virgo.kernel.deployer.core.event;version="0",\
  org.eclipse.virgo.kernel.install.*;version="0",\
  org.eclipse.virgo.kernel.osgi.*;version="0",\
+ org.eclipse.virgo.kernel.model;version="0",\
  org.eclipse.virgo.kernel.model.management;version="0",\
  org.eclipse.virgo.kernel.module;version="0",\
  org.eclipse.virgo.kernel.serviceability;version="0",\
@@ -32,6 +35,9 @@
  org.slf4j.spi;version="[1.6.1,2)"
 
 serviceImports =\
+ org.eclipse.virgo.kernel.osgi.region.Region,\
+ org.eclipse.virgo.kernel.osgi.region.RegionDigraph,\
+ org.osgi.framework.hooks.resolver.ResolverHookFactory,\
  org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer,\
  org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser,\
  org.eclipse.virgo.kernel.install.artifact.ScopeServiceRepository,\
@@ -46,9 +52,13 @@
  org.eclipse.virgo.kernel.core.Shutdown,\
  org.osgi.service.cm.ConfigurationAdmin,\
  org.osgi.service.event.EventAdmin,\
+ org.eclipse.virgo.medic.eventlog.EventLogger,\
  org.eclipse.virgo.medic.dump.DumpGenerator,\
  org.eclipse.virgo.kernel.shim.scope.ScopeFactory,\
- org.eclipse.virgo.kernel.shim.serviceability.TracingService
+ org.eclipse.virgo.kernel.shim.serviceability.TracingService,\
+ org.eclipse.virgo.kernel.model.RuntimeArtifactRepository,\
+ org.eclipse.osgi.service.resolver.PlatformAdmin,\
+ org.osgi.service.packageadmin.PackageAdmin
 
 serviceExports =\
  org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener,\
@@ -60,24 +70,12 @@
  org.eclipse.virgo.kernel.osgi.framework.OsgiFramework,\
  org.eclipse.virgo.kernel.osgi.framework.ImportExpander,\
  org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil,\
+ org.eclipse.virgo.kernel.osgi.region.Region,\
  org.osgi.service.event.EventHandler,\
  org.osgi.service.cm.ConfigurationListener,\
  org.osgi.service.cm.ManagedService,\
- org.osgi.service.cm.ManagedServiceFactory
-
-inheritedFrameworkProperties =\
- eclipse.bundle.setTCCL,\
- eclipse.enableStateSaver,\
- org.eclipse.virgo.suppress.heap.dumps,\
- osgi.java.profile,\
- osgi.parentClassloader,\
- osgi.context.bootdelegation,\
- osgi.compatibility.bootdelegation,\
- osgi.java.profile.bootdelegation,\
- osgi.hook.configurators.include
-
-# osgi console support
-# osgi.console=2401
+ org.osgi.service.cm.ManagedServiceFactory,\
+ org.osgi.framework.BundleContext
 
 # the next line must not be broken with back-slashes
 initialArtifacts = repository:plan/org.eclipse.virgo.kernel.userregion.springdm
diff --git a/build-kernel/kernel-ivy.xml b/build-kernel/kernel-ivy.xml
index d034558..11ddf2d 100644
--- a/build-kernel/kernel-ivy.xml
+++ b/build-kernel/kernel-ivy.xml
@@ -14,16 +14,22 @@
 		<!-- lib/kernel -->	
 		<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel" rev="latest.integration" conf="lib-kernel->runtime"/>
 		<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.osgicommand" rev="latest.integration" conf="lib-kernel->runtime"/>
+        <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.userregionfactory" rev="latest.integration" conf="lib-kernel->runtime"/>
 		<dependency org="org.slf4j" name="com.springsource.slf4j.org.apache.commons.logging" rev="${org.slf4j}" conf="lib-kernel->runtime"/>
-        <dependency org="org.aspectj" name="com.springsource.org.aspectj.weaver" rev="${org.aspectj}" conf="lib-kernel->runtime"/>
+		<dependency org="org.aspectj" name="com.springsource.org.aspectj.weaver" rev="${org.aspectj}" conf="lib-kernel->runtime"/>
 		<dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="lib-kernel->runtime"/>
-		<dependency org="org.eclipse.equinox" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="lib-kernel->runtime"/>
-
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="lib-kernel->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.ds" rev="${org.eclipse.equinox.ds}" conf="lib-kernel->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.util" rev="${org.eclipse.equinox.util}" conf="lib-kernel->runtime"/>
 
 		<!-- repository-ext -->
 		<dependency org="org.springframework.osgi" name="org.springframework.osgi.core" rev="${org.springframework.osgi}" conf="repository-ext->runtime"/>
 		<dependency org="org.springframework.osgi" name="org.springframework.osgi.extender" rev="${org.springframework.osgi}" conf="repository-ext->runtime"/>
 		<dependency org="org.springframework.osgi" name="org.springframework.osgi.io" rev="${org.springframework.osgi}" conf="repository-ext->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.ds" rev="${org.eclipse.equinox.ds}" conf="repository-ext->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.util" rev="${org.eclipse.equinox.util}" conf="repository-ext->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="repository-ext->runtime"/>
+		
 		
 		<exclude org="org.eclipse.osgi" module="org.eclipse.osgi"/>
 		<exclude org="org.eclipse.virgo.util" conf="repository-ext"/>
diff --git a/build-kernel/lib-ivy.xml b/build-kernel/lib-ivy.xml
index 6b4e7aa..896e0c3 100644
--- a/build-kernel/lib-ivy.xml
+++ b/build-kernel/lib-ivy.xml
@@ -15,6 +15,8 @@
 		<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.authentication" rev="latest.integration" conf="lib->runtime"/>
 		<dependency org="org.eclipse.virgo.osgi" name="org.eclipse.virgo.osgi.launcher" rev="${org.eclipse.virgo.osgi}" conf="lib->runtime"/>
 		<dependency org="org.eclipse.virgo.osgi" name="org.eclipse.virgo.osgi.extensions.equinox" rev="${org.eclipse.virgo.osgi}" conf="lib->runtime"/>
+		<dependency org="org.eclipse.virgo.osgi" name="org.eclipse.virgo.osgi.console" rev="${org.eclipse.virgo.osgi}" conf="lib->runtime"/>
+		<dependency org="javax.transaction" name="com.springsource.javax.transaction" rev="${javax.transaction}" conf="lib->runtime"/>
 	</dependencies>
 
 </ivy-module>
diff --git a/build-kernel/lib/org.eclipse.virgo.kernel.launch.properties b/build-kernel/lib/org.eclipse.virgo.kernel.launch.properties
new file mode 100644
index 0000000..63bc1db
--- /dev/null
+++ b/build-kernel/lib/org.eclipse.virgo.kernel.launch.properties
@@ -0,0 +1,63 @@
+launcher.bundles =\
+ file:lib/kernel/com.springsource.slf4j.api-@SLF4J.VERSION@.jar@start,\
+ file:lib/kernel/com.springsource.slf4j.org.apache.commons.logging-@SLF4J.VERSION@.jar@start,\
+ file:lib/kernel/com.springsource.org.aspectj.weaver-@ASPECTJ.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.deployer-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.medic-@MEDIC.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.osgi.services-@OSGI.SERVICES.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.equinox.cm-@EQUINOX.CONFIGADMIN.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.medic.core-@MEDIC.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.util.osgi-@UTIL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.equinox.event-@EQUINOX.EVENT.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.util.common-@UTIL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.util.io-@UTIL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.util.jmx-@UTIL.VERSION@.jar,\
+ file:lib/kernel/org.eclipse.virgo.util.math-@UTIL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.util.parser.manifest-@UTIL.VERSION@.jar@start,\
+ file:lib/kernel/com.springsource.org.apache.commons.codec-1.3.0.jar@start,\
+ file:lib/kernel/com.springsource.org.apache.commons.httpclient-3.1.0.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.repository-@REPOSITORY.VERSION@.jar@start,\
+ file:lib/kernel/org.springframework.aop-@SPRING.VERSION@.jar,\
+ file:lib/kernel/org.springframework.asm-@SPRING.VERSION@.jar,\
+ file:lib/kernel/org.springframework.expression-@SPRING.VERSION@.jar,\
+ file:lib/kernel/org.springframework.beans-@SPRING.VERSION@.jar,\
+ file:lib/kernel/org.springframework.core-@SPRING.VERSION@.jar,\
+ file:lib/kernel/org.springframework.context-@SPRING.VERSION@.jar,\
+ file:lib/kernel/org.eclipse.virgo.kernel.core-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.agent.dm-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.springframework.osgi.core-@SPRING.DM.VERSION@.jar,\
+ file:lib/kernel/org.springframework.osgi.extender-@SPRING.DM.VERSION@.jar@start,\
+ file:lib/kernel/org.springframework.osgi.io-@SPRING.DM.VERSION@.jar,\
+ file:lib/kernel/com.springsource.org.aopalliance-1.0.0.jar,\
+ file:lib/kernel/org.eclipse.equinox.ds-@EQUINOX.DS.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.equinox.util-@EQUINOX.UTIL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.artifact-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.services-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.model-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.kerneldmfragment-@KERNEL.VERSION@.jar,\
+ file:lib/kernel/org.eclipse.virgo.kernel.shell-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.osgi-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.core-@KERNEL.VERSION@.jar@start,\
+ file:lib/kernel/org.eclipse.virgo.kernel.userregionfactory-@KERNEL.VERSION@.jar@start
+
+#Equinox Configuration 
+osgi.parentClassloader=fwk
+osgi.context.bootdelegation=false
+osgi.compatibility.bootdelegation=false
+osgi.clean=true
+org.osgi.framework.bsnversion=multiple
+
+# osgi console support
+# osgi.console=2401
+
+osgi.java.profile=file:lib/java6-server.profile
+osgi.java.profile.bootdelegation=override
+osgi.hook.configurators.include=\
+ org.eclipse.virgo.osgi.extensions.equinox.hooks.ExtensionsHookConfigurator,\
+ org.eclipse.virgo.osgi.console.telnet.hook.TelnetHookConfigurator
+
+org.eclipse.virgo.medic.log.config.path=config/serviceability.xml
+org.eclipse.virgo.suppress.heap.dumps=false
+
+eclipse.bundle.setTCCL=false
+eclipse.enableStateSaver=false
diff --git a/build-kernel/repository/ext/org.eclipse.virgo.kernel.userregion.springdm.plan b/build-kernel/repository/ext/org.eclipse.virgo.kernel.userregion.springdm.plan
index f9f9d9b..d6d6b19 100644
--- a/build-kernel/repository/ext/org.eclipse.virgo.kernel.userregion.springdm.plan
+++ b/build-kernel/repository/ext/org.eclipse.virgo.kernel.userregion.springdm.plan
@@ -1,4 +1,4 @@
-<plan name="org.eclipse.virgo.kernel.userregion.springdm" version="2.2.0" scoped="false" atomic="false"
+<plan name="org.eclipse.virgo.kernel.userregion.springdm" version="3.0.0" scoped="false" atomic="false"
                 xmlns="http://www.eclipse.org/virgo/schema/plan"
 				xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 				xsi:schemaLocation="
@@ -8,6 +8,9 @@
         <artifact type="bundle" name="org.springframework.osgi.core" version="[1.2.1, 1.3.0)"/>
         <artifact type="bundle" name="org.springframework.osgi.extender" version="[1.2.1, 1.3.0)"/>
         <artifact type="bundle" name="org.springframework.osgi.io" version="[1.2.1, 1.3.0)"/>
-        <artifact type="bundle" name="org.eclipse.virgo.kernel.agent.dm" version="[2.1.0, 3.0)"/>
-        <artifact type="bundle" name="org.eclipse.virgo.kernel.deployer.dm" version="[2.1.0, 3.0)"/>
+        <artifact type="bundle" name="org.eclipse.virgo.kernel.agent.dm" version="[3.0, 4.0)"/>
+        <artifact type="bundle" name="org.eclipse.virgo.kernel.deployer.dm" version="[3.0, 4.0)"/>
+		<artifact type="bundle" name="org.eclipse.equinox.ds" version="0.0.0"/>
+		<artifact type="bundle" name="org.eclipse.equinox.util" version="0.0.0"/>
+		<artifact type="bundle" name="org.eclipse.osgi.services" version="0.0.0"/>
 </plan>
diff --git a/build.properties b/build.properties
index 694f389..1463e3a 100644
--- a/build.properties
+++ b/build.properties
@@ -1,5 +1,5 @@
-version=2.2.0

-release.type=integration

+version=3.0.0
+release.type=integration
 javadoc.exclude.package.names=**/internal/**,**/internal

 ivy.cache.dir=${basedir}/../ivy-cache

 integration.repo.dir=${basedir}/../integration-repo

diff --git a/build.versions b/build.versions
index c9baee4..59f654f 100644
--- a/build.versions
+++ b/build.versions
@@ -1,15 +1,17 @@
 # Compile
-org.apache.felix.eventadmin=1.0.0
-org.eclipse.osgi.services=3.3.0.v20101018
-org.eclipse.equinox.cm=1.0.200.v20100520
-org.eclipse.equinox.launcher=1.1.0.v20100507
-org.eclipse.equinox.simpleconfigurator=1.0.200.v20100503
+org.eclipse.osgi.services=3.3.0.v20110110
+org.eclipse.equinox.event=1.2.100.v20110110
+org.eclipse.equinox.util=1.0.200.v20100503
+org.eclipse.equinox.ds=1.3.0.v20110124-0830
+org.eclipse.equinox.cm=1.0.300.v20101204
+org.eclipse.equinox.launcher=1.2.0.v20110124-0830
+org.eclipse.equinox.simpleconfigurator=1.0.200.v20110228
 org.aspectj=1.6.6.RELEASE
-org.eclipse.osgi=3.7.0.v20101022
-org.eclipse.virgo.medic=2.2.0.D-20101207150849
-org.eclipse.virgo.osgi=2.2.0.D-20101207145732
-org.eclipse.virgo.repository=2.2.0.D-20101207151510
-org.eclipse.virgo.util=2.2.0.D-20101207150035
+org.eclipse.osgi=3.7.0.v20110224
+org.eclipse.virgo.medic=3.0.0.M02
+org.eclipse.virgo.osgi=3.0.0.M02
+org.eclipse.virgo.repository=3.0.0.D-20110309170144
+org.eclipse.virgo.util=3.0.0.M02
 org.slf4j=1.6.1
 org.slf4j.spi=1.6.1
 org.springframework.osgi=1.2.1
@@ -30,7 +32,7 @@
 javax.servlet=2.5.0
 javax.transaction=1.1.0
 org.easymock=2.3.0
-org.eclipse.virgo.test=2.2.0.D-20101207150629
-org.eclipse.virgo.teststubs=2.2.0.D-20101207145338
+org.eclipse.virgo.test=3.0.0.M02
+org.eclipse.virgo.teststubs=3.0.0.M02
 org.hsqldb=1.8.0.9
 org.junit=4.7.0
diff --git a/org.eclipse.virgo.kernel.agent.dm/.classpath b/org.eclipse.virgo.kernel.agent.dm/.classpath
index 7b32f1c..580ce91 100644
--- a/org.eclipse.virgo.kernel.agent.dm/.classpath
+++ b/org.eclipse.virgo.kernel.agent.dm/.classpath
@@ -22,24 +22,25 @@
 	</classpathentry>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar">
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar">
 		<attributes>
 			<attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
 		</attributes>
 	</classpathentry>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-sources-1.2.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-sources-1.2.1.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-sources-1.6.1.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.apache.felix/org.apache.felix.eventadmin/1.0.0/org.apache.felix.eventadmin-1.0.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.apache.felix/org.apache.felix.eventadmin/1.0.0/org.apache.felix.eventadmin-sources-1.0.0.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-2.2.0.D-20101207145338.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-sources-2.2.0.D-20101207145338.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="src" path="/org.eclipse.virgo.kernel.deployer"/>
 	<classpathentry kind="src" path="/org.eclipse.virgo.kernel.core"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
+	<classpathentry kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.equinox.event/1.2.100.v20110110/org.eclipse.equinox.event-1.2.100.v20110110.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/org.eclipse.virgo.kernel.agent.dm/ivy.xml b/org.eclipse.virgo.kernel.agent.dm/ivy.xml
index 52391a0..9882443 100644
--- a/org.eclipse.virgo.kernel.agent.dm/ivy.xml
+++ b/org.eclipse.virgo.kernel.agent.dm/ivy.xml
@@ -20,7 +20,8 @@
         <dependency name='org.eclipse.osgi' rev='${org.eclipse.osgi}' org='org.eclipse.osgi' conf='compile->runtime'/>
 
 		<dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="compile->runtime"/>
-		<dependency org="org.eclipse.equinox" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="compile->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="compile->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.event" rev="${org.eclipse.equinox.event}" conf="compile->runtime"/>
 
         <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.deployer" rev="latest.integration" conf='compile->compile'/>
         <dependency name='org.eclipse.virgo.util.io' rev='${org.eclipse.virgo.util}' org='org.eclipse.virgo.util' conf='compile->compile'/>
@@ -30,7 +31,6 @@
         <dependency name='org.eclipse.virgo.medic' rev='${org.eclipse.virgo.medic}' org='org.eclipse.virgo.medic' conf='aspects, compile->runtime'/>
         <dependency name='org.eclipse.virgo.medic.core' rev='${org.eclipse.virgo.medic}' org='org.eclipse.virgo.medic' conf='runtime->runtime'/>
         <dependency name='org.eclipse.virgo.medic.test' rev='${org.eclipse.virgo.medic}' org='org.eclipse.virgo.medic' conf='test->runtime'/>
-        <dependency name='org.apache.felix.eventadmin' rev='${org.apache.felix.eventadmin}' conf='compile->compile' org='org.apache.felix'/>
         <dependency org="org.springframework.osgi" name="org.springframework.osgi.extender" rev="${org.springframework.osgi}" conf="compile->compile"/>
         <dependency org="org.springframework.osgi" name="org.springframework.osgi.core" rev="${org.springframework.osgi}" conf="compile->compile"/>
         <override org="org.springframework" rev="${org.springframework}"/>
diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/AgentDMStartTracker.java b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/AgentDMStartTracker.java
new file mode 100644
index 0000000..013fd9d
--- /dev/null
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/AgentDMStartTracker.java
@@ -0,0 +1,24 @@
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 SAP AG

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   SAP AG - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.agent.dm;

+

+/**

+ * 

+ * This interface is registered as a service that is enabled only when the agent.DM is started successfully

+ * <p />

+ *

+ * <strong>Concurrent Semantics</strong><br />

+ * Implementations of this interface must be thread safe.

+ */

+public interface AgentDMStartTracker {

+

+}

diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/StandardAgentDMStartTracker.java b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/StandardAgentDMStartTracker.java
new file mode 100644
index 0000000..faefba1
--- /dev/null
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/StandardAgentDMStartTracker.java
@@ -0,0 +1,25 @@
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 SAP AG

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   SAP AG - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.agent.dm;

+

+/**

+ * 

+ * This class is the standard implementation for the AgentDMStartTracker

+ * <p />

+ *

+ * <strong>Concurrent Semantics</strong><br />

+ * Thread safe.

+ */

+

+public class StandardAgentDMStartTracker implements AgentDMStartTracker {

+

+}

diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/AgentActivator.java b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/AgentActivator.java
index 242acf9..35ed716 100644
--- a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/AgentActivator.java
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/AgentActivator.java
@@ -14,20 +14,19 @@
 import java.util.Dictionary;
 import java.util.Hashtable;
 
-import org.osgi.framework.BundleActivator;
+import org.eclipse.virgo.medic.eventlog.EventLogger;
+import org.eclipse.virgo.medic.eventlog.EventLoggerFactory;
+import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.ComponentContext;
 import org.osgi.service.event.EventAdmin;
 import org.osgi.service.event.EventConstants;
 import org.osgi.service.event.EventHandler;
 import org.springframework.osgi.context.event.OsgiBundleApplicationContextListener;
 
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.eclipse.virgo.medic.eventlog.EventLoggerFactory;
-import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
-
 /**
- * {@link BundleActivator} for the Kernel's Agent bundle
+ * ComponentContext activator for the Kernel's Agent bundle
  * 
  * <p />
  * 
@@ -36,15 +35,14 @@
  * Thread-safe.
  * 
  */
-public final class AgentActivator implements BundleActivator {
+public final class AgentActivator {
 
+    private static final String AGENT_DM_START_TRACKER = "agentDMStartTracker";
     private final ServiceRegistrationTracker registrationTracker = new ServiceRegistrationTracker();
 
-    /**
-     * {@inheritDoc}
-     */
-    public void start(BundleContext context) {
-        registerSpringDmToBlueprintEventAdapter(context);
+    public void activate(ComponentContext context) {
+        registerSpringDmToBlueprintEventAdapter(context.getBundleContext());
+        context.enableComponent(AGENT_DM_START_TRACKER);
     }
 
     private void registerSpringDmToBlueprintEventAdapter(BundleContext context) {
@@ -66,11 +64,8 @@
         props.put(EventConstants.EVENT_TOPIC, new String[] { "org/osgi/service/blueprint/container/*" });
         this.registrationTracker.track(context.registerService(EventHandler.class.getName(), failureListener, props));
     }
-    
-    /**
-     * {@inheritDoc}
-     */
-    public void stop(BundleContext context) throws Exception {
+
+    public void deactivate(ComponentContext context) throws Exception {
         this.registrationTracker.unregisterAll();
     }
 
@@ -82,10 +77,11 @@
             result = (T) context.getService(ref);
         }
         if (result == null) {
-//TODO: is consuming service references reasonable if failures are retried many times? May need the following code.
-//            if (ref != null) {
-//                context.ungetService(ref); 
-//            }
+            // TODO: is consuming service references reasonable if failures are retried many times? May need the
+            // following code.
+            // if (ref != null) {
+            // context.ungetService(ref);
+            // }
             throw new IllegalStateException("Unable to access required service of type '" + clazz.getName() + "' from bundle '"
                 + context.getBundle().getSymbolicName() + "'");
         }
diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java
index cca255c..afd39bb 100644
--- a/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/java/org/eclipse/virgo/kernel/agent/dm/internal/DeployerFailureListener.java
@@ -11,13 +11,16 @@
 
 package org.eclipse.virgo.kernel.agent.dm.internal;
 
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.eclipse.virgo.medic.eventlog.EventLogger;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
 import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
 import org.osgi.service.event.Event;
 import org.osgi.service.event.EventHandler;
 
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-
 /**
  * A {@link EventHandler} implementation that listens for and handles Blueprint container failure events.
  * <p />
@@ -37,6 +40,10 @@
 
     private final EventLogger eventLogger;
 
+    private volatile RegionDigraph regionDigraph;
+
+    private volatile Region agentRegion;
+
     public DeployerFailureListener(EventLogger eventLogger) {
         this.eventLogger = eventLogger;
     }
@@ -55,8 +62,25 @@
     }
 
     private boolean inThisRegion(Bundle bundle) {
-        Bundle agentBundle = FrameworkUtil.getBundle(getClass());
-        return agentBundle.getBundleContext().getBundle(bundle.getBundleId()) == bundle;
+        if (regionDigraph == null) {
+            Bundle agentBundle = FrameworkUtil.getBundle(getClass());
+            BundleContext bundleContext = agentBundle.getBundleContext();
+            ServiceReference<RegionDigraph> regionMembershipServiceReference = bundleContext.getServiceReference(RegionDigraph.class);
+            if (regionMembershipServiceReference != null) {
+                this.regionDigraph = bundleContext.getService(regionMembershipServiceReference);
+                this.agentRegion = getRegion(agentBundle);
+            }
+        }
+        return this.regionDigraph != null ? getRegion(bundle).equals(this.agentRegion) : true;
+    }
+
+    private Region getRegion(Bundle bundle) {
+        for (Region region : this.regionDigraph) {
+            if (region.contains(bundle)) {
+                return region;
+            }
+        }
+        return null;
     }
 
 }
diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/agentdm_start_tracker.xml b/org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/agentdm_start_tracker.xml
new file mode 100644
index 0000000..2e7d9f5
--- /dev/null
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/agentdm_start_tracker.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<component name="agentDMStartTracker" enabled="false" xmlns:src="http://www.osgi.org/xmlns/src/v1.1.0">

+	<implementation class="org.eclipse.virgo.kernel.agent.dm.StandardAgentDMStartTracker"/>

+	<service>

+      <provide interface="org.eclipse.virgo.kernel.agent.dm.AgentDMStartTracker"/>

+   	</service>

+</component>
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/dm_agent.xml b/org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/dm_agent.xml
new file mode 100644
index 0000000..1b52c6b
--- /dev/null
+++ b/org.eclipse.virgo.kernel.agent.dm/src/main/resources/OSGI-INF/dm_agent.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<component name="agentDM" immediate="true" xmlns:src="http://www.osgi.org/xmlns/src/v1.1.0">

+	<implementation class="org.eclipse.virgo.kernel.agent.dm.internal.AgentActivator"/>

+	<reference name="EventLogger"

+		interface="org.eclipse.virgo.medic.eventlog.EventLoggerFactory"

+		policy="dynamic"/>	

+	<reference name="EventAdmin"

+		interface="org.osgi.service.event.EventAdmin"

+		policy="dynamic"/>

+</component>
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.agent.dm/template.mf b/org.eclipse.virgo.kernel.agent.dm/template.mf
index baa0fc1..b1b6ce2 100644
--- a/org.eclipse.virgo.kernel.agent.dm/template.mf
+++ b/org.eclipse.virgo.kernel.agent.dm/template.mf
@@ -1,17 +1,19 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Virgo Kernel Agent Spring DM integration
-Bundle-SymbolicName: org.eclipse.virgo.kernel.agent.dm
-Bundle-Version: 2.2.0
-Bundle-Activator: org.eclipse.virgo.kernel.agent.dm.internal.AgentActivator
-Excluded-Exports: 
- *.internal.*
-Import-Template: 
- org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",
- org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
- org.aspectj.*;version="${org.aspectj:[=.=.=.=, +1)}",
- org.osgi.*;version="0",
- org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",
- org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",
+Manifest-Version: 1.0

+Bundle-ManifestVersion: 2

+Bundle-Name: Virgo Kernel Agent Spring DM integration

+Bundle-SymbolicName: org.eclipse.virgo.kernel.agent.dm

+Bundle-Version: 3.0.0

+Excluded-Exports: 

+ *.internal.*

+Import-Template: 

+ org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",

+ org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",

+ org.aspectj.*;version="${org.aspectj:[=.=.=.=, +1)}",

+ org.osgi.*;version="0",

+ org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",

+ org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",

  org.springframework.*;version="${org.springframework:[2.5.6, =.+1)}",
- org.springframework.osgi.*;version="${org.springframework.osgi:[=.=.=, +1)}"
+ org.springframework.osgi.*;version="${org.springframework.osgi:[=.=.=, +1)}",
+ org.osgi.*;version="0",
+ org.eclipse.osgi.*;version="0"

+Service-Component: OSGI-INF/dm_agent.xml, OSGI-INF/agentdm_start_tracker.xml

diff --git a/org.eclipse.virgo.kernel.artifact/.classpath b/org.eclipse.virgo.kernel.artifact/.classpath
index 20f009c..84a7dce 100644
--- a/org.eclipse.virgo.kernel.artifact/.classpath
+++ b/org.eclipse.virgo.kernel.artifact/.classpath
@@ -22,16 +22,18 @@
 	</classpathentry>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-2.2.0.D-20101207151510.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-sources-2.2.0.D-20101207151510.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-sources-2.0019103807.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-2.0019103807.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-sources-1.6.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-sources-1.6.1.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/2.2.0.D-20101207150849/org.eclipse.virgo.medic.core-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/2.2.0.D-20101207150849/org.eclipse.virgo.medic.core-sources-2.2.0.D-20101207150849.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-3.3.0.v20110110.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-sources-3.3.0.v20110110.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/org.eclipse.virgo.kernel.artifact/ivy.xml b/org.eclipse.virgo.kernel.artifact/ivy.xml
index 4b96c7e..4090f3f 100644
--- a/org.eclipse.virgo.kernel.artifact/ivy.xml
+++ b/org.eclipse.virgo.kernel.artifact/ivy.xml
@@ -17,11 +17,14 @@
     	<dependency org="org.eclipse.virgo.repository" name="org.eclipse.virgo.repository" rev="${org.eclipse.virgo.repository}" conf="compile->compile" />
 
     	<dependency org="org.junit" name="com.springsource.org.junit" rev="${org.junit}" conf="test->runtime"/>
+    	<dependency org="org.easymock" name="com.springsource.org.easymock" rev="${org.easymock}" conf="test->runtime"/>
     	<dependency org="org.slf4j" name="com.springsource.slf4j.nop" rev="${org.slf4j}" conf="test->runtime"/>
 
 		<dependency org="javax.servlet" name="com.springsource.javax.servlet" rev="${javax.servlet}" conf="test->runtime"/>
 		<dependency org="org.apache.commons" name="com.springsource.org.apache.commons.dbcp" rev="${commons.dbcp}" conf="test->runtime" />
 		<dependency org="org.aopalliance" name="com.springsource.org.aopalliance" rev="${org.aopalliance}" conf="test->runtime" />
+		
+		<dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="compile->runtime"/>
 
 		<override org="org.eclipse.virgo.util" rev="${org.eclipse.virgo.util}"/>
     </dependencies>
diff --git a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java
index d7298b8..9106e42 100644
--- a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java
+++ b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java
@@ -40,9 +40,9 @@
  * either as a JAR file, or a directory.
  * <p />
  * <strong>Concurrent Semantics</strong><br />
- * 
+ *
  * This class is thread-safe
- * 
+ *
  */
 public final class BundleBridge implements ArtifactBridge {
 
@@ -53,9 +53,9 @@
     public static final String RAW_HEADER_PREFIX = "RAW_HEADER:";
 
     public static final String BRIDGE_TYPE = "bundle";
-    
+
     private final HashGenerator hashGenerator;
-    
+
     public BundleBridge(HashGenerator hashGenerator) {
         this.hashGenerator = hashGenerator;
     }
@@ -72,17 +72,47 @@
         BundleManifest bundleManifest;
 
         try {
-            bundleManifest = BundleManifestUtils.readBundleManifest(artifactFile, JAR_SUFFIX, WAR_SUFFIX);            
+            bundleManifest = BundleManifestUtils.readBundleManifest(artifactFile, JAR_SUFFIX, WAR_SUFFIX);
         } catch (RuntimeException re) {
             throw new RuntimeException(String.format("Error occurred while parsing the manifest of file '%s'.", artifactFile.getPath()),  re);
         } catch (Exception e) {
             throw new ArtifactGenerationException("Error occurred while parsing the manifest.", BRIDGE_TYPE, e);
         }
-        
-        if (bundleManifest == null) {
-            return null;
+
+        ArtifactDescriptor descriptor = null;
+
+        if (bundleManifest != null) {
+            descriptor = createArtifactDescriptorFromManifest(artifactFile, bundleManifest);
         }
 
+        if (descriptor == null) {
+            descriptor = createArtifactDescriptorFromFile(artifactFile);
+        }
+
+        return descriptor;
+    }
+
+    private ArtifactDescriptor createArtifactDescriptorFromFile(File artifactFile) {
+        String fileName = artifactFile.getName();
+
+        if (fileName.endsWith(JAR_SUFFIX) || fileName.endsWith(WAR_SUFFIX)) {
+            String name = fileName.substring(0, fileName.length() - JAR_SUFFIX.length());
+
+            ArtifactDescriptorBuilder artifactDescriptorBuilder = new ArtifactDescriptorBuilder();
+            artifactDescriptorBuilder.setUri(artifactFile.toURI());
+            artifactDescriptorBuilder.setName(name);
+            artifactDescriptorBuilder.setType(BRIDGE_TYPE);
+            artifactDescriptorBuilder.setVersion(Version.emptyVersion);
+
+            this.hashGenerator.generateHash(artifactDescriptorBuilder, artifactFile);
+
+            return artifactDescriptorBuilder.build();
+        }
+
+        return null;
+    }
+
+    private ArtifactDescriptor createArtifactDescriptorFromManifest(File artifactFile, BundleManifest bundleManifest) throws ArtifactGenerationException {
         try {
             ArtifactDescriptorBuilder artifactDescriptorBuilder = new ArtifactDescriptorBuilder();
 
diff --git a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/par/ParBridge.java b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/par/ParBridge.java
index 0219e9c..d3f145a 100644
--- a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/par/ParBridge.java
+++ b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/par/ParBridge.java
@@ -14,8 +14,6 @@
 import java.io.File;
 import java.io.IOException;
 
-import org.osgi.framework.Version;
-
 import org.eclipse.virgo.kernel.artifact.internal.BundleManifestUtils;
 import org.eclipse.virgo.repository.ArtifactBridge;
 import org.eclipse.virgo.repository.ArtifactDescriptor;
@@ -25,16 +23,17 @@
 import org.eclipse.virgo.repository.builder.AttributeBuilder;
 import org.eclipse.virgo.util.common.StringUtils;
 import org.eclipse.virgo.util.osgi.manifest.BundleManifest;
+import org.osgi.framework.Version;
 
 /**
  * An <code>ArtifactBridge</code> for PAR files.
- * 
+ *
  * <p />
- * 
+ *
  * <strong>Concurrent Semantics</strong><br />
- * 
+ *
  * Thread-safe.
- * 
+ *
  */
 public final class ParBridge implements ArtifactBridge {
 
@@ -50,6 +49,8 @@
 
     public static final String BRIDGE_TYPE = "par";
 
+    public static final String PAR_SUFFIX = ".par";
+
     private final HashGenerator hashGenerator;
 
     public ParBridge(HashGenerator hashGenerator) {
@@ -61,7 +62,7 @@
         BundleManifest manifest;
 
         try {
-            manifest = BundleManifestUtils.readBundleManifest(artifactFile, ".par");
+            manifest = BundleManifestUtils.readBundleManifest(artifactFile, PAR_SUFFIX);
         } catch (IOException ioe) {
             throw new ArtifactGenerationException("Failed to read manifest from " + artifactFile, ioe);
         }
@@ -69,10 +70,27 @@
         if (manifest != null) {
             return createDescriptorFromManifest(manifest, artifactFile);
         } else {
-            return null;
+            return createDescriptorFromFile(artifactFile);
         }
     }
 
+    private ArtifactDescriptor createDescriptorFromFile(File artifactFile) throws ArtifactGenerationException {
+        String fileName = artifactFile.getName();
+
+        if (fileName.endsWith(PAR_SUFFIX)) {
+            String symbolicName = fileName.substring(0, fileName.length() - PAR_SUFFIX.length());
+
+            ArtifactDescriptorBuilder builder = new ArtifactDescriptorBuilder();
+            builder.setType(BRIDGE_TYPE).setName(symbolicName).setVersion(Version.emptyVersion).setUri(artifactFile.toURI());
+
+            this.hashGenerator.generateHash(builder, artifactFile);
+
+            return builder.build();
+        }
+
+        return null;
+    }
+
     private ArtifactDescriptor createDescriptorFromManifest(BundleManifest manifest, File artifactFile) throws ArtifactGenerationException {
 
         String symbolicName = getApplicationSymbolicName(manifest);
@@ -88,7 +106,7 @@
 
         applyAttributeIfPresent(HEADER_APPLICATION_NAME, manifest, builder);
         applyAttributeIfPresent(HEADER_APPLICATION_DESCRIPTION, manifest, builder);
-        
+
         this.hashGenerator.generateHash(builder, artifactFile);
 
         return builder.build();
@@ -102,7 +120,7 @@
         }
     }
 
-    private Version getApplicationVersion(BundleManifest manifest) throws ArtifactGenerationException {
+    private Version getApplicationVersion(BundleManifest manifest) {
         String versionString = manifest.getHeader(HEADER_APPLICATION_VERSION);
         Version version;
 
@@ -112,7 +130,7 @@
             try {
                 version = new Version(versionString);
             } catch (IllegalArgumentException iae) {
-                throw new ArtifactGenerationException("Version '" + versionString + "' is ill-formed", iae);
+                throw new IllegalArgumentException("Version '" + versionString + "' is ill-formed", iae);
             }
         }
         return version;
diff --git a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridge.java b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridge.java
index a1963ff..cd62c9b 100644
--- a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridge.java
+++ b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridge.java
@@ -16,14 +16,17 @@
 import java.io.IOException;
 import java.util.Properties;
 
-import org.osgi.framework.Version;
-
 import org.eclipse.virgo.repository.ArtifactBridge;
 import org.eclipse.virgo.repository.ArtifactDescriptor;
 import org.eclipse.virgo.repository.ArtifactGenerationException;
 import org.eclipse.virgo.repository.HashGenerator;
 import org.eclipse.virgo.repository.builder.ArtifactDescriptorBuilder;
+import org.eclipse.virgo.repository.builder.AttributeBuilder;
+import org.eclipse.virgo.util.common.StringUtils;
 import org.eclipse.virgo.util.io.IOUtils;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
+import org.osgi.service.cm.ConfigurationAdmin;
 
 /**
  * An {@link ArtifactBridge} that creates {@link ArtifactDescriptor ArtifactDescriptors} for .properties files.
@@ -42,8 +45,11 @@
 
     private final HashGenerator hashGenerator;
 
-    public PropertiesBridge(HashGenerator hashGenerator) {
+    private final ConfigurationAdmin configAdmin;
+
+    public PropertiesBridge(HashGenerator hashGenerator, ConfigurationAdmin configAdmin) {
         this.hashGenerator = hashGenerator;
+        this.configAdmin = configAdmin;
     }
 
     public ArtifactDescriptor generateArtifactDescriptor(File artifactFile) throws ArtifactGenerationException {
@@ -51,10 +57,11 @@
             FileReader reader = null;
             try {
                 reader = new FileReader(artifactFile);
-                new Properties().load(reader);
-                return createArtifactDescriptor(artifactFile);
+                Properties properties = new Properties();
+                properties.load(reader);
+                return createArtifactDescriptor(artifactFile, properties);
             } catch (IOException e) {
-                throw new ArtifactGenerationException("Failed to read properties file", ARTIFACT_TYPE, e);
+                throw new ArtifactGenerationException("Failed processing properties file", ARTIFACT_TYPE, e);
             } finally {
                 IOUtils.closeQuietly(reader);
             }
@@ -62,10 +69,43 @@
         return null;
     }
 
-    private ArtifactDescriptor createArtifactDescriptor(File propertiesFile) {
-        String fileName = propertiesFile.getName();
-        String name = fileName.substring(0, fileName.length() - PROPERTIES_SUFFIX.length());
+    private ArtifactDescriptor createArtifactDescriptor(File propertiesFile, Properties properties) throws IOException {
 
+        String name = properties.getProperty(ConfigurationAdmin.SERVICE_FACTORYPID);
+        if (StringUtils.hasText(name)) {
+            // this is a factory configuration - need to generate actual PID for a new configuration
+            return buildForManagedServiceFactoryConfiguration(propertiesFile, name, properties);
+        }
+
+        name = properties.getProperty(Constants.SERVICE_PID);
+        if (!StringUtils.hasText(name)) {
+            String fileName = propertiesFile.getName();
+            name = fileName.substring(0, fileName.length() - PROPERTIES_SUFFIX.length());
+        }
+
+        return buildAtrifactDescriptor(propertiesFile, name).build();
+    }
+
+    /**
+     * @param propertiesFile
+     * @param name
+     * @param properties
+     * @return
+     * @throws IOException
+     */
+    private ArtifactDescriptor buildForManagedServiceFactoryConfiguration(File propertiesFile, String factoryPid, Properties properties)
+        throws IOException {
+
+        // generated service.pid - will use as a name for artifactId
+        String pid = configAdmin.createFactoryConfiguration(factoryPid, null).getPid();
+
+        ArtifactDescriptorBuilder builder = buildAtrifactDescriptor(propertiesFile, pid);
+        builder.addAttribute(new AttributeBuilder().setName(ConfigurationAdmin.SERVICE_FACTORYPID).setValue(factoryPid).build());
+
+        return builder.build();
+    }
+
+    private ArtifactDescriptorBuilder buildAtrifactDescriptor(File propertiesFile, String name) {
         ArtifactDescriptorBuilder artifactDescriptorBuilder = new ArtifactDescriptorBuilder();
 
         artifactDescriptorBuilder //
@@ -73,9 +113,9 @@
         .setType(ARTIFACT_TYPE) //
         .setName(name) //
         .setVersion(Version.emptyVersion);
-        
+
         this.hashGenerator.generateHash(artifactDescriptorBuilder, propertiesFile);
 
-        return artifactDescriptorBuilder.build();
+        return artifactDescriptorBuilder;
     }
 }
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridgeTests.java b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridgeTests.java
index 8d606db..ef06b0a 100644
--- a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridgeTests.java
+++ b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridgeTests.java
@@ -37,21 +37,21 @@
  * Unit tests for {@link org.eclipse.virgo.kernel.artifact.bundle.BundleBridge BundleBridge}. Uses a combination of real bundle files and
  * static test data.
  * </p>
- * 
+ *
  * <strong>Concurrent Semantics</strong><br />
- * 
+ *
  * Threadsafe test case
- * 
+ *
  */
 public class BundleBridgeTests {
-    
+
     //Test Data
-    
+
     private final static String ARTEFACT_ATTRIBUTE_NAME = "name";
 
     private final static String ARTEFACT_ATTRIBUTE_VERSION = "version";
     //End Test Data
-    
+
     private static BundleBridge BUNDLE_BRIDGE;
 
     private static final StubBundleArtefactBridge STUB_ARTEFACT_DEFINITION = new StubBundleArtefactBridge();
@@ -162,7 +162,7 @@
     public void webBundleWar() throws ArtifactGenerationException {
         ArtifactDescriptor descriptor = BUNDLE_BRIDGE.generateArtifactDescriptor(new File("src/test/resources/wars/test.war"));
         assertNotNull(descriptor);
-        assertEquals("bundle", descriptor.getType());
+        assertEquals(BundleBridge.BRIDGE_TYPE, descriptor.getType());
         assertEquals("com.springsource.server.admin.web", descriptor.getName());
         assertEquals(new Version(2, 0, 0), descriptor.getVersion());
     }
@@ -171,14 +171,32 @@
     public void explodedBundle() throws ArtifactGenerationException {
         ArtifactDescriptor descriptor = BUNDLE_BRIDGE.generateArtifactDescriptor(new File("src/test/resources/bundle.jar"));
         assertNotNull(descriptor);
-        assertEquals("bundle", descriptor.getType());
+        assertEquals(BundleBridge.BRIDGE_TYPE, descriptor.getType());
         assertEquals("exploded.bundle", descriptor.getName());
         assertEquals(new Version(1, 0, 0), descriptor.getVersion());
     }
 
+    @Test
+    public void noSymbolicName() throws ArtifactGenerationException {
+        ArtifactDescriptor descriptor = BUNDLE_BRIDGE.generateArtifactDescriptor(new File("src/test/resources/jars/no-symbolic-name.jar"));
+        assertNotNull(descriptor);
+        assertEquals(BundleBridge.BRIDGE_TYPE, descriptor.getType());
+        assertEquals("no-symbolic-name", descriptor.getName());
+        assertEquals(new Version(0, 0, 0), descriptor.getVersion());
+    }
+
+    @Test
+    public void noManifest() throws ArtifactGenerationException {
+        ArtifactDescriptor descriptor = BUNDLE_BRIDGE.generateArtifactDescriptor(new File("src/test/resources/jars/no-manifest.jar"));
+        assertNotNull(descriptor);
+        assertEquals(BundleBridge.BRIDGE_TYPE, descriptor.getType());
+        assertEquals("no-manifest", descriptor.getName());
+        assertEquals(Version.emptyVersion, descriptor.getVersion());
+    }
+
     private Set<ArtifactDescriptor> generateArtefacts(File directory) throws ArtifactGenerationException {
         Set<ArtifactDescriptor> artefacts = new HashSet<ArtifactDescriptor>();
-        
+
         for (File fileInDir : directory.listFiles()) {
             if(!fileInDir.getName().endsWith(".jar") && !fileInDir.getName().contains("sources")){
                 ArtifactDescriptor artefact = BUNDLE_BRIDGE.generateArtifactDescriptor(fileInDir);
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/par/ParBridgeTests.java b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/par/ParBridgeTests.java
index 459889f..8a47a35 100644
--- a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/par/ParBridgeTests.java
+++ b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/par/ParBridgeTests.java
@@ -22,56 +22,51 @@
 import org.junit.Test;
 import org.osgi.framework.Version;
 
-
 import org.eclipse.virgo.kernel.artifact.StubHashGenerator;
 import org.eclipse.virgo.kernel.artifact.par.ParBridge;
 import org.eclipse.virgo.repository.ArtifactDescriptor;
 import org.eclipse.virgo.repository.ArtifactGenerationException;
 
-
-/**
- *
- */
 public class ParBridgeTests {
-    
+
     private final ParBridge parBridge = new ParBridge(new StubHashGenerator());
-    
+
     @Test
     public void descriptorGeneration() throws ArtifactGenerationException {
         ArtifactDescriptor descriptor = this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/basic.par"));
         assertDescriptor(descriptor, "par", "basic", new Version(1,2,3), "Basic Par", "A basic PAR file for the unit tests");
     }
-    
+
     @Test
     public void generationWithNoManifest() throws ArtifactGenerationException {
         ArtifactDescriptor descriptor = this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/no-manifest.par"));
-        assertNull(descriptor);
+        assertDescriptor(descriptor, "par", "no-manifest", Version.emptyVersion, null, null);
     }
-    
+
     @Test
     public void generationWithNoApplicationSymbolicName() throws ArtifactGenerationException {
         ArtifactDescriptor descriptor = this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/no-asn.par"));
         assertNull(descriptor);
     }
-    
+
     @Test
     public void generationWithNoApplicationVersion() throws ArtifactGenerationException {
         ArtifactDescriptor descriptor = this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/no-version.par"));
         assertDescriptor(descriptor, "par", "basic", Version.emptyVersion, "Basic Par", "A basic PAR file for the unit tests");
     }
-    
+
     @Test
     public void generationWithNoName() throws ArtifactGenerationException {
         ArtifactDescriptor descriptor = this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/no-name.par"));
         assertDescriptor(descriptor, "par", "basic", new Version(1,2,3), null, "A basic PAR file for the unit tests");
     }
-    
+
     @Test
     public void generationWithNoDescription() throws ArtifactGenerationException {
         ArtifactDescriptor descriptor = this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/no-description.par"));
         assertDescriptor(descriptor, "par", "basic", new Version(1,2,3), "Basic Par", null);
     }
-    
+
     @Test
     public void generationWithIllegalApplicationSymbolicName() throws Exception {
         try {
@@ -79,24 +74,24 @@
             fail("Illegal Application-SymbolicName did not throw an ArtifactGenerationException");
         } catch (ArtifactGenerationException age) {
             assertEquals("Application-SymbolicName '.@$%' contains illegal characters", age.getMessage());
-        }        
+        }
     }
-    
+
     @Test
     public void generationWithIllegalApplicationVersion() throws Exception {
         try {
             this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/illegal-version.par"));
-            fail("Illegal Application-Version did not throw an ArtifactGenerationException");
-        } catch (ArtifactGenerationException age) {
-            assertEquals("Version 'alpha' is ill-formed", age.getMessage());
-        }        
+            fail("Illegal Application-Version did not throw an IllegalArgumentException");
+        } catch (IllegalArgumentException iae) {
+            assertEquals("Version 'alpha' is ill-formed", iae.getMessage());
+        }
     }
-    
+
     @Test(expected=ArtifactGenerationException.class)
     public void generationWithMissingPar() throws ArtifactGenerationException {
-        this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/not-there.par"));   
+        this.parBridge.generateArtifactDescriptor(new File("src/test/resources/pars/not-there.par"));
     }
-    
+
     private void assertDescriptor(ArtifactDescriptor descriptor, String type, String symbolicName, Version version, String name, String description) {
         assertNotNull(descriptor);
         assertEquals(type, descriptor.getType());
@@ -107,7 +102,7 @@
         } else {
             assertTrue(descriptor.getAttribute("Application-Name").isEmpty());
         }
-        
+
         if (description != null) {
             assertEquals(description, descriptor.getAttribute("Application-Description").iterator().next().getValue());
         } else {
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridgeTests.java b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridgeTests.java
index 4f046b2..d0aa49f 100644
--- a/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridgeTests.java
+++ b/org.eclipse.virgo.kernel.artifact/src/test/java/org/eclipse/virgo/kernel/artifact/properties/PropertiesBridgeTests.java
@@ -11,18 +11,23 @@
 
 package org.eclipse.virgo.kernel.artifact.properties;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.Assert.*;
+import static org.easymock.EasyMock.*;
 
 import java.io.File;
+import java.io.IOException;
+import java.util.Set;
 
 import org.junit.Test;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
 
-
+import org.easymock.EasyMock;
 import org.eclipse.virgo.kernel.artifact.StubHashGenerator;
 import org.eclipse.virgo.kernel.artifact.properties.PropertiesBridge;
 import org.eclipse.virgo.repository.ArtifactDescriptor;
 import org.eclipse.virgo.repository.ArtifactGenerationException;
+import org.eclipse.virgo.repository.Attribute;
 
 /**
  */
@@ -30,14 +35,14 @@
 
     @Test
     public void testGeneratePropertiesFile() throws ArtifactGenerationException {
-        PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator());
+        PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), EasyMock.createMock(ConfigurationAdmin.class));
         ArtifactDescriptor result = bridge.generateArtifactDescriptor(new File("src/test/resources/properties/foo.properties"));
         assertNotNull(result);
     }
 
     @Test(expected = ArtifactGenerationException.class)
     public void testFileDoesNotExist() throws ArtifactGenerationException {
-        PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator());
+        PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), EasyMock.createMock(ConfigurationAdmin.class));
 
         File file = new File("src/test/resources/properties/not.exist.properties");
         bridge.generateArtifactDescriptor(file);
@@ -45,8 +50,68 @@
 
     @Test
     public void testGenerateNotPropertiesFile() throws ArtifactGenerationException {
-        PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator());
+        PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), createMock(ConfigurationAdmin.class));
         ArtifactDescriptor descriptor = bridge.generateArtifactDescriptor(new File("src/test/resources/bar.noterties"));
         assertNull(descriptor);
     }
+
+    @Test
+    public void testGenerateWithFactoryPid() throws ArtifactGenerationException {
+        final String factoryPid = "test.factory.pid";
+        final String propertiesFile = "src/test/resources/properties/factoryPid.properties";
+
+        ConfigurationAdmin mockConfigAdmin = createMock(ConfigurationAdmin.class);
+        Configuration mockConfiguration = createMock(Configuration.class);
+
+        try {
+            expect(mockConfigAdmin.createFactoryConfiguration(factoryPid, null)).andReturn(mockConfiguration);
+        } catch (IOException e) {
+            fail(e.getMessage());
+        }
+        expect(mockConfiguration.getPid()).andReturn("1");
+
+        replay(mockConfigAdmin, mockConfiguration);
+        
+        PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), mockConfigAdmin);
+        ArtifactDescriptor descriptor = bridge.generateArtifactDescriptor(new File(propertiesFile));
+        
+        verify(mockConfigAdmin, mockConfiguration);
+        
+        // asserts
+        assertNotNull(descriptor);
+        assertEquals("1", descriptor.getName());
+        // only expect one attribute
+        Set<Attribute> attrSet = descriptor.getAttribute(ConfigurationAdmin.SERVICE_FACTORYPID);
+        assertEquals(1, attrSet.size());
+        Attribute attr = attrSet.iterator().next();
+        assertNotNull(factoryPid, attr.getValue());
+    }
+    
+    @Test(expected = ArtifactGenerationException.class)
+    public void testGenerateWithFactoryPidAndIoExceptionFromConfigAdmin() throws ArtifactGenerationException {
+        final String factoryPid = "test.factory.pid";
+        final String propertiesFile = "src/test/resources/properties/factoryPid.properties";
+
+        ConfigurationAdmin mockConfigAdmin = createMock(ConfigurationAdmin.class);
+        
+        try {
+            expect(mockConfigAdmin.createFactoryConfiguration(factoryPid, null)).andThrow(new IOException("exception from configadmin"));
+        } catch (IOException e) {
+            // I really hate checked exceptions.
+        }
+        
+        replay(mockConfigAdmin);
+        PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), mockConfigAdmin);
+        bridge.generateArtifactDescriptor(new File(propertiesFile));
+        verify(mockConfigAdmin);
+    }
+    
+    @Test
+    public void makeSureThatServicePidIsTakenFromTheFileProvidedProperties() throws ArtifactGenerationException {
+        final String name = "service.pid.in.the.file";
+        PropertiesBridge bridge = new PropertiesBridge(new StubHashGenerator(), EasyMock.createMock(ConfigurationAdmin.class));
+        ArtifactDescriptor result = bridge.generateArtifactDescriptor(new File("src/test/resources/properties/with-service-pid.properties"));
+        assertNotNull(result);
+        assertEquals(name, result.getName());
+    }
 }
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/resources/jars/no-manifest.jar b/org.eclipse.virgo.kernel.artifact/src/test/resources/jars/no-manifest.jar
new file mode 100644
index 0000000..f63054b
--- /dev/null
+++ b/org.eclipse.virgo.kernel.artifact/src/test/resources/jars/no-manifest.jar
Binary files differ
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/resources/jars/no-symbolic-name.jar b/org.eclipse.virgo.kernel.artifact/src/test/resources/jars/no-symbolic-name.jar
new file mode 100644
index 0000000..7ab5fb3
--- /dev/null
+++ b/org.eclipse.virgo.kernel.artifact/src/test/resources/jars/no-symbolic-name.jar
Binary files differ
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/factoryPid.properties b/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/factoryPid.properties
new file mode 100644
index 0000000..f8d8d91
--- /dev/null
+++ b/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/factoryPid.properties
@@ -0,0 +1,6 @@
+# factory pid for config admin service
+service.factoryPid = test.factory.pid
+
+# properties for the managed service
+prop1 = prop1
+prop2 = 2
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/with-service-pid.properties b/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/with-service-pid.properties
new file mode 100644
index 0000000..e008c6c
--- /dev/null
+++ b/org.eclipse.virgo.kernel.artifact/src/test/resources/properties/with-service-pid.properties
@@ -0,0 +1,6 @@
+#config admin properties config with service.pid specified in the file vs. filename
+service.pid = service.pid.in.the.file
+
+# properties
+prop1 = prop1
+prop2 = 2
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.artifact/template.mf b/org.eclipse.virgo.kernel.artifact/template.mf
index bda0fda..14c5507 100644
--- a/org.eclipse.virgo.kernel.artifact/template.mf
+++ b/org.eclipse.virgo.kernel.artifact/template.mf
@@ -2,13 +2,14 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Virgo Kernel Artifact Integration
 Bundle-SymbolicName: org.eclipse.virgo.kernel.artifact
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
 Import-Template: 
  org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
  org.eclipse.virgo.repository.*;version="${org.eclipse.virgo.repository:[=.=.=, =.+1)}",
  org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",
  org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",
  org.osgi.framework.*;version="0",
+ org.osgi.service.cm.*;version="0",
  org.springframework.*;version="${org.springframework:[2.5.6, =.+1)}",
  javax.xml.*;version="0",
  org.xml.*;version="0",
diff --git a/org.eclipse.virgo.kernel.authentication/template.mf b/org.eclipse.virgo.kernel.authentication/template.mf
index 8774264..e98744b 100644
--- a/org.eclipse.virgo.kernel.authentication/template.mf
+++ b/org.eclipse.virgo.kernel.authentication/template.mf
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Virgo Kernel Authentication
 Bundle-SymbolicName: org.eclipse.virgo.kernel.authentication
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
 Import-Template: javax.security.*;version="0"
 Excluded-Exports: *.internal.*
 
diff --git a/org.eclipse.virgo.kernel.core/.classpath b/org.eclipse.virgo.kernel.core/.classpath
index a987399..1461101 100644
--- a/org.eclipse.virgo.kernel.core/.classpath
+++ b/org.eclipse.virgo.kernel.core/.classpath
@@ -22,29 +22,29 @@
 	</classpathentry>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-sources-2.2.0.D-20101207150035.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-sources-2.2.0.D-20101207150849.jar">
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-sources-3.0.0.M02.jar">
 		<attributes>
 			<attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/2.2.0.D-20101207150849/org.eclipse.virgo.medic.core-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/2.2.0.D-20101207150849/org.eclipse.virgo.medic.core-sources-2.2.0.D-20101207150849.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-sources-1.6.1.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-2.2.0.D-20101207145338.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-sources-2.2.0.D-20101207145338.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-sources-1.6.1.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry exported="true" kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-3.3.0.v20101018.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-sources-3.3.0.v20101018.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.apache.felix/org.apache.felix.eventadmin/1.0.0/org.apache.felix.eventadmin-1.0.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-sources-3.3.0.v20101018.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-sources-2.2.0.D-20101207150849.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-3.0.0.M02.jar"/>
+	<classpathentry exported="true" kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-3.3.0.v20110110.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-sources-3.3.0.v20110110.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-sources-1.2.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-sources-1.2.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-1.1.1.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.equinox.event/1.2.100.v20110110/org.eclipse.equinox.event-1.2.100.v20110110.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/org.eclipse.virgo.kernel.core/ivy.xml b/org.eclipse.virgo.kernel.core/ivy.xml
index 05a0a68..c828c5f 100644
--- a/org.eclipse.virgo.kernel.core/ivy.xml
+++ b/org.eclipse.virgo.kernel.core/ivy.xml
@@ -20,7 +20,8 @@
         <dependency name='org.eclipse.osgi' rev='${org.eclipse.osgi}' org='org.eclipse.osgi' conf='compile->runtime'/>
 
 		<dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="compile->runtime"/>
-		<dependency org="org.eclipse.equinox" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="compile->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="compile->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.event" rev="${org.eclipse.equinox.event}" conf="compile->runtime"/>
 
         <dependency name='org.eclipse.virgo.util.io' rev='${org.eclipse.virgo.util}' org='org.eclipse.virgo.util' conf='compile->compile'/>
         <dependency name='org.eclipse.virgo.util.jmx' rev='${org.eclipse.virgo.util}' org='org.eclipse.virgo.util' conf='aspects->runtime'/>
@@ -30,7 +31,6 @@
         <dependency name='org.eclipse.virgo.medic' rev='${org.eclipse.virgo.medic}' org='org.eclipse.virgo.medic' conf='aspects, compile->runtime'/>
         <dependency name='org.eclipse.virgo.medic.core' rev='${org.eclipse.virgo.medic}' org='org.eclipse.virgo.medic' conf='runtime->runtime'/>
         <dependency name='org.eclipse.virgo.medic.test' rev='${org.eclipse.virgo.medic}' org='org.eclipse.virgo.medic' conf='test->runtime'/>
-        <dependency name='org.apache.felix.eventadmin' rev='${org.apache.felix.eventadmin}' conf='compile->compile' org='org.apache.felix'/>
         <dependency org="org.springframework.osgi" name="org.springframework.osgi.extender" rev="${org.springframework.osgi}" conf="compile->compile"/>
         <dependency org="org.springframework.osgi" name="org.springframework.osgi.core" rev="${org.springframework.osgi}" conf="compile->compile"/>
         <override org="org.springframework" rev="${org.springframework}"/>
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfiguration.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfiguration.java
index 88fc00f..20cd2ee 100644
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfiguration.java
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfiguration.java
@@ -16,21 +16,29 @@
 import java.util.List;
 
 import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public final class KernelConfiguration {
 
+    private final Logger LOGGER = LoggerFactory.getLogger(this.getClass());
+
     static final String PROPERTY_KERNEL_CONFIG = "org.eclipse.virgo.kernel.config";
 
     static final String PROPERTY_KERNEL_HOME = "org.eclipse.virgo.kernel.home";
 
     static final String PROPERTY_KERNEL_DOMAIN = "org.eclipse.virgo.kernel.domain";
 
+    static final String PROPERTY_KERNEL_STARTUP_WAIT_LIMIT = "org.eclipse.virgo.kernel.startup.wait.limit";
+
     private static final String DEFAULT_WORK_DIRECTORY_NAME = "work";
 
     private static final String DEFAULT_CONFIG_DIRECTORY_NAME = "config";
 
     private static final String DEFAULT_KERNEL_DOMAIN = "org.eclipse.virgo.kernel";
 
+    private static final int DEFAULT_STARTUP_WAIT_LIMIT = 180; // 3 minutes
+
     private final File homeDirectory;
 
     private final File[] configDirectories;
@@ -39,11 +47,14 @@
 
     private final String domain;
 
+    private final int startupWaitLimit;
+
     public KernelConfiguration(BundleContext context) {
         this.homeDirectory = readHomeDirectory(context);
         this.configDirectories = readConfigDirectories(context);
         this.workDirectory = new File(this.homeDirectory, DEFAULT_WORK_DIRECTORY_NAME);
         this.domain = readDomain(context);
+        this.startupWaitLimit = readBundleStartupWaitLimit(context);
     }
 
     public File getHomeDirectory() {
@@ -62,6 +73,10 @@
         return domain;
     }
 
+    public int getStartupWaitLimit() {
+        return startupWaitLimit;
+    }
+
     private static File readHomeDirectory(BundleContext context) {
         String kernelHomeProperty = readFrameworkProperty(PROPERTY_KERNEL_HOME, context);
         if (!hasText(kernelHomeProperty)) {
@@ -105,6 +120,21 @@
         return kernelDomainProperty;
     }
 
+    private int readBundleStartupWaitLimit(BundleContext context) {
+        String waitLimitProperty = readFrameworkProperty(PROPERTY_KERNEL_STARTUP_WAIT_LIMIT, context);
+        if (!hasText(waitLimitProperty)) {
+          return DEFAULT_STARTUP_WAIT_LIMIT;
+        }
+
+        try {
+            return Integer.parseInt(waitLimitProperty);
+        } catch (NumberFormatException e) {
+            LOGGER.warn("Could not parse property {} with value '{}'. Using default limit {} seconds",
+                        new Object[]{PROPERTY_KERNEL_STARTUP_WAIT_LIMIT, waitLimitProperty, DEFAULT_STARTUP_WAIT_LIMIT});
+            return DEFAULT_STARTUP_WAIT_LIMIT;
+        }
+    }
+
     private static String readFrameworkProperty(String propertyKey, BundleContext context) {
         return context.getProperty(propertyKey);
     }
@@ -112,5 +142,4 @@
     private static boolean hasText(String string) {
         return (string != null && !string.trim().isEmpty());
     }
-
 }
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSource.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSource.java
index 5643392..da4a3f3 100644
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSource.java
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSource.java
@@ -36,6 +36,8 @@
 
     static final String KERNEL_CONFIGURATION_PID = "org.eclipse.virgo.kernel";
 
+    static final String PROPERTY_KERNEL_STARTUP_WAIT_LIMIT = "org.eclipse.virgo.kernel.startup.wait.limit";
+
     private final KernelConfiguration kernelConfiguration;
 
     public KernelConfigurationPropertiesSource(KernelConfiguration kernelConfiguration) {
@@ -54,6 +56,7 @@
         properties.put(PROPERTY_DOMAIN, this.kernelConfiguration.getDomain());
         properties.put(PROPERTY_HOME_DIRECTORY, this.kernelConfiguration.getHomeDirectory().getAbsolutePath());
         properties.put(PROPERTY_WORK_DIRECTORY, this.kernelConfiguration.getWorkDirectory().getAbsolutePath());
+        properties.put(PROPERTY_KERNEL_STARTUP_WAIT_LIMIT, Integer.toString(this.kernelConfiguration.getStartupWaitLimit()));
         return properties;
     }
 
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/StandardKernelConfig.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/StandardKernelConfig.java
new file mode 100644
index 0000000..7b71ad6
--- /dev/null
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/config/internal/StandardKernelConfig.java
@@ -0,0 +1,55 @@
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 SAP AG

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   SAP AG - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.config.internal;

+

+import org.eclipse.virgo.kernel.core.KernelConfig;

+import org.osgi.service.component.ComponentContext;

+import org.slf4j.Logger;

+import org.slf4j.LoggerFactory;

+

+/**

+ * 

+ * This class is the standard implementation for the KernelConfig interface. It enables access to the configurations provided by the kernel core.

+ * <p />

+ *

+ * <strong>Concurrent Semantics</strong><br />

+ * Thread safe.

+ */

+

+public class StandardKernelConfig implements KernelConfig {

+    private final Logger LOGGER = LoggerFactory.getLogger(this.getClass());

+    ComponentContext context;

+

+    protected void activate(ComponentContext context) {

+        this.context = context;

+        LOGGER.debug("Activating StandardKernelConfig component with properties " + context.getProperties());

+    }

+

+    protected void deactivate(ComponentContext context) {

+        LOGGER.debug("Deactivating StandardKernelConfig component");

+        this.context = null;

+    }

+

+    @Override

+    public String getProperty(String name) {

+        Object value = this.context.getProperties().get(name);

+        LOGGER.debug("KernelConfig.getProperty() is called with name [" + name + "] value is [" + value + "]");

+        if (value instanceof String) {

+            return (String) value;

+        } else if (value instanceof String[] && ((String[]) value).length > 0) {

+            return ((String[]) value)[0];

+        } else {

+            return value.toString();

+        }

+    }

+

+}

diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/AbortableSignal.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/AbortableSignal.java
new file mode 100644
index 0000000..7519e5b
--- /dev/null
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/AbortableSignal.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.core;
+
+/**
+ * {@link AbortableSignal} is an interface for signalling successful or unsuccessful completion.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * 
+ * Implementations of this class must be thread safe.
+ * 
+ */
+public interface AbortableSignal extends Signal {
+
+	/**
+	 * Notifies the abortion of this Signal, there has been no error but the signal will not complete. 
+	 * If signalFailure or signalCompletion has already been called, the behaviour is undefined.
+	 */
+	void signalAborted();
+	
+}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BlockingAbortableSignal.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BlockingAbortableSignal.java
new file mode 100644
index 0000000..260ca0e
--- /dev/null
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BlockingAbortableSignal.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+package org.eclipse.virgo.kernel.core;
+
+import java.util.concurrent.TimeUnit;
+
+
+/**
+ * <p>
+ * A <code>Signal</code> implementation that blocks until notified of completion or abortion.
+ * </p>
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ *
+ * Thread-safe.
+ *
+ */
+public final class BlockingAbortableSignal implements AbortableSignal {
+
+	private volatile boolean aborted = false;
+	
+	private final BlockingSignal blockingSignal;
+	
+	public BlockingAbortableSignal() {
+		this.blockingSignal = new BlockingSignal();
+	}
+
+    /** 
+     * {@inheritDoc}
+     */
+	public void signalSuccessfulCompletion() {
+		this.blockingSignal.signalSuccessfulCompletion();
+	}
+
+    /** 
+     * {@inheritDoc}
+     */
+	public void signalFailure(final Throwable cause) {
+		this.blockingSignal.signalFailure(cause);
+	}
+
+    /** 
+     * {@inheritDoc}
+     */
+	public void signalAborted() {
+		this.aborted = true;
+		this.blockingSignal.signalSuccessfulCompletion();
+	}
+	
+	public boolean isAborted(){
+		return this.aborted;
+	}
+	
+    public boolean awaitCompletion(long period, TimeUnit timeUnit) throws FailureSignalledException {
+    	boolean complete = this.blockingSignal.awaitCompletion(period, timeUnit);
+    	if(aborted){
+    		return false;
+    	}
+    	return complete;
+    }
+	
+}
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BundleStarter.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BundleStarter.java
index bce3ec9..f02d90b 100644
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BundleStarter.java
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/BundleStarter.java
@@ -35,7 +35,7 @@
      * @param signal the <code>Signal</code> to drive.
      * @throws BundleException if Bundle {@link Bundle#start()} fails
      */
-    void start(Bundle bundle, Signal signal) throws BundleException;
+    void start(Bundle bundle, AbortableSignal signal) throws BundleException;
 
     /**
      * Starts the supplied {@link Bundle}, driving the supplied signal upon successful or unsuccessful completion
@@ -48,7 +48,13 @@
      * @param signal the <code>Signal</code> to drive.
      * @throws BundleException
      */
-    void start(Bundle bundle, int options, Signal signal) throws BundleException;
+    void start(Bundle bundle, int options, AbortableSignal signal) throws BundleException;
     
-    void trackStart(Bundle bundle, Signal signal);
+    /**
+     * Apply tracking to the given <code>Bundle</code> using the given <code>Signal</code> but don't actually start it.
+     * 
+     * @param bundle the <code>Bundle</code> to track.
+     * @param signal the <code>Signal</code> to be notified.
+     */
+    void trackStart(Bundle bundle, AbortableSignal signal);
 }
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/KernelConfig.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/KernelConfig.java
new file mode 100644
index 0000000..a69feec
--- /dev/null
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/KernelConfig.java
@@ -0,0 +1,31 @@
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 SAP AG

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   SAP AG - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.core;

+

+/**

+ * 

+ * Interface defining a way to access kernel's configuration.

+ * <p />

+ *

+ * <strong>Concurrent Semantics</strong><br />

+ * The implementations of this interface must be thread safe.

+ */

+public interface KernelConfig {

+    

+    /**

+     * Obtains the specified property from the ConfigAdmin's configuration provided by the core bundle.

+     * @param name - the name of the wanted property

+     * @return the property's value

+     */

+	public String getProperty(String name);

+

+}

diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/BundleStartTracker.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/BundleStartTracker.java
index a20e51e..9c57156 100644
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/BundleStartTracker.java
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/BundleStartTracker.java
@@ -17,6 +17,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.eclipse.virgo.kernel.core.AbortableSignal;
 import org.eclipse.virgo.kernel.core.BundleUtils;
 import org.eclipse.virgo.kernel.core.Signal;
 import org.osgi.framework.Bundle;
@@ -68,7 +69,7 @@
 
     private final Map<Bundle, Throwable> failureMap = new HashMap<Bundle, Throwable>();
 
-    private final Map<Bundle, List<Signal>> signalMap = new HashMap<Bundle, List<Signal>>();
+    private final Map<Bundle, List<AbortableSignal>> signalMap = new HashMap<Bundle, List<AbortableSignal>>();
 
     private final BundleListener bundleListener = new StartupTrackerBundleListener();
     
@@ -92,7 +93,7 @@
 
     private void driveSignalsIfStartCompleted(Bundle bundle, boolean springDmPowered) {
 
-        List<Signal> signals = null;
+        List<AbortableSignal> signals = null;
         Throwable failure = null;
         boolean isActive = isBundleActive(bundle);
         
@@ -123,20 +124,22 @@
         if (signals != null) {
             if (!springDmPowered && isActive) {
                 LOGGER.info("Non-Spring DM powered bundle '{}' has started. Driving signals '{}'.", bundle, signals);
-                driveSignals(signals, null);
+                driveSignals(signals, false, null);
             }
             else {
-                driveSignals(signals, failure);
+                driveSignals(signals, false, failure);
             }
         }
     }
 
-    private void driveSignals(final List<Signal> signals, final Throwable cause) {
+    private void driveSignals(final List<AbortableSignal> signals, final boolean aborted, final Throwable cause) {
         this.signalExecutor.execute(new Runnable() {
             public void run() {
-                for (Signal signal : signals) {
+                for (AbortableSignal signal : signals) {
                     LOGGER.info("Driving signal '{}'", signal);
-                    if (cause == null) {
+                    if (aborted){
+                    	signal.signalAborted();
+                    } else if (cause == null) {
                         signal.signalSuccessfulCompletion();
                     } else {
                         signal.signalFailure(cause);
@@ -154,7 +157,7 @@
         LOGGER.info("Handling event '{}'", event);
 
         Throwable cause = null;
-        List<Signal> signals = null;
+        List<AbortableSignal> signals = null;
 
         Bundle bundle = (Bundle) event.getProperty("bundle");
         if (EVENT_FAILURE.equals(event.getTopic())) {
@@ -176,11 +179,11 @@
         }
 
         if (signals != null) {
-            driveSignals(signals, cause);
+            driveSignals(signals, false, cause);
         }
     }
 
-    public void trackStart(Bundle bundle, Signal signal) {
+    public void trackStart(Bundle bundle, AbortableSignal signal) {
         if (BundleUtils.isFragmentBundle(bundle)) {
             throw new IllegalArgumentException("Cannot track the start of a fragment bundle.");
         }
@@ -191,11 +194,11 @@
         
         if (signal != null) {
             if (springDmPowered || !bundleActive) {
-                List<Signal> queue;
+                List<AbortableSignal> queue;
                 synchronized (this.monitor) {
                     queue = this.signalMap.get(bundle);
                     if (queue == null) {
-                        queue = new ArrayList<Signal>();
+                        queue = new ArrayList<AbortableSignal>();
                         this.signalMap.put(bundle, queue);
                     }
                     LOGGER.info("Adding signal '{}' for bundle '{}'", signal, bundle);
@@ -203,7 +206,7 @@
                 }
             } else {
                 // !springDmPowered && bundleActive
-                driveSignals(Arrays.asList(signal), null);
+                driveSignals(Arrays.asList(signal), false, null);
             }
         }
         driveSignalsIfStartCompleted(bundle, springDmPowered);
@@ -224,26 +227,32 @@
 
     private final class StartupTrackerBundleListener implements SynchronousBundleListener {
 
+        private Boolean isLazyBundle = false;
+
         /**
          * {@inheritDoc}
          */
         public void bundleChanged(BundleEvent event) {
             Bundle bundle = event.getBundle();
             if (event.getType() == BundleEvent.STARTED) {
-                List<Signal> signals = null;
+                List<AbortableSignal> signals = null;
                 if (!isSpringDmPoweredBundle(bundle)) {
                     synchronized (BundleStartTracker.this.monitor) {
                         signals = BundleStartTracker.this.signalMap.remove(bundle);
                     }
                     if (signals != null) {
                         LOGGER.info("Non-Spring DM powered bundle '{}' has started. Driving signals '{}'.", bundle, signals);
-                        driveSignals(signals, null);
+                        driveSignals(signals, false, null);
                     }
                 }
             }
+            if (event.getType() == BundleEvent.LAZY_ACTIVATION) {
+                this.isLazyBundle = true;
+                LOGGER.info("Bundle '{}' has lazy activation and is in the starting state.", bundle);
+            }
             if (event.getType() == BundleEvent.STOPPED) {
                 LOGGER.info("Bundle '{}' has stopped. Removing its related tracking state.", bundle);
-                BundleStartTracker.this.cleanup(bundle, new RuntimeException("bundle stopped"));
+                BundleStartTracker.this.cleanup(bundle, this.isLazyBundle, this.isLazyBundle ? null : new RuntimeException("Bundle '" + bundle + "' stopped"));
             }
         }
     }
@@ -253,8 +262,8 @@
      * @param bundle whose tracking state is removed
      * @param cause reason for cleaning up
      */
-    public void cleanup(Bundle bundle, Throwable cause) {
-        List<Signal> danglingSignals = null;
+    public void cleanup(Bundle bundle, boolean aborted, Throwable cause) {
+        List<AbortableSignal> danglingSignals = null;
         synchronized (BundleStartTracker.this.monitor) {
             if (bundle != null) {
                 BundleStartTracker.this.bundlesWithCreatedApplicationContexts.remove(bundle);
@@ -263,7 +272,7 @@
             }
         }
         if (danglingSignals != null) {
-            driveSignals(danglingSignals, cause);
+            driveSignals(danglingSignals, aborted, cause);
         }
     }
 
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivator.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivator.java
index f318b36..e450343 100644
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivator.java
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivator.java
@@ -38,22 +38,22 @@
 import org.eclipse.virgo.medic.dump.DumpGenerator;
 import org.eclipse.virgo.medic.eventlog.EventLogger;
 import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
-import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.launch.Framework;
+import org.osgi.service.component.ComponentContext;
 import org.osgi.service.event.EventConstants;
 import org.osgi.service.event.EventHandler;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 
 /**
- * {@link BundleActivator} that initialises the core of the Kernel.
+ * ComponentContext activator that initialises the core of the Kernel.
  * 
  * <strong>Concurrent Semantics</strong><br />
  * Threadsafe.
  * 
  */
-public class CoreBundleActivator implements BundleActivator {
+public class CoreBundleActivator {
 
     private static final String START_SIGNALLING_THREAD_NAME_PREFIX = "start-signalling-";
 
@@ -69,8 +69,6 @@
 
     private static final String MBEAN_KEY_TYPE = "type";
     
-    private static final int STARTUP_WAIT_LIMIT = 3600; // one hour
-
     private final ServiceRegistrationTracker tracker = new ServiceRegistrationTracker();
 
     private final ConfigurationInitialiser configurationInitialiser = new ConfigurationInitialiser();
@@ -83,10 +81,9 @@
     
     private volatile BundleStartTracker bundleStartTracker;
 
-    /**
-     * {@inheritDoc}
-     */
-    public void start(BundleContext context) throws Exception {
+    public void activate(ComponentContext componentContext) throws Exception {
+        BundleContext context = componentContext.getBundleContext();
+        
         EventLogger eventLogger = getRequiredService(context, EventLogger.class);
 
         KernelConfiguration configuration = this.configurationInitialiser.start(context, eventLogger);
@@ -99,7 +96,7 @@
         
         DumpGenerator dumpGenerator = getRequiredService(context, DumpGenerator.class);
         
-        this.startupTracker = new StartupTracker(context, configuration, STARTUP_WAIT_LIMIT, bundleStartTracker, shutdown, dumpGenerator);
+        this.startupTracker = new StartupTracker(context, configuration, configuration.getStartupWaitLimit(), bundleStartTracker, shutdown, dumpGenerator);
         this.startupTracker.start();
         
         initShimServices(context, eventLogger);
@@ -155,10 +152,7 @@
         return bundleStarter;
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public void stop(BundleContext context) throws Exception {
+    public void deactivate(ComponentContext context) throws Exception {
         this.tracker.unregisterAll();
         this.startupTracker.stop();
         this.configurationInitialiser.stop();
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/ServiceReferenceTracker.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/ServiceReferenceTracker.java
index 4c3cd78..18f91d7 100644
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/ServiceReferenceTracker.java
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/ServiceReferenceTracker.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * This file is part of the Virgo Web Server.
  *
- * Copyright (c) 2010 Eclipse Foundation.
+ * Copyright (c) 2010 VMware Inc.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StandardBundleStarter.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StandardBundleStarter.java
index 7eca0d0..a354a9b 100644
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StandardBundleStarter.java
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StandardBundleStarter.java
@@ -11,9 +11,9 @@
 
 package org.eclipse.virgo.kernel.core.internal;
 
+import org.eclipse.virgo.kernel.core.AbortableSignal;
 import org.eclipse.virgo.kernel.core.BundleStarter;
 import org.eclipse.virgo.kernel.core.BundleUtils;
-import org.eclipse.virgo.kernel.core.Signal;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 
@@ -41,14 +41,14 @@
     /**
      * {@inheritDoc}
      */
-    public void start(Bundle bundle, Signal signal) throws BundleException {
+    public void start(Bundle bundle, AbortableSignal signal) throws BundleException {
         start(bundle, DEFAULT_START_OPTIONS, signal);
     }
 
     /**
      * {@inheritDoc}
      */
-    public void start(Bundle bundle, int options, Signal signal) throws BundleException {
+    public void start(Bundle bundle, int options, AbortableSignal signal) throws BundleException {
         
         trackStart(bundle, signal);
         
@@ -56,12 +56,25 @@
             try {
                 bundle.start(options);
             } catch (BundleException be) {
-                this.bundleStartTracker.cleanup(bundle, be);
+                this.bundleStartTracker.cleanup(bundle, false, be);
                 throw be;
             }
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public void trackStart(Bundle bundle, AbortableSignal signal) {
+        if (BundleUtils.isFragmentBundle(bundle)) {
+            throw new IllegalArgumentException("A fragment bundle cannot be started and so start cannot be tracked");
+        }
+        
+        if (signal != null) {
+            this.bundleStartTracker.trackStart(bundle, signal);
+        }
+    }
+
     private static boolean bundleNeedsStarting(Bundle bundle) {
         if (bundle != null) {
             int bundleState = bundle.getState();
@@ -69,14 +82,5 @@
         }
         return false;
     }
-
-    public void trackStart(Bundle bundle, Signal signal) {
-        if (BundleUtils.isFragmentBundle(bundle)) {
-            throw new IllegalArgumentException("A fragment bundle cannot be started and so start cannot be tracked");
-        }
-        
-        if (signal != null) {
-            this.bundleStartTracker.trackStart(bundle, signal);
-        }
-    }
+    
 }
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StartupTracker.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StartupTracker.java
index b334d17..9355c20 100644
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StartupTracker.java
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/core/internal/StartupTracker.java
@@ -12,25 +12,16 @@
 package org.eclipse.virgo.kernel.core.internal;
 
 import java.lang.management.ManagementFactory;
-import java.util.concurrent.TimeUnit;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 import javax.management.JMException;
 import javax.management.MBeanServer;
 import javax.management.ObjectInstance;
 import javax.management.ObjectName;
 
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventAdmin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
 import org.eclipse.virgo.kernel.config.internal.KernelConfiguration;
-import org.eclipse.virgo.kernel.core.BlockingSignal;
+import org.eclipse.virgo.kernel.core.BlockingAbortableSignal;
 import org.eclipse.virgo.kernel.core.BundleUtils;
 import org.eclipse.virgo.kernel.core.FailureSignalledException;
 import org.eclipse.virgo.kernel.core.FatalKernelException;
@@ -38,6 +29,13 @@
 import org.eclipse.virgo.kernel.diagnostics.KernelLogEvents;
 import org.eclipse.virgo.medic.dump.DumpGenerator;
 import org.eclipse.virgo.medic.eventlog.EventLogger;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * <code>StartupTracker</code> tracks the startup of the Kernel and produces event log entries, and
@@ -60,9 +58,11 @@
     private static final String KERNEL_EVENT_STARTING = KERNEL_EVENT_TOPIC + "STARTING";
 
     private static final String KERNEL_EVENT_STARTED = KERNEL_EVENT_TOPIC + "STARTED";
-    
+
     private static final String KERNEL_EVENT_START_TIMED_OUT = KERNEL_EVENT_TOPIC + "START_TIMED_OUT";
     
+    private static final String KERNEL_EVENT_START_ABORTED = KERNEL_EVENT_TOPIC + "START_ABORTED";
+    
     private static final String KERNEL_EVENT_START_FAILED = KERNEL_EVENT_TOPIC + "START_FAILED";
     
     private static final String KERNEL_BSN_PREFIX = "org.eclipse.virgo.kernel";
@@ -151,20 +151,35 @@
                 Bundle[] bundles = this.context.getBundles();
                 
                 try {
+                    long waitTime = TimeUnit.SECONDS.toMillis(this.startupWaitTime);
+
                     for (Bundle bundle : bundles) {
-                    	if (!BundleUtils.isFragmentBundle(bundle) && isKernelBundle(bundle)) {
-                            BlockingSignal signal = new BlockingSignal();
-                            
+
+                        if (!BundleUtils.isFragmentBundle(bundle) && isKernelBundle(bundle)) {
+                            BlockingAbortableSignal signal = new BlockingAbortableSignal();
+
                             this.asyncBundleStartTracker.trackStart(bundle, signal);
-                            
-                            LOGGER.debug("Awaiting signal {} for up to {} seconds", signal, this.startupWaitTime);
-                            
-                            if (!signal.awaitCompletion(this.startupWaitTime, TimeUnit.SECONDS)) {
-                            	LOGGER.error("Bundle {} did not start within {} seconds.", bundle, this.startupWaitTime);
-                                kernelStartTimedOut();
+
+                            LOGGER.debug("Awaiting startup of bundle {} for up to {} milliseconds with signal {}.", new Object[]{bundle, waitTime, signal});
+
+                            long startTime = System.currentTimeMillis();
+                            boolean bundleStarted = signal.awaitCompletion(waitTime, TimeUnit.MILLISECONDS);
+                            waitTime -= System.currentTimeMillis() - startTime;
+
+                            if (!bundleStarted) {
+                                if(signal.isAborted()){
+                                    LOGGER.error("Bundle {} aborted before the Kernel timeout of {} seconds with {} seconds remaining.", new Object[]{bundle, this.startupWaitTime, TimeUnit.MILLISECONDS.toSeconds(waitTime)});
+                                    kernelStartAborted(bundle);
+                                } else if (waitTime <= 0) {
+                                    LOGGER.error("Kernel has failed to start before the timeout of {} seconds.", this.startupWaitTime);
+                                    kernelStartTimedOut();
+                                } else {
+                                    LOGGER.error("Bundle {} did not start within the Kernel timeout of {} seconds.", bundle, this.startupWaitTime);
+                                    kernelStartTimedOut();
+                                }
                                 return;
                             }
-                    	}
+                        }
                     }
                 } catch (FailureSignalledException fse) {
                     kernelStartFailed(fse.getCause());
@@ -216,6 +231,12 @@
             logEvent(KernelLogEvents.KERNEL_STARTED);
         }
         
+        private void kernelStartAborted(Bundle bundle) {
+            postEvent(KERNEL_EVENT_START_ABORTED);
+            logEvent(KernelLogEvents.KERNEL_EVENT_START_ABORTED, bundle.getSymbolicName(), bundle.getVersion());
+            generateDumpAndShutdown("startupTimedOut", null);
+        }
+        
         private void kernelStartTimedOut() {
             postEvent(KERNEL_EVENT_START_TIMED_OUT);
             logEvent(KernelLogEvents.KERNEL_START_TIMED_OUT, this.startupWaitTime);
diff --git a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/diagnostics/KernelLogEvents.java b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/diagnostics/KernelLogEvents.java
index e2d5088..67b0fb6 100644
--- a/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/diagnostics/KernelLogEvents.java
+++ b/org.eclipse.virgo.kernel.core/src/main/java/org/eclipse/virgo/kernel/diagnostics/KernelLogEvents.java
@@ -29,6 +29,7 @@
     KERNEL_START_FAILED(3, Level.ERROR), //
     KERNEL_START_TIMED_OUT(4, Level.ERROR), //
     KERNEL_PLAN_ARGUMENTS_INCORRECT(5, Level.WARNING), //
+    KERNEL_EVENT_START_ABORTED(6, Level.ERROR), //
     
     SHUTDOWN_INITIATED(10, Level.INFO), //
     IMMEDIATE_SHUTDOWN_INITIATED(11, Level.INFO), //
diff --git a/org.eclipse.virgo.kernel.core/src/main/resources/EventLogMessages.properties b/org.eclipse.virgo.kernel.core/src/main/resources/EventLogMessages.properties
index bac9210..3eec203 100644
--- a/org.eclipse.virgo.kernel.core/src/main/resources/EventLogMessages.properties
+++ b/org.eclipse.virgo.kernel.core/src/main/resources/EventLogMessages.properties
@@ -3,6 +3,7 @@
 KE0003E = Kernel failed to start.
 KE0004E = Kernel failed to start within {} seconds.
 KE0005W = Option -plan requires one or two arguments but {} were provided: '{}'.
+KE0006E = Kernel failed to start due to the aborted start of '{}' version '{}'.
 
 KE0010I = Shutdown initiated.
 KE0011I = Immediate shutdown initiated.
diff --git a/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernel_config.xml b/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernel_config.xml
new file mode 100644
index 0000000..d07c2dd
--- /dev/null
+++ b/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernel_config.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"

+	 immediate="true" name="org.eclipse.virgo.kernel" configuration-policy="require">

+	<implementation

+		class="org.eclipse.virgo.kernel.config.internal.StandardKernelConfig" />

+	<service>

+		<provide interface="org.eclipse.virgo.kernel.core.KernelConfig" />

+	</service>

+</scr:component>
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernelcore.xml b/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernelcore.xml
new file mode 100644
index 0000000..e08d39a
--- /dev/null
+++ b/org.eclipse.virgo.kernel.core/src/main/resources/OSGI-INF/kernelcore.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<component name="kernelcore" immediate="true" xmlns:src="http://www.osgi.org/xmlns/src/v1.1.0">

+	<implementation class="org.eclipse.virgo.kernel.core.internal.CoreBundleActivator"/>

+	<reference name="EventLogger"

+		interface="org.eclipse.virgo.medic.eventlog.EventLogger"

+		policy="dynamic"/>

+	<reference name="DumpGenerator"

+		interface="org.eclipse.virgo.medic.dump.DumpGenerator"

+		policy="dynamic"/>	

+	<reference name="ConfigAdmin"

+		interface="org.osgi.service.cm.ConfigurationAdmin"

+		policy="dynamic"/>

+  	<reference name="EventAdmin"

+		interface="org.osgi.service.event.EventAdmin"

+		policy="dynamic"/>

+</component>
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSourceTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSourceTests.java
index 5b36149..ed6e2db 100644
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSourceTests.java
+++ b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationPropertiesSourceTests.java
@@ -19,8 +19,6 @@
 
 import org.junit.Test;
 
-import org.eclipse.virgo.kernel.config.internal.KernelConfiguration;
-import org.eclipse.virgo.kernel.config.internal.KernelConfigurationPropertiesSource;
 import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
 
 
@@ -44,5 +42,6 @@
         assertEquals(configuration.getDomain(), properties.getProperty(KernelConfigurationPropertiesSource.PROPERTY_DOMAIN));
         assertEquals(configuration.getHomeDirectory().getAbsolutePath(), properties.getProperty(KernelConfigurationPropertiesSource.PROPERTY_HOME_DIRECTORY));
         assertEquals(configuration.getWorkDirectory().getAbsolutePath(), properties.getProperty(KernelConfigurationPropertiesSource.PROPERTY_WORK_DIRECTORY));
+        assertEquals(Integer.toString(configuration.getStartupWaitLimit()), properties.getProperty(KernelConfigurationPropertiesSource.PROPERTY_KERNEL_STARTUP_WAIT_LIMIT));
     }
 }
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationTests.java
index cbc667c..b801a54 100644
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationTests.java
+++ b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/config/internal/KernelConfigurationTests.java
@@ -18,7 +18,6 @@
 
 import org.junit.Test;
 
-import org.eclipse.virgo.kernel.config.internal.KernelConfiguration;
 import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
 
 
@@ -37,6 +36,7 @@
         assertNotNull(configuration.getConfigDirectories());
         assertEquals(1, configuration.getConfigDirectories().length);
         assertNotNull(configuration.getDomain());
+        assertNotNull(configuration.getStartupWaitLimit());
     }
     
     @Test
@@ -45,6 +45,7 @@
         context.addProperty(KernelConfiguration.PROPERTY_KERNEL_HOME, "target");
         context.addProperty(KernelConfiguration.PROPERTY_KERNEL_DOMAIN, "my.domain");
         context.addProperty(KernelConfiguration.PROPERTY_KERNEL_CONFIG, "foo,bar");
+        context.addProperty(KernelConfiguration.PROPERTY_KERNEL_STARTUP_WAIT_LIMIT, "60");
         
         KernelConfiguration configuration = new KernelConfiguration(context);
         assertEquals(new File("target"), configuration.getHomeDirectory());
@@ -52,6 +53,7 @@
         assertNotNull(configuration.getConfigDirectories());
         assertEquals(2, configuration.getConfigDirectories().length);
         assertEquals("my.domain", configuration.getDomain());
+        assertEquals(60, configuration.getStartupWaitLimit());
     }
     
     @Test(expected=IllegalStateException.class)
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/BundleStartTrackerTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/BundleStartTrackerTests.java
index 0398a61..46b121c 100644
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/BundleStartTrackerTests.java
+++ b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/BundleStartTrackerTests.java
@@ -21,11 +21,13 @@
 
 import org.junit.Test;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleException;
+import org.osgi.framework.BundleListener;
 import org.osgi.service.event.Event;
 import org.springframework.core.task.SyncTaskExecutor;
 
-import org.eclipse.virgo.kernel.core.Signal;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
 import org.eclipse.virgo.kernel.core.internal.BundleStartTracker;
 import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
 import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
@@ -50,6 +52,7 @@
         bundle.start();
         
         assertEquals(1, signal.successCount);
+        assertEquals(0, signal.abortCount);
         assertEquals(0, signal.failures.size());
         
         assertEquals(Bundle.ACTIVE, bundle.getState());
@@ -79,6 +82,38 @@
         bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/CREATED", properties));
         
         assertEquals(1, signal.successCount);
+        assertEquals(0, signal.abortCount);
+        assertEquals(0, signal.failures.size());
+    }
+    
+    @Test
+    public void startOfLazyActivationBundle() throws BundleException {
+        StubBundleContext bundleContext = new StubBundleContext();
+        StubBundle bundle = new StubBundle();
+        bundle.addHeader("Bundle-ActivationPolicy", "lazy");
+        bundle.setBundleContext(bundleContext);
+        
+        BundleStartTracker bundleStartTracker = new BundleStartTracker(new SyncTaskExecutor());
+        bundleStartTracker.initialize(bundleContext);
+        
+        UnitTestSignal signal = new UnitTestSignal();
+        bundleStartTracker.trackStart(bundle, signal);
+        
+        List<BundleListener> bundleListeners = bundleContext.getBundleListeners();
+        for(BundleListener listener : bundleListeners){
+        	listener.bundleChanged(new BundleEvent(BundleEvent.LAZY_ACTIVATION, bundle));
+        }
+        
+        assertEquals(0, signal.successCount);
+        assertEquals(0, signal.abortCount);
+        assertEquals(0, signal.failures.size());
+        
+        for(BundleListener listener : bundleListeners){
+        	listener.bundleChanged(new BundleEvent(BundleEvent.STOPPED, bundle));
+        }
+
+        assertEquals(0, signal.successCount);
+        assertEquals(1, signal.abortCount);
         assertEquals(0, signal.failures.size());
     }
     
@@ -96,6 +131,7 @@
         bundleStartTracker.trackStart(bundle, signal);
         
         assertEquals(0, signal.successCount);
+        assertEquals(0, signal.abortCount);
         assertEquals(0, signal.failures.size());
         
         bundle.start();
@@ -108,6 +144,7 @@
         bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/FAILURE", properties));
         
         assertEquals(0, signal.successCount);
+        assertEquals(0, signal.abortCount);
         assertEquals(1, signal.failures.size());
         
         assertTrue(signal.failures.contains(failure));
@@ -132,6 +169,7 @@
         bundleStartTracker.trackStart(bundle, signal);
         
         assertEquals(1, signal.successCount);
+        assertEquals(0, signal.abortCount);
         assertEquals(0, signal.failures.size());
     }
     
@@ -156,6 +194,7 @@
         bundleStartTracker.trackStart(bundle, signal);
         
         assertEquals(0, signal.successCount);
+        assertEquals(0, signal.abortCount);
         assertEquals(1, signal.failures.size());
         assertTrue(signal.failures.contains(failure));       
     }
@@ -174,6 +213,7 @@
         bundleStartTracker.trackStart(bundle, signal);
         
         assertEquals(0, signal.successCount);
+        assertEquals(0, signal.abortCount);
         assertEquals(0, signal.failures.size());
         
         Dictionary<String, Object> properties = new Hashtable<String, Object>();
@@ -184,6 +224,7 @@
         bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/CREATED", properties));
         
         assertEquals(1, signal.successCount);
+        assertEquals(0, signal.abortCount);
         assertEquals(0, signal.failures.size());
     }
     
@@ -201,6 +242,7 @@
         bundleStartTracker.trackStart(bundle, signal);
         
         assertEquals(0, signal.successCount);
+        assertEquals(0, signal.abortCount);
         assertEquals(0, signal.failures.size());
         
         Dictionary<String, Object> properties = new Hashtable<String, Object>();
@@ -213,6 +255,7 @@
         bundleStartTracker.handleEvent(new Event("org/osgi/service/blueprint/container/FAILURE", properties));
         
         assertEquals(0, signal.successCount);
+        assertEquals(0, signal.abortCount);
         assertEquals(1, signal.failures.size());
         
         assertTrue(signal.failures.contains(failure));
@@ -240,6 +283,7 @@
         bundleStartTracker.trackStart(bundle, signal);
         
         assertEquals(0, signal.successCount);
+        assertEquals(0, signal.abortCount);
         assertEquals(0, signal.failures.size());
     }
     
@@ -266,14 +310,16 @@
         bundleStartTracker.trackStart(bundle, signal);
         
         assertEquals(0, signal.successCount);
+        assertEquals(0, signal.abortCount);
         assertEquals(0, signal.failures.size());
     }
     
-    private static final class UnitTestSignal implements Signal {
+    private static final class UnitTestSignal implements AbortableSignal {
         
         private final List<Throwable> failures = new ArrayList<Throwable>();
-        
+
         private int successCount = 0;
+        private int abortCount = 0;
                 
         /** 
          * {@inheritDoc}
@@ -287,6 +333,13 @@
          */
         public void signalSuccessfulCompletion() {
             successCount++;            
-        }        
+        }
+
+        /** 
+         * {@inheritDoc}
+         */
+		public void signalAborted() {
+			abortCount++;
+		}        
     }
 }
diff --git a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivatorTests.java b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivatorTests.java
index 23e73c2..c3cbe70 100644
--- a/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivatorTests.java
+++ b/org.eclipse.virgo.kernel.core/src/test/java/org/eclipse/virgo/kernel/core/internal/CoreBundleActivatorTests.java
@@ -30,6 +30,7 @@
 import org.eclipse.virgo.medic.eventlog.EventLogger;
 import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
 import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
+import org.eclipse.virgo.teststubs.osgi.service.component.StubComponentContext;
 import org.eclipse.virgo.teststubs.osgi.service.event.StubEventAdmin;
 
 /**
@@ -41,14 +42,16 @@
     @Test(expected = IllegalStateException.class)
     public void noConfigService() throws Exception {
         StubBundleContext bundleContext = new StubBundleContext();
+        StubComponentContext componentContext = new StubComponentContext(bundleContext);
         bundleContext.addFilter(StartupTracker.APPLICATION_CONTEXT_FILTER, FrameworkUtil.createFilter(StartupTracker.APPLICATION_CONTEXT_FILTER));
         CoreBundleActivator activator = new TestCoreBundleActivator();
-        activator.start(bundleContext);
+        activator.activate(componentContext);
     }
 
     @Test
     public void startAndStop() throws Exception {
         StubBundleContext bundleContext = new StubBundleContext();
+        StubComponentContext componentContext = new StubComponentContext(bundleContext);
         DumpGenerator dumpGenerator = createNiceMock(DumpGenerator.class);
         bundleContext.addFilter(StartupTracker.APPLICATION_CONTEXT_FILTER, FrameworkUtil.createFilter(StartupTracker.APPLICATION_CONTEXT_FILTER));
         bundleContext.registerService(ConfigurationAdmin.class.getName(), new StubConfigurationAdmin(), null);
@@ -59,8 +62,8 @@
         bundleContext.addProperty("org.eclipse.virgo.kernel.home", new File(".").getAbsolutePath());
 
         CoreBundleActivator activator = new TestCoreBundleActivator();
-        activator.start(bundleContext);
-        activator.stop(bundleContext);
+        activator.activate(componentContext);
+        activator.deactivate(componentContext);
     }
     
     private static final class TestCoreBundleActivator extends CoreBundleActivator {
diff --git a/org.eclipse.virgo.kernel.core/template.mf b/org.eclipse.virgo.kernel.core/template.mf
index 30876aa..8681c79 100644
--- a/org.eclipse.virgo.kernel.core/template.mf
+++ b/org.eclipse.virgo.kernel.core/template.mf
@@ -1,9 +1,9 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Virgo Kernel Core
-Bundle-Activator: org.eclipse.virgo.kernel.core.internal.CoreBundleActivator
 Bundle-SymbolicName: org.eclipse.virgo.kernel.core
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
+Service-Component: OSGI-INF/kernel_config.xml,OSGI-INF/kernelcore.xml
 Import-Template: 
  org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
  org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",
@@ -14,6 +14,7 @@
  org.osgi.*;version="0",
  org.springframework.*;version="${org.springframework:[2.5.6, =.+1)}",
  org.springframework.osgi.*;version="${org.springframework.osgi:[=.=.=, +1)}",
+ org.eclipse.osgi.*;version="0",
  org.w3c.dom;version="0",
  org.xml.sax;version="0"
 Excluded-Exports: 
diff --git a/org.eclipse.virgo.kernel.deployer.dm/.classpath b/org.eclipse.virgo.kernel.deployer.dm/.classpath
index 724d32e..ac62c64 100644
--- a/org.eclipse.virgo.kernel.deployer.dm/.classpath
+++ b/org.eclipse.virgo.kernel.deployer.dm/.classpath
@@ -25,19 +25,19 @@
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-sources-1.2.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context.support/3.0.0.RELEASE/org.springframework.context.support-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context.support/3.0.0.RELEASE/org.springframework.context.support-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-sources-1.2.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-sources-1.2.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.deployer"/>
 	<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar">
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar">
 		<attributes>
 			<attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-2.2.0.D-20101207145338.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-sources-2.2.0.D-20101207145338.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.apache.commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-1.1.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar"/>
 	<classpathentry kind="src" path="/org.eclipse.virgo.kernel.core"/>
diff --git a/org.eclipse.virgo.kernel.deployer.dm/src/main/resources/META-INF/spring/deployer-dm-context.xml b/org.eclipse.virgo.kernel.deployer.dm/src/main/resources/META-INF/spring/deployer-dm-context.xml
index b6f267c..b7e2279 100644
--- a/org.eclipse.virgo.kernel.deployer.dm/src/main/resources/META-INF/spring/deployer-dm-context.xml
+++ b/org.eclipse.virgo.kernel.deployer.dm/src/main/resources/META-INF/spring/deployer-dm-context.xml
@@ -12,5 +12,8 @@
 
 	<osgi:service ref="moduleContextAccessor"
 		interface="org.eclipse.virgo.kernel.module.ModuleContextAccessor" />
+		
+	<osgi:reference id="agentDMStartTracker"
+		interface="org.eclipse.virgo.kernel.agent.dm.AgentDMStartTracker" />
 
 </beans:beans>
diff --git a/org.eclipse.virgo.kernel.deployer.dm/template.mf b/org.eclipse.virgo.kernel.deployer.dm/template.mf
index 29657ae..b7e5c73 100644
--- a/org.eclipse.virgo.kernel.deployer.dm/template.mf
+++ b/org.eclipse.virgo.kernel.deployer.dm/template.mf
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Virgo Kernel Deployer Spring DM Integration
 Bundle-SymbolicName: org.eclipse.virgo.kernel.deployer.dm
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
 Import-Template: 
  org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",
  org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",
diff --git a/org.eclipse.virgo.kernel.deployer.test/.classpath b/org.eclipse.virgo.kernel.deployer.test/.classpath
index fa8976b..638548c 100644
--- a/org.eclipse.virgo.kernel.deployer.test/.classpath
+++ b/org.eclipse.virgo.kernel.deployer.test/.classpath
@@ -28,18 +28,17 @@
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.orm/3.0.0.RELEASE/org.springframework.orm-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.orm/3.0.0.RELEASE/org.springframework.orm-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.transaction/3.0.0.RELEASE/org.springframework.transaction-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.transaction/3.0.0.RELEASE/org.springframework.transaction-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-sources-1.2.1.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/2.2.0.D-20101207150035/org.eclipse.virgo.util.math-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/2.2.0.D-20101207150035/org.eclipse.virgo.util.math-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/javax.transaction/com.springsource.javax.transaction/1.1.0/com.springsource.javax.transaction-1.1.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-2.2.0.D-20101207151510.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-sources-2.2.0.D-20101207151510.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-sources-2.2.0.D-20101207150035.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-3.0.0.M02.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.osgi/org.osgi.compendium/4.1.0/org.osgi.compendium-4.1.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/2.2.0.D-20101207145732/org.eclipse.virgo.osgi.launcher-2.2.0.D-20101207145732.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/2.2.0.D-20101207145732/org.eclipse.virgo.osgi.launcher-sources-2.2.0.D-20101207145732.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.test/org.eclipse.virgo.test.framework/2.2.0.D-20101207150629/org.eclipse.virgo.test.framework-2.2.0.D-20101207150629.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.test/org.eclipse.virgo.test.framework/2.2.0.D-20101207150629/org.eclipse.virgo.test.framework-sources-2.2.0.D-20101207150629.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/3.0.0.M02/org.eclipse.virgo.osgi.launcher-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/3.0.0.M02/org.eclipse.virgo.osgi.launcher-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.test/org.eclipse.virgo.test.framework/3.0.0.M02/org.eclipse.virgo.test.framework-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.test/org.eclipse.virgo.test.framework/3.0.0.M02/org.eclipse.virgo.test.framework-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="src" path="/org.eclipse.virgo.kernel.model"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-3.3.0.v20101018.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-sources-3.3.0.v20101018.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-3.3.0.v20110110.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-sources-3.3.0.v20110110.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/org.eclipse.virgo.kernel.deployer.test/.project b/org.eclipse.virgo.kernel.deployer.test/.project
index f79f915..11a008c 100644
--- a/org.eclipse.virgo.kernel.deployer.test/.project
+++ b/org.eclipse.virgo.kernel.deployer.test/.project
@@ -20,11 +20,6 @@
 			<arguments>
 			</arguments>
 		</buildCommand>
-		<buildCommand>
-			<name>com.springsource.server.ide.bundlor.core.builder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
 	</buildSpec>
 	<natures>
 		<nature>com.springsource.server.ide.facet.core.bundlenature</nature>
diff --git a/org.eclipse.virgo.kernel.deployer.test/ivy.xml b/org.eclipse.virgo.kernel.deployer.test/ivy.xml
index 6d4080a..e25cb4c 100644
--- a/org.eclipse.virgo.kernel.deployer.test/ivy.xml
+++ b/org.eclipse.virgo.kernel.deployer.test/ivy.xml
@@ -36,6 +36,8 @@
 		<dependency org="org.apache.commons" name="com.springsource.org.apache.commons.dbcp" rev="${commons.dbcp}" conf="test->runtime"/>
 		<dependency org="org.apache.commons" name="com.springsource.org.apache.commons.pool" rev="${commons.pool}" conf="test->runtime"/>
 		
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.ds" rev="${org.eclipse.equinox.ds}" conf="test->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.util" rev="${org.eclipse.equinox.util}" conf="test->runtime"/>
 		<dependency org="org.junit" name="com.springsource.org.junit" rev="${org.junit}" conf="test->runtime"/>
 		<dependency org="org.springframework" name="org.springframework.spring-library" rev="${org.springframework}" conf="test->runtime"/>
 		<dependency org="org.springframework" name="org.springframework.core" rev="${org.springframework}" conf="test->runtime"/>
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/main/java/META-INF/MANIFEST.MF b/org.eclipse.virgo.kernel.deployer.test/src/main/java/META-INF/MANIFEST.MF
index c49e7c1..081628b 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/main/java/META-INF/MANIFEST.MF
+++ b/org.eclipse.virgo.kernel.deployer.test/src/main/java/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
 Manifest-Version: 1.0

 Bundle-ClassPath: .,org.springframework.beans-2.5.6.A.jar,org.springfr

  amework.core-2.5.6.A.jar

-Bundle-Version: 2.2.0

+Bundle-Version: 3.0.0

 Tool: Bundlor 1.0.0.RELEASE

 Bundle-Name: Virgo Kernel Deployer Test

 Bundle-ManifestVersion: 2

diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/AbstractDeployerIntegrationTest.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/AbstractDeployerIntegrationTest.java
index 7c326ac..497bdab 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/AbstractDeployerIntegrationTest.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/AbstractDeployerIntegrationTest.java
@@ -20,6 +20,10 @@
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
+import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.eclipse.virgo.kernel.osgi.framework.OsgiFramework;
+import org.eclipse.virgo.test.framework.dmkernel.DmKernelTestRunner;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
@@ -31,15 +35,8 @@
 import org.osgi.framework.Version;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.framework.SurrogateBundle;
 import org.osgi.service.packageadmin.PackageAdmin;
 
-import org.eclipse.virgo.kernel.osgi.framework.OsgiFramework;
-
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
-import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
-import org.eclipse.virgo.test.framework.dmkernel.DmKernelTestRunner;
-
 @RunWith(DmKernelTestRunner.class)
 @SuppressWarnings("deprecation")
 public abstract class AbstractDeployerIntegrationTest {
@@ -66,16 +63,17 @@
             this.deployer = this.context.getService(applicationDeployerServiceReference);
         }
 
-        Bundle bundle = this.context.getBundle(1);
-        if (bundle instanceof SurrogateBundle) {
-            this.kernelContext = ((SurrogateBundle) bundle).getCompositeBundleContext();
-        }
+        this.kernelContext = getKernelContext();
 
         ServiceReference<PackageAdmin> packageAdminServiceReference = context.getServiceReference(PackageAdmin.class);
         if (packageAdminServiceReference != null) {
             this.packageAdmin = context.getService(packageAdminServiceReference);
         }
     }
+    
+    private BundleContext getKernelContext() {
+        return this.context.getBundle(0L).getBundleContext();
+    }
 
     @BeforeClass
     public static void awaitKernelStartup() throws Exception {
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationDeploymentTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationDeploymentTests.java
index effd2b9..3f49789 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationDeploymentTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationDeploymentTests.java
@@ -160,27 +160,11 @@
     }
 
     private void pollUntilInDeploymentIdentities(String type, String name, String version) throws InterruptedException {
-        long start = System.currentTimeMillis();
-
-        while (!isInDeploymentIdentities(type, name, version)) {
-            long delta = System.currentTimeMillis() - start;
-            if (delta > 60000) {
-                fail("Deployment identity was not available within 60 seconds");
-            }
-            Thread.sleep(100);
-        }
+        ConfigurationTestUtils.pollUntilInDeploymentIdentities(appDeployer, type, name, version);
     }
 
     private void pollUntilNotInDeploymentIdentities(String type, String name, String version) throws InterruptedException {
-        long start = System.currentTimeMillis();
-
-        while (isInDeploymentIdentities(type, name, version)) {
-            long delta = System.currentTimeMillis() - start;
-            if (delta > 60000) {
-                fail("Deployment identity was still available after 60 seconds");
-            }
-            Thread.sleep(100);
-        }
+        ConfigurationTestUtils.pollUntilNotInDeploymentIdentities(appDeployer, type, name, version);
     }
 
     @SuppressWarnings("unchecked")
@@ -206,40 +190,18 @@
     }
 
     private boolean isInDeploymentIdentities(DeploymentIdentity deploymentIdentity) {
-        boolean found = false;
-        for (DeploymentIdentity id : this.appDeployer.getDeploymentIdentities()) {
-            if (deploymentIdentity.equals(id)) {
-                found = true;
-            }
-        }
-        return found;
-    }
-
-    private boolean isInDeploymentIdentities(String type, String name, String version) {
-        for (DeploymentIdentity id : this.appDeployer.getDeploymentIdentities()) {
-            if (id.getType().equals(type) && id.getSymbolicName().equals(name) && id.getVersion().equals(version)) {
-                return true;
-            }
-        }
-        return false;
+        return ConfigurationTestUtils.isInDeploymentIdentities(appDeployer, deploymentIdentity);
     }
 
     private boolean isInConfigurationAdmin() throws IOException, InvalidSyntaxException {
-        Configuration[] configurations = this.configAdmin.listConfigurations(null);
-        for (Configuration configuration : configurations) {
-            if ("t".equals(configuration.getPid())) {
-                return true;
-            }
-        }
-
-        return false;
+        return ConfigurationTestUtils.isInConfigurationAdmin(configAdmin, "t");
     }
 
     @SuppressWarnings("unchecked")
     private void checkConfigAvailable() throws IOException, InvalidSyntaxException, InterruptedException {
-	// Allow asynchronous delivery of configuration events to complete
-	Thread.sleep(100);
-	
+        // Allow asynchronous delivery of configuration events to complete
+        Thread.sleep(100);
+
         long start = System.currentTimeMillis();
 
         while (!isInConfigurationAdmin()) {
@@ -257,9 +219,9 @@
     }
 
     private void checkConfigUnavailable() throws IOException, InvalidSyntaxException, InterruptedException {
-	// Allow asynchronous delivery of configuration events to complete
-	Thread.sleep(100);
-	
+        // Allow asynchronous delivery of configuration events to complete
+        Thread.sleep(100);
+
         assertFalse(isInConfigurationAdmin());
     }
 
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationTestUtils.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationTestUtils.java
new file mode 100644
index 0000000..935a70d
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ConfigurationTestUtils.java
@@ -0,0 +1,123 @@
+/*
+ * This file is part of the Eclipse Virgo project.
+ *
+ * Copyright (c) 2011 Chariot Solutions LLC
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    dsklyut - initial contribution
+ */
+
+package org.eclipse.virgo.kernel.deployer.test;
+
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+
+import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+/**
+ * Utilities to share between configuration and factory configuration tests.
+ * <p />
+ * 
+ */
+final class ConfigurationTestUtils {
+
+    static void pollUntilInDeploymentIdentities(ApplicationDeployer appDeployer, String type, String name, String version)
+        throws InterruptedException {
+        long start = System.currentTimeMillis();
+
+        while (!isInDeploymentIdentities(appDeployer, type, name, version)) {
+            long delta = System.currentTimeMillis() - start;
+            if (delta > 60000) {
+                fail("Deployment identity was not available within 60 seconds");
+            }
+            Thread.sleep(100);
+        }
+    }
+
+    static void pollUntilNotInDeploymentIdentities(ApplicationDeployer appDeployer, String type, String name, String version)
+        throws InterruptedException {
+        long start = System.currentTimeMillis();
+
+        while (isInDeploymentIdentities(appDeployer, type, name, version)) {
+            long delta = System.currentTimeMillis() - start;
+            if (delta > 60000) {
+                fail("Deployment identity was still available after 60 seconds");
+            }
+            Thread.sleep(100);
+        }
+    }
+
+    static boolean isInDeploymentIdentities(ApplicationDeployer appDeployer, DeploymentIdentity deploymentIdentity) {
+        for (DeploymentIdentity id : appDeployer.getDeploymentIdentities()) {
+            if (deploymentIdentity.equals(id)) {
+                return true;
+            }
+        }
+        return false;
+
+    }
+
+    static boolean isInDeploymentIdentities(ApplicationDeployer appDeployer, String type, String name, String version) {
+        for (DeploymentIdentity id : appDeployer.getDeploymentIdentities()) {
+            if (id.getType().equals(type) && id.getSymbolicName().equals(name) && id.getVersion().equals(version)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    static boolean isInConfigurationAdmin(ConfigurationAdmin configAdmin, String pid) throws IOException, InvalidSyntaxException {
+        Configuration[] configurations = configAdmin.listConfigurations(null);
+        for (Configuration configuration : configurations) {
+            if (pid.equals(configuration.getPid())) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    static boolean isFactoryInConfigurationAdmin(ConfigurationAdmin configAdmin, String factoryPid) throws IOException, InvalidSyntaxException {
+        Configuration[] configurations = configAdmin.listConfigurations(null);
+        for (Configuration configuration : configurations) {
+            if (factoryPid.equals(configuration.getFactoryPid())) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    static void pollUntilFactoryInConfigurationAdmin(ConfigurationAdmin configAdmin, String factoryPid) throws Exception {
+        long start = System.currentTimeMillis();
+
+        while (!isFactoryInConfigurationAdmin(configAdmin, factoryPid)) {
+            long delta = System.currentTimeMillis() - start;
+            if (delta > 60000) {
+                fail("Deployment identity was not available within 60 seconds");
+            }
+            Thread.sleep(100);
+        }
+    }
+
+    static void pollUntilFactoryNotInConfigurationAdmin(ConfigurationAdmin configAdmin, String factoryPid) throws Exception {
+        long start = System.currentTimeMillis();
+
+        while (isFactoryInConfigurationAdmin(configAdmin, factoryPid)) {
+            long delta = System.currentTimeMillis() - start;
+            if (delta > 60000) {
+                fail("Deployment identity was still available after 60 seconds");
+            }
+            Thread.sleep(100);
+        }
+    }
+}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/FactoryConfigurationDeploymentTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/FactoryConfigurationDeploymentTests.java
new file mode 100644
index 0000000..5937910
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/FactoryConfigurationDeploymentTests.java
@@ -0,0 +1,372 @@
+/*
+ * This file is part of the Eclipse Virgo project.
+ *
+ * Copyright (c) 2011 Chariot Solutions, LLC
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    dsklyut - initial contribution
+ */
+
+package org.eclipse.virgo.kernel.deployer.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedServiceFactory;
+
+/**
+ * Tests for Configuration artifacts that support ManagedServiceFactory
+ *
+ */
+public class FactoryConfigurationDeploymentTests extends AbstractDeployerIntegrationTest {
+
+    private ServiceReference<ApplicationDeployer> appDeployerServiceReference;
+
+    private ApplicationDeployer appDeployer;
+
+    private ServiceReference<ConfigurationAdmin> configAdminServiceReference;
+
+    private ConfigurationAdmin configAdmin;
+
+    @Before
+    public void setUp() throws Exception {
+        this.appDeployerServiceReference = this.context.getServiceReference(ApplicationDeployer.class);
+        this.appDeployer = this.context.getService(this.appDeployerServiceReference);
+        this.configAdminServiceReference = this.context.getServiceReference(ConfigurationAdmin.class);
+        this.configAdmin = this.context.getService(this.configAdminServiceReference);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        if (this.appDeployerServiceReference != null) {
+            this.context.ungetService(this.appDeployerServiceReference);
+        }
+        if (this.configAdminServiceReference != null) {
+            this.context.ungetService(this.configAdminServiceReference);
+        }
+    }
+
+    @SuppressWarnings("rawtypes")
+    private static class TestManagedServiceFactory implements ManagedServiceFactory {
+
+        private volatile Dictionary properties;
+
+        private final AtomicInteger updateCallCount = new AtomicInteger(0);
+
+        private final AtomicInteger deleteCallCount = new AtomicInteger(0);
+
+        @Override
+        public String getName() {
+            return "Test Managed Service Factory";
+        }
+
+        @Override
+        public void updated(String pid, Dictionary properties) throws ConfigurationException {
+            this.updateCallCount.incrementAndGet();
+            this.properties = properties;
+        }
+
+        @Override
+        public void deleted(String pid) {
+            this.deleteCallCount.incrementAndGet();
+        }
+
+        Dictionary getProperties() {
+            return this.properties;
+        }
+
+        int updateCount() {
+            return this.updateCallCount.get();
+        }
+
+        int deleteCount() {
+            return this.deleteCallCount.get();
+        }
+    }
+
+    @Test
+    @SuppressWarnings("rawtypes")
+    public void testSimpleDeployUndeployOfFactoryConfig() throws Exception {
+
+        Hashtable<String, String> properties = new Hashtable<String, String>();
+        properties.put(Constants.SERVICE_PID, "test.factory.pid.a");
+        TestManagedServiceFactory service = new TestManagedServiceFactory();
+        this.context.registerService(ManagedServiceFactory.class, service, properties);
+
+        // make sure that we are starting off with a clean slate
+        assertEquals(0, countFactoryConfigurations("test.factory.pid.a"));
+
+        File configurationFile = new File("src/test/resources/configuration.deployment/factory-config-a.properties");
+
+        DeploymentIdentity deploymentIdentity = this.appDeployer.deploy(configurationFile.toURI());
+        assertNotNull(deploymentIdentity);
+
+        // let it deploy
+        Thread.sleep(1000);
+
+        assertEquals(1, countFactoryConfigurations("test.factory.pid.a"));
+        assertEquals(1, service.updateCount());
+        assertEquals(0, service.deleteCount());
+        Dictionary propertiesFromService = service.getProperties();
+        assertNotNull(propertiesFromService);
+        assertEquals("prop1", propertiesFromService.get("prop1"));
+        assertEquals("2", propertiesFromService.get("prop2"));
+
+        this.appDeployer.undeploy(deploymentIdentity);
+
+        // give time for events to percolate
+        Thread.sleep(1000);
+
+        assertEquals(0, countFactoryConfigurations("test.factory.pid.a"));
+        assertEquals(1, service.updateCount());
+        assertEquals(1, service.deleteCount());
+
+        // now lets make sure that we can deploy it again
+        deploymentIdentity = this.appDeployer.deploy(configurationFile.toURI());
+        Thread.sleep(1000);
+        assertEquals(1, countFactoryConfigurations("test.factory.pid.a"));
+        assertEquals(2, service.updateCount());
+        assertEquals(1, service.deleteCount());
+
+        this.appDeployer.undeploy(deploymentIdentity);
+    }
+
+    @Test
+    @SuppressWarnings("rawtypes")
+    public void testHotDeployFactoryConfiguration() throws Exception {
+
+        final String factoryPid = "test.factory.pid.hot";
+        final Properties hotDeployConfiguration = new Properties();
+        hotDeployConfiguration.setProperty(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
+        hotDeployConfiguration.setProperty("prop1", "prop1");
+        hotDeployConfiguration.setProperty("prop2", "2");
+
+        File target = new File("target/pickup/factory-config-a-hot.properties");
+
+        if (target.exists()) {
+            assertTrue(target.delete());
+        }
+
+        try {
+            Hashtable<String, String> properties = new Hashtable<String, String>();
+            properties.put(Constants.SERVICE_PID, factoryPid);
+            TestManagedServiceFactory service = new TestManagedServiceFactory();
+            this.context.registerService(ManagedServiceFactory.class, service, properties);
+
+            // make sure that we are starting off with a clean slate
+            assertEquals(0, countFactoryConfigurations(factoryPid));
+
+            // copy file to hot deploy location
+            hotDeployConfiguration.store(new FileOutputStream(target), "no comment");
+
+            ConfigurationTestUtils.pollUntilFactoryInConfigurationAdmin(this.configAdmin, factoryPid);
+            assertEquals(1, countFactoryConfigurations(factoryPid));
+            assertEquals(1, service.updateCount());
+            assertEquals(0, service.deleteCount());
+
+            Dictionary propertiesFromService = service.getProperties();
+            assertNotNull(propertiesFromService);
+            assertEquals("prop1", propertiesFromService.get("prop1"));
+            assertEquals("2", propertiesFromService.get("prop2"));
+
+            // remove the file and let it be removed
+            target.delete();
+            ConfigurationTestUtils.pollUntilFactoryNotInConfigurationAdmin(this.configAdmin, factoryPid);
+
+            assertEquals(0, countFactoryConfigurations(factoryPid));
+            assertEquals(1, service.updateCount());
+            assertEquals(1, service.deleteCount());
+        } finally {
+            if (target.exists()) {
+                target.delete();
+            }
+        }
+
+    }
+
+    @Test
+    @SuppressWarnings("rawtypes")
+    public void testHotDeployWithUpdateFactoryConfiguration() throws Exception {
+
+        final String factoryPid = "test.factory.pid.hot.update";
+        final Properties hotDeployConfiguration = new Properties();
+        hotDeployConfiguration.setProperty(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
+        hotDeployConfiguration.setProperty("prop1", "prop1");
+        hotDeployConfiguration.setProperty("prop2", "2");
+
+        File target = new File("target/pickup/factory-config-a-hot-update.properties");
+
+        if (target.exists()) {
+            assertTrue(target.delete());
+        }
+
+        try {
+
+            Hashtable<String, String> properties = new Hashtable<String, String>();
+            properties.put(Constants.SERVICE_PID, factoryPid);
+            TestManagedServiceFactory service = new TestManagedServiceFactory();
+            this.context.registerService(ManagedServiceFactory.class, service, properties);
+
+            // make sure that we are starting off with a clean slate
+            assertEquals(0, countFactoryConfigurations(factoryPid));
+
+            // copy file to hot deploy location
+            hotDeployConfiguration.store(new FileOutputStream(target), "initial");
+
+            ConfigurationTestUtils.pollUntilFactoryInConfigurationAdmin(this.configAdmin, factoryPid);
+            // let events propagate
+            Thread.sleep(100);
+            assertEquals(1, countFactoryConfigurations(factoryPid));
+            assertEquals(1, service.updateCount());
+            assertEquals(0, service.deleteCount());
+
+            Dictionary propertiesFromService = service.getProperties();
+            assertNotNull(propertiesFromService);
+            assertEquals("prop1", propertiesFromService.get("prop1"));
+            assertEquals("2", propertiesFromService.get("prop2"));
+
+            // update configuration
+            hotDeployConfiguration.setProperty("prop2", "22");
+            // save updated configuration
+            hotDeployConfiguration.store(new FileOutputStream(target), "updated");
+
+            // let events propagate and update happen
+            Thread.sleep(3000);
+            assertEquals(1, countFactoryConfigurations(factoryPid));
+            assertEquals(2, service.updateCount());
+            assertEquals(0, service.deleteCount());
+
+            propertiesFromService = service.getProperties();
+            assertNotNull(propertiesFromService);
+            assertEquals("prop1", propertiesFromService.get("prop1"));
+            assertEquals("22", propertiesFromService.get("prop2"));
+
+            // remove the file and let it be removed
+            target.delete();
+            ConfigurationTestUtils.pollUntilFactoryNotInConfigurationAdmin(this.configAdmin, factoryPid);
+
+            assertEquals(0, countFactoryConfigurations(factoryPid));
+            assertEquals(2, service.updateCount());
+            assertEquals(1, service.deleteCount());
+        } finally {
+            if (target.exists()) {
+                target.delete();
+            }
+        }
+    }
+
+    @Test
+    @SuppressWarnings("rawtypes")
+    public void testHotDeployMultipleFactoryConfiguration() throws Exception {
+
+        final String factoryPid = "test.factory.pid.hot.multiple";
+
+        final Properties configOne = new Properties();
+        configOne.setProperty(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
+        configOne.setProperty("prop1", "prop1");
+        configOne.setProperty("prop2", "1");
+
+        final Properties configTwo = new Properties();
+        configTwo.setProperty(ConfigurationAdmin.SERVICE_FACTORYPID, factoryPid);
+        configTwo.setProperty("prop1", "prop2");
+        configTwo.setProperty("prop2", "2");
+
+        final File targetOne = new File("target/pickup/factory-config-a-hot-update-1.properties");
+        final File targetTwo = new File("target/pickup/factory-config-a-hot-update-2.properties");
+
+        if (targetOne.exists()) {
+            assertTrue(targetOne.delete());
+        }
+        if (targetTwo.exists()) {
+            assertTrue(targetTwo.delete());
+        }
+
+        try {
+
+            Hashtable<String, String> properties = new Hashtable<String, String>();
+            properties.put(Constants.SERVICE_PID, factoryPid);
+            TestManagedServiceFactory service = new TestManagedServiceFactory();
+            this.context.registerService(ManagedServiceFactory.class, service, properties);
+
+            // make sure that we are starting off with a clean slate
+            assertEquals(0, countFactoryConfigurations(factoryPid));
+
+            // copy file to hot deploy location
+            configOne.store(new FileOutputStream(targetOne), "initial");
+
+            ConfigurationTestUtils.pollUntilFactoryInConfigurationAdmin(this.configAdmin, factoryPid);
+            // let events propagate
+            Thread.sleep(100);
+            assertEquals(1, countFactoryConfigurations(factoryPid));
+            assertEquals(1, service.updateCount());
+            assertEquals(0, service.deleteCount());
+
+            // validate first configuration
+            Dictionary propertiesFromService = service.getProperties();
+            assertNotNull(propertiesFromService);
+            assertEquals("prop1", propertiesFromService.get("prop1"));
+            assertEquals("1", propertiesFromService.get("prop2"));
+
+            configTwo.store(new FileOutputStream(targetTwo), "initial");
+            Thread.sleep(3000);
+            assertEquals(2, countFactoryConfigurations(factoryPid));
+            assertEquals(2, service.updateCount());
+            assertEquals(0, service.deleteCount());
+
+            propertiesFromService = service.getProperties();
+            assertNotNull(propertiesFromService);
+            assertEquals("prop2", propertiesFromService.get("prop1"));
+            assertEquals("2", propertiesFromService.get("prop2"));
+
+            assertTrue(targetOne.delete());
+            assertTrue(targetTwo.delete());
+
+            // let events propagate and update happen
+            ConfigurationTestUtils.pollUntilFactoryNotInConfigurationAdmin(this.configAdmin, factoryPid);
+            assertEquals(0, countFactoryConfigurations(factoryPid));
+            assertEquals(2, service.updateCount());
+            assertEquals(2, service.deleteCount());
+
+        } finally {
+            if (targetOne.exists()) {
+                targetOne.delete();
+            }
+            if (targetTwo.exists()) {
+                targetTwo.delete();
+            }
+        }
+    }
+
+    private int countFactoryConfigurations(String factoryPid) throws Exception {
+        Configuration[] configurations = this.configAdmin.listConfigurations(null);
+        int counter = 0;
+        for (Configuration c : configurations) {
+            if (factoryPid.equals(c.getFactoryPid())) {
+                counter++;
+            }
+        }
+        return counter;
+    }
+}
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/NestedPlanIntegrationTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/NestedPlanIntegrationTests.java
index 8bb533c..6e64d01 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/NestedPlanIntegrationTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/NestedPlanIntegrationTests.java
@@ -22,6 +22,7 @@
 import java.io.Writer;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
@@ -276,7 +277,8 @@
     private void checkPlanScoping(TestPlanArtifactInfo parent, Model model) {
         if (parent.isScoped()) {
             Artifact parentPlan = getPlan(parent);
-            for (Artifact child : parentPlan.getDependents()) {
+            Set<Artifact> children = parentPlan.getDependents();
+            for (Artifact child : children) {
                 if (PLAN_TYPE.equals(child.getType())) {
                     String childPlanName = child.getName();
                     String unscopedChildPlanName = parent.getChildPlan().getName();
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParDeploymentTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParDeploymentTests.java
index 8222932..078324d 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParDeploymentTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParDeploymentTests.java
@@ -34,6 +34,7 @@
     
     private static final File PAR_FILE = new File("src/test/resources/BundlesAndConfig.par");
     private static final File PAR_FOR_BUG331767 = new File("src/test/resources/bug331767.par");
+	private static final File PAR_FOR_BUG330506 = new File("src/test/resources/bug330506.par");
     
     private static final String BUNDLE_SYMBOLIC_NAME = "appA-1-bundleA";
     private static final String BUNDLE_SYMBOLIC_NAME_BUG331767 = "PARbug331767-1-BUNDLEbug331767";
@@ -65,6 +66,11 @@
         this.deployer.undeploy(deploymentIdentity);
         assertBundleNotPresent(BUNDLE_SYMBOLIC_NAME_BUG331767, BUNDLE_VERSION);
     }
+	
+	@Test(expected=DeploymentException.class)
+    public void deployParContainingFragmentOfSystemBundle() throws DeploymentException {
+        this.deployer.deploy(PAR_FOR_BUG330506.toURI());
+    }
    
     private void assertBundlePresent(String symbolicName, Version version) {
         Bundle[] bundles = this.context.getBundles();
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParRefreshTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParRefreshTests.java
index 3b39224..72f1fe5 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParRefreshTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/ParRefreshTests.java
@@ -15,24 +15,21 @@
 import static org.junit.Assert.fail;
 
 import java.io.File;
-import java.util.ArrayList;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
 
+import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.eclipse.virgo.kernel.deployer.test.util.ArtifactLifecycleEvent;
+import org.eclipse.virgo.kernel.deployer.test.util.ArtifactListener;
+import org.eclipse.virgo.kernel.deployer.test.util.TestLifecycleEvent;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener;
+import org.eclipse.virgo.util.math.Sets;
 import org.junit.Before;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Version;
 
-import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
-import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener;
-import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListenerSupport;
-
-import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
-import org.eclipse.virgo.util.math.Sets;
-
 /**
  * Test refresh of artifacts in a Par
  *
@@ -180,184 +177,4 @@
         }
     }  
     
-    private static enum TestLifecycleEvent {
-        INSTALLED, INSTALLING, RESOLVED, RESOLVING, STARTED, STARTING, STOPPED, STOPPING, UNINSTALLED, UNINSTALLING, UNRESOLVED
-    }
-
-    private static class ArtifactLifecycleEvent {
-        public ArtifactLifecycleEvent(TestLifecycleEvent lifecycleEvent, String type, String name, Version version) {
-            this.lifeCycleEvent = lifecycleEvent;
-            this.type = type;
-            this.name = name;
-            this.version = version;
-        }
-        public boolean equals(Object obj) {
-            if (obj instanceof ArtifactLifecycleEvent) {
-                ArtifactLifecycleEvent other = (ArtifactLifecycleEvent) obj;
-                return (this.lifeCycleEvent.equals(other.lifeCycleEvent)
-                    && this.type.equals(other.type)
-                    && this.name.equals(other.name)
-                    && this.version.equals(other.version));
-            }
-            return false;
-        }
-        public int hashCode() {
-            final int prime = 17;
-            int result = this.lifeCycleEvent.hashCode() + prime
-                * (this.name.hashCode() + prime * (this.type.hashCode() + prime * (this.version.hashCode())));
-            return result;
-        }
-        public String toString() {
-            StringBuilder sb = new StringBuilder("[");
-            sb.append(this.lifeCycleEvent).append(", ");
-            sb.append(this.type).append(", ");
-            sb.append(this.name).append(", ");
-            sb.append(this.version).append("]");
-            return sb.toString();
-        }
-        
-        private final TestLifecycleEvent lifeCycleEvent;
-        private final String type;
-        private final String name;
-        private final Version version;
-    }
-    
-    private static class ArtifactListener extends InstallArtifactLifecycleListenerSupport {
-
-        private final Object monitor = new Object();
-        
-        List<ArtifactLifecycleEvent> eventList = new ArrayList<ArtifactLifecycleEvent>();
-        
-        public void clear() {
-            synchronized (this.monitor) {
-                this.eventList.clear();
-            }
-        }        
-        
-        public boolean waitForEvents(final Set<ArtifactLifecycleEvent> expectedEventSet, long timeout) {
-            boolean allReceived = eventsReceived(expectedEventSet);
-            while (!allReceived && timeout>0) {
-                timeout -= 50L;
-                try {
-                    Thread.sleep(50L);
-                } catch (InterruptedException _) {
-                    // do nothing
-                }
-                allReceived = eventsReceived(expectedEventSet);
-            }
-            return allReceived;
-        }
-
-        private boolean eventsReceived(Set<ArtifactLifecycleEvent> eventSet) {
-            synchronized (this.monitor) {
-                for (ArtifactLifecycleEvent event : eventSet) {
-                    if (!this.eventList.contains(event)) {
-                        return false;
-                    }
-                }
-                return true;
-            }
-        }
-        
-        public List<ArtifactLifecycleEvent> extract() {
-            synchronized (this.monitor) {
-                return new ArrayList<ArtifactLifecycleEvent>(this.eventList);
-            }
-        }
-        
-        /** 
-         * {@inheritDoc}
-         */
-        @Override
-        public void onInstalled(InstallArtifact installArtifact) {
-            addEvent(TestLifecycleEvent.INSTALLED, installArtifact);
-        }
-
-        /** 
-         * {@inheritDoc}
-         */
-        @Override
-        public void onInstalling(InstallArtifact installArtifact) {
-            addEvent(TestLifecycleEvent.INSTALLING, installArtifact);
-        }
-
-        /** 
-         * {@inheritDoc}
-         */
-        @Override
-        public void onResolved(InstallArtifact installArtifact) {
-            addEvent(TestLifecycleEvent.RESOLVED, installArtifact);
-        }
-
-        /** 
-         * {@inheritDoc}
-         */
-        @Override
-        public void onResolving(InstallArtifact installArtifact) {
-            addEvent(TestLifecycleEvent.RESOLVING, installArtifact);
-        }
-
-        /** 
-         * {@inheritDoc}
-         */
-        @Override
-        public void onStarted(InstallArtifact installArtifact) {
-            addEvent(TestLifecycleEvent.STARTED, installArtifact);
-        }
-
-        /** 
-         * {@inheritDoc}
-         */
-        @Override
-        public void onStarting(InstallArtifact installArtifact) {
-            addEvent(TestLifecycleEvent.STARTING, installArtifact);
-        }
-
-        /** 
-         * {@inheritDoc}
-         */
-        @Override
-        public void onStopped(InstallArtifact installArtifact) {
-            addEvent(TestLifecycleEvent.STOPPED, installArtifact);
-        }
-
-        /** 
-         * {@inheritDoc}
-         */
-        @Override
-        public void onStopping(InstallArtifact installArtifact) {
-            addEvent(TestLifecycleEvent.STOPPING, installArtifact);
-        }
-
-        /** 
-         * {@inheritDoc}
-         */
-        @Override
-        public void onUninstalled(InstallArtifact installArtifact) {
-            addEvent(TestLifecycleEvent.UNINSTALLED, installArtifact);
-        }
-
-        /** 
-         * {@inheritDoc}
-         */
-        @Override
-        public void onUninstalling(InstallArtifact installArtifact) {
-            addEvent(TestLifecycleEvent.UNINSTALLING, installArtifact);
-        }
-
-        /** 
-         * {@inheritDoc}
-         */
-        @Override
-        public void onUnresolved(InstallArtifact installArtifact) {
-            addEvent(TestLifecycleEvent.UNRESOLVED, installArtifact);
-        }
-
-        private void addEvent(TestLifecycleEvent event, InstallArtifact installArtifact) {
-            synchronized (this.monitor) {
-                this.eventList.add(new ArtifactLifecycleEvent(event, installArtifact.getType(), installArtifact.getName(),
-                    installArtifact.getVersion()));
-            }
-        }
-    }
 }
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PipelinedDeployerIntegrationTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PipelinedDeployerIntegrationTests.java
index 8a0a6ac..03de2e6 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PipelinedDeployerIntegrationTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PipelinedDeployerIntegrationTests.java
@@ -29,7 +29,7 @@
 
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 import org.eclipse.virgo.util.io.FileCopyUtils;
 import org.eclipse.virgo.util.io.FileSystemUtils;
 import org.eclipse.virgo.util.io.PathReference;
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentTests.java
index 031e203..29fb747 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/PlanDeploymentTests.java
@@ -20,34 +20,50 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Dictionary;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Map.Entry;
 import java.util.Properties;
 import java.util.Set;
-import java.util.Map.Entry;
 
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.eclipse.virgo.kernel.deployer.test.util.ArtifactLifecycleEvent;
+import org.eclipse.virgo.kernel.deployer.test.util.ArtifactListener;
+import org.eclipse.virgo.kernel.deployer.test.util.TestLifecycleEvent;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener;
+import org.eclipse.virgo.util.math.Sets;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
 import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
 
-
 public class PlanDeploymentTests extends AbstractDeployerIntegrationTest {
 
-	private ServiceReference<ConfigurationAdmin> configAdminServiceReference;
+    private ServiceReference<ConfigurationAdmin> configAdminServiceReference;
 
-	private ConfigurationAdmin configAdmin;
-	
-	@Test
-	public void planReferencingAPar() throws Exception {
-	    testPlanDeployment(new File("src/test/resources/test-with-par.plan"), null, "par-deployed-by-plan-1-one");
-	}
-	
-	@Test(expected=DeploymentException.class)
+    private ConfigurationAdmin configAdmin;
+
+    private static final String PLAN_SYMBOLIC_NAME_BUG336200 = "bug336200.plan";
+
+    private static final String BUG336200_LAZY_BSN = "lazyBundle";
+
+    private static final Version VERSION_BUG336200 = new Version(1, 0, 0);
+
+    private final ArtifactListener artifactListener = new ArtifactListener();
+
+    @Test
+    public void planReferencingAPar() throws Exception {
+        testPlanDeployment(new File("src/test/resources/test-with-par.plan"), null, "par-deployed-by-plan-1-one");
+    }
+
+    @Test(expected = DeploymentException.class)
     public void scopedPlanReferencingAPar() throws Exception {
         testPlanDeployment(new File("src/test/resources/scoped-test-with-par.plan"), null);
     }
@@ -57,9 +73,10 @@
         String oneBsn = "simple.bundle.one";
         String twoBsn = "simple.bundle.two";
 
-        testPlanDeployment(new File("src/test/resources/test.plan"), new File("src/test/resources/plan-deployment/com.foo.bar.properties"), oneBsn, twoBsn);
+        testPlanDeployment(new File("src/test/resources/test.plan"), new File("src/test/resources/plan-deployment/com.foo.bar.properties"), oneBsn,
+            twoBsn);
     }
-    
+
     @Test
     public void testSimpleBundleWithFragment() throws Exception {
         String oneBsn = "simple.bundle.one";
@@ -67,13 +84,14 @@
 
         testPlanDeployment(new File("src/test/resources/fragment.plan"), null, oneBsn, twoBsn);
     }
-    
+
     @Test
     public void testUnscopedNonAtomicPlan() throws Exception {
         String oneBsn = "simple.bundle.one";
         String twoBsn = "simple.bundle.two";
 
-        testPlanDeployment(new File("src/test/resources/testunscopednonatomic.plan"), new File("src/test/resources/plan-deployment/com.foo.bar.properties"), oneBsn, twoBsn);
+        testPlanDeployment(new File("src/test/resources/testunscopednonatomic.plan"), new File(
+            "src/test/resources/plan-deployment/com.foo.bar.properties"), oneBsn, twoBsn);
     }
 
     @Test
@@ -82,18 +100,24 @@
         Bundle[] bundles = this.context.getBundles();
         boolean found = false;
         for (Bundle bundle : bundles) {
-            if("bundle.properties".equals(bundle.getSymbolicName())) {
+            if ("bundle.properties".equals(bundle.getSymbolicName())) {
                 found = true;
                 assertEquals("foo", bundle.getHeaders().get("Test-Header"));
             }
         }
         assertTrue(found);
     }
-    
+
+    @Test
+    public void testUnscopedAtomicPlanStartingEventsDuringDeployment() throws Exception {
+        testPlanDeploymentStartingEvents(new File("src/test/resources/bug336200.plan"), BUG336200_LAZY_BSN);
+    }
+
     @Before
-    public void setUp() throws Exception {        
+    public void setUp() throws Exception {
         this.configAdminServiceReference = this.context.getServiceReference(ConfigurationAdmin.class);
         this.configAdmin = this.context.getService(this.configAdminServiceReference);
+        this.context.registerService(InstallArtifactLifecycleListener.class.getName(), artifactListener, null);
     }
 
     private void testPlanDeployment(File plan, File propertiesFile, String... candidateBsns) throws Exception {
@@ -103,23 +127,107 @@
         DeploymentIdentity deploymentIdentity = this.deployer.deploy(plan.toURI());
         Bundle[] afterDeployBundles = this.context.getBundles();
         assertBundlesInstalled(afterDeployBundles, candidateBsns);
-        
+
         String pid = null;
-        
+
         if (propertiesFile != null) {
-        	pid = propertiesFile.getName().substring(0, propertiesFile.getName().length() - ".properties".length());
-        	checkConfigAvailable(pid, propertiesFile);
+            pid = propertiesFile.getName().substring(0, propertiesFile.getName().length() - ".properties".length());
+            checkConfigAvailable(pid, propertiesFile);
         }
 
         this.deployer.undeploy(deploymentIdentity);
         Bundle[] afterUndeployBundles = this.context.getBundles();
         assertBundlesNotInstalled(afterUndeployBundles, candidateBsns);
-        
+
         if (propertiesFile != null) {
-        	checkConfigUnavailable(pid);
+            checkConfigUnavailable(pid);
         }
     }
 
+    private void testPlanDeploymentStartingEvents(File plan, String... candidateBsns) throws Exception {
+
+        this.artifactListener.clear();
+
+        Set<ArtifactLifecycleEvent> expectedEventSet = new HashSet<ArtifactLifecycleEvent>();
+        // events expected due to explicit refresh;
+        expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.RESOLVING, "plan", PLAN_SYMBOLIC_NAME_BUG336200, VERSION_BUG336200));
+        expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.RESOLVED, "plan", PLAN_SYMBOLIC_NAME_BUG336200, VERSION_BUG336200));
+        expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.INSTALLING, "plan", PLAN_SYMBOLIC_NAME_BUG336200, VERSION_BUG336200));
+        expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.INSTALLED, "plan", PLAN_SYMBOLIC_NAME_BUG336200, VERSION_BUG336200));
+        expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.STARTING, "plan", PLAN_SYMBOLIC_NAME_BUG336200, VERSION_BUG336200));
+        expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.STARTED, "plan", PLAN_SYMBOLIC_NAME_BUG336200, VERSION_BUG336200));
+        
+        expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.RESOLVING, "bundle", BUG336200_LAZY_BSN, VERSION_BUG336200));
+        expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.RESOLVED, "bundle", BUG336200_LAZY_BSN, VERSION_BUG336200));
+        expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.INSTALLING, "bundle", BUG336200_LAZY_BSN, VERSION_BUG336200));
+        expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.INSTALLED, "bundle", BUG336200_LAZY_BSN, VERSION_BUG336200));
+        expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.STARTING, "bundle", BUG336200_LAZY_BSN, VERSION_BUG336200));
+        expectedEventSet.add(new ArtifactLifecycleEvent(TestLifecycleEvent.STARTED, "bundle", BUG336200_LAZY_BSN, VERSION_BUG336200));
+ 
+        Bundle[] beforeDeployBundles = this.context.getBundles();
+        assertBundlesNotInstalled(beforeDeployBundles, candidateBsns);
+        Thread startBundleThread = new Thread(new StartBundleRunnable(this.context));
+        startBundleThread.start();
+        
+        DeploymentIdentity deploymentIdentity = this.deployer.deploy(plan.toURI());
+        waitForAndCheckEventsReceived(expectedEventSet, 10000L);
+
+        Bundle[] afterDeployBundles = this.context.getBundles();
+        assertBundlesInstalled(afterDeployBundles, candidateBsns);
+
+        this.deployer.undeploy(deploymentIdentity);
+        Bundle[] afterUndeployBundles = this.context.getBundles();
+        assertBundlesNotInstalled(afterUndeployBundles, candidateBsns);
+    }
+
+    private class StartBundleRunnable implements Runnable {
+
+        BundleContext context = null;
+
+        public StartBundleRunnable(BundleContext bundleContext) {
+            this.context = bundleContext;
+        }
+
+        @Override
+        public void run() {
+            try {
+                waitAndStartLazyBundle();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            } catch (BundleException e) {
+                e.printStackTrace();
+            }
+
+        }
+
+        private void waitAndStartLazyBundle() throws InterruptedException, BundleException {
+            Thread.sleep(2500);
+
+            for (Bundle bundle : this.context.getBundles()) {
+                if (bundle.getSymbolicName().equals(BUG336200_LAZY_BSN)) {
+                    bundle.start();
+                }
+            }
+        }
+
+    }
+
+    private void waitForAndCheckEventsReceived(Set<ArtifactLifecycleEvent> expectedEventSet, long timeout) {
+        this.artifactListener.waitForEvents(expectedEventSet, timeout);
+        
+        Set<ArtifactLifecycleEvent> actualEventSet = new HashSet<ArtifactLifecycleEvent>(this.artifactListener.extract());
+
+        Set<ArtifactLifecycleEvent> extraEvents = Sets.difference(actualEventSet, expectedEventSet);
+        Set<ArtifactLifecycleEvent> missingEvents = Sets.difference(expectedEventSet, actualEventSet);
+
+        assertTrue("More events were received than expected: " + extraEvents, extraEvents.isEmpty());
+        assertTrue("There were missing events: " + missingEvents, missingEvents.isEmpty());
+        
+        List<ArtifactLifecycleEvent> actualEventSetList = this.artifactListener.extract();
+        ArtifactLifecycleEvent planStartingEvent = new ArtifactLifecycleEvent(TestLifecycleEvent.STARTING, "bundle", BUG336200_LAZY_BSN, VERSION_BUG336200);
+        assertTrue("More than one STARTING event received for the atomic plan.", actualEventSetList.indexOf(planStartingEvent) == actualEventSetList.lastIndexOf(planStartingEvent));
+    }
+
     private void assertBundlesNotInstalled(Bundle[] bundles, String... candidateBsns) {
         List<String> installedBsns = getInstalledBsns(bundles);
         for (String candidateBsn : candidateBsns) {
@@ -130,21 +238,21 @@
             }
         }
     }
-    
+
     @SuppressWarnings("unchecked")
     private void checkConfigAvailable(String pid, File propertiesFile) throws IOException {
         Configuration configuration = this.configAdmin.getConfiguration(pid, null);
         Dictionary<Object, Object> dictionary = configuration.getProperties();
-        
+
         Properties properties = new Properties();
         properties.load(new FileReader(propertiesFile));
-        
+
         Set<Entry<Object, Object>> entrySet = properties.entrySet();
-        
+
         for (Entry<Object, Object> entry : entrySet) {
-        	Assert.assertEquals(entry.getValue(), dictionary.get(entry.getKey()));
-		}
-        
+            Assert.assertEquals(entry.getValue(), dictionary.get(entry.getKey()));
+        }
+
         Assert.assertEquals(pid, dictionary.get("service.pid"));
     }
 
@@ -174,6 +282,5 @@
 
         return installedBsns;
     }
-    
-    
+
 }
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RedeployRefreshTests.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RedeployRefreshTests.java
index 4c3399c..bec672a 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RedeployRefreshTests.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/RedeployRefreshTests.java
@@ -23,7 +23,7 @@
 import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 import org.eclipse.virgo.util.io.PathReference;
 
 /**
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/StubInstallArtifactLifecycleListener.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/StubInstallArtifactLifecycleListener.java
index 9d33b13..4baefa8 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/StubInstallArtifactLifecycleListener.java
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/StubInstallArtifactLifecycleListener.java
@@ -92,6 +92,12 @@
     /**
      * {@inheritDoc}
      */
+    public void onStartAborted(InstallArtifact installArtifact) {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public void onStarted(InstallArtifact installArtifact) {
         this.startedCount.incrementAndGet();
     }
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/ArtifactLifecycleEvent.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/ArtifactLifecycleEvent.java
new file mode 100644
index 0000000..18f2030
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/ArtifactLifecycleEvent.java
@@ -0,0 +1,60 @@
+/*******************************************************************************

+ * Copyright (c) 2008, 2011 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   VMware Inc. - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.deployer.test.util;

+

+import org.osgi.framework.Version;

+

+public class ArtifactLifecycleEvent {

+

+    public ArtifactLifecycleEvent(TestLifecycleEvent lifecycleEvent, String type, String name, Version version) {

+        this.lifeCycleEvent = lifecycleEvent;

+        this.type = type;

+        this.name = name;

+        this.version = version;

+    }

+

+    @Override

+    public boolean equals(Object obj) {

+        if (obj instanceof ArtifactLifecycleEvent) {

+            ArtifactLifecycleEvent other = (ArtifactLifecycleEvent) obj;

+            return this.lifeCycleEvent.equals(other.lifeCycleEvent) && this.type.equals(other.type) && this.name.equals(other.name)

+                && this.version.equals(other.version);

+        }

+        return false;

+    }

+

+    @Override

+    public int hashCode() {

+        final int prime = 17;

+        int result = this.lifeCycleEvent.hashCode() + prime

+            * (this.name.hashCode() + prime * (this.type.hashCode() + prime * this.version.hashCode()));

+        return result;

+    }

+

+    @Override

+    public String toString() {

+        StringBuilder sb = new StringBuilder("[");

+        sb.append(this.lifeCycleEvent).append(", ");

+        sb.append(this.type).append(", ");

+        sb.append(this.name).append(", ");

+        sb.append(this.version).append("]");

+        return sb.toString();

+    }

+

+    private final TestLifecycleEvent lifeCycleEvent;

+

+    private final String type;

+

+    private final String name;

+

+    private final Version version;

+}
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/ArtifactListener.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/ArtifactListener.java
new file mode 100644
index 0000000..ad3b4dc
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/ArtifactListener.java
@@ -0,0 +1,157 @@
+/*******************************************************************************

+ * Copyright (c) 2008, 2011 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   VMware Inc. - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.deployer.test.util;

+

+import java.util.ArrayList;

+import java.util.List;

+import java.util.Set;

+

+import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;

+import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListenerSupport;

+

+public class ArtifactListener extends InstallArtifactLifecycleListenerSupport {

+

+    private final Object monitor = new Object();

+

+    List<ArtifactLifecycleEvent> eventList = new ArrayList<ArtifactLifecycleEvent>();

+

+    public void clear() {

+        synchronized (this.monitor) {

+            this.eventList.clear();

+        }

+    }

+

+    public boolean waitForEvents(final Set<ArtifactLifecycleEvent> expectedEventSet, long timeout) {

+        boolean allReceived = eventsReceived(expectedEventSet);

+        while (!allReceived && timeout > 0) {

+            timeout -= 50L;

+            try {

+                Thread.sleep(50L);

+            } catch (InterruptedException _) {

+                // do nothing

+            }

+            allReceived = eventsReceived(expectedEventSet);

+        }

+        return allReceived;

+    }

+

+    private boolean eventsReceived(Set<ArtifactLifecycleEvent> eventSet) {

+        synchronized (this.monitor) {

+            for (ArtifactLifecycleEvent event : eventSet) {

+                if (!this.eventList.contains(event)) {

+                    return false;

+                }

+            }

+            return true;

+        }

+    }

+

+    public List<ArtifactLifecycleEvent> extract() {

+        synchronized (this.monitor) {

+            return new ArrayList<ArtifactLifecycleEvent>(this.eventList);

+        }

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    @Override

+    public void onInstalled(InstallArtifact installArtifact) {

+        addEvent(TestLifecycleEvent.INSTALLED, installArtifact);

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    @Override

+    public void onInstalling(InstallArtifact installArtifact) {

+        addEvent(TestLifecycleEvent.INSTALLING, installArtifact);

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    @Override

+    public void onResolved(InstallArtifact installArtifact) {

+        addEvent(TestLifecycleEvent.RESOLVED, installArtifact);

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    @Override

+    public void onResolving(InstallArtifact installArtifact) {

+        addEvent(TestLifecycleEvent.RESOLVING, installArtifact);

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    @Override

+    public void onStarted(InstallArtifact installArtifact) {

+        addEvent(TestLifecycleEvent.STARTED, installArtifact);

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    @Override

+    public void onStarting(InstallArtifact installArtifact) {

+        addEvent(TestLifecycleEvent.STARTING, installArtifact);

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    @Override

+    public void onStopped(InstallArtifact installArtifact) {

+        addEvent(TestLifecycleEvent.STOPPED, installArtifact);

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    @Override

+    public void onStopping(InstallArtifact installArtifact) {

+        addEvent(TestLifecycleEvent.STOPPING, installArtifact);

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    @Override

+    public void onUninstalled(InstallArtifact installArtifact) {

+        addEvent(TestLifecycleEvent.UNINSTALLED, installArtifact);

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    @Override

+    public void onUninstalling(InstallArtifact installArtifact) {

+        addEvent(TestLifecycleEvent.UNINSTALLING, installArtifact);

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    @Override

+    public void onUnresolved(InstallArtifact installArtifact) {

+        addEvent(TestLifecycleEvent.UNRESOLVED, installArtifact);

+    }

+

+    private void addEvent(TestLifecycleEvent event, InstallArtifact installArtifact) {

+        synchronized (this.monitor) {

+            this.eventList.add(new ArtifactLifecycleEvent(event, installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion()));

+        }

+    }

+}
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/TestLifecycleEvent.java b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/TestLifecycleEvent.java
new file mode 100644
index 0000000..fa86ee8
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/java/org/eclipse/virgo/kernel/deployer/test/util/TestLifecycleEvent.java
@@ -0,0 +1,16 @@
+/*******************************************************************************

+ * Copyright (c) 2008, 2011 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   VMware Inc. - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.deployer.test.util;

+

+public enum TestLifecycleEvent {

+    INSTALLED, INSTALLING, RESOLVED, RESOLVING, STARTED, STARTING, STOPPED, STOPPING, UNINSTALLED, UNINSTALLING, UNRESOLVED

+}

diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/MANIFEST.MF b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/MANIFEST.MF
index 1274b8a..326a811 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/MANIFEST.MF
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/MANIFEST.MF
@@ -12,6 +12,7 @@
  org.eclipse.virgo.kernel.module,

  org.eclipse.virgo.kernel.osgi.common,

  org.eclipse.virgo.kernel.osgi.framework,

+ org.eclipse.virgo.kernel.osgi.region,

  org.eclipse.virgo.kernel.services.work,

  org.eclipse.virgo.util.io,

  org.eclipse.virgo.util.math,

diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/no.heap.dump.test.config.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/no.heap.dump.test.config.properties
index 6e30a45..6d10a2b 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/no.heap.dump.test.config.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/no.heap.dump.test.config.properties
@@ -1,13 +1,15 @@
 launcher.bundles =\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.ds/1.3.0.v20110124-0830/org.eclipse.equinox.ds-1.3.0.v20110124-0830.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.util/1.0.200.v20100503/org.eclipse.equinox.util-1.0.200.v20100503.jar@start,\
  file:../ivy-cache/repository/org.slf4j/com.springsource.slf4j.api/${org.slf4j}/com.springsource.slf4j.api-${org.slf4j}.jar@start,\
  file:../ivy-cache/repository/org.slf4j/com.springsource.slf4j.org.apache.commons.logging/${org.slf4j}/com.springsource.slf4j.org.apache.commons.logging-${org.slf4j}.jar@start,\
  file:../ivy-cache/repository/org.aspectj/com.springsource.org.aspectj.weaver/${org.aspectj}/com.springsource.org.aspectj.weaver-${org.aspectj}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.medic/org.eclipse.virgo.medic/${org.eclipse.virgo.medic}/org.eclipse.virgo.medic-${org.eclipse.virgo.medic}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.osgi.services/${org.eclipse.osgi.services}/org.eclipse.osgi.services-${org.eclipse.osgi.services}.jar,\
- file:../ivy-cache/repository/org.eclipse.equinox/org.eclipse.equinox.cm/${org.eclipse.equinox.cm}/org.eclipse.equinox.cm-${org.eclipse.equinox.cm}.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.cm/${org.eclipse.equinox.cm}/org.eclipse.equinox.cm-${org.eclipse.equinox.cm}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/${org.eclipse.virgo.medic}/org.eclipse.virgo.medic.core-${org.eclipse.virgo.medic}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/${org.eclipse.virgo.util}/org.eclipse.virgo.util.osgi-${org.eclipse.virgo.util}.jar@start,\
- file:../ivy-cache/repository/org.apache.felix/org.apache.felix.eventadmin/${org.apache.felix.eventadmin}/org.apache.felix.eventadmin-${org.apache.felix.eventadmin}.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.event/${org.eclipse.equinox.event}/org.eclipse.equinox.event-${org.eclipse.equinox.event}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.common/${org.eclipse.virgo.util}/org.eclipse.virgo.util.common-${org.eclipse.virgo.util}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.io/${org.eclipse.virgo.util}/org.eclipse.virgo.util.io-${org.eclipse.virgo.util}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.jmx/${org.eclipse.virgo.util}/org.eclipse.virgo.util.jmx-${org.eclipse.virgo.util}.jar,\
@@ -30,10 +32,12 @@
  file:../ivy-cache/repository/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar,\
  file:../org.eclipse.virgo.kernel.artifact/target/classes@start,\
  file:../org.eclipse.virgo.kernel.services/target/classes@start,\
- file:../org.eclipse.virgo.kernel.osgi/target/classes@start,\
  file:../org.eclipse.virgo.kernel.deployer/target/classes@start,\
  file:../org.eclipse.virgo.kernel.model/target/classes@start,\
- file:../org.eclipse.virgo.kernel.kerneldmfragment/target/classes
+ file:../org.eclipse.virgo.kernel.kerneldmfragment/target/classes,\
+ file:../org.eclipse.virgo.kernel.osgi/target/classes@start,\
+ file:../org.eclipse.virgo.kernel.userregionfactory/target/classes@start
+ 
 
 org.eclipse.virgo.test.properties.include=file:../build.versions,file:../build.properties
 
@@ -43,6 +47,7 @@
 osgi.compatibility.bootdelegation=false
 osgi.clean=true
 osgi.configuration.area=target
+org.osgi.framework.bsnversion=multiple
 
 #osgi.console=2401
 
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/spring256.test.config.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/spring256.test.config.properties
index 9413291..63e1ff2 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/spring256.test.config.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/spring256.test.config.properties
@@ -1,13 +1,15 @@
 launcher.bundles =\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.ds/1.3.0.v20110124-0830/org.eclipse.equinox.ds-1.3.0.v20110124-0830.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.util/1.0.200.v20100503/org.eclipse.equinox.util-1.0.200.v20100503.jar@start,\
  file:../ivy-cache/repository/org.slf4j/com.springsource.slf4j.api/${org.slf4j}/com.springsource.slf4j.api-${org.slf4j}.jar@start,\
  file:../ivy-cache/repository/org.slf4j/com.springsource.slf4j.org.apache.commons.logging/${org.slf4j}/com.springsource.slf4j.org.apache.commons.logging-${org.slf4j}.jar@start,\
  file:../ivy-cache/repository/org.aspectj/com.springsource.org.aspectj.weaver/${org.aspectj}/com.springsource.org.aspectj.weaver-${org.aspectj}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.medic/org.eclipse.virgo.medic/${org.eclipse.virgo.medic}/org.eclipse.virgo.medic-${org.eclipse.virgo.medic}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.osgi.services/${org.eclipse.osgi.services}/org.eclipse.osgi.services-${org.eclipse.osgi.services}.jar,\
- file:../ivy-cache/repository/org.eclipse.equinox/org.eclipse.equinox.cm/${org.eclipse.equinox.cm}/org.eclipse.equinox.cm-${org.eclipse.equinox.cm}.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.cm/${org.eclipse.equinox.cm}/org.eclipse.equinox.cm-${org.eclipse.equinox.cm}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/${org.eclipse.virgo.medic}/org.eclipse.virgo.medic.core-${org.eclipse.virgo.medic}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/${org.eclipse.virgo.util}/org.eclipse.virgo.util.osgi-${org.eclipse.virgo.util}.jar@start,\
- file:../ivy-cache/repository/org.apache.felix/org.apache.felix.eventadmin/${org.apache.felix.eventadmin}/org.apache.felix.eventadmin-${org.apache.felix.eventadmin}.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.event/${org.eclipse.equinox.event}/org.eclipse.equinox.event-${org.eclipse.equinox.event}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.common/${org.eclipse.virgo.util}/org.eclipse.virgo.util.common-${org.eclipse.virgo.util}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.io/${org.eclipse.virgo.util}/org.eclipse.virgo.util.io-${org.eclipse.virgo.util}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.jmx/${org.eclipse.virgo.util}/org.eclipse.virgo.util.jmx-${org.eclipse.virgo.util}.jar@start,\
@@ -30,10 +32,12 @@
  file:../ivy-cache/repository/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar,\
  file:../org.eclipse.virgo.kernel.artifact/target/classes@start,\
  file:../org.eclipse.virgo.kernel.services/target/classes@start,\
- file:../org.eclipse.virgo.kernel.osgi/target/classes@start,\
  file:../org.eclipse.virgo.kernel.deployer/target/classes@start,\
  file:../org.eclipse.virgo.kernel.model/target/classes@start,\
- file:../org.eclipse.virgo.kernel.kerneldmfragment/target/classes
+ file:../org.eclipse.virgo.kernel.kerneldmfragment/target/classes,\
+ file:../org.eclipse.virgo.kernel.osgi/target/classes@start,\
+ file:../org.eclipse.virgo.kernel.userregionfactory/target/classes@start
+ 
 
 org.eclipse.virgo.test.properties.include=file:../build.versions,file:../build.properties
 
@@ -43,6 +47,7 @@
 osgi.compatibility.bootdelegation=false
 osgi.clean=true
 osgi.configuration.area=target
+org.osgi.framework.bsnversion=multiple
 
 #osgi.console=2401
 
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/test.config.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/test.config.properties
index 4d7a5d1..b2182b1 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/test.config.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/META-INF/test.config.properties
@@ -1,13 +1,15 @@
 launcher.bundles =\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.ds/1.3.0.v20110124-0830/org.eclipse.equinox.ds-1.3.0.v20110124-0830.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.util/1.0.200.v20100503/org.eclipse.equinox.util-1.0.200.v20100503.jar@start,\
  file:../ivy-cache/repository/org.slf4j/com.springsource.slf4j.api/${org.slf4j}/com.springsource.slf4j.api-${org.slf4j}.jar@start,\
  file:../ivy-cache/repository/org.slf4j/com.springsource.slf4j.org.apache.commons.logging/${org.slf4j}/com.springsource.slf4j.org.apache.commons.logging-${org.slf4j}.jar@start,\
  file:../ivy-cache/repository/org.aspectj/com.springsource.org.aspectj.weaver/${org.aspectj}/com.springsource.org.aspectj.weaver-${org.aspectj}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.medic/org.eclipse.virgo.medic/${org.eclipse.virgo.medic}/org.eclipse.virgo.medic-${org.eclipse.virgo.medic}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.osgi.services/${org.eclipse.osgi.services}/org.eclipse.osgi.services-${org.eclipse.osgi.services}.jar,\
- file:../ivy-cache/repository/org.eclipse.equinox/org.eclipse.equinox.cm/${org.eclipse.equinox.cm}/org.eclipse.equinox.cm-${org.eclipse.equinox.cm}.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.cm/${org.eclipse.equinox.cm}/org.eclipse.equinox.cm-${org.eclipse.equinox.cm}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/${org.eclipse.virgo.medic}/org.eclipse.virgo.medic.core-${org.eclipse.virgo.medic}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/${org.eclipse.virgo.util}/org.eclipse.virgo.util.osgi-${org.eclipse.virgo.util}.jar@start,\
- file:../ivy-cache/repository/org.apache.felix/org.apache.felix.eventadmin/${org.apache.felix.eventadmin}/org.apache.felix.eventadmin-${org.apache.felix.eventadmin}.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.event/${org.eclipse.equinox.event}/org.eclipse.equinox.event-${org.eclipse.equinox.event}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.common/${org.eclipse.virgo.util}/org.eclipse.virgo.util.common-${org.eclipse.virgo.util}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.io/${org.eclipse.virgo.util}/org.eclipse.virgo.util.io-${org.eclipse.virgo.util}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.jmx/${org.eclipse.virgo.util}/org.eclipse.virgo.util.jmx-${org.eclipse.virgo.util}.jar,\
@@ -30,10 +32,12 @@
  file:../ivy-cache/repository/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar,\
  file:../org.eclipse.virgo.kernel.artifact/target/classes@start,\
  file:../org.eclipse.virgo.kernel.services/target/classes@start,\
- file:../org.eclipse.virgo.kernel.osgi/target/classes@start,\
  file:../org.eclipse.virgo.kernel.deployer/target/classes@start,\
  file:../org.eclipse.virgo.kernel.model/target/classes@start,\
- file:../org.eclipse.virgo.kernel.kerneldmfragment/target/classes
+ file:../org.eclipse.virgo.kernel.kerneldmfragment/target/classes,\
+ file:../org.eclipse.virgo.kernel.osgi/target/classes@start,\
+ file:../org.eclipse.virgo.kernel.userregionfactory/target/classes@start
+ 
 
 org.eclipse.virgo.test.properties.include=file:../build.versions,file:../build.properties
 
@@ -43,6 +47,7 @@
 osgi.compatibility.bootdelegation=false
 osgi.clean=true
 osgi.configuration.area=target
+org.osgi.framework.bsnversion=multiple
 
 #osgi.console=2401
 
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/bug330506.par b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/bug330506.par
new file mode 100644
index 0000000..84cceab
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/bug330506.par
Binary files differ
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/bug336200.plan b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/bug336200.plan
new file mode 100644
index 0000000..f64ea0a
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/bug336200.plan
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plan name="bug336200.plan" version="1.0.0" scoped="false" atomic="true"
+		xmlns="http://www.eclipse.org/virgo/schema/plan"
+		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+		xsi:schemaLocation="
+			http://www.eclipse.org/virgo/schema/plan 
+			http://www.eclipse.org/virgo/schema/plan/eclipse-virgo-plan.xsd">
+
+	<artifact type="bundle" name="lazyBundle" version="0.0.0"/>
+
+</plan>
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
index 1c501c9..127b562 100644
--- a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
@@ -9,6 +9,9 @@
  file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar@start,\
  file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-1.2.1.jar,\
  file:../ivy-cache/repository/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.ds/1.3.0.v20110124-0830/org.eclipse.equinox.ds-1.3.0.v20110124-0830.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.util/1.0.200.v20100503/org.eclipse.equinox.util-1.0.200.v20100503.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-3.3.0.v20110110.jar,\
  file:../org.eclipse.virgo.kernel.agent.dm/target/classes@start,\
  file:../org.eclipse.virgo.kernel.deployer.dm/target/classes@start,\
  file:../org.eclipse.virgo.kernel.dmfragment/target/classes,\
@@ -20,6 +23,8 @@
  file:../ivy-cache/repository/javax.persistence/com.springsource.javax.persistence/1.0.0/com.springsource.javax.persistence-1.0.0.jar,\
  file:../ivy-cache/repository/com.oracle.toplink.essentials/com.springsource.oracle.toplink.essentials/2.0.0.b41-beta2/com.springsource.oracle.toplink.essentials-2.0.0.b41-beta2.jar
  
+bundleImports = org.eclipse.osgi;bundle-version="0"
+
 packageImports =\
  org.eclipse.virgo.kernel.artifact.*;version="0",\
  org.eclipse.virgo.kernel.core;version="0",\
@@ -47,6 +52,8 @@
  org.slf4j;version="[1.6.1,2)"
 
 serviceImports =\
+ org.eclipse.virgo.kernel.osgi.region.Region,\
+ org.eclipse.virgo.kernel.osgi.region.RegionDigraph,\
  org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer,\
  org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser,\
  org.eclipse.virgo.kernel.install.artifact.ScopeServiceRepository,\
@@ -57,36 +64,30 @@
  org.eclipse.virgo.medic.eventlog.EventLoggerFactory,\
  org.eclipse.virgo.repository.Repository,\
  org.eclipse.virgo.kernel.core.Shutdown,\
+ org.osgi.framework.hooks.resolver.ResolverHookFactory,\
  org.osgi.service.cm.ConfigurationAdmin,\
  org.osgi.service.event.EventAdmin,\
+ org.eclipse.virgo.medic.eventlog.EventLogger,\
  org.eclipse.virgo.medic.dump.DumpGenerator,\
  org.eclipse.virgo.kernel.shim.scope.ScopeFactory,\
  org.eclipse.virgo.kernel.shim.serviceability.TracingService,\
- org.eclipse.virgo.kernel.model.RuntimeArtifactRepository
+ org.eclipse.virgo.kernel.model.RuntimeArtifactRepository,\
+ org.eclipse.osgi.service.resolver.PlatformAdmin,\
+ org.osgi.service.packageadmin.PackageAdmin
 
 serviceExports =\
  org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener,\
  org.eclipse.virgo.kernel.install.artifact.ArtifactTypeDeterminer,\
  org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer,\
+ org.eclipse.virgo.kernel.module.ModuleContextAccessor,\
  org.eclipse.virgo.medic.dump.DumpContributor,\
  org.eclipse.virgo.kernel.osgi.quasi.QuasiFrameworkFactory,\
  org.eclipse.virgo.kernel.osgi.framework.OsgiFramework,\
  org.eclipse.virgo.kernel.osgi.framework.ImportExpander,\
  org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil,\
+ org.eclipse.virgo.kernel.osgi.region.Region,\
  org.osgi.service.event.EventHandler,\
  org.osgi.service.cm.ConfigurationListener,\
  org.osgi.service.cm.ManagedService,\
- org.osgi.service.cm.ManagedServiceFactory
-
-inheritedFrameworkProperties =\
- eclipse.bundle.setTCCL,\
- eclipse.enableStateSaver,\
- org.eclipse.virgo.suppress.heap.dumps,\
- osgi.java.profile,\
- osgi.parentClassloader,\
- osgi.context.bootdelegation,\
- osgi.compatibility.bootdelegation,\
- osgi.java.profile.bootdelegation,\
- osgi.hook.configurators.include
- 
-# osgi.console=2401
+ org.osgi.service.cm.ManagedServiceFactory,\
+ org.osgi.framework.BundleContext
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/configuration.deployment/factory-config-a.properties b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/configuration.deployment/factory-config-a.properties
new file mode 100644
index 0000000..6313f1a
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/configuration.deployment/factory-config-a.properties
@@ -0,0 +1,6 @@
+# factory pid for config admin service
+service.factoryPid = test.factory.pid.a
+
+# properties for the managed service
+prop1 = prop1
+prop2 = 2
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.deployer.test/src/test/resources/plan-deployment/lazyBundle.jar b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/plan-deployment/lazyBundle.jar
new file mode 100644
index 0000000..5ec5d32
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer.test/src/test/resources/plan-deployment/lazyBundle.jar
Binary files differ
diff --git a/org.eclipse.virgo.kernel.deployer.test/template.mf b/org.eclipse.virgo.kernel.deployer.test/template.mf
index 017e8b9..e2f8f06 100644
--- a/org.eclipse.virgo.kernel.deployer.test/template.mf
+++ b/org.eclipse.virgo.kernel.deployer.test/template.mf
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Virgo Kernel Deployer Test
 Bundle-SymbolicName: org.eclipse.virgo.kernel.deployer.test.loadable
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
 Excluded-Exports: 
  *
 Excluded-Imports: 
diff --git a/org.eclipse.virgo.kernel.deployer.testbundle/template.mf b/org.eclipse.virgo.kernel.deployer.testbundle/template.mf
index de90477..d01b58b 100644
--- a/org.eclipse.virgo.kernel.deployer.testbundle/template.mf
+++ b/org.eclipse.virgo.kernel.deployer.testbundle/template.mf
@@ -2,4 +2,4 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Virgo Kernel Deployer Test Bundle
 Bundle-SymbolicName: org.eclipse.virgo.kernel.deployer.testbundle
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
diff --git a/org.eclipse.virgo.kernel.deployer/.classpath b/org.eclipse.virgo.kernel.deployer/.classpath
index 1be4ebe..b66d1af 100644
--- a/org.eclipse.virgo.kernel.deployer/.classpath
+++ b/org.eclipse.virgo.kernel.deployer/.classpath
@@ -24,35 +24,35 @@
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/2.2.0.D-20101207150035/org.eclipse.virgo.util.math-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/2.2.0.D-20101207150035/org.eclipse.virgo.util.math-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/2.2.0.D-20101207145732/org.eclipse.virgo.osgi.extensions.equinox-2.2.0.D-20101207145732.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/2.2.0.D-20101207145732/org.eclipse.virgo.osgi.extensions.equinox-sources-2.2.0.D-20101207145732.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/3.0.0.M02/org.eclipse.virgo.osgi.extensions.equinox-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/3.0.0.M02/org.eclipse.virgo.osgi.extensions.equinox-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar" sourcepath="/DEV_DIR/external-artifacts/non-spring-build/org.springframework.osgi/org.springframework.osgi.extender/1.2.1.RC1-SFW3/org.springframework.osgi.extender-sources.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-sources-1.2.1.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-2.2.0.D-20101207151510.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-sources-2.2.0.D-20101207151510.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
 	<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-sources-2.2.0.D-20101207150849.jar">
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-sources-3.0.0.M02.jar">
 		<attributes>
 			<attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/2.2.0.D-20101207150849/org.eclipse.virgo.medic.core-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/2.2.0.D-20101207150849/org.eclipse.virgo.medic.core-sources-2.2.0.D-20101207150849.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-sources-1.6.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-sources-1.6.1.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.services"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-sources-2.2.0.D-20101207150849.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.apache.felix/org.apache.felix.eventadmin/1.0.0/org.apache.felix.eventadmin-1.0.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.apache.felix/org.apache.felix.eventadmin/1.0.0/org.apache.felix.eventadmin-sources-1.0.0.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-sources-3.0.0.M02.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.artifact"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-2.2.0.D-20101207145338.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/1.0.0.CI-B39/org.eclipse.virgo.teststubs.osgi-sources-1.0.0.CI-B39.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/1.0.0.CI-B39/org.eclipse.virgo.teststubs.osgi-sources-1.0.0.CI-B39.jar"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.equinox.event/1.2.100.v20110110/org.eclipse.equinox.event-1.2.100.v20110110.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/org.eclipse.virgo.kernel.deployer/ivy.xml b/org.eclipse.virgo.kernel.deployer/ivy.xml
index 8350265..193766d 100644
--- a/org.eclipse.virgo.kernel.deployer/ivy.xml
+++ b/org.eclipse.virgo.kernel.deployer/ivy.xml
@@ -22,6 +22,7 @@
 		<dependency org="org.eclipse.virgo.teststubs" name="org.eclipse.virgo.teststubs.osgi" rev="${org.eclipse.virgo.teststubs}" conf="test->runtime"/>
 
 		<dependency org="org.eclipse.osgi" name="org.eclipse.osgi" rev="${org.eclipse.osgi}" conf="compile->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.event" rev="${org.eclipse.equinox.event}" conf="compile->runtime"/>
 
 		<dependency org="org.springframework" name="org.springframework.core" rev="${org.springframework}" conf="compile->runtime"/>
 		<dependency org="org.springframework" name="org.springframework.context" rev="${org.springframework}" conf="compile->runtime"/>
@@ -29,9 +30,7 @@
 		<dependency org="org.springframework" name="org.springframework.beans" rev="${org.springframework}" conf="compile->runtime"/>
 
 		<dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="compile->runtime"/>
-		<dependency org="org.eclipse.equinox" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="compile->runtime"/>
-
-		<dependency name='org.apache.felix.eventadmin' rev='${org.apache.felix.eventadmin}' conf='compile->compile' org='org.apache.felix'/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="compile->runtime"/>
 		
 		<dependency org="org.springframework.osgi" name="org.springframework.osgi.core" rev="${org.springframework.osgi}" conf="compile->runtime"/>
 		<dependency org="org.springframework.osgi" name="org.springframework.osgi.extender" rev="${org.springframework.osgi}" conf="compile->runtime"/>
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ApplicationDeployer.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ApplicationDeployer.java
index 29f2556..936433c 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ApplicationDeployer.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ApplicationDeployer.java
@@ -28,115 +28,6 @@
 public interface ApplicationDeployer {
 
     /**
-     * {@link DeploymentOptions} provides a collection of deployment options.
-     * <p />
-     * 
-     * <strong>Concurrent Semantics</strong><br />
-     * 
-     * This class is immutable and therefore thread safe.
-     */
-    public class DeploymentOptions {
-
-        public static final DeploymentOptions DEFAULT_DEPLOYMENT_OPTIONS = new DeploymentOptions();
-
-        private final boolean recoverable;
-
-        private final boolean deployerOwned;
-
-        private final boolean synchronous;
-
-        /**
-         * Create default deployment options.
-         */
-        public DeploymentOptions() {
-            this.recoverable = true;
-            this.deployerOwned = false;
-            this.synchronous = true;
-        }
-
-        /**
-         * Create deployment options with the given recoverability, ownership, and synchronisation.
-         * 
-         * @param recoverable <code>true</code> if and only if the application is to persist across Server restarts
-         * @param deployerOwned <code>true</code> if and only if the application at the location specified on deployment
-         *        is to be deleted when the application is undeployed
-         * @param synchronous <code>true</code> if and only if the application should be deployed synchronously
-         */
-        public DeploymentOptions(boolean recoverable, boolean deployerOwned, boolean synchronous) {
-            this.recoverable = recoverable;
-            this.deployerOwned = deployerOwned;
-            this.synchronous = synchronous;
-        }
-
-        /**
-         * Get the recoverability option.
-         * 
-         * @return <code>true</code> if and only if the application is to persist across Server restarts
-         */
-        public boolean getRecoverable() {
-            return this.recoverable;
-        }
-
-        /**
-         * Get the ownership option.
-         * 
-         * @return <code>true</code> if and only if the application at the location specified on deployment is to be
-         *         deleted when the application is undeployed
-         */
-        public boolean getDeployerOwned() {
-            return this.deployerOwned;
-        }
-
-        /**
-         * Get the synchronisation option which is <code>true</code> if and only if the application should be deployed
-         * synchronously.
-         * <p/>
-         * Deploying synchronously means that control does not return to the caller of the
-         * {@link org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer#deploy(URI, DeploymentOptions) deploy}
-         * method until any application contexts for the application have been built and published in the service
-         * registry or deployment fails or times out.
-         * <p/>
-         * Deploying asynchronously means that control returns to the caller of the
-         * {@link org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer#deploy(URI, DeploymentOptions) deploy}
-         * method once the application has been started, but not necessarily before any application contexts have been
-         * built and published.
-         * 
-         * @return <code>true</code> if and only if the application should be deployed synchronously
-         */
-        public boolean getSynchronous() {
-            return this.synchronous;
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + (deployerOwned ? 1231 : 1237);
-            result = prime * result + (recoverable ? 1231 : 1237);
-            result = prime * result + (synchronous ? 1231 : 1237);
-            return result;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj)
-                return true;
-            if (obj == null)
-                return false;
-            if (getClass() != obj.getClass())
-                return false;
-            DeploymentOptions other = (DeploymentOptions) obj;
-            if (deployerOwned != other.deployerOwned)
-                return false;
-            if (recoverable != other.recoverable)
-                return false;
-            if (synchronous != other.synchronous)
-                return false;
-            return true;
-        }
-    }
-
-    /**
      * Deploys the artifact are the supplied <code>location</code>. The supplied <code>options</code> govern how the
      * installed artifact is handled by the deployed, e.g. if it is recovered and re-installed upon warm restart.
      * 
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeployerLogEvents.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeployerLogEvents.java
index 230040c..e5f21e3 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeployerLogEvents.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeployerLogEvents.java
@@ -69,6 +69,7 @@
     REFRESH_REQUEST_FAILED(505, Level.ERROR), //
     UNDEPLOY_ARTEFACT_NOT_FOUND(506, Level.ERROR), //
     REFRESH_ARTEFACT_NOT_FOUND(507, Level.ERROR), //
+    START_ABORTED(508, Level.INFO), //    
 
     JAR_UNPACK_ERROR(600, Level.ERROR), //
 
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptions.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptions.java
new file mode 100644
index 0000000..4f243dc
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptions.java
@@ -0,0 +1,112 @@
+package org.eclipse.virgo.kernel.deployer.core;
+
+import java.net.URI;
+
+/**
+ * {@link DeploymentOptions} provides a collection of deployment options.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * 
+ * This class is immutable and therefore thread safe.
+ */
+public class DeploymentOptions {
+
+    public static final DeploymentOptions DEFAULT_DEPLOYMENT_OPTIONS = new DeploymentOptions();
+
+    private final boolean recoverable;
+
+    private final boolean deployerOwned;
+
+    private final boolean synchronous;
+
+    /**
+     * Create default deployment options.
+     */
+    public DeploymentOptions() {
+        this.recoverable = true;
+        this.deployerOwned = false;
+        this.synchronous = true;
+    }
+
+    /**
+     * Create deployment options with the given recoverability, ownership, and synchronisation.
+     * 
+     * @param recoverable <code>true</code> if and only if the application is to persist across Server restarts
+     * @param deployerOwned <code>true</code> if and only if the application at the location specified on deployment
+     *        is to be deleted when the application is undeployed
+     * @param synchronous <code>true</code> if and only if the application should be deployed synchronously
+     */
+    public DeploymentOptions(boolean recoverable, boolean deployerOwned, boolean synchronous) {
+        this.recoverable = recoverable;
+        this.deployerOwned = deployerOwned;
+        this.synchronous = synchronous;
+    }
+
+    /**
+     * Get the recoverability option.
+     * 
+     * @return <code>true</code> if and only if the application is to persist across Server restarts
+     */
+    public boolean getRecoverable() {
+        return this.recoverable;
+    }
+
+    /**
+     * Get the ownership option.
+     * 
+     * @return <code>true</code> if and only if the application at the location specified on deployment is to be
+     *         deleted when the application is undeployed
+     */
+    public boolean getDeployerOwned() {
+        return this.deployerOwned;
+    }
+
+    /**
+     * Get the synchronisation option which is <code>true</code> if and only if the application should be deployed
+     * synchronously.
+     * <p/>
+     * Deploying synchronously means that control does not return to the caller of the
+     * {@link org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer#deploy(URI, DeploymentOptions) deploy}
+     * method until any application contexts for the application have been built and published in the service
+     * registry or deployment fails or times out.
+     * <p/>
+     * Deploying asynchronously means that control returns to the caller of the
+     * {@link org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer#deploy(URI, DeploymentOptions) deploy}
+     * method once the application has been started, but not necessarily before any application contexts have been
+     * built and published.
+     * 
+     * @return <code>true</code> if and only if the application should be deployed synchronously
+     */
+    public boolean getSynchronous() {
+        return this.synchronous;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + (deployerOwned ? 1231 : 1237);
+        result = prime * result + (recoverable ? 1231 : 1237);
+        result = prime * result + (synchronous ? 1231 : 1237);
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        DeploymentOptions other = (DeploymentOptions) obj;
+        if (deployerOwned != other.deployerOwned)
+            return false;
+        if (recoverable != other.recoverable)
+            return false;
+        if (synchronous != other.synchronous)
+            return false;
+        return true;
+    }
+}
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerApplicationInfo.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerApplicationInfo.java
deleted file mode 100644
index 6ad893d..0000000
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerApplicationInfo.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.deployer.core;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * <p>
- * Used to expose management information about a deployed application, and it's 
- * constituent modules/deployed bundles. See {@link ServerModuleInfo ServerModuleInfo}
- * </p>
- * 
- * <strong>Concurrent Semantics</strong><br />
- * 
- * Implementations of this interface must be Thread Safe
- * 
- */
-public interface ServerApplicationInfo {
-
-    /**
-     * @return The name of the application as specified in the manifest, otherwise something sensible
-     */
-    String getName();
-
-    /**
-     * @return The specified version of the application or '0' if unknown
-     */
-    String getVersion();
-
-    /**
-     * @return The number of milliseconds since midnight, January 1, 1970 UTC, when this application was deployed
-     */
-    Date getDeployTime();
-
-    /**
-     * @return The type of the application, OSGi/non-OSGi etc...
-     */
-    String getType();
-
-    /**
-     * Get the {@link ServerModuleInfo ServerModuleInfos} of all the modules of this application.
-     * 
-     * @return this application's {@link ServerModuleInfo ServerModuleInfos}
-     */
-    List<ServerModuleInfo> getServerModuleInfo();
-    
-    /**
-     * Get the URI used to deploy this application.
-     * 
-     * @return the string form of the URI
-     */
-    String getURI();
-
-}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerModuleInfo.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerModuleInfo.java
deleted file mode 100644
index d9859f7..0000000
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/ServerModuleInfo.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.deployer.core;
-
-/**
- * {@link ServerModuleInfo} provides management information for a deployed module of an application.
- * <p />
- * 
- * <strong>Concurrent Semantics</strong><br />
- * 
- * Implementations of this interface must be thread safe.
- * 
- */
-public interface ServerModuleInfo extends Comparable<ServerModuleInfo>{
-
-    /**
-     * Get the personality of this module.
-     * 
-     * @return the personality of this module or <code>null</code> if this module is devoid of personality
-     */
-    String getPersonality();
-
-    /**
-     * Get an identifier of this module which uniquely identifies the module among all modules of the same personality.
-     * 
-     * @return the personality identifier of this module or <code>null</code> if this module is devoid of personality
-     */
-    String getPersonalityIdentifier();
-    
-    /**
-     * Get the symbolic name that this bundle is based on.
-     * @return the symbolic bundle name as specified in the manifest header
-     */
-    String getBundleSymbolicName();
-    
-}
-
-
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/AbortableSignalJunction.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/AbortableSignalJunction.java
new file mode 100644
index 0000000..d98c896
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/AbortableSignalJunction.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.deployer.core.internal;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.eclipse.virgo.kernel.core.AbortableSignal;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * {@link AbortableSignalJunction} provides a collection of signals of a given size that join to drive a given signal. The given
+ * signal is driven for completion when any of the signals in the collection is driven for failure or all the signals in
+ * the collection are driven for successful completion. The given signal is driven at most once.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * 
+ * This class is thread safe.
+ * 
+ */
+public final class AbortableSignalJunction {
+	
+	private static final Logger LOGGER = LoggerFactory.getLogger(AbortableSignalJunction.class);
+
+    private final AbortableSignal signal;
+
+    private final List<AbortableSignal> subSignals;
+
+    private final AtomicInteger incompleteCount;
+
+    private final AtomicBoolean failureSignalled = new AtomicBoolean(false);
+    
+    private final AtomicBoolean abortionSignalled = new AtomicBoolean(false);
+
+    /**
+     * Constructs a {@link AbortableSignalJunction} of the given size for the given signal.
+     * 
+     * @param signal the signal to be controlled
+     * @param size the number of signals in the collection
+     */
+    public AbortableSignalJunction(AbortableSignal signal, int size) {
+        this.signal = signal;
+        List<AbortableSignal> s = new ArrayList<AbortableSignal>();
+        for (int i = 0; i < size; i++) {
+            s.add(new SubSignal());
+        }
+        this.subSignals = Collections.unmodifiableList(s);
+        this.incompleteCount = new AtomicInteger(size);
+        if (size <= 0) {
+            if (this.signal != null) {
+                this.signal.signalSuccessfulCompletion();
+            }
+        }
+    }
+
+    /**
+     * Gets the signals in the collection.
+     * 
+     * @return an unmodifiable {@link Set} of signals in the collection
+     */
+    public List<AbortableSignal> getSignals() {
+        return this.subSignals;
+    }
+    
+    public boolean failed() {
+        return this.failureSignalled.get();
+    }
+    
+    public boolean aborted() {
+        return this.abortionSignalled.get();
+    }
+    
+    private void subSignalFailed(Throwable cause) {
+        // Ensure the incomplete count is zero.
+        int i = AbortableSignalJunction.this.incompleteCount.get();
+        
+        LOGGER.debug("SubSignal failed. {} has {} incomplete signals", this, i);
+        
+        while (i > 0 && !AbortableSignalJunction.this.incompleteCount.compareAndSet(i, 0)) {
+            i = AbortableSignalJunction.this.incompleteCount.get();
+        }
+
+        // If this invocation took the count to zero, drive failure.
+        if (i > 0) {
+            if (AbortableSignalJunction.this.signal != null) {
+            	LOGGER.debug("{} signalling failure", this);
+                AbortableSignalJunction.this.signal.signalFailure(cause);
+                this.failureSignalled.set(true);
+            }
+        }
+    }
+
+    private void subSignalAborted() {
+        // Ensure the incomplete count is zero.
+        int i = AbortableSignalJunction.this.incompleteCount.get();
+        
+        LOGGER.debug("SubSignal aborted. {} has {} incomplete signals", this, i);
+        
+        while (i > 0 && !AbortableSignalJunction.this.incompleteCount.compareAndSet(i, 0)) {
+            i = AbortableSignalJunction.this.incompleteCount.get();
+        }
+
+        // If this invocation took the count to zero, drive failure.
+        if (i > 0) {
+            if (AbortableSignalJunction.this.signal != null) {
+            	LOGGER.debug("{} signalling aborted", this);
+                AbortableSignalJunction.this.signal.signalAborted();
+                this.abortionSignalled.set(true);
+            }
+        }
+    }
+
+    private void subSignalSucceeded() {
+        // Decrement the incomplete count.
+        int incomplete = AbortableSignalJunction.this.incompleteCount.decrementAndGet();
+        
+        LOGGER.debug("SubSignal succeeded. {} now has {} incomplete signals", this, incomplete);
+        
+		if (incomplete == 0) {
+            // If this invocation took the count to zero, drive successful completion.
+            if (AbortableSignalJunction.this.signal != null) {
+            	LOGGER.debug("{} has no incomplete signals. Signalling success", this);
+                AbortableSignalJunction.this.signal.signalSuccessfulCompletion();
+            }
+        }
+    }
+
+    /**
+     * {@link SubSignal} is a signal that reports completion to its {@link AbortableSignalJunction} once and only once.
+     * 
+     */
+    private class SubSignal implements AbortableSignal {
+
+        private final AtomicBoolean complete = new AtomicBoolean(false);
+
+        public void signalFailure(Throwable cause) {
+            if (this.complete.compareAndSet(false, true)) {
+            	LOGGER.debug("SubSignal {} signalling failure", this);
+                subSignalFailed(cause);
+            }
+        }
+
+        public void signalSuccessfulCompletion() {
+            if (this.complete.compareAndSet(false, true)) {
+            	LOGGER.debug("SubSignal {} signalling success", this);
+                subSignalSucceeded();
+            }
+        }
+
+		public void signalAborted() {
+            if (this.complete.compareAndSet(false, true)) {
+            	LOGGER.debug("SubSignal {} signalling abortion", this);
+                subSignalAborted();
+            }
+		}
+    }
+}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/ApplicationRecoverer.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/ApplicationRecoverer.java
index ec0bea2..22391c0 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/ApplicationRecoverer.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/ApplicationRecoverer.java
@@ -14,7 +14,7 @@
 import java.net.URI;
 
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 
 
 /**
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/BlockingAbortableSignal.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/BlockingAbortableSignal.java
new file mode 100644
index 0000000..2701883
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/BlockingAbortableSignal.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+package org.eclipse.virgo.kernel.deployer.core.internal;
+
+import org.eclipse.virgo.kernel.core.AbortableSignal;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
+
+
+/**
+ * <p>
+ * A <code>Signal</code> implementation that blocks until notified of completion or abortion.
+ * </p>
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ *
+ * Thread-safe.
+ *
+ */
+public final class BlockingAbortableSignal implements AbortableSignal {
+
+	private final BlockingSignal blockingSignal;
+	
+	private boolean aborted = false;
+	
+	public BlockingAbortableSignal(boolean synchronous) {
+		this.blockingSignal = new BlockingSignal(synchronous);
+	}
+	
+    /**
+     * {@inheritDoc}
+     */
+	public void signalSuccessfulCompletion() {
+		this.blockingSignal.signalSuccessfulCompletion();
+	}
+
+    /**
+     * {@inheritDoc}
+     */
+	public void signalFailure(Throwable cause) {
+		this.blockingSignal.signalFailure(cause);
+	}
+
+    /**
+     * {@inheritDoc}
+     */
+	public void signalAborted() {
+		this.aborted = true;
+	}
+
+	public boolean isAborted(){
+		return this.aborted;
+	}
+	
+	public boolean awaitCompletion(long timeInSeconds) throws DeploymentException {
+		return this.blockingSignal.awaitCompletion(timeInSeconds);
+	}
+
+	public boolean checkComplete() throws DeploymentException {
+		boolean complete = this.blockingSignal.checkComplete();
+		if(this.aborted){
+			return false;
+		}
+		return complete;
+	}
+
+}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java
index dd4cf3b..b349822 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java
@@ -28,6 +28,7 @@
 import org.eclipse.virgo.kernel.deployer.core.DeployerLogEvents;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 import org.eclipse.virgo.kernel.deployer.core.internal.event.DeploymentListener;
 import org.eclipse.virgo.kernel.deployer.model.DuplicateDeploymentIdentityException;
 import org.eclipse.virgo.kernel.deployer.model.DuplicateFileNameException;
@@ -79,9 +80,14 @@
 
     private final int deployerConfiguredTimeoutInSeconds;
 
-    public PipelinedApplicationDeployer(Pipeline pipeline, InstallArtifactTreeInclosure installArtifactTreeInclosure,
-        InstallEnvironmentFactory installEnvironmentFactory, RuntimeArtifactModel ram, DeploymentListener deploymentListener,
-        EventLogger eventLogger, DeployUriNormaliser normaliser, DeployerConfiguration deployerConfiguration) {
+    public PipelinedApplicationDeployer(Pipeline pipeline, 
+                                        InstallArtifactTreeInclosure installArtifactTreeInclosure,
+                                        InstallEnvironmentFactory installEnvironmentFactory, 
+                                        RuntimeArtifactModel ram, 
+                                        DeploymentListener deploymentListener,
+                                        EventLogger eventLogger, 
+                                        DeployUriNormaliser normaliser, 
+                                        DeployerConfiguration deployerConfiguration) {
         this.eventLogger = eventLogger;
         this.installArtifactTreeInclosure = installArtifactTreeInclosure;
         this.installEnvironmentFactory = installEnvironmentFactory;
@@ -272,6 +278,8 @@
         } catch (UnableToSatisfyBundleDependenciesException utsbde) {
             logDependencySatisfactionException(uri, utsbde);
             throw new DeploymentException("Dependency satisfaction failed", utsbde);
+        } finally {
+            installEnvironment.destroy();
         }
     }
 
@@ -281,13 +289,14 @@
     }
 
     private void start(InstallArtifact installArtifact, boolean synchronous) throws DeploymentException {
-        BlockingSignal blockingSignal = new BlockingSignal(synchronous);
+        BlockingAbortableSignal blockingSignal = new BlockingAbortableSignal(synchronous);
         installArtifact.start(blockingSignal);
         if (synchronous && this.deployerConfiguredTimeoutInSeconds > 0) {
             boolean complete = blockingSignal.awaitCompletion(this.deployerConfiguredTimeoutInSeconds);
-            if (!complete) {
-                this.eventLogger.log(DeployerLogEvents.START_TIMED_OUT, installArtifact.getType(), installArtifact.getName(),
-                    installArtifact.getVersion(), this.deployerConfiguredTimeoutInSeconds);
+            if(blockingSignal.isAborted()){
+                this.eventLogger.log(DeployerLogEvents.START_ABORTED, installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion(), this.deployerConfiguredTimeoutInSeconds);
+            } else if (!complete) {
+                this.eventLogger.log(DeployerLogEvents.START_TIMED_OUT, installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion());
             }
         } else {
             // Completion messages will have been issued if complete, so ignore return value.
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/RegionAwarePackageAdminAccessor.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/RegionAwarePackageAdminAccessor.java
deleted file mode 100644
index 05adc0d..0000000
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/RegionAwarePackageAdminAccessor.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.deployer.core.internal;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkUtils;
-import org.eclipse.virgo.kernel.osgi.region.Region;
-
-@SuppressWarnings("deprecation")
-final class RegionAwarePackageAdminAccessor {
-    public static PackageAdmin getPackageAdmin(Region region) {
-        BundleContext bundleContext = region.getBundleContext();
-        return OsgiFrameworkUtils.getService(bundleContext, PackageAdmin.class).getService();        
-    }
-}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/SignalJunction.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/SignalJunction.java
deleted file mode 100644
index 2dbda4f..0000000
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/SignalJunction.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.deployer.core.internal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.eclipse.virgo.kernel.core.Signal;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * {@link SignalJunction} provides a collection of signals of a given size that join to drive a given signal. The given
- * signal is driven for completion when any of the signals in the collection is driven for failure or all the signals in
- * the collection are driven for successful completion. The given signal is driven at most once.
- * <p />
- * 
- * <strong>Concurrent Semantics</strong><br />
- * 
- * This class is thread safe.
- * 
- */
-public final class SignalJunction {
-	
-	private static final Logger LOGGER = LoggerFactory.getLogger(SignalJunction.class);
-
-    private final Signal signal;
-
-    private final List<Signal> subSignals;
-
-    private final AtomicInteger incompleteCount;
-    
-    private final AtomicBoolean failureSignalled = new AtomicBoolean(false);
-
-    /**
-     * Constructs a {@link SignalJunction} of the given size for the given signal.
-     * 
-     * @param signal the signal to be controlled
-     * @param size the number of signals in the collection
-     */
-    public SignalJunction(Signal signal, int size) {
-        this.signal = signal;
-        List<Signal> s = new ArrayList<Signal>();
-        for (int i = 0; i < size; i++) {
-            s.add(new SubSignal());
-        }
-        this.subSignals = Collections.unmodifiableList(s);
-        this.incompleteCount = new AtomicInteger(size);
-        if (size <= 0) {
-            if (this.signal != null) {
-                this.signal.signalSuccessfulCompletion();
-            }
-        }
-    }
-
-    /**
-     * Gets the signals in the collection.
-     * 
-     * @return an unmodifiable {@link Set} of signals in the collection
-     */
-    public List<Signal> getSignals() {
-        return this.subSignals;
-    }
-
-    private void subSignalFailed(Throwable cause) {
-        // Ensure the incomplete count is zero.
-        int i = SignalJunction.this.incompleteCount.get();
-        
-        LOGGER.debug("SubSignal failed. {} has {} incomplete signals", this, i);
-        
-        while (i > 0 && !SignalJunction.this.incompleteCount.compareAndSet(i, 0)) {
-            i = SignalJunction.this.incompleteCount.get();
-        }
-
-        // If this invocation took the count to zero, drive failure.
-        if (i > 0) {
-            if (SignalJunction.this.signal != null) {
-            	LOGGER.debug("{} signalling failure", this);
-                SignalJunction.this.signal.signalFailure(cause);
-                this.failureSignalled.set(true);
-            }
-        }
-    }
-    
-    public boolean failed() {
-        return this.failureSignalled.get();
-    }
-
-    private void subSignalSucceeded() {
-        // Decrement the incomplete count.
-        int incomplete = SignalJunction.this.incompleteCount.decrementAndGet();
-        
-        LOGGER.debug("SubSignal succeeded. {} now has {} incomplete signals", this, incomplete);
-        
-		if (incomplete == 0) {
-            // If this invocation took the count to zero, drive successful completion.
-            if (SignalJunction.this.signal != null) {
-            	LOGGER.debug("{} has no incomplete signals. Signalling success", this);
-                SignalJunction.this.signal.signalSuccessfulCompletion();
-            }
-        }
-    }
-
-    /**
-     * {@link SubSignal} is a signal that reports completion to its {@link SignalJunction} once and only once.
-     * 
-     */
-    private class SubSignal implements Signal {
-
-        private final AtomicBoolean complete = new AtomicBoolean(false);
-
-        public void signalFailure(Throwable cause) {
-            if (this.complete.compareAndSet(false, true)) {
-            	LOGGER.debug("SubSignal {} signalling failure", this);
-                subSignalFailed(cause);
-            }
-        }
-
-        public void signalSuccessfulCompletion() {
-            if (this.complete.compareAndSet(false, true)) {
-            	LOGGER.debug("SubSignal {} signalling success", this);
-                subSignalSucceeded();
-            }
-        }
-    }
-}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/event/DeploymentListener.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/event/DeploymentListener.java
index 38e4ca4..513bc0e 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/event/DeploymentListener.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/event/DeploymentListener.java
@@ -13,7 +13,7 @@
 
 import java.net.URI;
 
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 
 
 
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLog.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLog.java
index 0135cc6..cb6376e 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLog.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLog.java
@@ -28,8 +28,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 import org.eclipse.virgo.kernel.deployer.core.FatalDeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
 import org.eclipse.virgo.util.io.PathReference;
 
 /**
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogDeploymentListener.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogDeploymentListener.java
index 048cce7..b020d94 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogDeploymentListener.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogDeploymentListener.java
@@ -13,7 +13,7 @@
 
 import java.net.URI;
 
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 import org.eclipse.virgo.kernel.deployer.core.internal.event.DeploymentListener;
 
 
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/RecoveryAgent.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/RecoveryAgent.java
index ebc5c64..7344db2 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/RecoveryAgent.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/RecoveryAgent.java
@@ -22,8 +22,8 @@
 
 import org.eclipse.virgo.kernel.deployer.core.DeployerLogEvents;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 import org.eclipse.virgo.kernel.deployer.core.FatalDeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
 import org.eclipse.virgo.kernel.deployer.core.internal.ApplicationRecoverer;
 import org.eclipse.virgo.medic.eventlog.EventLogger;
 
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/hot/HotDeploymentFileSystemListener.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/hot/HotDeploymentFileSystemListener.java
index 03c8299..0df6f88 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/hot/HotDeploymentFileSystemListener.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/hot/HotDeploymentFileSystemListener.java
@@ -22,8 +22,8 @@
 import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 import org.eclipse.virgo.kernel.deployer.core.FatalDeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
 import org.eclipse.virgo.kernel.serviceability.NonNull;
 import org.eclipse.virgo.medic.eventlog.EventLogger;
 import org.eclipse.virgo.medic.eventlog.LogEvent;
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/management/StandardDeployer.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/management/StandardDeployer.java
index 54a1aa8..7492bd8 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/management/StandardDeployer.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/management/StandardDeployer.java
@@ -20,7 +20,7 @@
 import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 
 
 /**
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifact.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifact.java
index efd3190..543c533 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifact.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifact.java
@@ -17,7 +17,7 @@
 
 
 import org.eclipse.virgo.kernel.artifact.fs.ArtifactFS;
-import org.eclipse.virgo.kernel.core.Signal;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
 import org.eclipse.virgo.kernel.serviceability.NonNull;
 import org.eclipse.virgo.util.common.Tree;
@@ -79,14 +79,14 @@
     /**
      * Starts this {@link InstallArtifact}. Returns before any asynchronous processing has necessarily completed.
      * <p/>
-     * Equivalent to calling {@link InstallArtifact#start(Signal) start(null)}.
+     * Equivalent to calling {@link InstallArtifact#start(AbortableSignal) start(null)}.
      * 
      * @throws DeploymentException
      */
     void start() throws DeploymentException;
 
     /**
-     * Starts this {@link InstallArtifact} and drives the given {@link Signal} when the start, including any
+     * Starts this {@link InstallArtifact} and drives the given {@link AbortableSignal} when the start, including any
      * asynchronous processing, completes either successfully or unsuccessfully.
      * <p/>
      * If the start does not involve asynchronous processing, drives the given <code>Signal</code> before returning.
@@ -100,10 +100,10 @@
      * Note: this method behaves as specified above when called multiple times on the same <code>InstallArtifact</code>
      * with any combination of the same or distinct or <code>null</code> <code>Signals</code>.
      * 
-     * @param signal a <code>Signal</code> that is ready to be driven or <code>null</code> if signalling is not required
+     * @param signal a <code>AbortableSignal</code> that is ready to be driven or <code>null</code> if signalling is not required
      * @throws DeploymentException
      */
-    void start(Signal signal) throws DeploymentException;
+    void start(AbortableSignal signal) throws DeploymentException;
 
     /**
      * Stops this {@link InstallArtifact}. If the <code>InstallArtifact</code> is already stopped, do nothing.
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListener.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListener.java
index 129a466..eb49c9d 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListener.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListener.java
@@ -111,6 +111,14 @@
     void onStartFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException;
 
     /**
+     * Notification that the given {@link InstallArtifact} aborted while starting.
+     * 
+     * @param installArtifact the <code>InstallArtifact</code> that aborted
+     * @throws DeploymentException if the listener failed to handle the event
+     */
+    void onStartAborted(InstallArtifact installArtifact) throws DeploymentException;
+
+    /**
      * Notification that the given {@link InstallArtifact} has started.
      * 
      * <p/>
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListenerSupport.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListenerSupport.java
index 52b1593..cdb959e 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListenerSupport.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactLifecycleListenerSupport.java
@@ -70,6 +70,12 @@
     /**
      * {@inheritDoc}
      */
+    public void onStartAborted(InstallArtifact installArtifact) throws DeploymentException {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public void onStarted(InstallArtifact installArtifact) throws DeploymentException {
     }
 
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactTreeInclosure.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactTreeInclosure.java
index 4eb1314..34aa7bd 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactTreeInclosure.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactTreeInclosure.java
@@ -16,7 +16,7 @@
 
 import org.eclipse.virgo.kernel.artifact.ArtifactSpecification;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 import org.eclipse.virgo.util.common.Tree;
 
 /**
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifact.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifact.java
index 1ee9d2f..ffd7c9c 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifact.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifact.java
@@ -18,6 +18,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.eclipse.virgo.kernel.artifact.fs.ArtifactFS;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
 import org.eclipse.virgo.kernel.core.Signal;
 import org.eclipse.virgo.kernel.deployer.core.DeployerLogEvents;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
@@ -76,8 +77,7 @@
      * @param repositoryName the name of the source repository, or <code>null</code> if the artifact is not from a
      *        repository
      */
-    protected AbstractInstallArtifact(@NonNull ArtifactIdentity identity, @NonNull ArtifactStorage artifactStorage,
-        @NonNull ArtifactStateMonitor artifactStateMonitor, String repositoryName, EventLogger eventLogger) {
+    protected AbstractInstallArtifact(@NonNull ArtifactIdentity identity, @NonNull ArtifactStorage artifactStorage, @NonNull ArtifactStateMonitor artifactStateMonitor, String repositoryName, EventLogger eventLogger) {
         this.identity = identity;
         this.artifactStorage = artifactStorage;
         this.artifactStateMonitor = artifactStateMonitor;
@@ -184,7 +184,7 @@
     /**
      * {@inheritDoc}
      */
-    public void start(Signal signal) throws DeploymentException {
+    public void start(AbortableSignal signal) throws DeploymentException {
         // If ACTIVE, signal successful completion immediately, otherwise proceed with start processing.
         if (getState().equals(State.ACTIVE)) {
             if (signal != null) {
@@ -203,20 +203,20 @@
         }
     }
 
-    protected final void driveDoStart(Signal signal) throws DeploymentException {
-        Signal stateMonitorSignal = createStateMonitorSignal(signal);
+    protected final void driveDoStart(AbortableSignal signal) throws DeploymentException {
+        AbortableSignal stateMonitorSignal = createStateMonitorSignal(signal);
         doStart(stateMonitorSignal);
     }
 
-    protected Signal createStateMonitorSignal(Signal signal) {
-        return new StateMonitorSignal(signal);
+    protected final AbortableSignal createStateMonitorSignal(AbortableSignal signal){
+    	return new StateMonitorSignal(signal);
     }
+    
+    private final class StateMonitorSignal implements AbortableSignal {
 
-    private final class StateMonitorSignal implements Signal {
+        private final AbortableSignal signal;
 
-        private final Signal signal;
-
-        public StateMonitorSignal(Signal signal) {
+        public StateMonitorSignal(AbortableSignal signal) {
             this.signal = signal;
         }
 
@@ -237,10 +237,6 @@
          */
         public void signalFailure(Throwable cause) {
             asyncStartFailed(cause);
-            handleFailure(cause);
-        }
-
-        private void handleFailure(Throwable cause) {
             try {
                 stop();
             } catch (DeploymentException de) {
@@ -249,6 +245,19 @@
             AbstractInstallArtifact.signalFailure(this.signal, cause);
         }
 
+        /**
+         * {@inheritDoc}
+         */
+		public void signalAborted() {
+            asyncStartAborted();
+            try {
+                stop();
+            } catch (DeploymentException de) {
+                AbstractInstallArtifact.this.logger.error("Stop aborted", de);
+            }
+            AbstractInstallArtifact.signalAbortion(this.signal);
+		}
+
     }
 
     protected static void signalSuccessfulCompletion(Signal signal) {
@@ -263,6 +272,12 @@
         }
     }
 
+    protected static void signalAbortion(AbortableSignal signal) {
+        if (signal != null) {
+            signal.signalAborted();
+        }
+    }
+
     /**
      * Perform the actual start of this {@link InstallArtifact} and drive the given {@link Signal} on successful or
      * unsuccessful completion.
@@ -270,7 +285,7 @@
      * @param signal the <code>Signal</code> to be driven
      * @throws DeploymentException if the start fails synchronously
      */
-    protected abstract void doStart(Signal signal) throws DeploymentException;
+    protected abstract void doStart(AbortableSignal signal) throws DeploymentException;
 
     private final void asyncStartSucceeded() throws DeploymentException {
         pushThreadContext();
@@ -292,6 +307,17 @@
         }
     }
 
+    private final void asyncStartAborted() {
+        pushThreadContext();
+        try {
+            this.artifactStateMonitor.onStartAborted(this);
+        } catch (DeploymentException e) {
+            logger.error(String.format("listener for %s threw DeploymentException", this), e);
+        } finally {
+            popThreadContext();
+        }
+    }
+
     /**
      * {@inheritDoc}
      */
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitor.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitor.java
index 446fad9..84737ea 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitor.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitor.java
@@ -11,314 +11,58 @@
 
 package org.eclipse.virgo.kernel.install.artifact.internal;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.install.artifact.ArtifactState;
 import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
-import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener;
 import org.eclipse.virgo.kernel.install.artifact.InstallArtifact.State;
-import org.osgi.framework.BundleContext;
-
-import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkUtils;
-import org.eclipse.virgo.kernel.osgi.framework.OsgiServiceHolder;
 
 /**
- * {@link ArtifactStateMonitor} logs {@link InstallArtifact} state changes and notifies
- * {@link InstallArtifactLifecycleListener InstallArtifactLifecycleListeners}.
- * <p />
  * 
- * <strong>Concurrent Semantics</strong><br />
- * 
- * This class is thread safe.
+ * Implementations must be thread safe
  * 
  */
-public class ArtifactStateMonitor {
-
-    private final BundleContext bundleContext;
-   
-    private final ArtifactState artifactState;
-
-    private ArtifactStateMonitor(BundleContext bundleContext, ArtifactState artifactState) {
-        this.bundleContext = bundleContext;
-        this.artifactState = artifactState;
-    }
-    
-    public ArtifactStateMonitor(BundleContext bundleContext) {
-        this(bundleContext, new ArtifactState());
-    }
+public interface ArtifactStateMonitor {
 
     /**
      * Returns the current state of the install artifact according to the events which have occurred.
      * 
-     * @return the {@link State} of this {@link ArtifactStateMonitor}
+     * @return the {@link State} of this {@link StandardArtifactStateMonitor}
      */
-    public State getState() {
-        return this.artifactState.getState();
-    }
-    
-    public void setState(State state) {
-        switch (state) {
-            case ACTIVE:
-                this.artifactState.setActive();
-                break;
-            case INITIAL:
-                this.artifactState.setInitial();
-                break;
-            case INSTALLED:
-                this.artifactState.setInstalled();
-                break;
-            case INSTALLING:
-                this.artifactState.setInstalling();
-                break;
-            case RESOLVED:
-                this.artifactState.setResolved();
-                break;
-            case RESOLVING:
-                this.artifactState.setResolving();
-                break;
-            case STARTING:
-                this.artifactState.setStarting();
-                break;
-            case STOPPING:
-                this.artifactState.setStopping();
-                break;
-            case UNINSTALLED:
-                this.artifactState.setUninstalled();
-                break;
-            case UNINSTALLING:
-                this.artifactState.setUninstalling();
-                break;
-        }
-    }
+    public State getState();
 
-    public void onInstalling(InstallArtifact installArtifact) throws DeploymentException {
-        if (this.artifactState.setInstalling()) {
-            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-            try {
-                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                    listener.onInstalling(installArtifact);
-                }
-            } finally {
-                ungetListeners(listenerHolders);
-            }
-        }
-    }
+    public void setState(State state);
 
-    public void onInstallFailed(InstallArtifact installArtifact) throws DeploymentException {
-        if (this.artifactState.setInitial()) {
-            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-            try {
-                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                    listener.onInstallFailed(installArtifact);
-                }
-            } finally {
-                ungetListeners(listenerHolders);
-            }
-        }
-    }
+    public void onInstalling(InstallArtifact installArtifact) throws DeploymentException;
 
-    public void onInstalled(InstallArtifact installArtifact) throws DeploymentException {
-        if (this.artifactState.setInstalled()) {
-            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-            try {
-                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                    listener.onInstalled(installArtifact);
-                }
-            } finally {
-                ungetListeners(listenerHolders);
-            }
-        }
-    }
+    public void onInstallFailed(InstallArtifact installArtifact) throws DeploymentException;
 
-    public void onResolving(InstallArtifact installArtifact) throws DeploymentException {
-        if (this.artifactState.setResolving()) {
-            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-            try {
-                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                    listener.onResolving(installArtifact);
-                }
-            } finally {
-                ungetListeners(listenerHolders);
-            }
-        }
-    }
+    public void onInstalled(InstallArtifact installArtifact) throws DeploymentException;
 
-    public void onResolveFailed(InstallArtifact installArtifact) throws DeploymentException {
-        if (this.artifactState.setInstalled()) {
-            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-            try {
-                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                    listener.onResolveFailed(installArtifact);
-                }
-            } finally {
-                ungetListeners(listenerHolders);
-            }
-        }
-    }
+    public void onResolving(InstallArtifact installArtifact) throws DeploymentException;
 
-    public void onResolved(InstallArtifact installArtifact) throws DeploymentException {
-        if (this.artifactState.setResolved()) {
-            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-            try {
-                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                    listener.onResolved(installArtifact);
-                }
-            } finally {
-                ungetListeners(listenerHolders);
-            }
-        }
-    }
+    public void onResolveFailed(InstallArtifact installArtifact) throws DeploymentException;
 
-    public boolean onStarting(InstallArtifact installArtifact) throws DeploymentException {
-        boolean stateChanged = this.artifactState.setStarting();
-        if (stateChanged) {
-            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-            try {
-                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                    listener.onStarting(installArtifact);
-                }
-            } finally {
-                ungetListeners(listenerHolders);
-            }
-        }
-        return stateChanged;
-    }
+    public void onResolved(InstallArtifact installArtifact) throws DeploymentException;
 
-    public void onStartFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
-        List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-        try {
-            for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                listener.onStartFailed(installArtifact, cause);
-            }
-        } finally {
-            ungetListeners(listenerHolders);
-        }
-    }
+    public boolean onStarting(InstallArtifact installArtifact) throws DeploymentException;
 
-    public void onStarted(InstallArtifact installArtifact) throws DeploymentException {
-        if (this.artifactState.setActive()) {
-            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-            try {
-                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                    listener.onStarted(installArtifact);
-                }
-            } finally {
-                ungetListeners(listenerHolders);
-            }
-        }
-    }
+    public void onStartFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException;
 
-    public void onStopping(InstallArtifact installArtifact) {
-        if (this.artifactState.setStopping()) {
-            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-            try {
-                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                    listener.onStopping(installArtifact);
-                }
-            } finally {
-                ungetListeners(listenerHolders);
-            }
-        }
-    }
+    public void onStartAborted(InstallArtifact installArtifact) throws DeploymentException;
 
-    public void onStopFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
-        if (this.artifactState.setActive()) {
-            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-            try {
-                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                    listener.onStopFailed(installArtifact, cause);
-                }
-            } finally {
-                ungetListeners(listenerHolders);
-            }
-        }
-    }
+    public void onStarted(InstallArtifact installArtifact) throws DeploymentException;
 
-    public void onStopped(InstallArtifact installArtifact) {
-        if (this.artifactState.setResolved()) {
-            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-            try {
-                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                    listener.onStopped(installArtifact);
-                }
-            } finally {
-                ungetListeners(listenerHolders);
-            }
-        }
-    }
+    public void onStopping(InstallArtifact installArtifact);
 
-    public void onUnresolved(InstallArtifact installArtifact) throws DeploymentException {
-        if (this.artifactState.setInstalled()) {
-            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-            try {
-                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                    listener.onUnresolved(installArtifact);
-                }
-            } finally {
-                ungetListeners(listenerHolders);
-            }
-        }
-    }
-    
-    public void onUninstalling(InstallArtifact installArtifact) throws DeploymentException {
-        if (this.artifactState.setUninstalling()) {
-            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-            try {
-                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                    listener.onUninstalling(installArtifact);
-                }
-            } finally {
-                ungetListeners(listenerHolders);
-            }
-        }
-    }
+    public void onStopFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException;
 
-    public void onUninstallFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
-        if (this.artifactState.setResolved()) {
-            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-            try {
-                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                    listener.onUninstallFailed(installArtifact, cause);
-                }
-            } finally {
-                ungetListeners(listenerHolders);
-            }
-        }
-    }
+    public void onStopped(InstallArtifact installArtifact);
 
-    public void onUninstalled(InstallArtifact installArtifact) throws DeploymentException {
-        if (this.artifactState.setUninstalled()) {
-            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
-            try {
-                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
-                    listener.onUninstalled(installArtifact);
-                }
-            } finally {
-                ungetListeners(listenerHolders);
-            }
-        }
-    }
+    public void onUnresolved(InstallArtifact installArtifact) throws DeploymentException;
 
-    private List<OsgiServiceHolder<InstallArtifactLifecycleListener>> getListenerHolders() {
-        return OsgiFrameworkUtils.getServices(this.bundleContext, InstallArtifactLifecycleListener.class);
-    }
+    public void onUninstalling(InstallArtifact installArtifact) throws DeploymentException;
 
-    private List<InstallArtifactLifecycleListener> getListeners(List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders) {
-        List<InstallArtifactLifecycleListener> listeners;
-        listeners = new ArrayList<InstallArtifactLifecycleListener>(listenerHolders.size());
+    public void onUninstallFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException;
 
-        for (OsgiServiceHolder<InstallArtifactLifecycleListener> listenerHolder : listenerHolders) {
-            listeners.add(listenerHolder.getService());
-        }
-        return listeners;
-    }
+    public void onUninstalled(InstallArtifact installArtifact) throws DeploymentException;
 
-    private void ungetListeners(List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders) {
-        for (OsgiServiceHolder<InstallArtifactLifecycleListener> listenerHolder : listenerHolders) {
-            this.bundleContext.ungetService(listenerHolder.getServiceReference());
-        }
-    }
-
-}
+}
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifact.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifact.java
index 9e92345..f382de5 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifact.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifact.java
@@ -12,7 +12,7 @@
 package org.eclipse.virgo.kernel.install.artifact.internal;
 
 
-import org.eclipse.virgo.kernel.core.Signal;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
 import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
 import org.eclipse.virgo.kernel.install.artifact.ArtifactStorage;
@@ -40,9 +40,14 @@
     /**
      * @throws DeploymentException  
      */
-    ConfigInstallArtifact(@NonNull ArtifactIdentity identity, @NonNull ArtifactStorage artifactStorage, @NonNull StartEngine startEngine,
-        @NonNull RefreshEngine refreshEngine, @NonNull StopEngine stopEngine, @NonNull ArtifactStateMonitor artifactStateMonitor,
-        String repositoryName, EventLogger eventLogger) throws DeploymentException {
+    ConfigInstallArtifact(@NonNull ArtifactIdentity identity, 
+    			@NonNull ArtifactStorage artifactStorage, 
+    			@NonNull StartEngine startEngine,
+    			@NonNull RefreshEngine refreshEngine, 
+    			@NonNull StopEngine stopEngine, 
+    			@NonNull ArtifactStateMonitor artifactStateMonitor,
+    			String repositoryName, 
+    			EventLogger eventLogger) throws DeploymentException {
         super(identity, artifactStorage, artifactStateMonitor, repositoryName, eventLogger);
 
         this.startEngine = startEngine;
@@ -78,7 +83,7 @@
      * {@inheritDoc}
      */
     @Override
-    protected final void doStart(Signal signal) throws DeploymentException {
+    protected final void doStart(AbortableSignal signal) throws DeploymentException {
         try {
             this.startEngine.start(getIdentity(), getArtifactFS());
             signalSuccessfulCompletion(signal);
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifactTreeFactory.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifactTreeFactory.java
index 99d5d95..dcea020 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifactTreeFactory.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ConfigInstallArtifactTreeFactory.java
@@ -59,7 +59,7 @@
     public Tree<InstallArtifact> constructInstallArtifactTree(ArtifactIdentity artifactIdentity, ArtifactStorage artifactStorage,
         Map<String, String> deploymentProperties, String repositoryName) throws DeploymentException {
         if (PROPERTIES_TYPE.equalsIgnoreCase(artifactIdentity.getType())) {
-            ArtifactStateMonitor artifactStateMonitor = new ArtifactStateMonitor(this.bundleContext);
+            ArtifactStateMonitor artifactStateMonitor = new StandardArtifactStateMonitor(this.bundleContext);
             InstallArtifact configInstallArtifact = new ConfigInstallArtifact(artifactIdentity, artifactStorage, this.lifecycleEngine,
                 this.lifecycleEngine, this.lifecycleEngine, artifactStateMonitor, repositoryName, eventLogger);
             return constructInstallTree(configInstallArtifact);
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/LoggingInstallArtifactLifecycleListener.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/LoggingInstallArtifactLifecycleListener.java
index b2f24bd..6048f3d 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/LoggingInstallArtifactLifecycleListener.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/LoggingInstallArtifactLifecycleListener.java
@@ -87,6 +87,13 @@
     /**
      * {@inheritDoc}
      */
+    public void onStartAborted(InstallArtifact installArtifact) {
+        logEvent(DeployerLogEvents.START_ABORTED, installArtifact);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public void onStarted(InstallArtifact installArtifact) {
         logEvent(DeployerLogEvents.STARTED, installArtifact);
     }
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ParPlanInstallArtifactFactory.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ParPlanInstallArtifactFactory.java
index 947a1a5..88ff847 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ParPlanInstallArtifactFactory.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ParPlanInstallArtifactFactory.java
@@ -71,7 +71,7 @@
     }
 
     ParPlanInstallArtifact createParPlanInstallArtifact(@NonNull ArtifactIdentity artifactIdentity, @NonNull ArtifactStorage artifactStorage, String repositoryName) throws DeploymentException {
-        ArtifactStateMonitor artifactStateMonitor = new ArtifactStateMonitor(this.bundleContext);
+        ArtifactStateMonitor artifactStateMonitor = new StandardArtifactStateMonitor(this.bundleContext);
         return new ParPlanInstallArtifact(artifactIdentity, artifactStorage, artifactStateMonitor, scopeServiceRepository, scopeFactory, eventLogger,
             bundleInstallArtifactTreeFactory, refreshHandler, repositoryName, this.configInstallArtifactTreeFactory,
             this.artifactStorageFactory, this.artifactIdentityDeterminer);
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/PlanInstallArtifactTreeFactory.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/PlanInstallArtifactTreeFactory.java
index db8833d..d120b1f 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/PlanInstallArtifactTreeFactory.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/PlanInstallArtifactTreeFactory.java
@@ -120,7 +120,7 @@
         StandardPlanInstallArtifact planInstallArtifact;
 
         planInstallArtifact = new StandardPlanInstallArtifact(artifactIdentity, planDescriptor.getAtomic(), planDescriptor.getScoped(),
-            artifactStorage, new ArtifactStateMonitor(this.bundleContext), this.scopeServiceRepository, this.scopeFactory,
+            artifactStorage, new StandardArtifactStateMonitor(this.bundleContext), this.scopeServiceRepository, this.scopeFactory,
             this.eventLogger, this.refreshHandler, repositoryName, planDescriptor.getArtifactSpecifications());
 
         Tree<InstallArtifact> tree = constructInstallTree(planInstallArtifact);
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminer.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminer.java
index 2603fee..91b1612 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminer.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminer.java
@@ -1,20 +1,19 @@
 /*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
+* Copyright (c) 2008, 2010 VMware Inc.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+*   VMware Inc. - initial contribution
+*******************************************************************************/
 
 package org.eclipse.virgo.kernel.install.artifact.internal;
 
 import java.io.File;
 import java.util.Set;
 
-import org.osgi.framework.Version;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -25,95 +24,44 @@
 import org.eclipse.virgo.repository.ArtifactGenerationException;
 
 /**
- * {@link StandardArtifactIdentityDeterminer} is a {@link ArtifactIdentityDeterminer} that can determine basic kernel artifact
- * identities.
- * <p />
- * 
- * <strong>Concurrent Semantics</strong><br />
- * 
- * This class is thread safe.
- * 
- */
+* {@link StandardArtifactIdentityDeterminer} is a {@link ArtifactIdentityDeterminer} that can determine basic kernel artifact
+* identities.
+* <p />
+*
+* <strong>Concurrent Semantics</strong><br />
+*
+* This class is thread safe.
+*
+*/
 final class StandardArtifactIdentityDeterminer implements ArtifactIdentityDeterminer {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(StandardArtifactIdentityDeterminer.class);
 
-    private static final String JAR_EXTENSION = ".jar";
-
-    private static final String PLAN_EXTENSION = ".plan";
-
-    private static final String PROPERTIES_EXTENSION = ".properties";
-
-    private static final String PAR_EXTENSION = ".par";
-
     private final Set<ArtifactBridge> bridges;
 
     public StandardArtifactIdentityDeterminer(Set<ArtifactBridge> bridges) {
         this.bridges = bridges;
     }
 
-    private ArtifactIdentity determineIdentityFromFile(File file, String scopeName) {
-        String type = null;
-        String name = null;
-        
-        String filename = file.getName();
-        
-        name = trimExtension(file);
-        
-        if (filename.endsWith(JAR_EXTENSION)) {
-            type = BUNDLE_TYPE;
-        } else if (filename.endsWith(PLAN_EXTENSION)) {
-            type = PLAN_TYPE;
-        } else if (filename.endsWith(PROPERTIES_EXTENSION)) {
-            type = CONFIGURATION_TYPE;
-        } else if (filename.endsWith(PAR_EXTENSION)) {
-            type = PAR_TYPE;
-        }
-
-        
-        if (type != null && name != null) {
-            return new ArtifactIdentity(type, name, Version.emptyVersion, scopeName);
-        } else {
-            return null;
-        }
-    }
-    
-    private String trimExtension(File file) {
-        String filename = file.getName();
-        
-        int lastIndexOf = filename.lastIndexOf('.');
-        
-        if (lastIndexOf > 0) {
-            return filename.substring(0, lastIndexOf);
-        } else {
-            return filename;
-        }
-    }
-    
     public ArtifactIdentity determineIdentity(File file, String scopeName) {
         ArtifactDescriptor artifactDescriptor = null;
         for (ArtifactBridge artifactBridge : this.bridges) {
             try {
                 artifactDescriptor = artifactBridge.generateArtifactDescriptor(file);
             } catch (ArtifactGenerationException e) {
-                LOGGER.warn(String.format("Error occurred while determining the type of an Artifact '%s' with the bridge '%s'.", file,
+                LOGGER.error(String.format("Error occurred while determining the identity of an Artifact '%s' with the bridge '%s'.", file,
                     artifactBridge.getClass().getSimpleName()), e);
+                return null;
             }
             if (artifactDescriptor != null) {
                 break;
             }
         }
+
         if (artifactDescriptor == null) {
-            return this.determineIdentityFromFile(file, scopeName);
-        } else {
-            String type = artifactDescriptor.getType();
-            String name = artifactDescriptor.getName();
-            Version version = artifactDescriptor.getVersion();
-            
-            name = name == null ? trimExtension(file) : name;
-            version = version == null ? Version.emptyVersion : version;
-            
-            return new ArtifactIdentity(type, name, version, scopeName);
+            return null;
         }
+
+        return new ArtifactIdentity(artifactDescriptor.getType(), artifactDescriptor.getName(), artifactDescriptor.getVersion(), scopeName);
     }
 }
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactStateMonitor.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactStateMonitor.java
new file mode 100644
index 0000000..b2eb797
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactStateMonitor.java
@@ -0,0 +1,387 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.install.artifact.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
+import org.eclipse.virgo.kernel.install.artifact.ArtifactState;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifact.State;
+import org.osgi.framework.BundleContext;
+
+import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkUtils;
+import org.eclipse.virgo.kernel.osgi.framework.OsgiServiceHolder;
+
+/**
+ * {@link StandardArtifactStateMonitor} logs {@link InstallArtifact} state changes and notifies
+ * {@link InstallArtifactLifecycleListener InstallArtifactLifecycleListeners}.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * 
+ * This class is thread safe.
+ * 
+ */
+public class StandardArtifactStateMonitor implements ArtifactStateMonitor {
+
+    private final BundleContext bundleContext;
+   
+    private final ArtifactState artifactState;
+
+    private StandardArtifactStateMonitor(BundleContext bundleContext, ArtifactState artifactState) {
+        this.bundleContext = bundleContext;
+        this.artifactState = artifactState;
+    }
+    
+    public StandardArtifactStateMonitor(BundleContext bundleContext) {
+        this(bundleContext, new ArtifactState());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public State getState() {
+        return this.artifactState.getState();
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+	public void setState(State state) {
+        switch (state) {
+            case ACTIVE:
+                this.artifactState.setActive();
+                break;
+            case INITIAL:
+                this.artifactState.setInitial();
+                break;
+            case INSTALLED:
+                this.artifactState.setInstalled();
+                break;
+            case INSTALLING:
+                this.artifactState.setInstalling();
+                break;
+            case RESOLVED:
+                this.artifactState.setResolved();
+                break;
+            case RESOLVING:
+                this.artifactState.setResolving();
+                break;
+            case STARTING:
+                this.artifactState.setStarting();
+                break;
+            case STOPPING:
+                this.artifactState.setStopping();
+                break;
+            case UNINSTALLED:
+                this.artifactState.setUninstalled();
+                break;
+            case UNINSTALLING:
+                this.artifactState.setUninstalling();
+                break;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void onInstalling(InstallArtifact installArtifact) throws DeploymentException {
+        if (this.artifactState.setInstalling()) {
+            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+            try {
+                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                    listener.onInstalling(installArtifact);
+                }
+            } finally {
+                ungetListeners(listenerHolders);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void onInstallFailed(InstallArtifact installArtifact) throws DeploymentException {
+        if (this.artifactState.setInitial()) {
+            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+            try {
+                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                    listener.onInstallFailed(installArtifact);
+                }
+            } finally {
+                ungetListeners(listenerHolders);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void onInstalled(InstallArtifact installArtifact) throws DeploymentException {
+        if (this.artifactState.setInstalled()) {
+            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+            try {
+                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                    listener.onInstalled(installArtifact);
+                }
+            } finally {
+                ungetListeners(listenerHolders);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void onResolving(InstallArtifact installArtifact) throws DeploymentException {
+        if (this.artifactState.setResolving()) {
+            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+            try {
+                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                    listener.onResolving(installArtifact);
+                }
+            } finally {
+                ungetListeners(listenerHolders);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void onResolveFailed(InstallArtifact installArtifact) throws DeploymentException {
+        if (this.artifactState.setInstalled()) {
+            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+            try {
+                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                    listener.onResolveFailed(installArtifact);
+                }
+            } finally {
+                ungetListeners(listenerHolders);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void onResolved(InstallArtifact installArtifact) throws DeploymentException {
+        if (this.artifactState.setResolved()) {
+            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+            try {
+                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                    listener.onResolved(installArtifact);
+                }
+            } finally {
+                ungetListeners(listenerHolders);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public boolean onStarting(InstallArtifact installArtifact) throws DeploymentException {
+        boolean stateChanged = this.artifactState.setStarting();
+        if (stateChanged) {
+            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+            try {
+                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                    listener.onStarting(installArtifact);
+                }
+            } finally {
+                ungetListeners(listenerHolders);
+            }
+        }
+        return stateChanged;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void onStartFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
+        List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+        try {
+            for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                listener.onStartFailed(installArtifact, cause);
+            }
+        } finally {
+            ungetListeners(listenerHolders);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void onStartAborted(InstallArtifact installArtifact) throws DeploymentException {
+        List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+        try {
+            for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                listener.onStartAborted(installArtifact);
+            }
+        } finally {
+            ungetListeners(listenerHolders);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void onStarted(InstallArtifact installArtifact) throws DeploymentException {
+        if (this.artifactState.setActive()) {
+            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+            try {
+                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                    listener.onStarted(installArtifact);
+                }
+            } finally {
+                ungetListeners(listenerHolders);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void onStopping(InstallArtifact installArtifact) {
+        if (this.artifactState.setStopping()) {
+            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+            try {
+                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                    listener.onStopping(installArtifact);
+                }
+            } finally {
+                ungetListeners(listenerHolders);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void onStopFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
+        if (this.artifactState.setActive()) {
+            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+            try {
+                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                    listener.onStopFailed(installArtifact, cause);
+                }
+            } finally {
+                ungetListeners(listenerHolders);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void onStopped(InstallArtifact installArtifact) {
+        if (this.artifactState.setResolved()) {
+            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+            try {
+                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                    listener.onStopped(installArtifact);
+                }
+            } finally {
+                ungetListeners(listenerHolders);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void onUnresolved(InstallArtifact installArtifact) throws DeploymentException {
+        if (this.artifactState.setInstalled()) {
+            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+            try {
+                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                    listener.onUnresolved(installArtifact);
+                }
+            } finally {
+                ungetListeners(listenerHolders);
+            }
+        }
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+	public void onUninstalling(InstallArtifact installArtifact) throws DeploymentException {
+        if (this.artifactState.setUninstalling()) {
+            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+            try {
+                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                    listener.onUninstalling(installArtifact);
+                }
+            } finally {
+                ungetListeners(listenerHolders);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void onUninstallFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
+        if (this.artifactState.setResolved()) {
+            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+            try {
+                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                    listener.onUninstallFailed(installArtifact, cause);
+                }
+            } finally {
+                ungetListeners(listenerHolders);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void onUninstalled(InstallArtifact installArtifact) throws DeploymentException {
+        if (this.artifactState.setUninstalled()) {
+            List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders = getListenerHolders();
+            try {
+                for (InstallArtifactLifecycleListener listener : getListeners(listenerHolders)) {
+                    listener.onUninstalled(installArtifact);
+                }
+            } finally {
+                ungetListeners(listenerHolders);
+            }
+        }
+    }
+
+    private List<OsgiServiceHolder<InstallArtifactLifecycleListener>> getListenerHolders() {
+        return OsgiFrameworkUtils.getServices(this.bundleContext, InstallArtifactLifecycleListener.class);
+    }
+
+    private List<InstallArtifactLifecycleListener> getListeners(List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders) {
+        List<InstallArtifactLifecycleListener> listeners;
+        listeners = new ArrayList<InstallArtifactLifecycleListener>(listenerHolders.size());
+
+        for (OsgiServiceHolder<InstallArtifactLifecycleListener> listenerHolder : listenerHolders) {
+            listeners.add(listenerHolder.getService());
+        }
+        return listeners;
+    }
+
+    private void ungetListeners(List<OsgiServiceHolder<InstallArtifactLifecycleListener>> listenerHolders) {
+        for (OsgiServiceHolder<InstallArtifactLifecycleListener> listenerHolder : listenerHolders) {
+            this.bundleContext.ungetService(listenerHolder.getServiceReference());
+        }
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactRefreshHandler.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactRefreshHandler.java
index d53def9..24f7c03 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactRefreshHandler.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactRefreshHandler.java
@@ -15,6 +15,7 @@
 
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
 import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
+import org.eclipse.virgo.kernel.install.environment.InstallEnvironment;
 import org.eclipse.virgo.kernel.install.environment.InstallEnvironmentFactory;
 import org.eclipse.virgo.kernel.install.pipeline.Pipeline;
 import org.eclipse.virgo.util.common.Tree;
@@ -46,12 +47,15 @@
         Tree<InstallArtifact> tree = installArtifact.getTree();
         
         boolean refreshed = true;
+        InstallEnvironment installEnvironment = this.installEnvironmentFactory.createInstallEnvironment(installArtifact);
         try {
-            this.refreshPipeline.process(tree, this.installEnvironmentFactory.createInstallEnvironment(installArtifact));
+            this.refreshPipeline.process(tree, installEnvironment);
         } catch (UnableToSatisfyBundleDependenciesException _) {
             refreshed = false;
         } catch (DeploymentException _) {
             refreshed = false;
+        } finally {
+            installEnvironment.destroy();
         }
         return refreshed;
     }
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosure.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosure.java
index 814dbb0..99e8c9d 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosure.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosure.java
@@ -26,7 +26,7 @@
 import org.eclipse.virgo.kernel.artifact.ArtifactSpecification;
 import org.eclipse.virgo.kernel.deployer.core.DeployerLogEvents;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
 import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentityDeterminer;
 import org.eclipse.virgo.kernel.install.artifact.ArtifactStorage;
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardPlanInstallArtifact.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardPlanInstallArtifact.java
index aee0157..e244a21 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardPlanInstallArtifact.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardPlanInstallArtifact.java
@@ -14,15 +14,11 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
 import org.eclipse.virgo.kernel.artifact.ArtifactSpecification;
-import org.eclipse.virgo.kernel.core.Signal;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
 import org.eclipse.virgo.kernel.deployer.core.DeployerLogEvents;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.internal.SignalJunction;
+import org.eclipse.virgo.kernel.deployer.core.internal.AbortableSignalJunction;
 import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
 import org.eclipse.virgo.kernel.install.artifact.ArtifactStorage;
 import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
@@ -34,6 +30,8 @@
 import org.eclipse.virgo.kernel.shim.scope.ScopeFactory;
 import org.eclipse.virgo.medic.eventlog.EventLogger;
 import org.eclipse.virgo.util.common.Tree;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * {@link StandardPlanInstallArtifact} is the standard implementation of {@link PlanInstallArtifact}.
@@ -102,20 +100,20 @@
      * {@inheritDoc}
      */
     @Override
-    protected final void doStart(Signal signal) throws DeploymentException {
+    protected final void doStart(AbortableSignal signal) throws DeploymentException {
         List<Tree<InstallArtifact>> children = getChildrenSnapshot();
         int numChildren = children.size();
 
         // The SignalJunction constructor will drive the signal if numChildren == 0.
-        SignalJunction signalJunction = new SignalJunction(signal, numChildren);
+        AbortableSignalJunction signalJunction = new AbortableSignalJunction(signal, numChildren);
         
         LOGGER.debug("Created {} that will notify {} to track start of {}", new Object[] {signalJunction, signal, this});
         
-        List<Signal> subSignals = signalJunction.getSignals();
+        List<AbortableSignal> subSignals = signalJunction.getSignals();
 
         for (int childIndex = 0; childIndex < numChildren && !signalJunction.failed(); childIndex++) {
             InstallArtifact childArtifact = children.get(childIndex).getValue();
-            Signal subSignal = subSignals.get(childIndex);
+            AbortableSignal subSignal = subSignals.get(childIndex);
             
             LOGGER.debug("Starting {} with signal {} from {}", new Object[] {childArtifact, subSignal, signalJunction});
             
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriver.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriver.java
index 8a669a1..3b87f8a 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriver.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriver.java
@@ -14,6 +14,7 @@
 import org.osgi.framework.Bundle;
 
 
+import org.eclipse.virgo.kernel.core.AbortableSignal;
 import org.eclipse.virgo.kernel.core.Signal;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
 import org.eclipse.virgo.kernel.install.artifact.ArtifactState;
@@ -52,10 +53,10 @@
      * Note: this method behaves as specified above when called multiple times on the same <code>InstallArtifact</code>
      * with any combination of the same or distinct or <code>null</code> <code>Signals</code>.
      * 
-     * @param signal a <code>Signal</code> that is ready to be driven or <code>null</code> if no signalling is required
+     * @param signal an <code>AbortableSignal</code> that is ready to be driven or <code>null</code> if no signalling is required
      * @throws DeploymentException 
      */
-    void start(Signal signal) throws DeploymentException;
+    void start(AbortableSignal signal) throws DeploymentException;
     
     /**
      * Updates the bundle associated with this {@link BundleDriver} using the given {@link BundleManifest} which
@@ -100,6 +101,6 @@
      */
     void popThreadContext();
 
-    void trackStart(Signal signal);
+    void trackStart(AbortableSignal signal);
 
 }
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriverBundleListener.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriverBundleListener.java
index a2f599f..5ce1670 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriverBundleListener.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleDriverBundleListener.java
@@ -22,11 +22,12 @@
 
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
 import org.eclipse.virgo.kernel.install.artifact.internal.ArtifactStateMonitor;
+import org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStateMonitor;
 import org.eclipse.virgo.kernel.serviceability.NonNull;
 import org.eclipse.virgo.util.math.ConcurrentHashSet;
 
 /**
- * {@link BundleDriverBundleListener} listens for bundle events and notifies the bundle's {@link ArtifactStateMonitor}.
+ * {@link BundleDriverBundleListener} listens for bundle events and notifies the bundle's {@link StandardArtifactStateMonitor}.
  * <p />
  * 
  * <strong>Concurrent Semantics</strong><br />
@@ -72,6 +73,7 @@
                         artifactStateMonitor.onResolved(this.installArtifact);
                         break;
                     case BundleEvent.LAZY_ACTIVATION:
+                        break;
                     case BundleEvent.STARTING:
                         artifactStateMonitor.onStarting(this.installArtifact);
                         break;
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleInstallArtifactFactory.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleInstallArtifactFactory.java
index 110d0da..c1a1155 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleInstallArtifactFactory.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/BundleInstallArtifactFactory.java
@@ -28,6 +28,7 @@
 import org.eclipse.virgo.kernel.install.artifact.ArtifactStorage;
 import org.eclipse.virgo.kernel.install.artifact.BundleInstallArtifact;
 import org.eclipse.virgo.kernel.install.artifact.internal.ArtifactStateMonitor;
+import org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStateMonitor;
 import org.eclipse.virgo.kernel.install.artifact.internal.InstallArtifactRefreshHandler;
 import org.eclipse.virgo.medic.eventlog.EventLogger;
 import org.eclipse.virgo.util.io.IOUtils;
@@ -69,7 +70,7 @@
 
     BundleInstallArtifact createBundleInstallArtifact(ArtifactIdentity identity, ArtifactStorage artifactStorage, String repositoryName) throws DeploymentException {
 
-        ArtifactStateMonitor artifactStateMonitor = new ArtifactStateMonitor(this.kernelBundleContext);
+        ArtifactStateMonitor artifactStateMonitor = new StandardArtifactStateMonitor(this.kernelBundleContext);
 
         StandardBundleDriver bundleDriver = this.bundleDriverFactory.createBundleDriver(identity, artifactStateMonitor);
 
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleDriver.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleDriver.java
index 2de961d..dfb5fe1 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleDriver.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleDriver.java
@@ -19,6 +19,7 @@
 import org.eclipse.virgo.kernel.osgi.framework.OsgiFramework;
 import org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil;
 
+import org.eclipse.virgo.kernel.core.AbortableSignal;
 import org.eclipse.virgo.kernel.core.BundleStarter;
 import org.eclipse.virgo.kernel.core.BundleUtils;
 import org.eclipse.virgo.kernel.core.KernelException;
@@ -140,7 +141,7 @@
     /**
      * {@inheritDoc}
      */
-    public void start(Signal signal) throws DeploymentException {
+    public void start(AbortableSignal signal) throws DeploymentException {
         Bundle bundle = obtainLocalBundle();
 
         if (!BundleUtils.isFragmentBundle(bundle)) {
@@ -162,7 +163,7 @@
 
     }
 
-    private void startBundle(Bundle bundle, Signal signal) throws DeploymentException {
+    private void startBundle(Bundle bundle, AbortableSignal signal) throws DeploymentException {
         this.bundleListener.addSolicitedStart(bundle);
         try {
             this.bundleStarter.start(bundle, signal);
@@ -200,23 +201,6 @@
         }
     }
 
-    public boolean asyncStart(Signal signal) {
-        Bundle bundle = obtainLocalBundle();
-
-        if (!BundleUtils.isFragmentBundle(bundle)) {
-            pushThreadContext();
-            try {
-                this.bundleStarter.start(obtainLocalBundle(), signal);
-            } catch (BundleException be) {
-                // ignore - the bundle starter will have already notified the signal
-            } finally {
-                popThreadContext();
-            }
-        } else
-            signalSuccessfulCompletion(signal);
-        return true;
-    }
-
     private Bundle obtainLocalBundle() {
         synchronized (this.monitor) {
             if (this.bundle == null) {
@@ -302,7 +286,7 @@
     /** 
      * {@inheritDoc}
      */
-    public void trackStart(Signal signal) {
+    public void trackStart(AbortableSignal signal) {
         this.bundleStarter.trackStart(obtainLocalBundle(), signal);
     }
 }
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifact.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifact.java
index 263eb14..1a57c90 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifact.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifact.java
@@ -23,17 +23,11 @@
 import java.util.List;
 import java.util.Set;
 
-import org.osgi.framework.Bundle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
-
 import org.eclipse.virgo.kernel.artifact.fs.ArtifactFSEntry;
-import org.eclipse.virgo.kernel.core.Signal;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
 import org.eclipse.virgo.kernel.deployer.core.DeployerLogEvents;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.internal.BlockingSignal;
+import org.eclipse.virgo.kernel.deployer.core.internal.BlockingAbortableSignal;
 import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
 import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentityDeterminer;
 import org.eclipse.virgo.kernel.install.artifact.ArtifactStorage;
@@ -44,6 +38,7 @@
 import org.eclipse.virgo.kernel.install.artifact.internal.ArtifactStateMonitor;
 import org.eclipse.virgo.kernel.install.artifact.internal.InstallArtifactRefreshHandler;
 import org.eclipse.virgo.kernel.install.artifact.internal.scoping.ArtifactIdentityScoper;
+import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
 import org.eclipse.virgo.kernel.serviceability.NonNull;
 import org.eclipse.virgo.medic.eventlog.EventLogger;
 import org.eclipse.virgo.util.common.Tree;
@@ -53,6 +48,9 @@
 import org.eclipse.virgo.util.osgi.manifest.BundleManifestFactory;
 import org.eclipse.virgo.util.osgi.manifest.BundleSymbolicName;
 import org.eclipse.virgo.util.osgi.manifest.ExportedPackage;
+import org.osgi.framework.Bundle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * {@link StandardBundleInstallArtifact} is the default implementation of {@link BundleInstallArtifact}.
@@ -68,6 +66,8 @@
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
     private static final String MANIFEST_ENTRY_NAME = "/META-INF/MANIFEST.MF";
+	
+	private static final String EQUINOX_SYSTEM_BUNDLE_NAME = "org.eclipse.osgi";
 
 	private static final long REFRESH_RESTART_WAIT_PERIOD = 60;
 
@@ -224,15 +224,31 @@
      * Track the start of the bundle.
      */
     void trackStart() {
-        Signal signal = createStateMonitorSignal(null);
+        AbortableSignal signal = createStateMonitorSignal(null);
         this.bundleDriver.trackStart(signal);
     }
 
+	@Override
+    public void beginInstall() throws DeploymentException {
+        if (isFragmentOnSystemBundle()) {
+            throw new DeploymentException("Deploying fragments of the system bundle is not supported");
+        }
+        super.beginInstall();
+    }
+
+    private boolean isFragmentOnSystemBundle() {
+        String fragmentHost = this.bundleManifest.getFragmentHost().getBundleSymbolicName();
+        if (fragmentHost != null) {
+            return fragmentHost.equals(EQUINOX_SYSTEM_BUNDLE_NAME);
+        }
+        return false;
+    }
+
     /**
      * {@inheritDoc}
      */
     @Override
-    public void start(Signal signal) throws DeploymentException {
+    public void start(AbortableSignal signal) throws DeploymentException {
         /*
          * Do not call super.start(signal) as it is essential that the starting event is driven under the bundle
          * lifecycle event so the listeners see a suitable bundle state.
@@ -249,7 +265,7 @@
      * {@inheritDoc}
      */
     @Override
-    protected void doStart(Signal signal) throws DeploymentException {
+    protected void doStart(AbortableSignal signal) throws DeploymentException {
         this.bundleDriver.start(signal);
     }
 
@@ -316,7 +332,7 @@
             boolean refreshed = this.bundleDriver.update(bundleManifest);
             if (refreshed) {
                 if (startRequired) {
-                    BlockingSignal blockingSignal = new BlockingSignal(true);
+                    BlockingAbortableSignal blockingSignal = new BlockingAbortableSignal(true);
                     start(blockingSignal);
                     try {
                         refreshed = blockingSignal.checkComplete();
@@ -403,7 +419,7 @@
     
     private void startIfNecessary(boolean bundleStopped) throws DeploymentException {
     	if (bundleStopped) {
-    		BlockingSignal signal = new BlockingSignal(true);
+    		BlockingAbortableSignal signal = new BlockingAbortableSignal(true);
             start(signal);
             signal.awaitCompletion(REFRESH_RESTART_WAIT_PERIOD);
         }
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/InstallEnvironment.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/InstallEnvironment.java
index 60fc795..15b35a7 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/InstallEnvironment.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/InstallEnvironment.java
@@ -48,4 +48,9 @@
      * @return an OSGi state or <code>null</code>
      */
     QuasiFramework getQuasiFramework();
+
+    /**
+     * Delete any resources associated with this {@link InstallEnvironment}.
+     */
+    void destroy();
 }
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/internal/StandardInstallEnvironment.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/internal/StandardInstallEnvironment.java
index 6d6cdbb..b4aa90f 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/internal/StandardInstallEnvironment.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/environment/internal/StandardInstallEnvironment.java
@@ -61,4 +61,13 @@
     public QuasiFramework getQuasiFramework() {
         return this.quasiFramework;
     }
+
+    /** 
+     * {@inheritDoc}
+     */
+    @Override
+    public void destroy() {
+        this.quasiFramework.destroy();
+    }
+    
 }
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/resources/EventLogMessages.properties b/org.eclipse.virgo.kernel.deployer/src/main/resources/EventLogMessages.properties
index aef753b..cfde703 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/resources/EventLogMessages.properties
+++ b/org.eclipse.virgo.kernel.deployer/src/main/resources/EventLogMessages.properties
@@ -43,6 +43,7 @@
 DE0505E = Refresh of artifact '{}' of {} '{}' version '{}' failed.
 DE0506E = Cannot undeploy {} '{}' version '{}'. Artifact not found.
 DE0507E = Cannot refresh {} '{}' version '{}'. Artifact not found.
+DE0508I = Aborted start of {} '{}' version '{}'.
 
 DE0600E = File '{}' cannot be unpacked as a JAR.
 
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/configuration-context.xml b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/configuration-context.xml
deleted file mode 100644
index b368be7..0000000
--- a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/configuration-context.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xmlns:osgi="http://www.springframework.org/schema/osgi"
-	xmlns:context="http://www.springframework.org/schema/context"
-	xmlns:osgi-compendium="http://www.springframework.org/schema/osgi-compendium"
-	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
-		http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd
-		http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.2.xsd">
-
-	<osgi-compendium:cm-properties id="kernelConfig" persistent-id="org.eclipse.virgo.kernel"/>
-	
-	<context:property-placeholder properties-ref="kernelConfig"/>
-	
-</beans>
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml
index 0a41f09..b8fbd6c 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml
+++ b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/deployer-context.xml
@@ -1,309 +1,306 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
-	xsi:schemaLocation="http://www.springframework.org/schema/osgi  
-       http://www.springframework.org/schema/osgi/spring-osgi.xsd
-       http://www.springframework.org/schema/beans   
-       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
-	<service
-		interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener">
-		<beans:bean
-			class="org.eclipse.virgo.kernel.install.artifact.internal.TreeRestrictingInstallArtifactLifecycleListener">
-			<beans:constructor-arg ref="eventLogger" />
-		</beans:bean>
-	</service>
-
-	<service id="applicationDeployer" ref="pipelinedApplicationDeployer"
-		interface="org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer" />
-
-	<beans:bean id="recoveryLog"
-		class="org.eclipse.virgo.kernel.deployer.core.internal.recovery.DeployerRecoveryLog">
-		<beans:constructor-arg value="#{workArea.workDirectory}" />
-	</beans:bean>
-
-	<beans:bean id="deploymentListener"
-		class="org.eclipse.virgo.kernel.deployer.core.internal.recovery.DeployerRecoveryLogDeploymentListener">
-		<beans:constructor-arg ref="recoveryLog" />
-	</beans:bean>
-
-	<beans:bean id="artifactStorageFactory"
-		class="org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStorageFactory">
-		<beans:constructor-arg value="#{workArea.workDirectory}" />
-		<beans:constructor-arg>
-			<beans:bean
-				class="org.eclipse.virgo.kernel.artifact.fs.StandardArtifactFSFactory" />
-		</beans:constructor-arg>
-		<beans:constructor-arg ref="eventLogger" />
-	</beans:bean>
-
-	<beans:bean id="syntheticContextCreatingTransformer"
-		class="org.eclipse.virgo.kernel.install.pipeline.stage.transform.internal.SyntheticContextBundleCreatingTransformer">
-		<beans:constructor-arg ref="bundleInstallArtifactTreeFactory" />
-		<beans:constructor-arg ref="artifactStorageFactory" />
-	</beans:bean>
-
-	<beans:bean id="scopingTransformer"
-		class="org.eclipse.virgo.kernel.install.pipeline.stage.transform.internal.ScopingTransformer" />
-
-	<beans:bean id="bundleManifestVersionUpgrader"
-		class="org.eclipse.virgo.kernel.deployer.core.internal.ManifestUpgrader" />
-
-	<beans:bean id="planResolver"
-		class="org.eclipse.virgo.kernel.deployer.core.internal.PlanResolver">
-		<beans:constructor-arg ref="installArtifactTreeInclosure" />
-	</beans:bean>
-
-	<beans:bean id="importExpandingTransformer"
-		class="org.eclipse.virgo.kernel.deployer.core.internal.ImportExpandingTransformer">
-		<beans:constructor-arg ref="importExpander" />
-	</beans:bean>
-
-	<beans:bean id="bundleDeploymentProperties"
-		class="org.eclipse.virgo.kernel.deployer.core.internal.BundleDeploymentPropertiesTransformer" />
-
-	<beans:bean id="userInstalledTaggingTransformer"
-		class="org.eclipse.virgo.kernel.install.pipeline.stage.transform.internal.UserInstalledTaggingTransformer" />
-
-	<service
-		interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
-		ref="planResolver" ranking="1000" />
-	<service
-		interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
-		ref="bundleManifestVersionUpgrader" ranking="2000" />
-	<service
-		interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
-		ref="bundleDeploymentProperties" ranking="2500" />
-	<service
-		interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
-		ref="userInstalledTaggingTransformer" ranking="2750" />
-	<service
-		interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
-		ref="syntheticContextCreatingTransformer" ranking="3000" />
-	<service
-		interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
-		ref="scopingTransformer" ranking="4000" />
-	<service
-		interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"
-		ref="importExpandingTransformer" ranking="5000" />
-
-	<service id="recoveryMonitorService" ref="recoveryMonitor"
-		interface="org.osgi.service.event.EventHandler">
-		<service-properties>
-			<beans:entry key="event.topics" value="org/eclipse/virgo/kernel/*" />
-		</service-properties>
-	</service>
-
-	<beans:bean id="recoveryMonitor"
-		class="org.eclipse.virgo.kernel.deployer.management.StandardRecoveryMonitor" />
-
-	<service id="recoveryAgent" interface="org.osgi.service.event.EventHandler">
-		<service-properties>
-			<beans:entry key="event.topics" value="org/eclipse/virgo/kernel/*" />
-		</service-properties>
-		<beans:bean
-			class="org.eclipse.virgo.kernel.deployer.core.internal.recovery.RecoveryAgent">
-			<beans:constructor-arg ref="pipelinedApplicationDeployer" />
-			<beans:constructor-arg ref="recoveryLog" />
-			<beans:constructor-arg ref="eventLogger" />
-			<beans:constructor-arg ref="eventAdmin" />
-		</beans:bean>
-	</service>
-
-	<beans:bean id="mainPipeline" factory-bean="plumber"
-		factory-method="getMainPipeline" />
-	<beans:bean id="refreshSubpipeline" factory-bean="plumber"
-		factory-method="getRefreshSubpipeline" />
-
-	<beans:bean id="pipelinedApplicationDeployer"
-		class="org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer">
-		<beans:constructor-arg ref="mainPipeline" />
-		<beans:constructor-arg ref="installArtifactTreeInclosure" />
-		<beans:constructor-arg ref="installEnvironmentFactory" />
-		<beans:constructor-arg ref="runtimeArtifactModel" />
-		<beans:constructor-arg ref="deploymentListener" />
-		<beans:constructor-arg ref="eventLogger" />
-		<beans:constructor-arg ref="uriNormaliser" />
-		<beans:constructor-arg ref="deployerConfig" />
-	</beans:bean>
-
-	<beans:bean id="stateCleanupListener"
-		class="org.eclipse.virgo.kernel.deployer.core.internal.StateCleanupInstallArtifactLifecycleListener">
-		<beans:constructor-arg ref="deploymentListener" />
-		<beans:constructor-arg ref="runtimeArtifactModel" />
-	</beans:bean>
-
-	<service ref="stateCleanupListener"
-		interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener" />
-
-	<service ref="uriNormaliser"
-		interface="org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser" />
-
-	<beans:bean id="uriNormaliser"
-		class="org.eclipse.virgo.kernel.deployer.core.internal.uri.CompoundDeployUriNormaliser">
-		<beans:constructor-arg>
-			<beans:list>
-				<beans:bean
-					class="org.eclipse.virgo.kernel.deployer.core.internal.uri.RepositoryDeployUriNormaliser">
-					<beans:constructor-arg ref="repository" />
-					<beans:constructor-arg ref="eventLogger" />
-				</beans:bean>
-				<beans:bean
-					class="org.eclipse.virgo.kernel.deployer.core.internal.uri.FileDeployUriNormaliser" />
-			</beans:list>
-		</beans:constructor-arg>
-	</beans:bean>
-
-	<beans:bean id="plumber"
-		class="org.eclipse.virgo.kernel.deployer.core.internal.Plumber">
-		<beans:constructor-arg>
-			<beans:bean factory-method="getPackageAdmin"
-				class="org.eclipse.virgo.kernel.deployer.core.internal.RegionAwarePackageAdminAccessor">
-				<beans:constructor-arg>
-					<reference interface="org.eclipse.virgo.kernel.osgi.region.Region" />
-				</beans:constructor-arg>
-			</beans:bean>
-		</beans:constructor-arg>
-		<beans:constructor-arg ref="bundleContext" />
-		<beans:constructor-arg ref="pipelineFactory" />
-		<beans:constructor-arg ref="quasiFrameworkFactory" />
-	</beans:bean>
-
-	<beans:bean id="pipelineFactory"
-		class="org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipelineFactory" />
-
-	<beans:bean id="installArtifactTreeInclosure"
-		class="org.eclipse.virgo.kernel.install.artifact.internal.StandardInstallArtifactTreeInclosure">
-		<beans:constructor-arg ref="artifactStorageFactory" />
-		<beans:constructor-arg ref="bundleContext" />
-		<beans:constructor-arg ref="repository" />
-		<beans:constructor-arg ref="eventLogger" />
-		<beans:constructor-arg ref="artifactIdentityDeterminer" />
-	</beans:bean>
-
-	<beans:bean id="installEnvironmentFactory"
-		class="org.eclipse.virgo.kernel.install.environment.internal.StandardInstallEnvironmentFactory">
-		<beans:constructor-arg ref="quasiFrameworkFactory" />
-		<beans:constructor-arg ref="eventLogger" />
-	</beans:bean>
-
-	<beans:bean id="runtimeArtifactModel"
-		class="org.eclipse.virgo.kernel.deployer.model.internal.StandardRuntimeArtifactModel">
-		<beans:constructor-arg ref="uriNormaliser" />
-	</beans:bean>
-
-	<service ref="runtimeArtifactModel"
-		interface="org.eclipse.virgo.kernel.deployer.model.RuntimeArtifactModel" />
-
-	<service ref="loggingListener"
-		interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener" />
-
-	<beans:bean id="loggingListener"
-		class="org.eclipse.virgo.kernel.install.artifact.internal.LoggingInstallArtifactLifecycleListener">
-		<beans:constructor-arg ref="eventLogger" />
-	</beans:bean>
-
-	<beans:bean id="deployerConfig"
-		class="org.eclipse.virgo.kernel.deployer.core.internal.StandardDeployerConfiguration">
-		<beans:constructor-arg value="${deployer.timeout}" />
-		<beans:constructor-arg value="${deployer.pickupDirectory}" />
-	</beans:bean>
-
-	<service ref="deployerConfig"
-		interface="org.eclipse.virgo.kernel.deployer.core.DeployerConfiguration" />
-
-	<beans:bean id="applicationDeploymentEventNotifier"
-		class="org.eclipse.virgo.kernel.deployer.core.event.ApplicationDeploymentEventNotifier">
-		<beans:constructor-arg ref="deploymentListeners" />
-	</beans:bean>
-
-	<set id="deploymentListeners"
-		interface="org.eclipse.virgo.kernel.deployer.core.event.DeploymentListener"
-		cardinality="0..N" />
-
-	<reference id="packageAdminUtil"
-		interface="org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil" />
-
-	<!--  scoping -->
-	<reference id="scopeFactory"
-		interface="org.eclipse.virgo.kernel.shim.scope.ScopeFactory" />
-
-	<beans:bean id="scopeServiceRepository"
-		class="org.eclipse.virgo.kernel.install.artifact.internal.StandardScopeServiceRepository" />
-
-	<service ref="scopeServiceRepository"
-		interface="org.eclipse.virgo.kernel.install.artifact.ScopeServiceRepository" />
-
-	<!--  basic artifact identity determination -->
-	<service
-		interface="org.eclipse.virgo.kernel.install.artifact.ArtifactIdentityDeterminer">
-		<beans:bean
-			class="org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactIdentityDeterminer">
-			<beans:constructor-arg>
-				<set id="artifactBridges" interface="org.eclipse.virgo.repository.ArtifactBridge" />
-			</beans:constructor-arg>
-		</beans:bean>
-	</service>
-
-	<beans:bean id="artifactIdentityDeterminer"
-		class="org.eclipse.virgo.kernel.install.artifact.internal.DelegatingServiceRegistryBackedArtifactIdentityDeterminer"
-		init-method="init" destroy-method="destroy">
-		<beans:constructor-arg ref="bundleContext" />
-	</beans:bean>
-
-	<beans:bean id="refreshHandler"
-		class="org.eclipse.virgo.kernel.install.artifact.internal.StandardInstallArtifactRefreshHandler">
-		<beans:constructor-arg ref="installEnvironmentFactory" />
-		<beans:constructor-arg ref="refreshSubpipeline" />
-	</beans:bean>
-
-	<!--  basic artifact type factories -->
-	<beans:bean id="bundleInstallArtifactTreeFactory"
-		class="org.eclipse.virgo.kernel.install.artifact.internal.bundle.BundleInstallArtifactTreeFactory">
-		<beans:constructor-arg ref="osgiFramework" />
-		<beans:constructor-arg ref="bundleContext" />
-		<beans:constructor-arg ref="refreshHandler" />
-		<beans:constructor-arg ref="bundleStarter" />
-		<beans:constructor-arg ref="tracingService" />
-		<beans:constructor-arg ref="packageAdminUtil" />
-		<beans:constructor-arg value="#{region.getBundleContext()}" />
-		<beans:constructor-arg ref="eventLogger" />
-		<beans:constructor-arg ref="artifactIdentityDeterminer" />
-	</beans:bean>
-
-	<service ref="bundleInstallArtifactTreeFactory"
-		interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeFactory" />
-
-	<beans:bean id="configInstallArtifactTreeFactory"
-		class="org.eclipse.virgo.kernel.install.artifact.internal.ConfigInstallArtifactTreeFactory">
-		<beans:constructor-arg ref="bundleContext" />
-		<beans:constructor-arg ref="configAdmin" />
-		<beans:constructor-arg ref="eventLogger" />
-	</beans:bean>
-
-	<service ref="configInstallArtifactTreeFactory"
-		interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeFactory" />
-
-	<service
-		interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeFactory">
-		<beans:bean
-			class="org.eclipse.virgo.kernel.install.artifact.internal.PlanInstallArtifactTreeFactory">
-			<beans:constructor-arg ref="bundleContext" />
-			<beans:constructor-arg ref="scopeServiceRepository" />
-			<beans:constructor-arg ref="scopeFactory" />
-			<beans:constructor-arg ref="eventLogger" />
-			<beans:constructor-arg ref="bundleInstallArtifactTreeFactory" />
-			<beans:constructor-arg ref="refreshHandler" />
-			<beans:constructor-arg ref="configInstallArtifactTreeFactory" />
-			<beans:constructor-arg ref="artifactStorageFactory" />
-			<beans:constructor-arg ref="artifactIdentityDeterminer" />
-		</beans:bean>
-	</service>
-
-	<service
-		interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener">
-		<beans:bean
-			class="org.eclipse.virgo.kernel.install.artifact.internal.AtomicInstallArtifactLifecycleListener" />
-	</service>
-
-</beans:beans>
+<?xml version="1.0" encoding="UTF-8"?>

+<beans:beans xmlns="http://www.springframework.org/schema/osgi"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"

+	xsi:schemaLocation="http://www.springframework.org/schema/osgi  

+       http://www.springframework.org/schema/osgi/spring-osgi.xsd

+       http://www.springframework.org/schema/beans   

+       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

+

+	<service

+		interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener">

+		<beans:bean

+			class="org.eclipse.virgo.kernel.install.artifact.internal.TreeRestrictingInstallArtifactLifecycleListener">

+			<beans:constructor-arg ref="eventLogger" />

+		</beans:bean>

+	</service>

+

+	<service id="applicationDeployer" ref="pipelinedApplicationDeployer"

+		interface="org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer" />

+

+	<beans:bean id="recoveryLog"

+		class="org.eclipse.virgo.kernel.deployer.core.internal.recovery.DeployerRecoveryLog">

+		<beans:constructor-arg value="#{workArea.workDirectory}" />

+	</beans:bean>

+

+	<beans:bean id="deploymentListener"

+		class="org.eclipse.virgo.kernel.deployer.core.internal.recovery.DeployerRecoveryLogDeploymentListener">

+		<beans:constructor-arg ref="recoveryLog" />

+	</beans:bean>

+

+	<beans:bean id="artifactStorageFactory"

+		class="org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStorageFactory">

+		<beans:constructor-arg value="#{workArea.workDirectory}" />

+		<beans:constructor-arg>

+			<beans:bean

+				class="org.eclipse.virgo.kernel.artifact.fs.StandardArtifactFSFactory" />

+		</beans:constructor-arg>

+		<beans:constructor-arg ref="eventLogger" />

+	</beans:bean>

+

+	<beans:bean id="syntheticContextCreatingTransformer"

+		class="org.eclipse.virgo.kernel.install.pipeline.stage.transform.internal.SyntheticContextBundleCreatingTransformer">

+		<beans:constructor-arg ref="bundleInstallArtifactTreeFactory" />

+		<beans:constructor-arg ref="artifactStorageFactory" />

+	</beans:bean>

+

+	<beans:bean id="scopingTransformer"

+		class="org.eclipse.virgo.kernel.install.pipeline.stage.transform.internal.ScopingTransformer" />

+

+	<beans:bean id="bundleManifestVersionUpgrader"

+		class="org.eclipse.virgo.kernel.deployer.core.internal.ManifestUpgrader" />

+

+	<beans:bean id="planResolver"

+		class="org.eclipse.virgo.kernel.deployer.core.internal.PlanResolver">

+		<beans:constructor-arg ref="installArtifactTreeInclosure" />

+	</beans:bean>

+

+	<beans:bean id="importExpandingTransformer"

+		class="org.eclipse.virgo.kernel.deployer.core.internal.ImportExpandingTransformer">

+		<beans:constructor-arg ref="importExpander" />

+	</beans:bean>

+

+	<beans:bean id="bundleDeploymentProperties"

+		class="org.eclipse.virgo.kernel.deployer.core.internal.BundleDeploymentPropertiesTransformer" />

+

+	<beans:bean id="userInstalledTaggingTransformer"

+		class="org.eclipse.virgo.kernel.install.pipeline.stage.transform.internal.UserInstalledTaggingTransformer" />

+

+	<service

+		interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"

+		ref="planResolver" ranking="1000" />

+	<service

+		interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"

+		ref="bundleManifestVersionUpgrader" ranking="2000" />

+	<service

+		interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"

+		ref="bundleDeploymentProperties" ranking="2500" />

+	<service

+		interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"

+		ref="userInstalledTaggingTransformer" ranking="2750" />

+	<service

+		interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"

+		ref="syntheticContextCreatingTransformer" ranking="3000" />

+	<service

+		interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"

+		ref="scopingTransformer" ranking="4000" />

+	<service

+		interface="org.eclipse.virgo.kernel.install.pipeline.stage.transform.Transformer"

+		ref="importExpandingTransformer" ranking="5000" />

+

+	<service id="recoveryMonitorService" ref="recoveryMonitor"

+		interface="org.osgi.service.event.EventHandler">

+		<service-properties>

+			<beans:entry key="event.topics" value="org/eclipse/virgo/kernel/*" />

+		</service-properties>

+	</service>

+

+	<beans:bean id="recoveryMonitor"

+		class="org.eclipse.virgo.kernel.deployer.management.StandardRecoveryMonitor" />

+

+	<service id="recoveryAgent" interface="org.osgi.service.event.EventHandler">

+		<service-properties>

+			<beans:entry key="event.topics" value="org/eclipse/virgo/kernel/*" />

+		</service-properties>

+		<beans:bean

+			class="org.eclipse.virgo.kernel.deployer.core.internal.recovery.RecoveryAgent">

+			<beans:constructor-arg ref="pipelinedApplicationDeployer" />

+			<beans:constructor-arg ref="recoveryLog" />

+			<beans:constructor-arg ref="eventLogger" />

+			<beans:constructor-arg ref="eventAdmin" />

+		</beans:bean>

+	</service>

+

+	<beans:bean id="mainPipeline" factory-bean="plumber"

+		factory-method="getMainPipeline" />

+	<beans:bean id="refreshSubpipeline" factory-bean="plumber"

+		factory-method="getRefreshSubpipeline" />

+

+	<beans:bean id="pipelinedApplicationDeployer"

+		class="org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer">

+		<beans:constructor-arg ref="mainPipeline" />

+		<beans:constructor-arg ref="installArtifactTreeInclosure" />

+		<beans:constructor-arg ref="installEnvironmentFactory" />

+		<beans:constructor-arg ref="runtimeArtifactModel" />

+		<beans:constructor-arg ref="deploymentListener" />

+		<beans:constructor-arg ref="eventLogger" />

+		<beans:constructor-arg ref="uriNormaliser" />

+		<beans:constructor-arg ref="deployerConfig" />

+	</beans:bean>

+

+	<beans:bean id="stateCleanupListener"

+		class="org.eclipse.virgo.kernel.deployer.core.internal.StateCleanupInstallArtifactLifecycleListener">

+		<beans:constructor-arg ref="deploymentListener" />

+		<beans:constructor-arg ref="runtimeArtifactModel" />

+	</beans:bean>

+

+	<service ref="stateCleanupListener"

+		interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener" />

+

+	<service ref="uriNormaliser"

+		interface="org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser" />

+

+	<beans:bean id="uriNormaliser"

+		class="org.eclipse.virgo.kernel.deployer.core.internal.uri.CompoundDeployUriNormaliser">

+		<beans:constructor-arg>

+			<beans:list>

+				<beans:bean

+					class="org.eclipse.virgo.kernel.deployer.core.internal.uri.RepositoryDeployUriNormaliser">

+					<beans:constructor-arg ref="repository" />

+					<beans:constructor-arg ref="eventLogger" />

+				</beans:bean>

+				<beans:bean

+					class="org.eclipse.virgo.kernel.deployer.core.internal.uri.FileDeployUriNormaliser" />

+			</beans:list>

+		</beans:constructor-arg>

+	</beans:bean>

+

+	<beans:bean id="plumber"

+		class="org.eclipse.virgo.kernel.deployer.core.internal.Plumber">

+		<beans:constructor-arg ref="packageAdmin" />

+		<beans:constructor-arg ref="bundleContext" />

+		<beans:constructor-arg ref="pipelineFactory" />

+		<beans:constructor-arg ref="quasiFrameworkFactory" />

+	</beans:bean>

+

+	<beans:bean id="pipelineFactory"

+		class="org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipelineFactory" />

+

+	<beans:bean id="installArtifactTreeInclosure"

+		class="org.eclipse.virgo.kernel.install.artifact.internal.StandardInstallArtifactTreeInclosure">

+		<beans:constructor-arg ref="artifactStorageFactory" />

+		<beans:constructor-arg ref="bundleContext" />

+		<beans:constructor-arg ref="repository" />

+		<beans:constructor-arg ref="eventLogger" />

+		<beans:constructor-arg ref="artifactIdentityDeterminer" />

+	</beans:bean>

+

+	<beans:bean id="installEnvironmentFactory"

+		class="org.eclipse.virgo.kernel.install.environment.internal.StandardInstallEnvironmentFactory">

+		<beans:constructor-arg ref="quasiFrameworkFactory" />

+		<beans:constructor-arg ref="eventLogger" />

+	</beans:bean>

+

+	<beans:bean id="runtimeArtifactModel"

+		class="org.eclipse.virgo.kernel.deployer.model.internal.StandardRuntimeArtifactModel">

+		<beans:constructor-arg ref="uriNormaliser" />

+	</beans:bean>

+

+	<service ref="runtimeArtifactModel"

+		interface="org.eclipse.virgo.kernel.deployer.model.RuntimeArtifactModel" />

+

+	<service ref="loggingListener"

+		interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener" />

+

+	<beans:bean id="loggingListener"

+		class="org.eclipse.virgo.kernel.install.artifact.internal.LoggingInstallArtifactLifecycleListener">

+		<beans:constructor-arg ref="eventLogger" />

+	</beans:bean>

+

+	<reference id="kernelConfig" interface="org.eclipse.virgo.kernel.core.KernelConfig"/>

+	

+	<beans:bean id="deployerConfig"

+		class="org.eclipse.virgo.kernel.deployer.core.internal.StandardDeployerConfiguration">

+		<beans:constructor-arg value="#{kernelConfig.getProperty('deployer.timeout')}" />

+		<beans:constructor-arg value="#{kernelConfig.getProperty('deployer.pickupDirectory')}" />

+	</beans:bean>

+

+	<service ref="deployerConfig"

+		interface="org.eclipse.virgo.kernel.deployer.core.DeployerConfiguration" />

+

+	<beans:bean id="applicationDeploymentEventNotifier"

+		class="org.eclipse.virgo.kernel.deployer.core.event.ApplicationDeploymentEventNotifier">

+		<beans:constructor-arg ref="deploymentListeners" />

+	</beans:bean>

+

+	<set id="deploymentListeners"

+		interface="org.eclipse.virgo.kernel.deployer.core.event.DeploymentListener"

+		cardinality="0..N" />

+

+	<reference id="packageAdminUtil"

+		interface="org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil" />

+

+	<!--  scoping -->

+	<reference id="scopeFactory"

+		interface="org.eclipse.virgo.kernel.shim.scope.ScopeFactory" />

+

+	<beans:bean id="scopeServiceRepository"

+		class="org.eclipse.virgo.kernel.install.artifact.internal.StandardScopeServiceRepository" />

+

+	<service ref="scopeServiceRepository"

+		interface="org.eclipse.virgo.kernel.install.artifact.ScopeServiceRepository" />

+

+	<!--  basic artifact identity determination -->

+	<service

+		interface="org.eclipse.virgo.kernel.install.artifact.ArtifactIdentityDeterminer">

+		<beans:bean

+			class="org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactIdentityDeterminer">

+			<beans:constructor-arg>

+				<set id="artifactBridges" interface="org.eclipse.virgo.repository.ArtifactBridge" />

+			</beans:constructor-arg>

+		</beans:bean>

+	</service>

+

+	<beans:bean id="artifactIdentityDeterminer"

+		class="org.eclipse.virgo.kernel.install.artifact.internal.DelegatingServiceRegistryBackedArtifactIdentityDeterminer"

+		init-method="init" destroy-method="destroy">

+		<beans:constructor-arg ref="bundleContext" />

+	</beans:bean>

+

+	<beans:bean id="refreshHandler"

+		class="org.eclipse.virgo.kernel.install.artifact.internal.StandardInstallArtifactRefreshHandler">

+		<beans:constructor-arg ref="installEnvironmentFactory" />

+		<beans:constructor-arg ref="refreshSubpipeline" />

+	</beans:bean>

+

+	<!--  basic artifact type factories -->

+	<beans:bean id="bundleInstallArtifactTreeFactory"

+		class="org.eclipse.virgo.kernel.install.artifact.internal.bundle.BundleInstallArtifactTreeFactory">

+		<beans:constructor-arg ref="osgiFramework" />

+		<beans:constructor-arg ref="bundleContext" />

+		<beans:constructor-arg ref="refreshHandler" />

+		<beans:constructor-arg ref="bundleStarter" />

+		<beans:constructor-arg ref="tracingService" />

+		<beans:constructor-arg ref="packageAdminUtil" />

+		<beans:constructor-arg ref="userBundleContext" />

+		<beans:constructor-arg ref="eventLogger" />

+		<beans:constructor-arg ref="artifactIdentityDeterminer" />

+	</beans:bean>

+	

+	<reference id="userBundleContext" interface="org.osgi.framework.BundleContext" filter="(org.eclipse.virgo.kernel.regionContext=true)"/>

+

+	<service ref="bundleInstallArtifactTreeFactory"

+		interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeFactory" />

+

+	<beans:bean id="configInstallArtifactTreeFactory"

+		class="org.eclipse.virgo.kernel.install.artifact.internal.ConfigInstallArtifactTreeFactory">

+		<beans:constructor-arg ref="bundleContext" />

+		<beans:constructor-arg ref="configAdmin" />

+		<beans:constructor-arg ref="eventLogger" />

+	</beans:bean>

+

+	<service ref="configInstallArtifactTreeFactory"

+		interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeFactory" />

+

+	<service

+		interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeFactory">

+		<beans:bean

+			class="org.eclipse.virgo.kernel.install.artifact.internal.PlanInstallArtifactTreeFactory">

+			<beans:constructor-arg ref="bundleContext" />

+			<beans:constructor-arg ref="scopeServiceRepository" />

+			<beans:constructor-arg ref="scopeFactory" />

+			<beans:constructor-arg ref="eventLogger" />

+			<beans:constructor-arg ref="bundleInstallArtifactTreeFactory" />

+			<beans:constructor-arg ref="refreshHandler" />

+			<beans:constructor-arg ref="configInstallArtifactTreeFactory" />

+			<beans:constructor-arg ref="artifactStorageFactory" />

+			<beans:constructor-arg ref="artifactIdentityDeterminer" />

+		</beans:bean>

+	</service>

+

+	<service

+		interface="org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener">

+		<beans:bean

+			class="org.eclipse.virgo.kernel.install.artifact.internal.AtomicInstallArtifactLifecycleListener" />

+	</service>

+

+</beans:beans>

diff --git a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/internal-osgi-context.xml b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/internal-osgi-context.xml
index 6c7f7ef..d534729 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/internal-osgi-context.xml
+++ b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/internal-osgi-context.xml
@@ -4,18 +4,15 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
 		http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd">
 
-	<!--
-		Configuration for OSGi services that the kernel depends on and
-		provides to the framework. These services are not considered part of
-		the kernel API.
-	-->
+	<!-- Configuration for OSGi services that the kernel depends on and provides 
+		to the framework. These services are not considered part of the kernel API. -->
 
 	<osgi:reference id="configAdmin"
 		interface="org.osgi.service.cm.ConfigurationAdmin" />
 
 	<osgi:reference id="eventLogger"
 		interface="org.eclipse.virgo.medic.eventlog.EventLogger" />
-		
+
 	<osgi:reference id="dumpGenerator"
 		interface="org.eclipse.virgo.medic.dump.DumpGenerator" />
 
@@ -42,16 +39,21 @@
 
 	<osgi:reference id="quasiFrameworkFactory"
 		interface="org.eclipse.virgo.kernel.osgi.quasi.QuasiFrameworkFactory" />
-		
+
 	<osgi:reference id="eventAdmin" interface="org.osgi.service.event.EventAdmin" />
 
-	<osgi:reference id="bundleStarter" interface="org.eclipse.virgo.kernel.core.BundleStarter" context-class-loader="unmanaged"/>
-	
-	<osgi:reference id="importExpander" interface="org.eclipse.virgo.kernel.osgi.framework.ImportExpander"/>
-	
-	<osgi:reference id="region" interface="org.eclipse.virgo.kernel.osgi.region.Region"/>
-	
-	<!--  services -->
+	<osgi:reference id="bundleStarter"
+		interface="org.eclipse.virgo.kernel.core.BundleStarter"
+		context-class-loader="unmanaged" />
+
+	<osgi:reference id="importExpander"
+		interface="org.eclipse.virgo.kernel.osgi.framework.ImportExpander" />
+
+	<osgi:reference id="region"
+		interface="org.eclipse.virgo.kernel.osgi.region.Region"
+		filter="(org.eclipse.virgo.kernel.region.name=org.eclipse.virgo.region.user)" />
+
+	<!-- services -->
 	<osgi:service ref="moduleContextEventPublisher"
 		interface="org.eclipse.virgo.kernel.module.ModuleContextEventPublisher" />
 
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/management-context.xml b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/management-context.xml
index e80bd4e..6badf42 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/management-context.xml
+++ b/org.eclipse.virgo.kernel.deployer/src/main/resources/META-INF/spring/management-context.xml
@@ -1,25 +1,27 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
-	xsi:schemaLocation="
-			http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
-			http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">
-
-	<!-- Deployer -->
-	<bean class="org.eclipse.virgo.kernel.management.ManagementExporter">
-		<constructor-arg>
-			<bean class="org.eclipse.virgo.kernel.deployer.management.StandardDeployer">
-				<constructor-arg ref="pipelinedApplicationDeployer" />
-			</bean>
-		</constructor-arg>
-		<constructor-arg
-			value="${domain}:category=Control,type=Deployer" />
-	</bean>
-
-	<!-- RecoveryMonitor -->
-	<bean class="org.eclipse.virgo.kernel.management.ManagementExporter">
-		<constructor-arg ref="recoveryMonitor" />
-		<constructor-arg
-			value="${domain}:category=Control,type=RecoveryMonitor" />
-	</bean>
-</beans>
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xsi:schemaLocation="

+			http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+			http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">

+

+	<!-- Deployer -->

+	<bean class="org.eclipse.virgo.kernel.management.ManagementExporter">

+		<constructor-arg>

+			<bean class="org.eclipse.virgo.kernel.deployer.management.StandardDeployer">

+				<constructor-arg ref="pipelinedApplicationDeployer" />

+			</bean>

+		</constructor-arg>

+		<constructor-arg

+			value="#{kernelConfig.getProperty('domain')}:category=Control,type=Deployer" />

+	</bean>

+

+	<!-- RecoveryMonitor -->

+	<bean class="org.eclipse.virgo.kernel.management.ManagementExporter">

+		<constructor-arg ref="recoveryMonitor" />

+		<constructor-arg

+			value="#{kernelConfig.getProperty('domain')}:category=Control,type=RecoveryMonitor" />

+	</bean>

+	

+	<osgi:reference id="kernelConfig" interface="org.eclipse.virgo.kernel.core.KernelConfig"/>

+</beans>

diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptionsTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptionsTests.java
index f93d26a..0883f37 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptionsTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/DeploymentOptionsTests.java
@@ -13,7 +13,6 @@
 
 import static org.junit.Assert.assertEquals;
 
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
 import org.junit.Test;
 
 
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/StubInstallArtifactLifecycleListener.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/StubInstallArtifactLifecycleListener.java
index dd403d2..71574cf 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/StubInstallArtifactLifecycleListener.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/StubInstallArtifactLifecycleListener.java
@@ -36,7 +36,9 @@
     private final AtomicInteger startingCount = new AtomicInteger();
 
     private final AtomicInteger startFailedCount = new AtomicInteger();
-
+    
+    private final AtomicInteger startAbortedCount = new AtomicInteger();
+    
     private final AtomicInteger startedCount = new AtomicInteger();
 
     private final AtomicInteger stoppingCount = new AtomicInteger();
@@ -115,6 +117,10 @@
         assertEquals("Incorrect start failed count", startFailed, this.startFailedCount.get());
     }
 
+    public void assertStartAbortedCount(int startAborted) {
+        assertEquals("Incorrect start abortion count", startAborted, this.startAbortedCount.get());
+    }
+
     public void assertStartedCount(int started) {
         assertEquals("Incorrect started count", started, this.startedCount.get());
     }
@@ -206,6 +212,13 @@
     /**
      * {@inheritDoc}
      */
+    public void onStartAborted(InstallArtifact installArtifact) {
+        this.startAbortedCount.incrementAndGet();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public void onStarted(InstallArtifact installArtifact) {
         this.startedCount.incrementAndGet();
     }
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/AbortableSignalJunctionTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/AbortableSignalJunctionTests.java
new file mode 100644
index 0000000..e675118
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/AbortableSignalJunctionTests.java
@@ -0,0 +1,229 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.deployer.core.internal;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.virgo.kernel.core.AbortableSignal;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ */
+public class AbortableSignalJunctionTests {
+
+    private AbortableSignal signal;
+    
+    private boolean signalCompleted;
+
+    private boolean signalFailed;
+    
+    private boolean signalAborted;
+
+    @Before
+    public void setUp() {
+        this.signalCompleted = false;
+        this.signalFailed = false;
+        
+        this.signal = new AbortableSignal(){
+
+            public void signalFailure(Throwable cause) {
+                signalFailed = true;
+            }
+
+            public void signalSuccessfulCompletion() {
+                signalCompleted = true;
+            }
+            
+            public void signalAborted() {
+				signalAborted = true;
+			}
+
+        };
+    }
+
+    @Test
+    public void testEmptyJunction() {
+        new AbortableSignalJunction(this.signal, 0);
+        assertTrue(this.signalCompleted);
+        assertFalse(this.signalFailed);
+        assertFalse(this.signalAborted);
+    }
+    
+    @Test
+    public void testUnaryJunction() {
+        AbortableSignalJunction sj = new AbortableSignalJunction(this.signal, 1);
+        sj.getSignals().get(0).signalSuccessfulCompletion();
+        assertTrue(this.signalCompleted);
+        assertFalse(this.signalFailed);
+        assertFalse(this.signalAborted);
+    }
+    
+    @Test
+    public void testBinaryJunction() {
+        AbortableSignalJunction sj = new AbortableSignalJunction(this.signal, 2);
+        sj.getSignals().get(0).signalSuccessfulCompletion();
+        sj.getSignals().get(1).signalSuccessfulCompletion();
+        assertTrue(this.signalCompleted);
+        assertFalse(this.signalFailed);
+        assertFalse(this.signalAborted);
+    }
+    
+    @Test
+    public void testBinaryJunctionFail() {
+        AbortableSignalJunction sj = new AbortableSignalJunction(this.signal, 2);
+        sj.getSignals().get(0).signalFailure(new RuntimeException());
+        assertFalse(this.signalCompleted);
+        assertTrue(this.signalFailed);
+        assertFalse(this.signalAborted);
+    }
+    
+    @Test
+    public void testBinaryJunctionAbort() {
+        AbortableSignalJunction sj = new AbortableSignalJunction(this.signal, 2);
+        sj.getSignals().get(0).signalAborted();
+        assertFalse(this.signalCompleted);
+        assertFalse(this.signalFailed);
+        assertTrue(this.signalAborted);
+    }
+    
+    @Test
+    public void testNestedBinaryJunctionOrder1() {
+        AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+        AbortableSignal top1 = top.getSignals().get(0);
+        AbortableSignal top2 = top.getSignals().get(1);
+        AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+        AbortableSignal bottom1 = bottom.getSignals().get(0);
+        AbortableSignal bottom2 = bottom.getSignals().get(1);
+        top1.signalSuccessfulCompletion();
+        bottom1.signalSuccessfulCompletion();
+        bottom2.signalSuccessfulCompletion();
+        assertTrue(this.signalCompleted);
+        assertFalse(this.signalFailed);
+        assertFalse(this.signalAborted);
+    }
+    
+    @Test
+    public void testNestedBinaryJunctionOrder2() {
+        AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+        AbortableSignal top1 = top.getSignals().get(0);
+        AbortableSignal top2 = top.getSignals().get(1);
+        AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+        AbortableSignal bottom1 = bottom.getSignals().get(0);
+        AbortableSignal bottom2 = bottom.getSignals().get(1);
+        bottom1.signalSuccessfulCompletion();
+        top1.signalSuccessfulCompletion();
+        bottom2.signalSuccessfulCompletion();
+        assertTrue(this.signalCompleted);
+        assertFalse(this.signalFailed);
+        assertFalse(this.signalAborted);
+    }
+    
+    @Test
+    public void testNestedBinaryJunctionOrder3() {
+        AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+        AbortableSignal top1 = top.getSignals().get(0);
+        AbortableSignal top2 = top.getSignals().get(1);
+        AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+        AbortableSignal bottom1 = bottom.getSignals().get(0);
+        AbortableSignal bottom2 = bottom.getSignals().get(1);
+        bottom1.signalSuccessfulCompletion();
+        bottom2.signalSuccessfulCompletion();
+        top1.signalSuccessfulCompletion();
+        assertTrue(this.signalCompleted);
+        assertFalse(this.signalFailed);
+        assertFalse(this.signalAborted);
+    }
+    
+    @Test
+    public void testNestedBinaryJunctionOrder4() {
+        AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+        AbortableSignal top1 = top.getSignals().get(0);
+        AbortableSignal top2 = top.getSignals().get(1);
+        AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+        AbortableSignal bottom1 = bottom.getSignals().get(0);
+        AbortableSignal bottom2 = bottom.getSignals().get(1);
+        top1.signalSuccessfulCompletion();
+        bottom2.signalSuccessfulCompletion();
+        bottom1.signalSuccessfulCompletion();
+        assertTrue(this.signalCompleted);
+        assertFalse(this.signalFailed);
+        assertFalse(this.signalAborted);
+    }
+    
+    @Test
+    public void testNestedBinaryJunctionOrder5() {
+        AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+        AbortableSignal top1 = top.getSignals().get(0);
+        AbortableSignal top2 = top.getSignals().get(1);
+        AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+        AbortableSignal bottom1 = bottom.getSignals().get(0);
+        AbortableSignal bottom2 = bottom.getSignals().get(1);
+        bottom2.signalSuccessfulCompletion();
+        top1.signalSuccessfulCompletion();
+        bottom1.signalSuccessfulCompletion();
+        assertTrue(this.signalCompleted);
+        assertFalse(this.signalFailed);
+        assertFalse(this.signalAborted);
+    }
+    
+    @Test
+    public void testNestedBinaryJunctionOrder6() {
+        AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+        AbortableSignal top1 = top.getSignals().get(0);
+        AbortableSignal top2 = top.getSignals().get(1);
+        AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+        AbortableSignal bottom1 = bottom.getSignals().get(0);
+        AbortableSignal bottom2 = bottom.getSignals().get(1);
+        bottom2.signalSuccessfulCompletion();
+        bottom1.signalSuccessfulCompletion();
+        top1.signalSuccessfulCompletion();
+        assertTrue(this.signalCompleted);
+        assertFalse(this.signalFailed);
+        assertFalse(this.signalAborted);
+    }
+    
+    @Test
+    public void testNestedBinaryJunctionOrderFail() {
+        AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+        AbortableSignal top1 = top.getSignals().get(0);
+        AbortableSignal top2 = top.getSignals().get(1);
+        AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+        AbortableSignal bottom1 = bottom.getSignals().get(0);
+        AbortableSignal bottom2 = bottom.getSignals().get(1);
+        top1.signalSuccessfulCompletion();
+        bottom1.signalFailure(new RuntimeException());
+        bottom2.signalSuccessfulCompletion();
+        assertFalse(this.signalCompleted);
+        assertTrue(this.signalFailed);
+        assertFalse(this.signalAborted);
+    }
+    
+    @Test
+    public void testNestedBinaryJunctionOrderAbort() {
+        AbortableSignalJunction top = new AbortableSignalJunction(this.signal, 2);
+        AbortableSignal top1 = top.getSignals().get(0);
+        AbortableSignal top2 = top.getSignals().get(1);
+        AbortableSignalJunction bottom = new AbortableSignalJunction(top2, 2);
+        AbortableSignal bottom1 = bottom.getSignals().get(0);
+        AbortableSignal bottom2 = bottom.getSignals().get(1);
+        top1.signalSuccessfulCompletion();
+        bottom1.signalAborted();
+        bottom2.signalSuccessfulCompletion();
+        assertFalse(this.signalCompleted);
+        assertFalse(this.signalFailed);
+        assertTrue(this.signalAborted);
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/ManifestUpgraderTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/ManifestUpgraderTests.java
index 0f7821e..9a8bc4f 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/ManifestUpgraderTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/ManifestUpgraderTests.java
@@ -162,5 +162,10 @@
             throw new UnsupportedOperationException();
         }
 
+        @Override
+        public void destroy() {
+            throw new UnsupportedOperationException();
+        }
+
     }
 }
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployerTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployerTests.java
new file mode 100644
index 0000000..d2c3d23
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployerTests.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+package org.eclipse.virgo.kernel.deployer.core.internal;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser;
+import org.eclipse.virgo.kernel.deployer.core.DeployerConfiguration;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
+import org.eclipse.virgo.kernel.deployer.core.internal.event.DeploymentListener;
+import org.eclipse.virgo.kernel.deployer.model.RuntimeArtifactModel;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeInclosure;
+import org.eclipse.virgo.kernel.install.environment.InstallEnvironmentFactory;
+import org.eclipse.virgo.kernel.install.pipeline.Pipeline;
+import org.eclipse.virgo.medic.eventlog.EventLogger;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.easymock.EasyMock.*;
+import static org.junit.Assert.*;
+
+public class PipelinedApplicationDeployerTests {
+
+    private PipelinedApplicationDeployer pipelinedApplicationDeployer;
+    private Pipeline pipeline;
+    private InstallArtifactTreeInclosure installArtifactTreeInclosure;
+    private InstallEnvironmentFactory installEnvironmentFactory;
+    private RuntimeArtifactModel ram;
+    private DeploymentListener deploymentListener;
+    private EventLogger eventLogger;
+    private DeployUriNormaliser normaliser;
+    private DeployerConfiguration deployerConfiguration;
+    private InstallArtifact installArtifact;
+    
+    @Before
+    public void setup() {
+        pipeline = createMock(Pipeline.class);
+        installArtifactTreeInclosure = createMock(InstallArtifactTreeInclosure.class);
+        installEnvironmentFactory = createMock(InstallEnvironmentFactory.class);
+        ram = createMock(RuntimeArtifactModel.class);
+        deploymentListener = createMock(DeploymentListener.class);
+        eventLogger = createNiceMock(EventLogger.class);
+        normaliser = createMock(DeployUriNormaliser.class);
+        deployerConfiguration = createMock(DeployerConfiguration.class);
+        installArtifact = createMock(InstallArtifact.class);
+        
+        expect(this.deployerConfiguration.getDeploymentTimeoutSeconds()).andReturn(5);
+    }
+
+    @After
+    public void tearDown() {
+        resetMocks();
+    }
+
+    private void startTests() {
+        replay(this.pipeline, this.installArtifactTreeInclosure, this.installEnvironmentFactory, this.ram, this.deploymentListener, this.eventLogger, this.normaliser, this.deployerConfiguration, this.installArtifact);
+        this.pipelinedApplicationDeployer = new PipelinedApplicationDeployer(pipeline, installArtifactTreeInclosure, installEnvironmentFactory, ram, deploymentListener, eventLogger, normaliser, deployerConfiguration);
+    }
+
+    private void verifyMocks() {
+        verify(this.pipeline, this.installArtifactTreeInclosure, this.installEnvironmentFactory, this.ram, this.deploymentListener, this.eventLogger, this.normaliser, this.deployerConfiguration, this.installArtifact);
+    }
+
+    private void resetMocks() {
+        reset(this.pipeline, this.installArtifactTreeInclosure, this.installEnvironmentFactory, this.ram, this.deploymentListener, this.eventLogger, this.normaliser, this.deployerConfiguration, this.installArtifact);
+    }
+    
+    @Test
+    public void testIsdeployedFalse() throws URISyntaxException, DeploymentException {
+        URI testURI = new URI("foo");
+        expect(this.normaliser.normalise(testURI)).andReturn(null);
+        this.startTests();
+        boolean result = this.pipelinedApplicationDeployer.isDeployed(testURI);
+        this.verifyMocks();
+        assertFalse(result);
+    }
+    
+    @Test
+    public void testIsdeployedFalse2() throws URISyntaxException, DeploymentException {
+        URI testURI = new URI("foo");
+        expect(this.normaliser.normalise(testURI)).andReturn(testURI);
+        expect(this.ram.get(testURI)).andReturn(null);
+        this.startTests();
+        boolean result = this.pipelinedApplicationDeployer.isDeployed(testURI);
+        this.verifyMocks();
+        assertFalse(result);
+    } 
+    
+    @Test
+    public void testIsdeployedSucsess() throws URISyntaxException, DeploymentException {
+        URI testURI = new URI("foo");
+        expect(this.normaliser.normalise(testURI)).andReturn(testURI);
+        expect(this.ram.get(testURI)).andReturn(this.installArtifact);
+        this.startTests();
+        boolean result = this.pipelinedApplicationDeployer.isDeployed(testURI);
+        this.verifyMocks();
+        assertTrue(result);
+    }    
+
+    @Test
+    public void testIsdeployedFail() throws URISyntaxException, DeploymentException {
+        URI testURI = new URI("foo");
+        expect(this.normaliser.normalise(testURI)).andThrow(new DeploymentException("fail"));
+        this.startTests();
+        boolean result = this.pipelinedApplicationDeployer.isDeployed(testURI);
+        this.verifyMocks();
+        assertFalse(result);
+    }
+    
+}
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/SignalJunctionTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/SignalJunctionTests.java
deleted file mode 100644
index d8b3fd8..0000000
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/SignalJunctionTests.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.deployer.core.internal;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.virgo.kernel.core.Signal;
-import org.eclipse.virgo.kernel.deployer.core.internal.SignalJunction;
-import org.junit.Before;
-import org.junit.Test;
-
-
-/**
- */
-public class SignalJunctionTests {
-
-    private Signal signal;
-    
-    private boolean signalCompleted;
-    
-    private boolean signalFailed;
-
-    @Before
-    public void setUp() {
-        this.signalCompleted = false;
-        this.signalFailed = false;
-        this.signal = new Signal() {
-
-            public void signalFailure(Throwable cause) {
-                signalFailed = true;
-            }
-
-            public void signalSuccessfulCompletion() {
-                signalCompleted = true;
-            }
-
-        };
-    }
-
-    @Test
-    public void testEmptyJunction() {
-        new SignalJunction(this.signal, 0);
-        assertTrue(this.signalCompleted);
-        assertFalse(this.signalFailed);
-    }
-    
-    @Test
-    public void testUnaryJunction() {
-        SignalJunction sj = new SignalJunction(this.signal, 1);
-        sj.getSignals().get(0).signalSuccessfulCompletion();
-        assertTrue(this.signalCompleted);
-        assertFalse(this.signalFailed);
-    }
-    
-    @Test
-    public void testBinaryJunction() {
-        SignalJunction sj = new SignalJunction(this.signal, 2);
-        sj.getSignals().get(0).signalSuccessfulCompletion();
-        sj.getSignals().get(1).signalSuccessfulCompletion();
-        assertTrue(this.signalCompleted);
-        assertFalse(this.signalFailed);
-    }
-    
-    @Test
-    public void testNestedBinaryJunctionOrder1() {
-        SignalJunction top = new SignalJunction(this.signal, 2);
-        Signal top1 = top.getSignals().get(0);
-        Signal top2 = top.getSignals().get(1);
-        SignalJunction bottom = new SignalJunction(top2, 2);
-        Signal bottom1 = bottom.getSignals().get(0);
-        Signal bottom2 = bottom.getSignals().get(1);
-        top1.signalSuccessfulCompletion();
-        bottom1.signalSuccessfulCompletion();
-        bottom2.signalSuccessfulCompletion();
-        assertTrue(this.signalCompleted);
-        assertFalse(this.signalFailed);
-    }
-    
-    @Test
-    public void testNestedBinaryJunctionOrder2() {
-        SignalJunction top = new SignalJunction(this.signal, 2);
-        Signal top1 = top.getSignals().get(0);
-        Signal top2 = top.getSignals().get(1);
-        SignalJunction bottom = new SignalJunction(top2, 2);
-        Signal bottom1 = bottom.getSignals().get(0);
-        Signal bottom2 = bottom.getSignals().get(1);
-        bottom1.signalSuccessfulCompletion();
-        top1.signalSuccessfulCompletion();
-        bottom2.signalSuccessfulCompletion();
-        assertTrue(this.signalCompleted);
-        assertFalse(this.signalFailed);
-    }
-    
-    @Test
-    public void testNestedBinaryJunctionOrder3() {
-        SignalJunction top = new SignalJunction(this.signal, 2);
-        Signal top1 = top.getSignals().get(0);
-        Signal top2 = top.getSignals().get(1);
-        SignalJunction bottom = new SignalJunction(top2, 2);
-        Signal bottom1 = bottom.getSignals().get(0);
-        Signal bottom2 = bottom.getSignals().get(1);
-        bottom1.signalSuccessfulCompletion();
-        bottom2.signalSuccessfulCompletion();
-        top1.signalSuccessfulCompletion();
-        assertTrue(this.signalCompleted);
-        assertFalse(this.signalFailed);
-    }
-    
-    @Test
-    public void testNestedBinaryJunctionOrder4() {
-        SignalJunction top = new SignalJunction(this.signal, 2);
-        Signal top1 = top.getSignals().get(0);
-        Signal top2 = top.getSignals().get(1);
-        SignalJunction bottom = new SignalJunction(top2, 2);
-        Signal bottom1 = bottom.getSignals().get(0);
-        Signal bottom2 = bottom.getSignals().get(1);
-        top1.signalSuccessfulCompletion();
-        bottom2.signalSuccessfulCompletion();
-        bottom1.signalSuccessfulCompletion();
-        assertTrue(this.signalCompleted);
-        assertFalse(this.signalFailed);
-    }
-    
-    @Test
-    public void testNestedBinaryJunctionOrder5() {
-        SignalJunction top = new SignalJunction(this.signal, 2);
-        Signal top1 = top.getSignals().get(0);
-        Signal top2 = top.getSignals().get(1);
-        SignalJunction bottom = new SignalJunction(top2, 2);
-        Signal bottom1 = bottom.getSignals().get(0);
-        Signal bottom2 = bottom.getSignals().get(1);
-        bottom2.signalSuccessfulCompletion();
-        top1.signalSuccessfulCompletion();
-        bottom1.signalSuccessfulCompletion();
-        assertTrue(this.signalCompleted);
-        assertFalse(this.signalFailed);
-    }
-    
-    @Test
-    public void testNestedBinaryJunctionOrder6() {
-        SignalJunction top = new SignalJunction(this.signal, 2);
-        Signal top1 = top.getSignals().get(0);
-        Signal top2 = top.getSignals().get(1);
-        SignalJunction bottom = new SignalJunction(top2, 2);
-        Signal bottom1 = bottom.getSignals().get(0);
-        Signal bottom2 = bottom.getSignals().get(1);
-        bottom2.signalSuccessfulCompletion();
-        bottom1.signalSuccessfulCompletion();
-        top1.signalSuccessfulCompletion();
-        assertTrue(this.signalCompleted);
-        assertFalse(this.signalFailed);
-    }
-
-}
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogTests.java
index 5a61bbc..a766fef 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/core/internal/recovery/DeployerRecoveryLogTests.java
@@ -23,8 +23,7 @@
 import org.junit.Before;
 import org.junit.Test;
 
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 import org.eclipse.virgo.kernel.deployer.core.internal.recovery.DeployerRecoveryLog;
 import org.eclipse.virgo.util.io.PathReference;
 
@@ -50,17 +49,17 @@
 
         // all true
         URI app1 = new File("app/one").toURI();
-        log.add(app1, new ApplicationDeployer.DeploymentOptions(true, true, true));
+        log.add(app1, new DeploymentOptions(true, true, true));
 
         // all false
         URI app2 = new File("app/two").toURI();
-        log.add(app2, new ApplicationDeployer.DeploymentOptions(false, false, false));
+        log.add(app2, new DeploymentOptions(false, false, false));
 
         URI app3 = new File("app/three").toURI();
-        log.add(app3, new ApplicationDeployer.DeploymentOptions(false, false, true));
+        log.add(app3, new DeploymentOptions(false, false, true));
 
         URI app4 = new File("app/four").toURI();
-        log.add(app4, new ApplicationDeployer.DeploymentOptions(false, true, true));
+        log.add(app4, new DeploymentOptions(false, true, true));
 
         log = new DeployerRecoveryLog(deployArea);
 
@@ -100,7 +99,7 @@
         DeployerRecoveryLog log = new DeployerRecoveryLog(deployArea);
         URI app1 = new File("app/one").toURI();
         for (int i = 0; i < 100; i++) {
-            log.add(app1, new ApplicationDeployer.DeploymentOptions(true, true, true));
+            log.add(app1, new DeploymentOptions(true, true, true));
             if (i < 99) {
                 log.remove(app1);
             }
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerFileSystemListenerTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerFileSystemListenerTests.java
index d2617d5..9de4975 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerFileSystemListenerTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerFileSystemListenerTests.java
@@ -25,7 +25,7 @@
 
 import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 import org.eclipse.virgo.kernel.deployer.hot.HotDeploymentFileSystemListener;
 import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
 import org.eclipse.virgo.util.io.FileSystemEvent;
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerTests.java
index c655585..bc6b528 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/deployer/hot/HotDeployerTests.java
@@ -23,9 +23,9 @@
 import java.util.Map;
 
 import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
 import org.eclipse.virgo.kernel.deployer.core.DeployerConfiguration;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentIdentity;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
 import org.eclipse.virgo.util.io.PathReference;
 import org.junit.After;
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifactTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifactTests.java
index 0c4d992..d2f879e 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifactTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifactTests.java
@@ -13,25 +13,24 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 import java.net.URI;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.eclipse.virgo.kernel.artifact.fs.ArtifactFS;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
+import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
+import org.eclipse.virgo.kernel.install.artifact.ArtifactStorage;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifact.State;
+import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.osgi.framework.Version;
 
-
-import org.eclipse.virgo.kernel.artifact.fs.ArtifactFS;
-import org.eclipse.virgo.kernel.core.Signal;
-import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
-import org.eclipse.virgo.kernel.install.artifact.ArtifactStorage;
-import org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact;
-import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
-
 /**
  */
 public class AbstractInstallArtifactTests {
@@ -42,11 +41,14 @@
 
     private static final String PROPERTY_VALUE_2 = "value2";
 
-    private TestInstallArtifact installArtifact;
+    private StubInstallArtifact installArtifact;
+    
+    private StubArtifactStateMonitor artifactStateMonitor;
 
     @Before
     public void setUp() throws Exception {
-        installArtifact = new TestInstallArtifact();
+        this.artifactStateMonitor = new StubArtifactStateMonitor();
+        this.installArtifact = new StubInstallArtifact(artifactStateMonitor);
     }
 
     @After
@@ -77,34 +79,126 @@
         assertEquals(PROPERTY_VALUE, this.installArtifact.setProperty(PROPERTY_NAME, PROPERTY_VALUE_2));
     }
 
-    public static final class TestInstallArtifact extends AbstractInstallArtifact {
+    @Test
+    public void testStart() throws DeploymentException {
+        this.artifactStateMonitor.setState(State.RESOLVED);
+        this.installArtifact.start(new StubAbortableSignal());
 
-        public TestInstallArtifact() {
-            super(new ArtifactIdentity("type", "name", Version.emptyVersion, null), new StubArtifactStorage(), null, null, new MockEventLogger());
-        }
-
-        @Override
-        protected void doStop() throws DeploymentException {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        protected void doUninstall() throws DeploymentException {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        protected void doStart(Signal signal) throws DeploymentException {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        protected boolean doRefresh() throws DeploymentException {
-            return false;
-        }
+        assertEquals(0, this.installArtifact.doRefreshCount);
+        assertEquals(1, this.installArtifact.doStartCount);
+        assertEquals(0, this.installArtifact.doStopCount);
+        assertEquals(0, this.installArtifact.doUninstallCount);
     }
 
-    private static class StubArtifactStorage implements ArtifactStorage {
+    @Test
+    public void testStartWhenAlreadyStarted() throws DeploymentException {
+        this.artifactStateMonitor.setState(State.ACTIVE);
+        this.installArtifact.start(new StubAbortableSignal());
+
+        assertEquals(0, this.installArtifact.doRefreshCount);
+        assertEquals(0, this.installArtifact.doStartCount);
+        assertEquals(0, this.installArtifact.doStopCount);
+        assertEquals(0, this.installArtifact.doUninstallCount);
+    }
+
+    @Test
+    public void testStop() throws DeploymentException {
+        this.artifactStateMonitor.setState(State.ACTIVE);
+        this.installArtifact.stop();
+
+        assertEquals(0, this.installArtifact.doRefreshCount);
+        assertEquals(0, this.installArtifact.doStartCount);
+        assertEquals(1, this.installArtifact.doStopCount);
+        assertEquals(0, this.installArtifact.doUninstallCount);
+    }
+
+    @Test
+    public void testStopWhenNotStarted() throws DeploymentException {
+        this.artifactStateMonitor.setState(State.INSTALLED);
+        this.installArtifact.stop();
+
+        assertEquals(0, this.installArtifact.doRefreshCount);
+        assertEquals(0, this.installArtifact.doStartCount);
+        assertEquals(0, this.installArtifact.doStopCount);
+        assertEquals(0, this.installArtifact.doUninstallCount);
+    }
+
+    @Test
+    public void testRefresh() throws DeploymentException {
+        this.artifactStateMonitor.setState(State.ACTIVE);
+        assertTrue(this.installArtifact.refresh());
+
+        assertEquals(1, this.installArtifact.doRefreshCount);
+        assertEquals(0, this.installArtifact.doStartCount);
+        assertEquals(0, this.installArtifact.doStopCount);
+        assertEquals(0, this.installArtifact.doUninstallCount);
+    }
+
+    @Test
+    public void testUninstall() throws DeploymentException {
+        this.artifactStateMonitor.setState(State.ACTIVE);
+        this.installArtifact.uninstall();
+
+        assertEquals(0, this.installArtifact.doRefreshCount);
+        assertEquals(0, this.installArtifact.doStartCount);
+        assertEquals(1, this.installArtifact.doStopCount);
+        assertEquals(1, this.installArtifact.doUninstallCount);
+    }
+    
+    private final class StubInstallArtifact extends AbstractInstallArtifact {
+
+        public StubInstallArtifact(ArtifactStateMonitor artifactStateMonitor) {
+            super(new ArtifactIdentity("type", "name", Version.emptyVersion, null), new StubArtifactStorage(), artifactStateMonitor, null, new MockEventLogger());
+        }
+
+        private int doStopCount = 0;
+        
+        private int doStartCount = 0;
+        
+        private int doUninstallCount = 0;
+
+        private int doRefreshCount = 0;
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        protected void doStop() throws DeploymentException {
+            this.doStopCount++;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        protected void doUninstall() throws DeploymentException {
+            this.doUninstallCount++;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        protected void doStart(AbortableSignal signal) throws DeploymentException {
+            this.doStartCount++;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        protected boolean doRefresh() throws DeploymentException {
+            this.doRefreshCount++;
+            return true;
+        }
+
+    }
+    
+    
+    
+    
+    
+    static class StubArtifactStorage implements ArtifactStorage {
 
         public void delete() {
         }
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitorTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitorTests.java
index 189221d..45cc52e 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitorTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStateMonitorTests.java
@@ -19,7 +19,7 @@
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
 import org.eclipse.virgo.kernel.deployer.core.StubInstallArtifactLifecycleListener;
 import org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener;
-import org.eclipse.virgo.kernel.install.artifact.internal.ArtifactStateMonitor;
+import org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStateMonitor;
 import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
 
 /**
@@ -35,7 +35,7 @@
     @Before
     public void setUp() {
         this.bundleContext = new StubBundleContext();
-        this.asm = new ArtifactStateMonitor(this.bundleContext);
+        this.asm = new StandardArtifactStateMonitor(this.bundleContext);
         this.listener = new StubInstallArtifactLifecycleListener();
         this.bundleContext.registerService(InstallArtifactLifecycleListener.class.getName(), this.listener, null);
     }
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AtomicInstallArtifactLifecycleListenerTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AtomicInstallArtifactLifecycleListenerTests.java
index cf4a2f6..d0110f6 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AtomicInstallArtifactLifecycleListenerTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/AtomicInstallArtifactLifecycleListenerTests.java
@@ -18,19 +18,16 @@
 import java.util.List;
 import java.util.Set;
 
-import org.junit.Test;
-import org.osgi.framework.Version;
-
-
 import org.eclipse.virgo.kernel.artifact.ArtifactSpecification;
 import org.eclipse.virgo.kernel.artifact.fs.ArtifactFS;
-import org.eclipse.virgo.kernel.core.Signal;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
 import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
 import org.eclipse.virgo.kernel.install.artifact.PlanInstallArtifact;
-import org.eclipse.virgo.kernel.install.artifact.internal.AtomicInstallArtifactLifecycleListener;
 import org.eclipse.virgo.util.common.ThreadSafeArrayListTree;
 import org.eclipse.virgo.util.common.Tree;
+import org.junit.Test;
+import org.osgi.framework.Version;
 
 public class AtomicInstallArtifactLifecycleListenerTests {
 
@@ -305,7 +302,7 @@
             start(null);
         }
 
-        public void start(Signal signal) throws DeploymentException {
+        public void start(AbortableSignal signal) throws DeploymentException {
             this.startCalled = true;
         }
 
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminerTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminerTests.java
index e1681e2..f5011a0 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminerTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardArtifactIdentityDeterminerTests.java
@@ -11,99 +11,97 @@
 
 package org.eclipse.virgo.kernel.install.artifact.internal;
 
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
+import org.eclipse.virgo.repository.ArtifactBridge;
+import org.eclipse.virgo.repository.ArtifactDescriptor;
+import org.eclipse.virgo.repository.ArtifactGenerationException;
+import org.junit.Test;
+import org.osgi.framework.Version;
 
 import java.io.File;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.Version;
+import static org.easymock.EasyMock.*;
+import static org.junit.Assert.*;
 
-import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentity;
-import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentityDeterminer;
-import org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactIdentityDeterminer;
-import org.eclipse.virgo.repository.ArtifactBridge;
-import org.eclipse.virgo.repository.ArtifactDescriptor;
-import org.eclipse.virgo.repository.ArtifactGenerationException;
-
-/**
- */
 public class StandardArtifactIdentityDeterminerTests {
 
-    private ArtifactIdentityDeterminer artifactIdentityDeterminer;
-
-    @Before
-    public void setUp() {
-        this.artifactIdentityDeterminer = new StandardArtifactIdentityDeterminer(Collections.<ArtifactBridge>emptySet());
-    }
+    private static final File TEST_FILE = new File("test");
 
     @Test
-    public void testJarFileType() {
-        ArtifactIdentity identity = this.artifactIdentityDeterminer.determineIdentity(new File("test.jar"), null);
-        assertEquals(ArtifactIdentityDeterminer.BUNDLE_TYPE, identity.getType());
-        assertEquals("test", identity.getName());
-        assertEquals(Version.emptyVersion, identity.getVersion());
+    public void identityWithoutBridge() {
+        ArtifactIdentity identity = new StandardArtifactIdentityDeterminer(Collections.<ArtifactBridge>emptySet()).determineIdentity(TEST_FILE, null);
+        assertNull(identity);
     }
 
     @Test
-    public void testPlanFileType() {
-        ArtifactIdentity identity = this.artifactIdentityDeterminer.determineIdentity(new File("test.plan"), null);
-        assertEquals(ArtifactIdentityDeterminer.PLAN_TYPE, identity.getType());
-        assertEquals("test", identity.getName());
-        assertEquals(Version.emptyVersion, identity.getVersion());
-    }
-
-    @Test
-    public void testPropertiesFileType() {
-        ArtifactIdentity identity = this.artifactIdentityDeterminer.determineIdentity(new File("test.properties"), null);
-        assertEquals(ArtifactIdentityDeterminer.CONFIGURATION_TYPE, identity.getType());
-        assertEquals("test", identity.getName());
-        assertEquals(Version.emptyVersion, identity.getVersion());
-    }
-
-    @Test
-    public void testParFileType() {
-        ArtifactIdentity identity = this.artifactIdentityDeterminer.determineIdentity(new File("test.par"), null);
-        assertEquals(ArtifactIdentityDeterminer.PAR_TYPE, identity.getType());
-        assertEquals("test", identity.getName());
-        assertEquals(Version.emptyVersion, identity.getVersion());
-    }
-
-    @Test
-    public void testWarFileType() {
-        assertNull(this.artifactIdentityDeterminer.determineIdentity(new File("test.war"), null));
-    }
-
-    @Test
-    public void testNoFileType() {
-        assertNull(this.artifactIdentityDeterminer.determineIdentity(new File("test"), null));
-    }
-    
-    @Test
     public void identityFromBridge() throws ArtifactGenerationException {
+        ArtifactDescriptor artifactDescriptor = createArtifactDescriptorMock();
+        ArtifactBridge bridge = createArtifactBridgeMock(artifactDescriptor);
+
+        checkIdentityDeterminer(bridge);
+
+        verify(artifactDescriptor, bridge);
+    }
+
+    @Test
+    public void identityFromBridgeThrowingException() throws ArtifactGenerationException {
+        ArtifactDescriptor artifactDescriptor = createArtifactDescriptorMock();
+        ArtifactBridge interestedBridge = createArtifactBridgeMock(artifactDescriptor);
+
+        ArtifactBridge throwingBridge = createMock(ArtifactBridge.class);
+        expect(throwingBridge.generateArtifactDescriptor(new File("test"))).andThrow(new ArtifactGenerationException("Illegal argument"));
+
+        replay(throwingBridge);
+
+        assertNull(new StandardArtifactIdentityDeterminer(new LinkedHashSet<ArtifactBridge>(Arrays.asList(throwingBridge, interestedBridge))).determineIdentity(new File("test"), null));
+    }
+
+    @Test
+    public void identityFromSeveralBridges() throws ArtifactGenerationException {
+        ArtifactDescriptor artifactDescriptor = createArtifactDescriptorMock();
+        ArtifactBridge interestedBridge = createArtifactBridgeMock(artifactDescriptor);
+
+        ArtifactBridge throwingBridge = createMock(ArtifactBridge.class);
+
+        ArtifactBridge uninterestedBridge = createMock(ArtifactBridge.class);
+        expect(uninterestedBridge.generateArtifactDescriptor(TEST_FILE)).andReturn(null);
+
+        replay(throwingBridge, uninterestedBridge);
+
+        checkIdentityDeterminer(uninterestedBridge,  interestedBridge, throwingBridge);
+
+        verify(artifactDescriptor, throwingBridge, interestedBridge, uninterestedBridge);
+    }
+
+    private ArtifactDescriptor createArtifactDescriptorMock() throws ArtifactGenerationException {
         ArtifactDescriptor artifactDescriptor = createMock(ArtifactDescriptor.class);
         expect(artifactDescriptor.getType()).andReturn("foo");
         expect(artifactDescriptor.getName()).andReturn("bar");
-        expect(artifactDescriptor.getVersion()).andReturn(new Version(1,2,3));
-        
+        expect(artifactDescriptor.getVersion()).andReturn(new Version(1, 2, 3));
+
+        replay(artifactDescriptor);
+
+        return artifactDescriptor;
+    }
+
+    private ArtifactBridge createArtifactBridgeMock(ArtifactDescriptor descriptor) throws ArtifactGenerationException {
         ArtifactBridge bridge = createMock(ArtifactBridge.class);
-        expect(bridge.generateArtifactDescriptor(new File("test"))).andReturn(artifactDescriptor);
-        
-        replay(artifactDescriptor, bridge);
-        
-        ArtifactIdentity artifactIdentity = new StandardArtifactIdentityDeterminer(new HashSet<ArtifactBridge>(Arrays.asList(bridge))).determineIdentity(new File("test"), null);
+        expect(bridge.generateArtifactDescriptor(new File("test"))).andReturn(descriptor);
+
+        replay(bridge);
+
+        return bridge;
+    }
+
+    private void checkIdentityDeterminer(ArtifactBridge... bridges) {
+        ArtifactIdentity artifactIdentity = new StandardArtifactIdentityDeterminer(new LinkedHashSet<ArtifactBridge>(Arrays.asList(bridges))).determineIdentity(TEST_FILE, null);
+        assertNotNull(artifactIdentity);
         assertEquals("foo", artifactIdentity.getType());
         assertEquals("bar", artifactIdentity.getName());
-        assertEquals(new Version(1,2,3), artifactIdentity.getVersion());
-        
-        verify(artifactDescriptor, bridge);
+        assertEquals(new Version(1, 2, 3), artifactIdentity.getVersion());
     }
+
 }
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosureTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosureTests.java
index 42eb145..d9db960 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosureTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactTreeInclosureTests.java
@@ -38,7 +38,7 @@
 import org.eclipse.virgo.kernel.artifact.fs.StandardArtifactFSFactory;
 import org.eclipse.virgo.kernel.core.BundleStarter;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 import org.eclipse.virgo.kernel.install.artifact.BundleInstallArtifact;
 import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
 import org.eclipse.virgo.kernel.install.artifact.InstallArtifactTreeFactory;
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubAbortableSignal.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubAbortableSignal.java
new file mode 100644
index 0000000..a1a86e0
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubAbortableSignal.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+package org.eclipse.virgo.kernel.install.artifact.internal;
+
+import org.eclipse.virgo.kernel.core.AbortableSignal;
+
+class StubAbortableSignal implements AbortableSignal {
+
+    private volatile boolean complete = false;
+    
+    private volatile boolean aborted = false;
+    
+    private volatile Throwable cause = null;
+
+    /**
+     * {@inheritDoc}
+     */
+    public void signalSuccessfulCompletion() {
+        this.complete = true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void signalFailure(Throwable t) {
+        this.complete = true;
+        this.cause = t;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+	public void signalAborted() {
+        this.complete = true;
+        this.aborted = true;
+	}
+    
+    public boolean isComplete() {
+        return this.complete;
+    }
+    
+    public boolean isAborted() {
+        return this.aborted;
+    }
+    
+    public Throwable getCause() {
+        return this.cause;
+    }
+    
+}
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactBridge.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactBridge.java
index c399405..48308a5 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactBridge.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactBridge.java
@@ -49,9 +49,12 @@
      */
     public ArtifactDescriptor generateArtifactDescriptor(File artifactFile) throws ArtifactGenerationException {
         boolean matched = false;
+        final String fileName = artifactFile.getName();
+
         for(String ending : this.matchs){
-            if(artifactFile.getName().endsWith(ending)){
+            if(fileName.endsWith(ending)){
                 matched = true;
+                break;
             }
         }
         
@@ -59,7 +62,7 @@
             return new ArtifactDescriptor() {
                 
                 public Version getVersion() {
-                    return null;
+                    return Version.emptyVersion;
                 }
                 
                 public URI getUri() {
@@ -71,11 +74,11 @@
                 }
                 
                 public String getName() {
-                    return null;
+                    return fileName.substring(0, fileName.lastIndexOf('.'));
                 }
                 
                 public String getFilename() {
-                    return null;
+                    return fileName;
                 }
                 
                 public Set<Attribute> getAttributes() {
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactStateMonitor.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactStateMonitor.java
new file mode 100644
index 0000000..aeba210
--- /dev/null
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/StubArtifactStateMonitor.java
@@ -0,0 +1,164 @@
+/*
+ * This file is part of the Eclipse Virgo project.
+ *
+ * Copyright (c) 2011 copyright_holder
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    cgfrost - initial contribution
+ */
+
+package org.eclipse.virgo.kernel.install.artifact.internal;
+
+import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifact.State;
+
+/**
+ * TODO Document StubArtifactStateMonitor
+ * <p />
+ *
+ * <strong>Concurrent Semantics</strong><br />
+ * TODO Document concurrent semantics of StubArtifactStateMonitor
+ */
+public class StubArtifactStateMonitor implements ArtifactStateMonitor {
+
+    private State myState = State.RESOLVED;
+    
+    /** 
+     * {@inheritDoc}
+     */
+    public State getState() {
+        return this.myState;
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void setState(State state) {
+        this.myState = state;
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onInstalling(InstallArtifact installArtifact) throws DeploymentException {
+
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onInstallFailed(InstallArtifact installArtifact) throws DeploymentException {
+
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onInstalled(InstallArtifact installArtifact) throws DeploymentException {
+
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onResolving(InstallArtifact installArtifact) throws DeploymentException {
+
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onResolveFailed(InstallArtifact installArtifact) throws DeploymentException {
+
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onResolved(InstallArtifact installArtifact) throws DeploymentException {
+
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public boolean onStarting(InstallArtifact installArtifact) throws DeploymentException {
+        return false;
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onStartFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
+
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onStartAborted(InstallArtifact installArtifact) throws DeploymentException {
+
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onStarted(InstallArtifact installArtifact) throws DeploymentException {
+
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onStopping(InstallArtifact installArtifact) {
+
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onStopFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
+
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onStopped(InstallArtifact installArtifact) {
+
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onUnresolved(InstallArtifact installArtifact) throws DeploymentException {
+
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onUninstalling(InstallArtifact installArtifact) throws DeploymentException {
+
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onUninstallFailed(InstallArtifact installArtifact, Throwable cause) throws DeploymentException {
+
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void onUninstalled(InstallArtifact installArtifact) throws DeploymentException {
+
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifactTests.java b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifactTests.java
index 9302107..8716c3e 100644
--- a/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifactTests.java
+++ b/org.eclipse.virgo.kernel.deployer/src/test/java/org/eclipse/virgo/kernel/install/artifact/internal/bundle/StandardBundleInstallArtifactTests.java
@@ -39,6 +39,7 @@
 import org.eclipse.virgo.kernel.install.artifact.BundleInstallArtifact;
 import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
 import org.eclipse.virgo.kernel.install.artifact.internal.ArtifactStateMonitor;
+import org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStateMonitor;
 import org.eclipse.virgo.kernel.install.artifact.internal.StubInstallArtifactRefreshHandler;
 import org.eclipse.virgo.kernel.install.artifact.internal.bundle.BundleDriver;
 import org.eclipse.virgo.kernel.install.artifact.internal.bundle.StandardBundleInstallArtifact;
@@ -65,7 +66,7 @@
 
     private final BundleContext bundleContext = new StubBundleContext();
 
-    private final ArtifactStateMonitor artifactStateMonitor = new ArtifactStateMonitor(this.bundleContext);
+    private final ArtifactStateMonitor artifactStateMonitor = new StandardArtifactStateMonitor(this.bundleContext);
 
     private BundleInstallArtifact createInstallArtifact(ArtifactStorage artifactStorage, ArtifactStateMonitor artifactStateMonitor)
         throws IOException {
diff --git a/org.eclipse.virgo.kernel.deployer/template.mf b/org.eclipse.virgo.kernel.deployer/template.mf
index 877fabb..1706cb7 100644
--- a/org.eclipse.virgo.kernel.deployer/template.mf
+++ b/org.eclipse.virgo.kernel.deployer/template.mf
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Virgo Kernel Deployer
 Bundle-SymbolicName: org.eclipse.virgo.kernel.deployer
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
 Import-Template: 
  org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",
  org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
diff --git a/org.eclipse.virgo.kernel.dmfragment/.classpath b/org.eclipse.virgo.kernel.dmfragment/.classpath
index 543c704..a736de0 100644
--- a/org.eclipse.virgo.kernel.dmfragment/.classpath
+++ b/org.eclipse.virgo.kernel.dmfragment/.classpath
@@ -1,43 +1,43 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="src/main/java">
-		<attributes>
-			<attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="false"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="src" path="src/main/resources">
-		<attributes>
-			<attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="false"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
-		<attributes>
-			<attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="true"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="src" output="target/test-classes" path="src/test/resources">
-		<attributes>
-			<attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="true"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/2.5.6/org.springframework.context-sources-2.5.6.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/2.5.6/org.springframework.beans-sources-2.5.6.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.aop/3.0.0.RELEASE/org.springframework.aop-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.aop/2.5.6/org.springframework.aop-2.5.6.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-sources-1.2.1.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-sources-1.2.1.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-sources-1.2.1.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.5.0.200809221524/org.eclipse.osgi-3.5.0.200809221524.jar"/>
-	<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar">
-		<attributes>
-			<attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
-		</attributes>
-	</classpathentry>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-sources-1.6.1.jar"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.agent.dm"/>
-	<classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>

+<classpath>

+	<classpathentry kind="src" path="src/main/java">

+		<attributes>

+			<attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="false"/>

+		</attributes>

+	</classpathentry>

+	<classpathentry kind="src" path="src/main/resources">

+		<attributes>

+			<attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="false"/>

+		</attributes>

+	</classpathentry>

+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">

+		<attributes>

+			<attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="true"/>

+		</attributes>

+	</classpathentry>

+	<classpathentry kind="src" output="target/test-classes" path="src/test/resources">

+		<attributes>

+			<attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="true"/>

+		</attributes>

+	</classpathentry>

+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/2.5.6/org.springframework.context-sources-2.5.6.jar"/>

+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/2.5.6/org.springframework.beans-sources-2.5.6.jar"/>

+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>

+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.aop/3.0.0.RELEASE/org.springframework.aop-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.aop/2.5.6/org.springframework.aop-2.5.6.jar"/>

+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-sources-1.2.1.jar"/>

+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-sources-1.2.1.jar"/>

+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-sources-1.2.1.jar"/>

+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.5.0.200809221524/org.eclipse.osgi-3.5.0.200809221524.jar"/>

+	<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>

+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar">

+		<attributes>

+			<attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>

+		</attributes>

+	</classpathentry>

+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-sources-1.6.1.jar"/>

+	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/>

+	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/>

+	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.agent.dm"/>

+	<classpathentry kind="output" path="target/classes"/>

+</classpath>

diff --git a/org.eclipse.virgo.kernel.dmfragment/.project b/org.eclipse.virgo.kernel.dmfragment/.project
index db96168..6b11756 100644
--- a/org.eclipse.virgo.kernel.dmfragment/.project
+++ b/org.eclipse.virgo.kernel.dmfragment/.project
@@ -1,37 +1,37 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>org.eclipse.virgo.kernel.dmfragment</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.wst.common.project.facet.core.builder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.ajdt.core.ajbuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.springframework.ide.eclipse.core.springbuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>com.springsource.server.ide.bundlor.core.builder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.ajdt.ui.ajnature</nature>
-		<nature>com.springsource.server.ide.facet.core.bundlenature</nature>
-		<nature>org.springframework.ide.eclipse.core.springnature</nature>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-		<nature>com.springsource.server.dev.eclipse.serverdevelopmentnature</nature>
-		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
-	</natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>

+<projectDescription>

+	<name>org.eclipse.virgo.kernel.dmfragment</name>

+	<comment></comment>

+	<projects>

+	</projects>

+	<buildSpec>

+		<buildCommand>

+			<name>org.eclipse.wst.common.project.facet.core.builder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.eclipse.ajdt.core.ajbuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>org.springframework.ide.eclipse.core.springbuilder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+		<buildCommand>

+			<name>com.springsource.server.ide.bundlor.core.builder</name>

+			<arguments>

+			</arguments>

+		</buildCommand>

+	</buildSpec>

+	<natures>

+		<nature>org.eclipse.ajdt.ui.ajnature</nature>

+		<nature>com.springsource.server.ide.facet.core.bundlenature</nature>

+		<nature>org.springframework.ide.eclipse.core.springnature</nature>

+		<nature>org.eclipse.jdt.core.javanature</nature>

+		<nature>com.springsource.server.dev.eclipse.serverdevelopmentnature</nature>

+		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>

+	</natures>

+</projectDescription>

diff --git a/org.eclipse.virgo.kernel.dmfragment/.settings/com.springsource.server.ide.bundlor.core.prefs b/org.eclipse.virgo.kernel.dmfragment/.settings/com.springsource.server.ide.bundlor.core.prefs
index 61ee8a9..d4dd06e 100644
--- a/org.eclipse.virgo.kernel.dmfragment/.settings/com.springsource.server.ide.bundlor.core.prefs
+++ b/org.eclipse.virgo.kernel.dmfragment/.settings/com.springsource.server.ide.bundlor.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 06 09:06:52 BST 2009
-com.springsource.server.ide.bundlor.core.template.properties.files=../build.properties;../build.versions
-eclipse.preferences.version=1
+#Mon Jul 06 09:06:52 BST 2009

+com.springsource.server.ide.bundlor.core.template.properties.files=../build.properties;../build.versions

+eclipse.preferences.version=1

diff --git a/org.eclipse.virgo.kernel.dmfragment/.settings/org.eclipse.wst.common.project.facet.core.xml b/org.eclipse.virgo.kernel.dmfragment/.settings/org.eclipse.wst.common.project.facet.core.xml
index 801f856..c9a337a 100644
--- a/org.eclipse.virgo.kernel.dmfragment/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ b/org.eclipse.virgo.kernel.dmfragment/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<faceted-project>
-  <installed facet="com.springsource.server.bundle" version="1.0"/>
-</faceted-project>
+<?xml version="1.0" encoding="UTF-8"?>

+<faceted-project>

+  <installed facet="com.springsource.server.bundle" version="1.0"/>

+</faceted-project>

diff --git a/org.eclipse.virgo.kernel.dmfragment/.settings/org.springframework.ide.eclipse.beans.core.prefs b/org.eclipse.virgo.kernel.dmfragment/.settings/org.springframework.ide.eclipse.beans.core.prefs
index e68da31..b8bf5a6 100644
--- a/org.eclipse.virgo.kernel.dmfragment/.settings/org.springframework.ide.eclipse.beans.core.prefs
+++ b/org.eclipse.virgo.kernel.dmfragment/.settings/org.springframework.ide.eclipse.beans.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 06 16:49:15 BST 2009
-eclipse.preferences.version=1
-org.springframework.ide.eclipse.beans.core.ignoreMissingNamespaceHandler=false
+#Mon Jul 06 16:49:15 BST 2009

+eclipse.preferences.version=1

+org.springframework.ide.eclipse.beans.core.ignoreMissingNamespaceHandler=false

diff --git a/org.eclipse.virgo.kernel.dmfragment/.springBeans b/org.eclipse.virgo.kernel.dmfragment/.springBeans
index a151801..9b08bae 100644
--- a/org.eclipse.virgo.kernel.dmfragment/.springBeans
+++ b/org.eclipse.virgo.kernel.dmfragment/.springBeans
@@ -1,14 +1,14 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beansProjectDescription>
-	<version>1</version>
-	<pluginVersion><![CDATA[2.2.5.200906231226-RC1]]></pluginVersion>
-	<configSuffixes>
-		<configSuffix><![CDATA[xml]]></configSuffix>
-	</configSuffixes>
-	<enableImports><![CDATA[false]]></enableImports>
-	<configs>
-		<config>src/main/resources/META-INF/spring/extender/kernel-dmfragment-context.xml</config>
-	</configs>
-	<configSets>
-	</configSets>
-</beansProjectDescription>
+<?xml version="1.0" encoding="UTF-8"?>

+<beansProjectDescription>

+	<version>1</version>

+	<pluginVersion><![CDATA[2.2.5.200906231226-RC1]]></pluginVersion>

+	<configSuffixes>

+		<configSuffix><![CDATA[xml]]></configSuffix>

+	</configSuffixes>

+	<enableImports><![CDATA[false]]></enableImports>

+	<configs>

+		<config>src/main/resources/META-INF/spring/extender/kernel-dmfragment-context.xml</config>

+	</configs>

+	<configSets>

+	</configSets>

+</beansProjectDescription>

diff --git a/org.eclipse.virgo.kernel.dmfragment/build.xml b/org.eclipse.virgo.kernel.dmfragment/build.xml
index 70d6c23..7ee9d51 100644
--- a/org.eclipse.virgo.kernel.dmfragment/build.xml
+++ b/org.eclipse.virgo.kernel.dmfragment/build.xml
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="org.eclipse.virgo.kernel.dmfragment">
-
-	<property file="${basedir}/../build.properties"/>
-	<property file="${basedir}/../build.versions"/>
-	<import file="${basedir}/../virgo-build/weaving/default.xml"/>
-
-</project>
+<?xml version="1.0" encoding="UTF-8"?>

+<project name="org.eclipse.virgo.kernel.dmfragment">

+

+	<property file="${basedir}/../build.properties"/>

+	<property file="${basedir}/../build.versions"/>

+	<import file="${basedir}/../virgo-build/weaving/default.xml"/>

+

+</project>

diff --git a/org.eclipse.virgo.kernel.dmfragment/ivy.xml b/org.eclipse.virgo.kernel.dmfragment/ivy.xml
index 670982d..7c5cab0 100644
--- a/org.eclipse.virgo.kernel.dmfragment/ivy.xml
+++ b/org.eclipse.virgo.kernel.dmfragment/ivy.xml
@@ -1,40 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-stylesheet type="text/xsl" href="http://ivyrep.jayasoft.org/ivy-doc.xsl"?>
-<ivy-module
-		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-		xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd"
-		version="1.3">
-
-	<info organisation="org.eclipse.virgo.kernel" module="${ant.project.name}"/>
-
-	<configurations>
-		<include file="${virgo.build.dir}/common/default-ivy-configurations.xml"/>
-	</configurations>
-
-	<publications>
-		<artifact name="${ant.project.name}"/>
-		<artifact name="${ant.project.name}-sources" type="src" ext="jar"/>
-	</publications>
-
-	<dependencies>
-		<dependency org="org.springframework" name="org.springframework.beans" rev="${org.springframework}" conf="compile->runtime"/>
-		<dependency org="org.springframework" name="org.springframework.context" rev="${org.springframework}" conf="compile->runtime"/>
-		<dependency org="org.springframework" name="org.springframework.context.support" rev="${org.springframework}" conf="compile->runtime"/>
-		<dependency org="org.springframework" name="org.springframework.core" rev="${org.springframework}" conf="compile->runtime"/>
-		<dependency org="org.springframework.osgi" name="org.springframework.osgi.core" rev="${org.springframework.osgi}" conf="compile->runtime"/>
-		<dependency org="org.springframework.osgi" name="org.springframework.osgi.extender" rev="${org.springframework.osgi}" conf="compile->runtime"/>
-		<dependency org="org.springframework.osgi" name="org.springframework.osgi.io" rev="${org.springframework.osgi}" conf="compile->runtime"/>
-		
-		<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.core" rev="latest.integration" conf="compile->compile"/>
-		<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.osgi" rev="latest.integration" conf="compile->compile"/>
-
-		<dependency org="org.slf4j" name="com.springsource.slf4j.api" rev="${org.slf4j}" conf="compile->runtime"/>
-		<dependency org="org.slf4j" name="com.springsource.slf4j.nop" rev="${org.slf4j}" conf="test->runtime"/>
-
-		<dependency org="org.eclipse.virgo.medic" name="org.eclipse.virgo.medic" rev="${org.eclipse.virgo.medic}" conf="aspects, compile->runtime"/>
-		<dependency org="org.eclipse.virgo.medic" name="org.eclipse.virgo.medic.core" rev="${org.eclipse.virgo.medic}" conf="runtime->runtime"/>
-		
-		<override org="org.springframework" rev="${org.springframework}"/>
-		<override org="org.eclipse.virgo.util" rev="${org.eclipse.virgo.util}"/>
-	</dependencies>
-</ivy-module>
+<?xml version="1.0" encoding="UTF-8"?>

+<?xml-stylesheet type="text/xsl" href="http://ivyrep.jayasoft.org/ivy-doc.xsl"?>

+<ivy-module

+		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+		xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd"

+		version="1.3">

+

+	<info organisation="org.eclipse.virgo.kernel" module="${ant.project.name}"/>

+

+	<configurations>

+		<include file="${virgo.build.dir}/common/default-ivy-configurations.xml"/>

+	</configurations>

+

+	<publications>

+		<artifact name="${ant.project.name}"/>

+		<artifact name="${ant.project.name}-sources" type="src" ext="jar"/>

+	</publications>

+

+	<dependencies>

+		<dependency org="org.springframework" name="org.springframework.beans" rev="${org.springframework}" conf="compile->runtime"/>

+		<dependency org="org.springframework" name="org.springframework.context" rev="${org.springframework}" conf="compile->runtime"/>

+		<dependency org="org.springframework" name="org.springframework.context.support" rev="${org.springframework}" conf="compile->runtime"/>

+		<dependency org="org.springframework" name="org.springframework.core" rev="${org.springframework}" conf="compile->runtime"/>

+		<dependency org="org.springframework.osgi" name="org.springframework.osgi.core" rev="${org.springframework.osgi}" conf="compile->runtime"/>

+		<dependency org="org.springframework.osgi" name="org.springframework.osgi.extender" rev="${org.springframework.osgi}" conf="compile->runtime"/>

+		<dependency org="org.springframework.osgi" name="org.springframework.osgi.io" rev="${org.springframework.osgi}" conf="compile->runtime"/>

+		

+		<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.core" rev="latest.integration" conf="compile->compile"/>

+		<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.osgi" rev="latest.integration" conf="compile->compile"/>

+

+		<dependency org="org.slf4j" name="com.springsource.slf4j.api" rev="${org.slf4j}" conf="compile->runtime"/>

+		<dependency org="org.slf4j" name="com.springsource.slf4j.nop" rev="${org.slf4j}" conf="test->runtime"/>

+

+		<dependency org="org.eclipse.virgo.medic" name="org.eclipse.virgo.medic" rev="${org.eclipse.virgo.medic}" conf="aspects, compile->runtime"/>

+		<dependency org="org.eclipse.virgo.medic" name="org.eclipse.virgo.medic.core" rev="${org.eclipse.virgo.medic}" conf="runtime->runtime"/>

+		

+		<override org="org.springframework" rev="${org.springframework}"/>

+		<override org="org.eclipse.virgo.util" rev="${org.eclipse.virgo.util}"/>

+	</dependencies>

+</ivy-module>

diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/ModuleBeanFactoryPostProcessor.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/ModuleBeanFactoryPostProcessor.java
index 8c252b1..18c7441 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/ModuleBeanFactoryPostProcessor.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/ModuleBeanFactoryPostProcessor.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.dmfragment;
-
-import org.osgi.framework.BundleContext;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-
-/**
- * <strong>Concurrent Semantics</strong><br />
- * 
- * Implementations must be thread-safe.
- * 
- */
-public interface ModuleBeanFactoryPostProcessor {
-
-    void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory);
-}
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   VMware Inc. - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.dmfragment;

+

+import org.osgi.framework.BundleContext;

+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

+

+/**

+ * <strong>Concurrent Semantics</strong><br />

+ * 

+ * Implementations must be thread-safe.

+ * 

+ */

+public interface ModuleBeanFactoryPostProcessor {

+

+    void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory);

+}

diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBean.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBean.java
index 579c69f..c9c992e 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBean.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBean.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.dmfragment.internal;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.BeanFactoryUtils;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationEvent;
-import org.springframework.context.ApplicationListener;
-import org.springframework.context.event.ApplicationContextEvent;
-import org.springframework.context.event.ContextClosedEvent;
-import org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean;
-
-/**
- * {@link ApplicationContextShutdownBean} manages the shutting down of application contexts in the dm Server. In
- * particular it is responsible for ensuring that Spring DM service proxies do not hold up application context shutdown.
- * <p />
- * 
- * <strong>Concurrent Semantics</strong><br />
- * 
- * This class is thread safe.
- * 
- */
-// Note that this class must not implement ApplicationListener<ContextClosedEvent> since it needs to work with Spring
-// 2.5.x as well as Spring 3 and beyond.
-final class ApplicationContextShutdownBean implements ApplicationListener<ApplicationEvent> {
-
-    private static final Logger logger = LoggerFactory.getLogger(ApplicationContextShutdownBean.class);
-
-    /**
-     * {@inheritDoc}
-     */
-    public void onApplicationEvent(ApplicationEvent event) {
-        if (event instanceof ContextClosedEvent) {
-            logger.info("Processing ContextClosedEvent '{}'", event);
-            ApplicationContext applicationContext = ((ApplicationContextEvent) event).getApplicationContext();
-            disableServiceProxyRetry(applicationContext);
-        }
-    }
-
-    static void disableServiceProxyRetry(ApplicationContext applicationContext) {
-        for (OsgiServiceProxyFactoryBean proxyBean : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext,
-            OsgiServiceProxyFactoryBean.class, true, false).values()) {
-            logger.info("Setting timeout to 0 for proxy '{}' of application context '{}'", proxyBean, applicationContext);
-            proxyBean.setTimeout(0);
-        }
-    }
-}
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   VMware Inc. - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.dmfragment.internal;

+

+import org.slf4j.Logger;

+import org.slf4j.LoggerFactory;

+import org.springframework.beans.factory.BeanFactoryUtils;

+import org.springframework.context.ApplicationContext;

+import org.springframework.context.ApplicationEvent;

+import org.springframework.context.ApplicationListener;

+import org.springframework.context.event.ApplicationContextEvent;

+import org.springframework.context.event.ContextClosedEvent;

+import org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean;

+

+/**

+ * {@link ApplicationContextShutdownBean} manages the shutting down of application contexts in the dm Server. In

+ * particular it is responsible for ensuring that Spring DM service proxies do not hold up application context shutdown.

+ * <p />

+ * 

+ * <strong>Concurrent Semantics</strong><br />

+ * 

+ * This class is thread safe.

+ * 

+ */

+// Note that this class must not implement ApplicationListener<ContextClosedEvent> since it needs to work with Spring

+// 2.5.x as well as Spring 3 and beyond.

+final class ApplicationContextShutdownBean implements ApplicationListener<ApplicationEvent> {

+

+    private static final Logger logger = LoggerFactory.getLogger(ApplicationContextShutdownBean.class);

+

+    /**

+     * {@inheritDoc}

+     */

+    public void onApplicationEvent(ApplicationEvent event) {

+        if (event instanceof ContextClosedEvent) {

+            logger.info("Processing ContextClosedEvent '{}'", event);

+            ApplicationContext applicationContext = ((ApplicationContextEvent) event).getApplicationContext();

+            disableServiceProxyRetry(applicationContext);

+        }

+    }

+

+    static void disableServiceProxyRetry(ApplicationContext applicationContext) {

+        for (OsgiServiceProxyFactoryBean proxyBean : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext,

+            OsgiServiceProxyFactoryBean.class, true, false).values()) {

+            logger.info("Setting timeout to 0 for proxy '{}' of application context '{}'", proxyBean, applicationContext);

+            proxyBean.setTimeout(0);

+        }

+    }

+}

diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBeanPostProcessor.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBeanPostProcessor.java
index cb9e6b7..28c148e 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBeanPostProcessor.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ApplicationContextShutdownBeanPostProcessor.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.dmfragment.internal;
-
-import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;
-import org.osgi.framework.BundleContext;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-
-
-
-final class ApplicationContextShutdownBeanPostProcessor implements ModuleBeanFactoryPostProcessor{
-
-    private static final String APPLICATION_CONTEXT_SHUTDOWN_BEAN_NAME = "org.eclipse.virgo.server.applicationContextShutdownBean";
-    
-    /** 
-     * {@inheritDoc}
-     */
-    public void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {
-        beanFactory.registerSingleton(APPLICATION_CONTEXT_SHUTDOWN_BEAN_NAME, new ApplicationContextShutdownBean());
-    }
-
-}
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   VMware Inc. - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.dmfragment.internal;

+

+import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;

+import org.osgi.framework.BundleContext;

+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

+

+

+

+final class ApplicationContextShutdownBeanPostProcessor implements ModuleBeanFactoryPostProcessor{

+

+    private static final String APPLICATION_CONTEXT_SHUTDOWN_BEAN_NAME = "org.eclipse.virgo.server.applicationContextShutdownBean";

+    

+    /** 

+     * {@inheritDoc}

+     */

+    public void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {

+        beanFactory.registerSingleton(APPLICATION_CONTEXT_SHUTDOWN_BEAN_NAME, new ApplicationContextShutdownBean());

+    }

+

+}

diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ContextClassLoaderPostProcessor.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ContextClassLoaderPostProcessor.java
index 1fc41bf..dcc4f09 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ContextClassLoaderPostProcessor.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ContextClassLoaderPostProcessor.java
@@ -1,69 +1,69 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.dmfragment.internal;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;
-import org.osgi.framework.BundleContext;
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.osgi.extender.OsgiBeanFactoryPostProcessor;
-import org.springframework.osgi.service.importer.support.ImportContextClassLoader;
-import org.springframework.osgi.service.importer.support.OsgiServiceCollectionProxyFactoryBean;
-import org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean;
-
-
-/**
- * {@link OsgiBeanFactoryPostProcessor} that ensures that all service references are in unmanaged mode for thread
- * context class loader propagation.<p/>
- * 
- * <strong>Concurrent Semantics</strong><br />
- * 
- * Threadsafe.
- * 
- */
-final class ContextClassLoaderPostProcessor implements ModuleBeanFactoryPostProcessor {
-
-    private static final String PROPERTY_CONTEXT_CLASS_LOADER = "contextClassLoader";
-
-    private static final Set<String> IMPORTER_CLASS_NAMES = createImportClassNames();
-
-    /**
-     * {@inheritDoc}
-     */
-    @SuppressWarnings("deprecation")
-    public void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {
-        String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames();
-        for (String name : beanDefinitionNames) {
-            BeanDefinition beanDefinition = beanFactory.getBeanDefinition(name);
-            if (isServiceImportDefinition(beanDefinition)) {
-                MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();
-                propertyValues.addPropertyValue(PROPERTY_CONTEXT_CLASS_LOADER, ImportContextClassLoader.UNMANAGED.getLabel());
-            }
-        }
-    }
-
-    private static Set<String> createImportClassNames() {
-        Set<String> names = new HashSet<String>();
-        names.add(OsgiServiceProxyFactoryBean.class.getName());
-        names.add(OsgiServiceCollectionProxyFactoryBean.class.getName());
-        return names;
-    }
-
-    private boolean isServiceImportDefinition(BeanDefinition beanDefinition) {
-        return IMPORTER_CLASS_NAMES.contains(beanDefinition.getBeanClassName());
-    }
-
-}
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   VMware Inc. - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.dmfragment.internal;

+

+import java.util.HashSet;

+import java.util.Set;

+

+import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;

+import org.osgi.framework.BundleContext;

+import org.springframework.beans.MutablePropertyValues;

+import org.springframework.beans.factory.config.BeanDefinition;

+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

+import org.springframework.osgi.extender.OsgiBeanFactoryPostProcessor;

+import org.springframework.osgi.service.importer.support.ImportContextClassLoader;

+import org.springframework.osgi.service.importer.support.OsgiServiceCollectionProxyFactoryBean;

+import org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean;

+

+

+/**

+ * {@link OsgiBeanFactoryPostProcessor} that ensures that all service references are in unmanaged mode for thread

+ * context class loader propagation.<p/>

+ * 

+ * <strong>Concurrent Semantics</strong><br />

+ * 

+ * Threadsafe.

+ * 

+ */

+final class ContextClassLoaderPostProcessor implements ModuleBeanFactoryPostProcessor {

+

+    private static final String PROPERTY_CONTEXT_CLASS_LOADER = "contextClassLoader";

+

+    private static final Set<String> IMPORTER_CLASS_NAMES = createImportClassNames();

+

+    /**

+     * {@inheritDoc}

+     */

+    @SuppressWarnings("deprecation")

+    public void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {

+        String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames();

+        for (String name : beanDefinitionNames) {

+            BeanDefinition beanDefinition = beanFactory.getBeanDefinition(name);

+            if (isServiceImportDefinition(beanDefinition)) {

+                MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();

+                propertyValues.addPropertyValue(PROPERTY_CONTEXT_CLASS_LOADER, ImportContextClassLoader.UNMANAGED.getLabel());

+            }

+        }

+    }

+

+    private static Set<String> createImportClassNames() {

+        Set<String> names = new HashSet<String>();

+        names.add(OsgiServiceProxyFactoryBean.class.getName());

+        names.add(OsgiServiceCollectionProxyFactoryBean.class.getName());

+        return names;

+    }

+

+    private boolean isServiceImportDefinition(BeanDefinition beanDefinition) {

+        return IMPORTER_CLASS_NAMES.contains(beanDefinition.getBeanClassName());

+    }

+

+}

diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelAnnotationMBeanExporter.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelAnnotationMBeanExporter.java
index 111b288..f8a0b66 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelAnnotationMBeanExporter.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelAnnotationMBeanExporter.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.dmfragment.internal;
-
-import javax.management.MBeanException;
-import javax.management.modelmbean.ModelMBean;
-
-import org.eclipse.virgo.kernel.shim.serviceability.TracingService;
-import org.springframework.jmx.export.annotation.AnnotationMBeanExporter;
-
-
-/**
- * An extension of {@link AnnotationMBeanExporter} that exports Kernel-specific MBeans.
- * 
- * <strong>Concurrent Semantics</strong><br />
- * As thread-safe as <code>MBeanExporter</code>.
- */
-final class KernelAnnotationMBeanExporter extends AnnotationMBeanExporter {
-
-    private final TracingService tracingService;
-
-    KernelAnnotationMBeanExporter(TracingService tracingService) {
-        this.tracingService = tracingService;
-    }
-
-    @Override
-    protected ModelMBean createModelMBean() throws MBeanException {
-        return new KernelModelMBean(this.tracingService, this.tracingService.getCurrentApplicationName());
-    }
-}
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   VMware Inc. - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.dmfragment.internal;

+

+import javax.management.MBeanException;

+import javax.management.modelmbean.ModelMBean;

+

+import org.eclipse.virgo.kernel.shim.serviceability.TracingService;

+import org.springframework.jmx.export.annotation.AnnotationMBeanExporter;

+

+

+/**

+ * An extension of {@link AnnotationMBeanExporter} that exports Kernel-specific MBeans.

+ * 

+ * <strong>Concurrent Semantics</strong><br />

+ * As thread-safe as <code>MBeanExporter</code>.

+ */

+final class KernelAnnotationMBeanExporter extends AnnotationMBeanExporter {

+

+    private final TracingService tracingService;

+

+    KernelAnnotationMBeanExporter(TracingService tracingService) {

+        this.tracingService = tracingService;

+    }

+

+    @Override

+    protected ModelMBean createModelMBean() throws MBeanException {

+        return new KernelModelMBean(this.tracingService, this.tracingService.getCurrentApplicationName());

+    }

+}

diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelExtensionConfiguringOsgiPostProcessor.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelExtensionConfiguringOsgiPostProcessor.java
index f20252a..0fc7c1d 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelExtensionConfiguringOsgiPostProcessor.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelExtensionConfiguringOsgiPostProcessor.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.dmfragment.internal;
-
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;
-import org.osgi.framework.BundleContext;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.osgi.extender.OsgiBeanFactoryPostProcessor;
-
-
-/**
- * {@link OsgiBeanFactoryPostProcessor} implementation that plugs in Server extensions implementation when needed.<p/>
- * 
- * <strong>Concurrent Semantics</strong><br />
- * 
- * Threadsafe.
- * 
- */
-final class KernelExtensionConfiguringOsgiPostProcessor implements OsgiBeanFactoryPostProcessor {
-
-    private final List<ModuleBeanFactoryPostProcessor> postProcessors = new CopyOnWriteArrayList<ModuleBeanFactoryPostProcessor>();
-
-    KernelExtensionConfiguringOsgiPostProcessor(List<ModuleBeanFactoryPostProcessor> defaultPostProcessors) {
-        this.postProcessors.addAll(defaultPostProcessors);
-
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void postProcessBeanFactory(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {
-        for (ModuleBeanFactoryPostProcessor postProcessor : this.postProcessors) {
-            postProcessor.postProcess(bundleContext, beanFactory);
-        }
-    }
-
-}
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   VMware Inc. - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.dmfragment.internal;

+

+import java.util.List;

+import java.util.concurrent.CopyOnWriteArrayList;

+

+import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;

+import org.osgi.framework.BundleContext;

+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

+import org.springframework.osgi.extender.OsgiBeanFactoryPostProcessor;

+

+

+/**

+ * {@link OsgiBeanFactoryPostProcessor} implementation that plugs in Server extensions implementation when needed.<p/>

+ * 

+ * <strong>Concurrent Semantics</strong><br />

+ * 

+ * Threadsafe.

+ * 

+ */

+final class KernelExtensionConfiguringOsgiPostProcessor implements OsgiBeanFactoryPostProcessor {

+

+    private final List<ModuleBeanFactoryPostProcessor> postProcessors = new CopyOnWriteArrayList<ModuleBeanFactoryPostProcessor>();

+

+    KernelExtensionConfiguringOsgiPostProcessor(List<ModuleBeanFactoryPostProcessor> defaultPostProcessors) {

+        this.postProcessors.addAll(defaultPostProcessors);

+

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public void postProcessBeanFactory(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {

+        for (ModuleBeanFactoryPostProcessor postProcessor : this.postProcessors) {

+            postProcessor.postProcess(bundleContext, beanFactory);

+        }

+    }

+

+}

diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelLoadTimeWeaver.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelLoadTimeWeaver.java
index 0c04439..af0b804 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelLoadTimeWeaver.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelLoadTimeWeaver.java
@@ -1,97 +1,97 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.dmfragment.internal;
-
-import java.lang.instrument.ClassFileTransformer;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.springframework.beans.factory.BeanClassLoaderAware;
-import org.springframework.instrument.classloading.LoadTimeWeaver;
-import org.springframework.osgi.util.BundleDelegatingClassLoader;
-
-import org.eclipse.virgo.kernel.osgi.framework.InstrumentableClassLoader;
-import org.eclipse.virgo.kernel.osgi.framework.OsgiFramework;
-
-/**
- * {@link LoadTimeWeaver} implementation that plugs into the {@link InstrumentableClassLoader
- * InstrumentableClassLoaders} created for all installed bundles.<p/>
- * 
- * <strong>Concurrent Semantics</strong><br />
- * 
- * Threadsafe.
- * 
- */
-final class KernelLoadTimeWeaver implements LoadTimeWeaver, BeanClassLoaderAware {
-
-    private volatile InstrumentableClassLoader instrumentableClassLoader;
-
-    /**
-     * {@inheritDoc}
-     */
-    public void addTransformer(ClassFileTransformer transformer) {
-        this.instrumentableClassLoader.addClassFileTransformer(transformer);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public ClassLoader getInstrumentableClassLoader() {
-        return (ClassLoader) this.instrumentableClassLoader;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public ClassLoader getThrowawayClassLoader() {
-        return this.instrumentableClassLoader.createThrowAway();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setBeanClassLoader(ClassLoader classLoader) {
-        InstrumentableClassLoader instrumentableClassLoader = null;
-        if (classLoader instanceof InstrumentableClassLoader) {
-            instrumentableClassLoader = (InstrumentableClassLoader) classLoader;
-        } else if (classLoader instanceof BundleDelegatingClassLoader) {
-            Bundle bundle = ((BundleDelegatingClassLoader) classLoader).getBundle();
-            ClassLoader bundleClassLoader = getBundleClassLoader(bundle);
-            if (bundleClassLoader instanceof InstrumentableClassLoader) {
-                instrumentableClassLoader = (InstrumentableClassLoader) bundleClassLoader;
-            }
-        }
-        if (instrumentableClassLoader == null) {
-            throw new IllegalStateException("ClassLoader '" + classLoader + "' is not instrumentable.");
-        }
-        this.instrumentableClassLoader = instrumentableClassLoader;
-    }
-
-    /**
-     * Gets the {@link ClassLoader} for the supplied {@link Bundle}.
-     * 
-     * @param bundle the <code>Bundle</code>.
-     * @return the <code>Bundles</code> <code>ClassLoader</code>.
-     */
-    private ClassLoader getBundleClassLoader(Bundle bundle) {
-        BundleContext bundleContext = bundle.getBundleContext();
-        ServiceReference<OsgiFramework> serviceReference = bundleContext.getServiceReference(OsgiFramework.class);
-        try {
-            OsgiFramework framework = bundleContext.getService(serviceReference);
-            return framework.getBundleClassLoader(bundle);
-        } finally {
-            bundleContext.ungetService(serviceReference);
-        }
-    }
-
-}
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   VMware Inc. - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.dmfragment.internal;

+

+import java.lang.instrument.ClassFileTransformer;

+

+import org.osgi.framework.Bundle;

+import org.osgi.framework.BundleContext;

+import org.osgi.framework.ServiceReference;

+import org.springframework.beans.factory.BeanClassLoaderAware;

+import org.springframework.instrument.classloading.LoadTimeWeaver;

+import org.springframework.osgi.util.BundleDelegatingClassLoader;

+

+import org.eclipse.virgo.kernel.osgi.framework.InstrumentableClassLoader;

+import org.eclipse.virgo.kernel.osgi.framework.OsgiFramework;

+

+/**

+ * {@link LoadTimeWeaver} implementation that plugs into the {@link InstrumentableClassLoader

+ * InstrumentableClassLoaders} created for all installed bundles.<p/>

+ * 

+ * <strong>Concurrent Semantics</strong><br />

+ * 

+ * Threadsafe.

+ * 

+ */

+final class KernelLoadTimeWeaver implements LoadTimeWeaver, BeanClassLoaderAware {

+

+    private volatile InstrumentableClassLoader instrumentableClassLoader;

+

+    /**

+     * {@inheritDoc}

+     */

+    public void addTransformer(ClassFileTransformer transformer) {

+        this.instrumentableClassLoader.addClassFileTransformer(transformer);

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public ClassLoader getInstrumentableClassLoader() {

+        return (ClassLoader) this.instrumentableClassLoader;

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public ClassLoader getThrowawayClassLoader() {

+        return this.instrumentableClassLoader.createThrowAway();

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public void setBeanClassLoader(ClassLoader classLoader) {

+        InstrumentableClassLoader instrumentableClassLoader = null;

+        if (classLoader instanceof InstrumentableClassLoader) {

+            instrumentableClassLoader = (InstrumentableClassLoader) classLoader;

+        } else if (classLoader instanceof BundleDelegatingClassLoader) {

+            Bundle bundle = ((BundleDelegatingClassLoader) classLoader).getBundle();

+            ClassLoader bundleClassLoader = getBundleClassLoader(bundle);

+            if (bundleClassLoader instanceof InstrumentableClassLoader) {

+                instrumentableClassLoader = (InstrumentableClassLoader) bundleClassLoader;

+            }

+        }

+        if (instrumentableClassLoader == null) {

+            throw new IllegalStateException("ClassLoader '" + classLoader + "' is not instrumentable.");

+        }

+        this.instrumentableClassLoader = instrumentableClassLoader;

+    }

+

+    /**

+     * Gets the {@link ClassLoader} for the supplied {@link Bundle}.

+     * 

+     * @param bundle the <code>Bundle</code>.

+     * @return the <code>Bundles</code> <code>ClassLoader</code>.

+     */

+    private ClassLoader getBundleClassLoader(Bundle bundle) {

+        BundleContext bundleContext = bundle.getBundleContext();

+        ServiceReference<OsgiFramework> serviceReference = bundleContext.getServiceReference(OsgiFramework.class);

+        try {

+            OsgiFramework framework = bundleContext.getService(serviceReference);

+            return framework.getBundleClassLoader(bundle);

+        } finally {

+            bundleContext.ungetService(serviceReference);

+        }

+    }

+

+}

diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelMBeanExporter.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelMBeanExporter.java
index d6cb410..96a9ba0 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelMBeanExporter.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelMBeanExporter.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.dmfragment.internal;
-
-import javax.management.MBeanException;
-import javax.management.modelmbean.ModelMBean;
-
-import org.eclipse.virgo.kernel.shim.serviceability.TracingService;
-import org.springframework.jmx.export.MBeanExporter;
-
-
-/**
- * An extension of {@link MBeanExporter} that exports Server-specific MBeans.
- * 
- * <strong>Concurrent Semantics</strong><br />
- * As thread-safe as <code>MBeanExporter</code>.
- * 
- */
-final class KernelMBeanExporter extends MBeanExporter {
-
-    private final TracingService tracingService;
-
-    KernelMBeanExporter(TracingService tracingService) {
-        this.tracingService = tracingService;
-    }
-
-    @Override
-    protected ModelMBean createModelMBean() throws MBeanException {
-        return new KernelModelMBean(this.tracingService, this.tracingService.getCurrentApplicationName());
-    }
-}
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   VMware Inc. - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.dmfragment.internal;

+

+import javax.management.MBeanException;

+import javax.management.modelmbean.ModelMBean;

+

+import org.eclipse.virgo.kernel.shim.serviceability.TracingService;

+import org.springframework.jmx.export.MBeanExporter;

+

+

+/**

+ * An extension of {@link MBeanExporter} that exports Server-specific MBeans.

+ * 

+ * <strong>Concurrent Semantics</strong><br />

+ * As thread-safe as <code>MBeanExporter</code>.

+ * 

+ */

+final class KernelMBeanExporter extends MBeanExporter {

+

+    private final TracingService tracingService;

+

+    KernelMBeanExporter(TracingService tracingService) {

+        this.tracingService = tracingService;

+    }

+

+    @Override

+    protected ModelMBean createModelMBean() throws MBeanException {

+        return new KernelModelMBean(this.tracingService, this.tracingService.getCurrentApplicationName());

+    }

+}

diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelModelMBean.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelModelMBean.java
index 3f35774..faae0f0 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelModelMBean.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/KernelModelMBean.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.dmfragment.internal;
-
-import javax.management.MBeanException;
-import javax.management.ReflectionException;
-import javax.management.RuntimeOperationsException;
-
-import org.eclipse.virgo.kernel.shim.serviceability.TracingService;
-import org.springframework.jmx.export.SpringModelMBean;
-
-
-/**
- * An extension of {@link SpringModelMBean} that acts as a Server-specific MBeans.
- * 
- * <strong>Concurrent Semantics</strong><br />
- * As thread-safe as <code>SpringModelMBean</code>.
- */
-final class KernelModelMBean extends SpringModelMBean {
-
-    private final TracingService tracingService;
-
-    private final String applicationName;
-
-    public KernelModelMBean(TracingService tracingService, String applicationName) throws RuntimeOperationsException, MBeanException {
-        this.tracingService = tracingService;
-        this.applicationName = applicationName;
-    }
-
-    @Override
-    public Object invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException {
-        String originalApplicationName = this.tracingService.getCurrentApplicationName();
-
-        try {
-            this.tracingService.setCurrentApplicationName(this.applicationName);
-            return super.invoke(opName, opArgs, sig);
-        } finally {
-            this.tracingService.setCurrentApplicationName(originalApplicationName);
-        }
-    }
-}
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   VMware Inc. - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.dmfragment.internal;

+

+import javax.management.MBeanException;

+import javax.management.ReflectionException;

+import javax.management.RuntimeOperationsException;

+

+import org.eclipse.virgo.kernel.shim.serviceability.TracingService;

+import org.springframework.jmx.export.SpringModelMBean;

+

+

+/**

+ * An extension of {@link SpringModelMBean} that acts as a Server-specific MBeans.

+ * 

+ * <strong>Concurrent Semantics</strong><br />

+ * As thread-safe as <code>SpringModelMBean</code>.

+ */

+final class KernelModelMBean extends SpringModelMBean {

+

+    private final TracingService tracingService;

+

+    private final String applicationName;

+

+    public KernelModelMBean(TracingService tracingService, String applicationName) throws RuntimeOperationsException, MBeanException {

+        this.tracingService = tracingService;

+        this.applicationName = applicationName;

+    }

+

+    @Override

+    public Object invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException {

+        String originalApplicationName = this.tracingService.getCurrentApplicationName();

+

+        try {

+            this.tracingService.setCurrentApplicationName(this.applicationName);

+            return super.invoke(opName, opArgs, sig);

+        } finally {

+            this.tracingService.setCurrentApplicationName(originalApplicationName);

+        }

+    }

+}

diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/LoadTimeWeaverPostProcessor.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/LoadTimeWeaverPostProcessor.java
index fc3efdd..33fe91e 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/LoadTimeWeaverPostProcessor.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/LoadTimeWeaverPostProcessor.java
@@ -1,38 +1,38 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.dmfragment.internal;
-
-import static org.springframework.context.ConfigurableApplicationContext.LOAD_TIME_WEAVER_BEAN_NAME;
-
-import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-
-
-final class LoadTimeWeaverPostProcessor implements ModuleBeanFactoryPostProcessor {
-
-    private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
-    public void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {
-        if (beanFactory.containsBean(LOAD_TIME_WEAVER_BEAN_NAME)) {
-            AbstractBeanDefinition ltwBean = (AbstractBeanDefinition) beanFactory.getBeanDefinition(LOAD_TIME_WEAVER_BEAN_NAME);
-            ltwBean.setBeanClass(KernelLoadTimeWeaver.class);
-            logger.info("Found load-time weaver bean for bundle '{}'. Switching to ServerLoadTimeWeaver.", bundleContext.getBundle());
-        } else {
-            logger.info("Load-time weaving not enabled for bundle '{}',", bundleContext.getBundle());
-        }
-    }
-
-}
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   VMware Inc. - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.dmfragment.internal;

+

+import static org.springframework.context.ConfigurableApplicationContext.LOAD_TIME_WEAVER_BEAN_NAME;

+

+import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;

+import org.osgi.framework.BundleContext;

+import org.slf4j.Logger;

+import org.slf4j.LoggerFactory;

+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

+import org.springframework.beans.factory.support.AbstractBeanDefinition;

+

+

+final class LoadTimeWeaverPostProcessor implements ModuleBeanFactoryPostProcessor {

+

+    private final Logger logger = LoggerFactory.getLogger(this.getClass());

+

+    public void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {

+        if (beanFactory.containsBean(LOAD_TIME_WEAVER_BEAN_NAME)) {

+            AbstractBeanDefinition ltwBean = (AbstractBeanDefinition) beanFactory.getBeanDefinition(LOAD_TIME_WEAVER_BEAN_NAME);

+            ltwBean.setBeanClass(KernelLoadTimeWeaver.class);

+            logger.info("Found load-time weaver bean for bundle '{}'. Switching to ServerLoadTimeWeaver.", bundleContext.getBundle());

+        } else {

+            logger.info("Load-time weaving not enabled for bundle '{}',", bundleContext.getBundle());

+        }

+    }

+

+}

diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/MBeanExporterPostProcessor.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/MBeanExporterPostProcessor.java
index d675f04..f4dc038 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/MBeanExporterPostProcessor.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/MBeanExporterPostProcessor.java
@@ -1,61 +1,61 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.dmfragment.internal;
-
-import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;
-import org.eclipse.virgo.kernel.shim.serviceability.TracingService;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.jmx.export.MBeanExporter;
-import org.springframework.jmx.export.annotation.AnnotationMBeanExporter;
-
-
-final class MBeanExporterPostProcessor implements ModuleBeanFactoryPostProcessor {
-
-    private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
-    private final TracingService tracingService;
-
-    public MBeanExporterPostProcessor(TracingService tracingService) {
-        this.tracingService = tracingService;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {
-        boolean foundExporter = false;
-        String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames();
-        for (String beanDefinitionName : beanDefinitionNames) {
-            AbstractBeanDefinition definition = (AbstractBeanDefinition) beanFactory.getBeanDefinition(beanDefinitionName);
-            if (MBeanExporter.class.getName().equals(definition.getBeanClassName())) {
-                definition.setBeanClass(KernelMBeanExporter.class);
-                definition.getConstructorArgumentValues().addGenericArgumentValue(this.tracingService);
-                foundExporter = true;
-            } else if (AnnotationMBeanExporter.class.getName().equals(definition.getBeanClassName())) {
-                definition.setBeanClass(KernelAnnotationMBeanExporter.class);
-                definition.getConstructorArgumentValues().addGenericArgumentValue(this.tracingService);
-                foundExporter = true;
-            }
-        }
-        if (foundExporter) {
-            logger.info("Found MBean exporter bean for bundle '{}'. Switching to ServerMBeanExporter or ServerAnnotationMBeanExporter.",
-                bundleContext.getBundle());
-        } else {
-            logger.info("MBean exporting not enabled for bundle '{}',", bundleContext.getBundle());
-        }
-    }
-
-}
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   VMware Inc. - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.dmfragment.internal;

+

+import org.eclipse.virgo.kernel.dmfragment.ModuleBeanFactoryPostProcessor;

+import org.eclipse.virgo.kernel.shim.serviceability.TracingService;

+import org.osgi.framework.BundleContext;

+import org.slf4j.Logger;

+import org.slf4j.LoggerFactory;

+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

+import org.springframework.beans.factory.support.AbstractBeanDefinition;

+import org.springframework.jmx.export.MBeanExporter;

+import org.springframework.jmx.export.annotation.AnnotationMBeanExporter;

+

+

+final class MBeanExporterPostProcessor implements ModuleBeanFactoryPostProcessor {

+

+    private final Logger logger = LoggerFactory.getLogger(this.getClass());

+

+    private final TracingService tracingService;

+

+    public MBeanExporterPostProcessor(TracingService tracingService) {

+        this.tracingService = tracingService;

+    }

+

+    /**

+     * {@inheritDoc}

+     */

+    public void postProcess(BundleContext bundleContext, ConfigurableListableBeanFactory beanFactory) {

+        boolean foundExporter = false;

+        String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames();

+        for (String beanDefinitionName : beanDefinitionNames) {

+            AbstractBeanDefinition definition = (AbstractBeanDefinition) beanFactory.getBeanDefinition(beanDefinitionName);

+            if (MBeanExporter.class.getName().equals(definition.getBeanClassName())) {

+                definition.setBeanClass(KernelMBeanExporter.class);

+                definition.getConstructorArgumentValues().addGenericArgumentValue(this.tracingService);

+                foundExporter = true;

+            } else if (AnnotationMBeanExporter.class.getName().equals(definition.getBeanClassName())) {

+                definition.setBeanClass(KernelAnnotationMBeanExporter.class);

+                definition.getConstructorArgumentValues().addGenericArgumentValue(this.tracingService);

+                foundExporter = true;

+            }

+        }

+        if (foundExporter) {

+            logger.info("Found MBean exporter bean for bundle '{}'. Switching to ServerMBeanExporter or ServerAnnotationMBeanExporter.",

+                bundleContext.getBundle());

+        } else {

+            logger.info("MBean exporting not enabled for bundle '{}',", bundleContext.getBundle());

+        }

+    }

+

+}

diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ServiceProxyRetryDisablingBundleListener.java b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ServiceProxyRetryDisablingBundleListener.java
index 5b02a00..7b09d1c 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ServiceProxyRetryDisablingBundleListener.java
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/java/org/eclipse/virgo/kernel/dmfragment/internal/ServiceProxyRetryDisablingBundleListener.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.dmfragment.internal;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.SynchronousBundleListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean;
-
-/**
- * A {@link SynchronousBundleListener} that reacts to a {@link BundleEvent#STOPPING STOPPING} event for the system
- * bundle. Upon such an event being received the listener retrieves all {@link ApplicationContext ApplicationContexts}
- * from the service registry and disables retry on any {@link OsgiServiceProxyFactoryBean OsgiServiceProxyFactoryBeans}
- * which they contain.
- * <p />
- * 
- * <strong>Concurrent Semantics</strong><br />
- * 
- * Thread-safe.
- * 
- * 
- * @see ApplicationContextShutdownBean#disableServiceProxyRetry(ApplicationContext)
- */
-class ServiceProxyRetryDisablingBundleListener implements SynchronousBundleListener {
-
-    private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
-    ServiceProxyRetryDisablingBundleListener(BundleContext bundleContext) {
-        bundleContext.addBundleListener(this);
-    }
-
-    public void bundleChanged(BundleEvent event) {
-        if (event.getBundle().getBundleId() == 0 && event.getType() == BundleEvent.STOPPING) {
-            BundleContext bundleContext = event.getBundle().getBundleContext();
-            try {
-                ServiceReference<?>[] applicationContextServiceReferences = event.getBundle().getBundleContext().getAllServiceReferences(
-                    ApplicationContext.class.getName(), null);
-
-                for (ServiceReference<?> applicationContextServiceReference : applicationContextServiceReferences) {
-                    ApplicationContext applicationContext = (ApplicationContext) bundleContext.getService(applicationContextServiceReference);
-                    ApplicationContextShutdownBean.disableServiceProxyRetry(applicationContext);
-                    bundleContext.ungetService(applicationContextServiceReference);
-                }
-            } catch (InvalidSyntaxException ise) {
-                logger.error("Failed to retrieve all application contexts from service registry", ise);
-            }
-        }
-    }
-}
+/*******************************************************************************

+ * Copyright (c) 2008, 2010 VMware Inc.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *

+ * Contributors:

+ *   VMware Inc. - initial contribution

+ *******************************************************************************/

+

+package org.eclipse.virgo.kernel.dmfragment.internal;

+

+import org.osgi.framework.BundleContext;

+import org.osgi.framework.BundleEvent;

+import org.osgi.framework.InvalidSyntaxException;

+import org.osgi.framework.ServiceReference;

+import org.osgi.framework.SynchronousBundleListener;

+import org.slf4j.Logger;

+import org.slf4j.LoggerFactory;

+import org.springframework.context.ApplicationContext;

+import org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean;

+

+/**

+ * A {@link SynchronousBundleListener} that reacts to a {@link BundleEvent#STOPPING STOPPING} event for the system

+ * bundle. Upon such an event being received the listener retrieves all {@link ApplicationContext ApplicationContexts}

+ * from the service registry and disables retry on any {@link OsgiServiceProxyFactoryBean OsgiServiceProxyFactoryBeans}

+ * which they contain.

+ * <p />

+ * 

+ * <strong>Concurrent Semantics</strong><br />

+ * 

+ * Thread-safe.

+ * 

+ * 

+ * @see ApplicationContextShutdownBean#disableServiceProxyRetry(ApplicationContext)

+ */

+class ServiceProxyRetryDisablingBundleListener implements SynchronousBundleListener {

+

+    private final Logger logger = LoggerFactory.getLogger(this.getClass());

+

+    ServiceProxyRetryDisablingBundleListener(BundleContext bundleContext) {

+        bundleContext.addBundleListener(this);

+    }

+

+    public void bundleChanged(BundleEvent event) {

+        if (event.getBundle().getBundleId() == 0 && event.getType() == BundleEvent.STOPPING) {

+            BundleContext bundleContext = event.getBundle().getBundleContext();

+            try {

+                ServiceReference<?>[] applicationContextServiceReferences = event.getBundle().getBundleContext().getAllServiceReferences(

+                    ApplicationContext.class.getName(), null);

+

+                for (ServiceReference<?> applicationContextServiceReference : applicationContextServiceReferences) {

+                    ApplicationContext applicationContext = (ApplicationContext) bundleContext.getService(applicationContextServiceReference);

+                    ApplicationContextShutdownBean.disableServiceProxyRetry(applicationContext);

+                    bundleContext.ungetService(applicationContextServiceReference);

+                }

+            } catch (InvalidSyntaxException ise) {

+                logger.error("Failed to retrieve all application contexts from service registry", ise);

+            }

+        }

+    }

+}

diff --git a/org.eclipse.virgo.kernel.dmfragment/src/main/resources/META-INF/spring/extender/kernel-dmfragment-context.xml b/org.eclipse.virgo.kernel.dmfragment/src/main/resources/META-INF/spring/extender/kernel-dmfragment-context.xml
index 93ceda9..1d1a1df 100644
--- a/org.eclipse.virgo.kernel.dmfragment/src/main/resources/META-INF/spring/extender/kernel-dmfragment-context.xml
+++ b/org.eclipse.virgo.kernel.dmfragment/src/main/resources/META-INF/spring/extender/kernel-dmfragment-context.xml
@@ -1,39 +1,39 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xmlns="http://www.springframework.org/schema/beans"
-	xmlns:osgi="http://www.springframework.org/schema/osgi"
-	xsi:schemaLocation="http://www.springframework.org/schema/osgi  
-       http://www.springframework.org/schema/osgi/spring-osgi.xsd
-       http://www.springframework.org/schema/beans   
-       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-		
-	<osgi:reference id="tracingService" interface="org.eclipse.virgo.kernel.shim.serviceability.TracingService"/>
-
-	<bean id="serverExtensionConfigurer" class="org.eclipse.virgo.kernel.dmfragment.internal.KernelExtensionConfiguringOsgiPostProcessor">
-		<constructor-arg>
-			<list>
-				<bean class="org.eclipse.virgo.kernel.dmfragment.internal.ContextClassLoaderPostProcessor"/>
-				<bean class="org.eclipse.virgo.kernel.dmfragment.internal.LoadTimeWeaverPostProcessor"/>	
-				<bean class="org.eclipse.virgo.kernel.dmfragment.internal.MBeanExporterPostProcessor">
-					<constructor-arg ref="tracingService"/>
-				</bean>
-				<bean class="org.eclipse.virgo.kernel.dmfragment.internal.ApplicationContextShutdownBeanPostProcessor"/>	
-			</list>
-		</constructor-arg>
-	</bean>
-	
-	<osgi:service ref="serverExtensionConfigurer" interface="org.springframework.osgi.extender.OsgiBeanFactoryPostProcessor" />
-
-	<bean id="taskExecutor" class="org.eclipse.virgo.kernel.agent.dm.ContextPropagatingTaskExecutor">
-		<constructor-arg value="region-dm-" />
-		<constructor-arg value="15" />		
-		<constructor-arg ref="bundleContext"/>
-	</bean>
-	
-	<alias alias="shutdownTaskExecutor" name="taskExecutor"/>
-	
-	<bean id="serviceProxyRetryDisabler" class="org.eclipse.virgo.kernel.dmfragment.internal.ServiceProxyRetryDisablingBundleListener">
- 	    <constructor-arg ref="bundleContext"/>
- 	</bean>
-	
-</beans>
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns="http://www.springframework.org/schema/beans"

+	xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xsi:schemaLocation="http://www.springframework.org/schema/osgi  

+       http://www.springframework.org/schema/osgi/spring-osgi.xsd

+       http://www.springframework.org/schema/beans   

+       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

+		

+	<osgi:reference id="tracingService" interface="org.eclipse.virgo.kernel.shim.serviceability.TracingService"/>

+

+	<bean id="serverExtensionConfigurer" class="org.eclipse.virgo.kernel.dmfragment.internal.KernelExtensionConfiguringOsgiPostProcessor">

+		<constructor-arg>

+			<list>

+				<bean class="org.eclipse.virgo.kernel.dmfragment.internal.ContextClassLoaderPostProcessor"/>

+				<bean class="org.eclipse.virgo.kernel.dmfragment.internal.LoadTimeWeaverPostProcessor"/>	

+				<bean class="org.eclipse.virgo.kernel.dmfragment.internal.MBeanExporterPostProcessor">

+					<constructor-arg ref="tracingService"/>

+				</bean>

+				<bean class="org.eclipse.virgo.kernel.dmfragment.internal.ApplicationContextShutdownBeanPostProcessor"/>	

+			</list>

+		</constructor-arg>

+	</bean>

+	

+	<osgi:service ref="serverExtensionConfigurer" interface="org.springframework.osgi.extender.OsgiBeanFactoryPostProcessor" />

+

+	<bean id="taskExecutor" class="org.eclipse.virgo.kernel.agent.dm.ContextPropagatingTaskExecutor">

+		<constructor-arg value="region-dm-" />

+		<constructor-arg value="15" />		

+		<constructor-arg ref="bundleContext"/>

+	</bean>

+	

+	<alias alias="shutdownTaskExecutor" name="taskExecutor"/>

+	

+	<bean id="serviceProxyRetryDisabler" class="org.eclipse.virgo.kernel.dmfragment.internal.ServiceProxyRetryDisablingBundleListener">

+ 	    <constructor-arg ref="bundleContext"/>

+ 	</bean>

+	

+</beans>

diff --git a/org.eclipse.virgo.kernel.dmfragment/template.mf b/org.eclipse.virgo.kernel.dmfragment/template.mf
index c8544a8..1d02941 100644
--- a/org.eclipse.virgo.kernel.dmfragment/template.mf
+++ b/org.eclipse.virgo.kernel.dmfragment/template.mf
@@ -1,21 +1,21 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Virgo Kernel User Region OSGi Spring DM Fragment
-Fragment-Host: org.springframework.osgi.extender
-Bundle-SymbolicName: org.eclipse.virgo.kernel.dmfragment
-Bundle-Version: 2.2.0
-Import-Package: 
- org.eclipse.virgo.kernel.agent.dm;version="${version:[=.=.=, =.+1)}",
- org.eclipse.virgo.kernel.shim.serviceability;version="${version:[=.=.=, =.+1)}"
-Import-Template: 
- org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",
- org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",
- org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",
- org.aspectj.*;version="${org.aspectj:[=.=.=.=, +1)}",
- javax.management.*;version="0",
- org.osgi.framework.*;version="0",
- org.springframework.*;version="${org.springframework:[2.5.6, =.+1)}"
-Excluded-Imports: 
- org.springframework.osgi.*
-Excluded-Exports: 
- org.eclipse.virgo.kernel.dmfragment.internal.*
+Manifest-Version: 1.0

+Bundle-ManifestVersion: 2

+Bundle-Name: Virgo Kernel User Region OSGi Spring DM Fragment

+Fragment-Host: org.springframework.osgi.extender

+Bundle-SymbolicName: org.eclipse.virgo.kernel.dmfragment

+Bundle-Version: 3.0.0

+Import-Package: 

+ org.eclipse.virgo.kernel.agent.dm;version="${version:[=.=.=, =.+1)}",

+ org.eclipse.virgo.kernel.shim.serviceability;version="${version:[=.=.=, =.+1)}"

+Import-Template: 

+ org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",

+ org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",

+ org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",

+ org.aspectj.*;version="${org.aspectj:[=.=.=.=, +1)}",

+ javax.management.*;version="0",

+ org.osgi.framework.*;version="0",

+ org.springframework.*;version="${org.springframework:[2.5.6, =.+1)}"

+Excluded-Imports: 

+ org.springframework.osgi.*

+Excluded-Exports: 

+ org.eclipse.virgo.kernel.dmfragment.internal.*

diff --git a/org.eclipse.virgo.kernel.kerneldmfragment/.classpath b/org.eclipse.virgo.kernel.kerneldmfragment/.classpath
index 8921d68..2c0153e 100644
--- a/org.eclipse.virgo.kernel.kerneldmfragment/.classpath
+++ b/org.eclipse.virgo.kernel.kerneldmfragment/.classpath
@@ -28,8 +28,8 @@
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-sources-1.2.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-sources-1.2.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-sources-1.2.1.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.5.0.200809221524/org.eclipse.osgi-3.5.0.200809221524.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar">
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.5.0.200809221524/org.eclipse.osgi-3.5.0.200809221524.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar">
 		<attributes>
 			<attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
 		</attributes>
diff --git a/org.eclipse.virgo.kernel.kerneldmfragment/template.mf b/org.eclipse.virgo.kernel.kerneldmfragment/template.mf
index 071b3f9..4216969 100644
--- a/org.eclipse.virgo.kernel.kerneldmfragment/template.mf
+++ b/org.eclipse.virgo.kernel.kerneldmfragment/template.mf
@@ -3,7 +3,7 @@
 Bundle-Name: Virgo Kernel OSGi Spring DM Fragment
 Fragment-Host: org.springframework.osgi.extender
 Bundle-SymbolicName: org.eclipse.virgo.kernel.kerneldmfragment
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
 Import-Package: 
  org.eclipse.virgo.kernel.agent.dm;version="${version:[=.=.=, =.+1)}",
  org.eclipse.virgo.kernel.shim.serviceability;version="${version:[=.=.=, =.+1)}"
diff --git a/org.eclipse.virgo.kernel.model/.classpath b/org.eclipse.virgo.kernel.model/.classpath
index f143618..7703263 100644
--- a/org.eclipse.virgo.kernel.model/.classpath
+++ b/org.eclipse.virgo.kernel.model/.classpath
@@ -25,16 +25,16 @@
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-sources-1.6.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-sources-1.6.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar">
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar">
 		<attributes>
 			<attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-2.2.0.D-20101207145338.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-sources-2.2.0.D-20101207145338.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-sources-2.2.0.D-20101207150035.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-3.0.0.M02.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.artifact"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.deployer"/>
diff --git a/org.eclipse.virgo.kernel.model/ivy.xml b/org.eclipse.virgo.kernel.model/ivy.xml
index 8cdefc4..64b2cce 100644
--- a/org.eclipse.virgo.kernel.model/ivy.xml
+++ b/org.eclipse.virgo.kernel.model/ivy.xml
@@ -31,7 +31,7 @@
         <dependency org="org.eclipse.osgi"  name="org.eclipse.osgi" rev="${org.eclipse.osgi}" conf="compile->runtime"/>
 
 		<dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="compile->runtime"/>
-		<dependency org="org.eclipse.equinox" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="compile->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="compile->runtime"/>
 
 		<override org="org.eclipse.virgo.util" rev="${org.eclipse.virgo.util}"/>
 		
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifact.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifact.java
index 8295179..a3cff3c 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifact.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleArtifact.java
@@ -109,7 +109,7 @@
         }
     }
 
-    private ArtifactState mapBundleState(int state) {
+    static ArtifactState mapBundleState(int state) {
         if (Bundle.UNINSTALLED == state) {
             return ArtifactState.UNINSTALLED;
         } else if (Bundle.INSTALLED == state) {
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java
index 74bc65e..c64c864 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminer.java
@@ -20,6 +20,7 @@
 import org.eclipse.virgo.kernel.model.internal.DependencyDeterminer;
 import org.eclipse.virgo.kernel.serviceability.NonNull;
 
+import org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiExportPackage;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiFramework;
@@ -42,9 +43,12 @@
 
     private final RuntimeArtifactRepository artifactRepository;
 
-    public BundleDependencyDeterminer(@NonNull QuasiFrameworkFactory quasiFrameworkFactory, @NonNull RuntimeArtifactRepository artifactRepository) {
+    private final PackageAdminUtil packageAdminUtil;
+
+    public BundleDependencyDeterminer(@NonNull QuasiFrameworkFactory quasiFrameworkFactory, @NonNull RuntimeArtifactRepository artifactRepository, @NonNull PackageAdminUtil packageAdminUtil) {
         this.quasiFrameworkFactory = quasiFrameworkFactory;
         this.artifactRepository = artifactRepository;
+        this.packageAdminUtil = packageAdminUtil;
     }
 
     /**
@@ -62,7 +66,11 @@
             QuasiExportPackage provider = importPackage.getProvider();
             if (provider != null) {
                 QuasiBundle bundle = provider.getExportingBundle();
-                artifacts.add(artifactRepository.getArtifact(BundleArtifact.TYPE, bundle.getSymbolicName(), bundle.getVersion()));
+                Artifact artifact = artifactRepository.getArtifact(BundleArtifact.TYPE, bundle.getSymbolicName(), bundle.getVersion());
+                if (artifact == null) {
+                    artifact = new QuasiBundleArtifact(bundle, this.packageAdminUtil);
+                }
+                artifacts.add(artifact);
             }
         }
 
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListenerInitializer.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListenerInitializer.java
index 7805fbb..d9869fb 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListenerInitializer.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListenerInitializer.java
@@ -15,6 +15,7 @@
 import javax.annotation.PreDestroy;
 
 import org.eclipse.virgo.kernel.model.RuntimeArtifactRepository;
+import org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil;
 import org.eclipse.virgo.kernel.serviceability.NonNull;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -22,8 +23,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil;
-
 /**
  * An intializer responsible for registering a {@link ModelBundleListener} and enumerating any existing {@link Bundle}
  * objects from the OSGi Framework.
@@ -44,7 +43,7 @@
     private final PackageAdminUtil packageAdminUtil;
 
     private final BundleContext kernelBundleContext;
-    
+
     private final BundleContext userRegionBundleContext;
 
     private final BundleListener bundleListener;
@@ -60,16 +59,18 @@
 
     /**
      * Registers a {@link BundleListener} with the OSGi framework. Enumerates any existing {@link Bundle}s that exist
-     * from the OSGi framework.
+     * in the user region.
      */
     @PostConstruct
     public void initialize() {
-        this.userRegionBundleContext.addBundleListener(bundleListener);
-        for (Bundle bundle : userRegionBundleContext.getBundles()) {
+        // Register the listener with the user region bundle context to see all bundles in the user region.
+        this.userRegionBundleContext.addBundleListener(this.bundleListener);
+        // Find bundles in the user region as the listener has almost certainly missed their installation.
+        for (Bundle bundle : this.userRegionBundleContext.getBundles()) {
             try {
-                this.artifactRepository.add(new BundleArtifact(kernelBundleContext, packageAdminUtil, bundle));
+                this.artifactRepository.add(new BundleArtifact(this.kernelBundleContext, this.packageAdminUtil, bundle));
             } catch (Exception e) {
-                logger.error(String.format("Exception adding bundle '%s:%s' to the repository", bundle.getSymbolicName(),
+                this.logger.error(String.format("Exception adding bundle '%s:%s' to the repository", bundle.getSymbolicName(),
                     bundle.getVersion().toString()), e);
             }
         }
@@ -80,6 +81,6 @@
      */
     @PreDestroy
     public void destroy() {
-        this.userRegionBundleContext.removeBundleListener(bundleListener);
+        this.userRegionBundleContext.removeBundleListener(this.bundleListener);
     }
 }
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifact.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifact.java
new file mode 100644
index 0000000..a32e9c3
--- /dev/null
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifact.java
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.model.internal.bundle;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.virgo.kernel.model.Artifact;
+import org.eclipse.virgo.kernel.model.ArtifactState;
+import org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil;
+import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
+import org.eclipse.virgo.kernel.serviceability.NonNull;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+
+/**
+ * {@link QuasiBundleArtifact} is an {@link Artifact} that wraps a {@link QuasiBundle}.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+final class QuasiBundleArtifact implements Artifact {
+
+    private final QuasiBundle quasiBundle;
+
+    private final PackageAdminUtil packageAdminUtil;
+
+    QuasiBundleArtifact(@NonNull QuasiBundle quasiBundle, @NonNull PackageAdminUtil packageAdminUtil) {
+        this.quasiBundle = quasiBundle;
+        this.packageAdminUtil = packageAdminUtil;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void start() {
+        Bundle bundle = getBundle();
+        try {
+            bundle.start();
+        } catch (BundleException e) {
+            throw new RuntimeException("Failed to start", e);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void stop() {
+        Bundle bundle = getBundle();
+        if (bundle != null) {
+            BundleContext bundleContext = bundle.getBundleContext();
+            if (bundleContext != null) {
+                new BundleArtifact(bundleContext, this.packageAdminUtil, bundle).stop();
+            }
+        }
+    }
+
+    private Bundle getBundle() {
+        return quasiBundle.getBundle();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean refresh() {
+        Bundle bundle = getBundle();
+        if (bundle != null) {
+            BundleContext bundleContext = bundle.getBundleContext();
+            if (bundleContext != null) {
+                return new BundleArtifact(bundleContext, this.packageAdminUtil, bundle).refresh();
+            } else {
+                try {
+                    bundle.update();
+                    return true;
+                } catch (BundleException _) {
+                    return false;
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void uninstall() {
+        Bundle bundle = getBundle();
+        if (bundle != null) {
+            try {
+                bundle.uninstall();
+            } catch (BundleException e) {
+                throw new RuntimeException("Failed to uninstall", e);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getType() {
+        return BundleArtifact.TYPE;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getName() {
+        return this.quasiBundle.getSymbolicName();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Version getVersion() {
+        return this.quasiBundle.getVersion();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ArtifactState getState() {
+        Bundle bundle = getBundle();
+        if (bundle != null) {
+            return BundleArtifact.mapBundleState(bundle.getState());
+        }
+        return ArtifactState.UNINSTALLED;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Set<Artifact> getDependents() {
+        Set<Artifact> dependents = new HashSet<Artifact>();
+        for (QuasiBundle quasiBundle : this.quasiBundle.getDependents()) {
+            /*
+             * Since QuasiBundleArtifact is used to represent dependencies in the kernel, the dependents should also be in
+             * the kernel and so can be represented by further QuasiBundleArtifacts.
+             */
+            dependents.add(new QuasiBundleArtifact(quasiBundle, this.packageAdminUtil));
+        }
+        return dependents;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Map<String, String> getProperties() {
+        return Collections.<String, String> emptyMap();
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((quasiBundle == null) ? 0 : quasiBundle.hashCode());
+        return result;
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof QuasiBundleArtifact)) {
+            return false;
+        }
+        QuasiBundleArtifact other = (QuasiBundleArtifact) obj;
+        if (quasiBundle == null) {
+            if (other.quasiBundle != null) {
+                return false;
+            }
+        } else if (!quasiBundle.equals(other.quasiBundle)) {
+            return false;
+        }
+        return true;
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerArtifact.java b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerArtifact.java
index 2a880e6..b107b52 100644
--- a/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerArtifact.java
+++ b/org.eclipse.virgo.kernel.model/src/main/java/org/eclipse/virgo/kernel/model/internal/deployer/DeployerArtifact.java
@@ -17,17 +17,16 @@
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
 
-import org.eclipse.virgo.kernel.core.BlockingSignal;
+import org.eclipse.virgo.kernel.core.BlockingAbortableSignal;
 import org.eclipse.virgo.kernel.core.FailureSignalledException;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.serviceability.NonNull;
-import org.osgi.framework.BundleContext;
-
 import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
 import org.eclipse.virgo.kernel.install.artifact.InstallArtifact.State;
 import org.eclipse.virgo.kernel.model.Artifact;
 import org.eclipse.virgo.kernel.model.ArtifactState;
 import org.eclipse.virgo.kernel.model.internal.AbstractArtifact;
+import org.eclipse.virgo.kernel.serviceability.NonNull;
+import org.osgi.framework.BundleContext;
 
 /**
  * Implementation of {@link Artifact} that delegates to a Kernel {@link InstallArtifact}
@@ -59,11 +58,15 @@
      */
     public final void start() {
         try {
-            BlockingSignal signal = new BlockingSignal();
+            BlockingAbortableSignal signal = new BlockingAbortableSignal();
             this.installArtifact.start(signal);
             try {
                 if (!signal.awaitCompletion(5, TimeUnit.MINUTES)) {
-                    throw new RuntimeException("Started failed");
+                	if(signal.isAborted()){
+                		throw new RuntimeException("Started aborted");
+                	} else {
+                		throw new RuntimeException("Started failed");
+                	}
                 }
             } catch (FailureSignalledException fse) {
                 throw new RuntimeException(fse.getCause());
diff --git a/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/module-context.xml b/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/module-context.xml
index 78edaea..274663d 100644
--- a/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/module-context.xml
+++ b/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/module-context.xml
@@ -1,75 +1,77 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
-	xsi:schemaLocation="
-				http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
-				http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
-	<bean class="org.eclipse.virgo.kernel.model.internal.bundle.ModelBundleListenerInitializer">
-		<constructor-arg ref="artifactRepository"/>
-		<constructor-arg ref="packageAdminUtil"/>
-		<constructor-arg ref="bundleContext"/>
-		<constructor-arg ref="userBundleContext"/>
-	</bean>
-
-	<bean class="org.eclipse.virgo.kernel.model.internal.configurationadmin.ModelConfigurationListenerInitializer">
-		<constructor-arg ref="artifactRepository"/>
-		<constructor-arg ref="bundleContext"/>
-		<constructor-arg ref="configurationAdmin"/>
-	</bean>
-
-	<bean class="org.eclipse.virgo.kernel.model.internal.deployer.ModelInstallArtifactLifecycleListenerInitializer">
-		<constructor-arg ref="artifactRepository"/>
-		<constructor-arg ref="bundleContext"/>
-		<constructor-arg ref="runtimeArtifactModel"/>
-	</bean>
-
-	<bean id="bundleDependencyDeterminer" class="org.eclipse.virgo.kernel.model.internal.bundle.BundleDependencyDeterminer">
-		<constructor-arg ref="quasiFrameworkFactory"/>
-		<constructor-arg ref="artifactRepository"/>
-	</bean>
-
-	<bean id="deployerCompositeArtifactDependencyDeterminer"
-			class="org.eclipse.virgo.kernel.model.internal.deployer.DeployerCompositeArtifactDependencyDeterminer">
-		<constructor-arg ref="artifactRepository"/>
-	</bean>
-
-	<bean id="artifactRepository" class="org.eclipse.virgo.kernel.model.internal.NotifyingRuntimeArtifactRepository">
-		<constructor-arg ref="artifactRepositoryListener"/>
-	</bean>
-
-	<bean id="artifactRepositoryListener" class="org.eclipse.virgo.kernel.model.management.internal.JmxArtifactRepositoryListener"
-			destroy-method="destroy">
-		<constructor-arg ref="runtimeArtifactModelObjectNameCreator"/>
-	</bean>
-
-	<bean id="runtimeArtifactModelObjectNameCreator" class="org.eclipse.virgo.kernel.model.management.internal.DefaultRuntimeArtifactModelObjectNameCreator">
-		<constructor-arg value="${domain}"/>
-	</bean>
-	
-	<bean id="installer" class="org.eclipse.virgo.kernel.model.management.internal.DelegatingInstaller">
-		<constructor-arg ref="applicationDeployer"/>
-		<constructor-arg ref="runtimeArtifactModelObjectNameCreator"/>
-	</bean>
-
-	<context:property-placeholder properties-ref="config-admin"/>
-
-	<context:annotation-config/>
-
-	<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
-		<property name="beans">
-		<map>
-			<entry key="installer" value-ref="installer"/>
-		</map>
-		</property>
-		<property name="namingStrategy">
-			<bean class="org.springframework.jmx.export.naming.KeyNamingStrategy">
-				<property name="mappings">
-					<props>
-						<prop key="installer">${domain}:type=Model,name=installer</prop>
-					</props>
-				</property>
-			</bean>
-		</property>
-	</bean>
-
-</beans>
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:osgi="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"

+	xsi:schemaLocation="

+				http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+				http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd

+				http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">

+

+	<bean class="org.eclipse.virgo.kernel.model.internal.bundle.ModelBundleListenerInitializer">

+		<constructor-arg ref="artifactRepository"/>

+		<constructor-arg ref="packageAdminUtil"/>

+		<constructor-arg ref="bundleContext"/>

+		<constructor-arg ref="userBundleContext"/>

+	</bean>

+

+	<bean class="org.eclipse.virgo.kernel.model.internal.configurationadmin.ModelConfigurationListenerInitializer">

+		<constructor-arg ref="artifactRepository"/>

+		<constructor-arg ref="bundleContext"/>

+		<constructor-arg ref="configurationAdmin"/>

+	</bean>

+

+	<bean class="org.eclipse.virgo.kernel.model.internal.deployer.ModelInstallArtifactLifecycleListenerInitializer">

+		<constructor-arg ref="artifactRepository"/>

+		<constructor-arg ref="bundleContext"/>

+		<constructor-arg ref="runtimeArtifactModel"/>

+	</bean>

+

+	<bean id="bundleDependencyDeterminer" class="org.eclipse.virgo.kernel.model.internal.bundle.BundleDependencyDeterminer">

+		<constructor-arg ref="quasiFrameworkFactory"/>

+		<constructor-arg ref="artifactRepository"/>

+		<constructor-arg ref="packageAdminUtil"/>

+	</bean>

+

+	<bean id="deployerCompositeArtifactDependencyDeterminer"

+			class="org.eclipse.virgo.kernel.model.internal.deployer.DeployerCompositeArtifactDependencyDeterminer">

+		<constructor-arg ref="artifactRepository"/>

+	</bean>

+

+	<bean id="artifactRepository" class="org.eclipse.virgo.kernel.model.internal.NotifyingRuntimeArtifactRepository">

+		<constructor-arg ref="artifactRepositoryListener"/>

+	</bean>

+

+	<bean id="artifactRepositoryListener" class="org.eclipse.virgo.kernel.model.management.internal.JmxArtifactRepositoryListener"

+			destroy-method="destroy">

+		<constructor-arg ref="runtimeArtifactModelObjectNameCreator"/>

+	</bean>

+

+	<bean id="runtimeArtifactModelObjectNameCreator" class="org.eclipse.virgo.kernel.model.management.internal.DefaultRuntimeArtifactModelObjectNameCreator">

+		<constructor-arg value="#{kernelConfig.getProperty('domain')}"/>

+	</bean>

+	

+	<bean id="installer" class="org.eclipse.virgo.kernel.model.management.internal.DelegatingInstaller">

+		<constructor-arg ref="applicationDeployer"/>

+		<constructor-arg ref="runtimeArtifactModelObjectNameCreator"/>

+	</bean>

+	

+	<osgi:reference id="kernelConfig" interface="org.eclipse.virgo.kernel.core.KernelConfig"/>

+

+	<context:annotation-config/>

+

+	<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">

+		<property name="beans">

+		<map>

+			<entry key="installer" value-ref="installer"/>

+		</map>

+		</property>

+		<property name="namingStrategy">

+			<bean class="org.springframework.jmx.export.naming.KeyNamingStrategy">

+				<property name="mappings">

+					<props>

+						<prop key="installer">#{kernelConfig.getProperty('domain')}:type=Model,name=installer</prop>

+					</props>

+				</property>

+			</bean>

+		</property>

+	</bean>

+

+</beans>

diff --git a/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/osgi-context.xml b/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/osgi-context.xml
index d47d47e..62a60c8 100644
--- a/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/osgi-context.xml
+++ b/org.eclipse.virgo.kernel.model/src/main/resources/META-INF/spring/osgi-context.xml
@@ -1,48 +1,46 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans
-		xmlns="http://www.springframework.org/schema/osgi" 
-		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-		xmlns:beans="http://www.springframework.org/schema/beans" 
-		xmlns:osgi-compendium="http://www.springframework.org/schema/osgi-compendium"
-		xsi:schemaLocation="
-				http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.2.xsd
-				http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd
-				http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
-
-	<service ref="artifactRepository" interface="org.eclipse.virgo.kernel.model.RuntimeArtifactRepository"/>
-	
-	<service ref="bundleDependencyDeterminer" interface="org.eclipse.virgo.kernel.model.internal.DependencyDeterminer">
-		<service-properties>
-			<beans:entry key="artifactType" value="bundle"/>
-		</service-properties>
-	</service>
-
-	<service ref="deployerCompositeArtifactDependencyDeterminer" interface="org.eclipse.virgo.kernel.model.internal.DependencyDeterminer">
-		<service-properties>
-			<beans:entry key="artifactType" value="plan"/>
-		</service-properties>
-	</service>
-
-	<service ref="deployerCompositeArtifactDependencyDeterminer" interface="org.eclipse.virgo.kernel.model.internal.DependencyDeterminer">
-		<service-properties>
-			<beans:entry key="artifactType" value="par"/>
-		</service-properties>
-	</service>
-	
-	<service ref="runtimeArtifactModelObjectNameCreator" interface="org.eclipse.virgo.kernel.model.management.RuntimeArtifactModelObjectNameCreator"/>
-
-	<reference id="packageAdminUtil" interface="org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil"/>
-
-	<reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
-	
-	<reference id="quasiFrameworkFactory" interface="org.eclipse.virgo.kernel.osgi.quasi.QuasiFrameworkFactory"/>
-	
-	<reference id="runtimeArtifactModel" interface="org.eclipse.virgo.kernel.deployer.model.RuntimeArtifactModel"/>
-	
-	<reference id="userBundleContext" interface="org.osgi.framework.BundleContext" filter="(org.eclipse.virgo.kernel.regionContext=true)"/>
-	
-	<reference id="applicationDeployer" interface="org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer"/>
-
-	<osgi-compendium:cm-properties id="config-admin" persistent-id="org.eclipse.virgo.kernel"/>
-
-</beans:beans>
+<?xml version="1.0" encoding="UTF-8"?>

+<beans:beans

+		xmlns="http://www.springframework.org/schema/osgi" 

+		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+		xmlns:beans="http://www.springframework.org/schema/beans" 

+		xmlns:osgi-compendium="http://www.springframework.org/schema/osgi-compendium"

+		xsi:schemaLocation="

+				http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.2.xsd

+				http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd

+				http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

+

+	<service ref="artifactRepository" interface="org.eclipse.virgo.kernel.model.RuntimeArtifactRepository"/>

+	

+	<service ref="bundleDependencyDeterminer" interface="org.eclipse.virgo.kernel.model.internal.DependencyDeterminer">

+		<service-properties>

+			<beans:entry key="artifactType" value="bundle"/>

+		</service-properties>

+	</service>

+

+	<service ref="deployerCompositeArtifactDependencyDeterminer" interface="org.eclipse.virgo.kernel.model.internal.DependencyDeterminer">

+		<service-properties>

+			<beans:entry key="artifactType" value="plan"/>

+		</service-properties>

+	</service>

+

+	<service ref="deployerCompositeArtifactDependencyDeterminer" interface="org.eclipse.virgo.kernel.model.internal.DependencyDeterminer">

+		<service-properties>

+			<beans:entry key="artifactType" value="par"/>

+		</service-properties>

+	</service>

+	

+	<service ref="runtimeArtifactModelObjectNameCreator" interface="org.eclipse.virgo.kernel.model.management.RuntimeArtifactModelObjectNameCreator"/>

+

+	<reference id="packageAdminUtil" interface="org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil"/>

+

+	<reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>

+	

+	<reference id="quasiFrameworkFactory" interface="org.eclipse.virgo.kernel.osgi.quasi.QuasiFrameworkFactory"/>

+	

+	<reference id="runtimeArtifactModel" interface="org.eclipse.virgo.kernel.deployer.model.RuntimeArtifactModel"/>

+	

+	<reference id="userBundleContext" interface="org.osgi.framework.BundleContext" filter="(org.eclipse.virgo.kernel.regionContext=true)"/>

+	

+	<reference id="applicationDeployer" interface="org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer"/>

+

+</beans:beans>

diff --git a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/NotifyingArtifactRepositoryTests.java b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/NotifyingArtifactRepositoryTests.java
index 00e0e12..fd2e020 100644
--- a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/NotifyingArtifactRepositoryTests.java
+++ b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/NotifyingArtifactRepositoryTests.java
@@ -20,8 +20,6 @@
 
 import org.eclipse.virgo.kernel.model.Artifact;
 import org.eclipse.virgo.kernel.model.StubCompositeArtifact;
-import org.eclipse.virgo.kernel.model.internal.ArtifactRepositoryListener;
-import org.eclipse.virgo.kernel.model.internal.NotifyingRuntimeArtifactRepository;
 import org.junit.Test;
 
 
diff --git a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminerTests.java b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminerTests.java
index 457ec64..8d4c10f 100644
--- a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminerTests.java
+++ b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/BundleDependencyDeterminerTests.java
@@ -28,6 +28,7 @@
 import org.eclipse.virgo.kernel.serviceability.Assert.FatalAssertionException;
 import org.junit.Test;
 
+import org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiFramework;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiFrameworkFactory;
@@ -37,17 +38,24 @@
     private final QuasiFrameworkFactory quasiFrameworkFactory = createMock(QuasiFrameworkFactory.class);
 
     private final RuntimeArtifactRepository artifactRepository = new StubArtifactRepository();
+    
+    private final PackageAdminUtil packageAdminUtil = createMock(PackageAdminUtil.class);
 
-    private final BundleDependencyDeterminer determiner = new BundleDependencyDeterminer(quasiFrameworkFactory, artifactRepository);
+    private final BundleDependencyDeterminer determiner = new BundleDependencyDeterminer(quasiFrameworkFactory, artifactRepository, packageAdminUtil);
 
     @Test(expected = FatalAssertionException.class)
     public void nullFactory() {
-        new BundleDependencyDeterminer(null, artifactRepository);
+        new BundleDependencyDeterminer(null, artifactRepository, packageAdminUtil);
     }
 
     @Test(expected = FatalAssertionException.class)
     public void nullRepository() {
-        new BundleDependencyDeterminer(quasiFrameworkFactory, null);
+        new BundleDependencyDeterminer(quasiFrameworkFactory, null, packageAdminUtil);
+    }
+    
+    @Test(expected = FatalAssertionException.class)
+    public void nullPackageAdminUtil() {
+        new BundleDependencyDeterminer(quasiFrameworkFactory, artifactRepository, null);
     }
 
     @Test
diff --git a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListenerInitializerTests.java b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListenerInitializerTests.java
index 760a6e4..9abb68d 100644
--- a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListenerInitializerTests.java
+++ b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/ModelBundleListenerInitializerTests.java
@@ -18,6 +18,7 @@
 
 import org.junit.Test;
 import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.Version;
 
 import org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil;
 
@@ -36,12 +37,17 @@
     private final PackageAdminUtil packageAdminUtil = createMock(PackageAdminUtil.class);
 
     private final StubBundleContext bundleContext;
+    
+    private final StubBundleContext systemBundleContext;
     {
         StubBundle bundle = new StubBundle();
         this.bundleContext = (StubBundleContext) bundle.getBundleContext();
+        StubBundle stubSystemBundle = new StubBundle(0L, "org.osgi.framework", new Version("0"), "loc");
+        this.systemBundleContext = (StubBundleContext)stubSystemBundle.getBundleContext();
+        this.bundleContext.addInstalledBundle(stubSystemBundle);
+        this.systemBundleContext.addInstalledBundle(bundle);
         String filterString = String.format("(&(objectClass=%s)(artifactType=bundle))", DependencyDeterminer.class.getCanonicalName());
         this.bundleContext.addFilter(filterString, new TrueFilter(filterString));
-        this.bundleContext.addInstalledBundle(bundle);
     }
 
     private final ModelBundleListenerInitializer initializer = new ModelBundleListenerInitializer(artifactRepository, packageAdminUtil, bundleContext, bundleContext);
@@ -62,10 +68,10 @@
     }
 
     @Test(expected = FatalAssertionException.class)
-    public void nullUserBundleContext() {
+    public void nullUserRegionBundleContext() {
         new ModelBundleListenerInitializer(artifactRepository, packageAdminUtil, bundleContext, null);
     }
-    
+
     @Test
     public void initialize() throws IOException, InvalidSyntaxException {
         assertEquals(0, this.bundleContext.getBundleListeners().size());
diff --git a/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifactTests.java b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifactTests.java
new file mode 100644
index 0000000..4f06330
--- /dev/null
+++ b/org.eclipse.virgo.kernel.model/src/test/java/org/eclipse/virgo/kernel/model/internal/bundle/QuasiBundleArtifactTests.java
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.model.internal.bundle;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.Assert;
+
+import org.easymock.EasyMock;
+import org.eclipse.virgo.kernel.model.Artifact;
+import org.eclipse.virgo.kernel.model.ArtifactState;
+import org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil;
+import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+public class QuasiBundleArtifactTests {
+
+    private static final Version TEST_BUNDLE_VERSION = new Version("4345.234.56.sfghz");
+
+    private static final String TEST_BUNDLE_SYMBOLIC_NAME = "test.bundle";
+
+    private QuasiBundle mockQuasiBundle;
+
+    private Bundle mockBundle;
+
+    private PackageAdminUtil mockPackageAdminUtil;
+
+    private Artifact quasiBundleArtifact;
+
+    private BundleContext mockBundleContext;
+
+    private Filter mockFilter;
+
+    @Before
+    public void setUp() throws Exception {
+        this.mockQuasiBundle = EasyMock.createMock(QuasiBundle.class);
+        EasyMock.expect(this.mockQuasiBundle.getSymbolicName()).andReturn(TEST_BUNDLE_SYMBOLIC_NAME).anyTimes();
+        EasyMock.expect(this.mockQuasiBundle.getVersion()).andReturn(TEST_BUNDLE_VERSION).anyTimes();
+        
+        this.mockBundle = EasyMock.createMock(Bundle.class);
+        this.mockBundleContext = EasyMock.createMock(BundleContext.class);
+        this.mockFilter = EasyMock.createMock(Filter.class);
+        EasyMock.expect(this.mockBundle.getSymbolicName()).andReturn(TEST_BUNDLE_SYMBOLIC_NAME).anyTimes();
+        EasyMock.expect(this.mockBundle.getVersion()).andReturn(TEST_BUNDLE_VERSION).anyTimes();
+        EasyMock.expect(this.mockBundle.getBundleContext()).andReturn(this.mockBundleContext).anyTimes();
+        EasyMock.expect(this.mockBundle.getState()).andReturn(Bundle.ACTIVE).anyTimes();
+        EasyMock.expect(this.mockBundleContext.createFilter(EasyMock.isA(String.class))).andReturn(this.mockFilter).anyTimes();
+        this.mockBundleContext.addServiceListener(EasyMock.isA(ServiceListener.class), EasyMock.isA(String.class));
+        EasyMock.expectLastCall().anyTimes();
+        ServiceReference<?>[] refs = {};
+        EasyMock.expect(this.mockBundleContext.getServiceReferences((String) EasyMock.eq(null), EasyMock.isA(String.class))).andReturn(refs).anyTimes();
+        
+        EasyMock.expect(this.mockQuasiBundle.getBundle()).andReturn(this.mockBundle).anyTimes();
+        
+        this.mockPackageAdminUtil = EasyMock.createMock(PackageAdminUtil.class);
+        this.quasiBundleArtifact = new QuasiBundleArtifact(this.mockQuasiBundle, this.mockPackageAdminUtil);
+    }
+
+    private void replay() {
+        EasyMock.replay(this.mockQuasiBundle, this.mockPackageAdminUtil, this.mockBundle, this.mockBundleContext, this.mockFilter);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        EasyMock.verify(this.mockQuasiBundle, this.mockPackageAdminUtil, this.mockBundle, this.mockBundleContext, this.mockFilter);
+    }
+
+    @Test
+    public void testStart() throws BundleException {
+        this.mockBundle.start();
+        EasyMock.expectLastCall();
+        replay();
+        this.quasiBundleArtifact.start();
+    }
+
+    @Test
+    public void testStop() throws BundleException {
+        this.mockBundle.stop();
+        EasyMock.expectLastCall();
+        replay();
+        this.quasiBundleArtifact.stop();
+    }
+
+    @Test
+    public void testRefresh() throws BundleException {
+        this.mockBundle.update();
+        Bundle[] bundles = { this.mockBundle };
+        this.mockPackageAdminUtil.synchronouslyRefreshPackages(EasyMock.aryEq(bundles));
+        EasyMock.expectLastCall().anyTimes();
+        EasyMock.expectLastCall();
+        replay();
+        this.quasiBundleArtifact.refresh();
+    }
+
+    @Test
+    public void testUninstall() throws BundleException {
+        this.mockBundle.uninstall();
+        EasyMock.expectLastCall();
+        replay();
+        this.quasiBundleArtifact.uninstall();
+    }
+
+    @Test
+    public void testGetType() {
+        replay();
+        Assert.assertEquals("bundle", this.quasiBundleArtifact.getType());
+    }
+
+    @Test
+    public void testGetName() {
+        replay();
+        Assert.assertEquals(TEST_BUNDLE_SYMBOLIC_NAME, this.quasiBundleArtifact.getName());
+    }
+
+    @Test
+    public void testGetVersion() {
+        replay();
+        Assert.assertEquals(TEST_BUNDLE_VERSION, this.quasiBundleArtifact.getVersion());
+    }
+
+    @Test
+    public void testGetState() {
+        replay();
+        Assert.assertEquals(ArtifactState.ACTIVE, this.quasiBundleArtifact.getState());
+    }
+
+    @Test
+    public void testGetDependents() {
+        QuasiBundle qb1 = EasyMock.createMock(QuasiBundle.class);
+        QuasiBundle qb2 = EasyMock.createMock(QuasiBundle.class);
+        List<QuasiBundle> dependents = new ArrayList<QuasiBundle>();
+        dependents.add(qb1);
+        dependents.add(qb2);
+        EasyMock.expect(this.mockQuasiBundle.getDependents()).andReturn(dependents);
+        replay();
+        Set<Artifact> expected = new HashSet<Artifact>();
+        expected.add(new QuasiBundleArtifact(qb1, this.mockPackageAdminUtil));
+        expected.add(new QuasiBundleArtifact(qb2, this.mockPackageAdminUtil));
+        Assert.assertEquals(expected, this.quasiBundleArtifact.getDependents());
+    }
+
+    @Test
+    public void testGetProperties() {
+        replay();
+        Assert.assertEquals(new HashMap<String, String>(), this.quasiBundleArtifact.getProperties());
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.model/template.mf b/org.eclipse.virgo.kernel.model/template.mf
index b6ec1c3..543d8fb 100644
--- a/org.eclipse.virgo.kernel.model/template.mf
+++ b/org.eclipse.virgo.kernel.model/template.mf
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Virgo Kernel Runtime Artifact Model
 Bundle-SymbolicName: org.eclipse.virgo.kernel.model
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
 Import-Template: 
  org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",
  org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
diff --git a/org.eclipse.virgo.kernel.osgi/.classpath b/org.eclipse.virgo.kernel.osgi/.classpath
index 481e67d..4733169 100644
--- a/org.eclipse.virgo.kernel.osgi/.classpath
+++ b/org.eclipse.virgo.kernel.osgi/.classpath
@@ -22,28 +22,28 @@
 	</classpathentry>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-sources-1.6.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-sources-1.6.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar"/>
 	<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-2.2.0.D-20101207151510.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-sources-2.2.0.D-20101207151510.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/2.2.0.D-20101207150035/org.eclipse.virgo.util.math-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/2.2.0.D-20101207150035/org.eclipse.virgo.util.math-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/2.2.0.D-20101207145732/org.eclipse.virgo.osgi.extensions.equinox-2.2.0.D-20101207145732.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/2.0.0.D-20090921150251/org.eclipse.virgo.osgi.extensions.equinox-sources-2.0.0.D-20090921150251.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-sources-2.2.0.D-20101207150035.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/3.0.0.M02/org.eclipse.virgo.osgi.extensions.equinox-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/2.0.0.D-20090921150251/org.eclipse.virgo.osgi.extensions.equinox-sources-2.0.0.D-20090921150251.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-sources-3.0.0.M02.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.services"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-2.2.0.D-20101207145338.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-sources-2.2.0.D-20101207145338.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-sources-2.2.0.D-20101207150849.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-sources-3.0.0.M02.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.artifact"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/2.2.0.D-20101207145732/org.eclipse.virgo.osgi.launcher-2.2.0.D-20101207145732.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/2.2.0.D-20101207145732/org.eclipse.virgo.osgi.launcher-sources-2.2.0.D-20101207145732.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.apache.felix/org.apache.felix.eventadmin/1.0.0/org.apache.felix.eventadmin-1.0.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-sources-3.3.0.v20101018.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-3.3.0.v20101018.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-sources-3.3.0.v20101018.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/3.0.0.M02/org.eclipse.virgo.osgi.launcher-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/3.0.0.M02/org.eclipse.virgo.osgi.launcher-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-3.3.0.v20110110.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-sources-3.3.0.v20110110.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.equinox.event/1.2.100.v20110110/org.eclipse.equinox.event-1.2.100.v20110110.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/org.eclipse.virgo.kernel.osgi/ivy.xml b/org.eclipse.virgo.kernel.osgi/ivy.xml
index c983ce6..196706c 100644
--- a/org.eclipse.virgo.kernel.osgi/ivy.xml
+++ b/org.eclipse.virgo.kernel.osgi/ivy.xml
@@ -18,6 +18,7 @@
         <dependency org='org.eclipse.virgo.medic' name='org.eclipse.virgo.medic' rev='${org.eclipse.virgo.medic}' conf='aspects, compile->runtime'/>
         <dependency org="org.eclipse.virgo.medic" name="org.eclipse.virgo.medic.test" rev="${org.eclipse.virgo.medic}" conf="test->runtime"/>
         <dependency org='org.eclipse.osgi' name='org.eclipse.osgi' rev='${org.eclipse.osgi}' conf='compile->compile'/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.event" rev="${org.eclipse.equinox.event}" conf='compile->compile'/>
         <dependency org='org.slf4j' name='com.springsource.slf4j.api' rev='${org.slf4j}' conf='compile->runtime'/>
         <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.services" rev="latest.integration" conf="compile->compile"/>
         <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.core" rev="latest.integration" conf="compile->compile"/>
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/quasi/QuasiFramework.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/quasi/QuasiFramework.java
index 2f12f68..02163a0 100644
--- a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/quasi/QuasiFramework.java
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/quasi/QuasiFramework.java
@@ -15,11 +15,10 @@
 import java.util.List;
 
 import org.eclipse.osgi.service.resolver.State;
+import org.eclipse.virgo.util.osgi.manifest.BundleManifest;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Version;
 
-import org.eclipse.virgo.util.osgi.manifest.BundleManifest;
-
 /**
  * {@link QuasiFramework} is a snapshot of the OSGi framework state into which bundles can be installed and resolved
  * and, in the normal case, committed into the OSGi framework.
@@ -103,4 +102,9 @@
      */
     void commit() throws BundleException;
 
+    /**
+     * Delete any resources associated with this {@link QuasiFramework}.
+     */
+    void destroy();
+
 }
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/IndeterminateRegionException.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/IndeterminateRegionException.java
new file mode 100644
index 0000000..e210955
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/IndeterminateRegionException.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * This file is part of the Virgo Web Server.
+ *
+ * Copyright (c) 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    SpringSource, a division of VMware - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region;
+
+/**
+ * {@link IndeterminateRegionException} is thrown when the region of a bundle cannot be determined.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * 
+ * Thread safe.
+ * 
+ */
+public abstract class IndeterminateRegionException extends Exception {
+
+    private static final long serialVersionUID = 76745737151453L;
+
+    /**
+     * Construct an {@link IndeterminateRegionException} for the given bundle.
+     * 
+     * @param bundleId the id of the bundle whose region cannot be determined
+     */
+    public IndeterminateRegionException(String message) {
+        super(message);
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/Region.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/Region.java
index e737cd2..88fc7f5 100644
--- a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/Region.java
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/Region.java
@@ -11,30 +11,182 @@
 
 package org.eclipse.virgo.kernel.osgi.region;
 
+import java.io.InputStream;
+import java.util.Set;
+
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph.FilteredRegion;
+import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
 
 /**
- * A region is an encapsulated OSGi framework. Regions are isolated from each other except by explicitly shared packages
- * and services that are defined when the region is created.
+ * A <i>region</i> is a subset of the bundles of an OSGi framework. A regions is "weakly" isolated from other regions
+ * except that is has full visibility of certain (subject to a {@link RegionFilter}) bundles, packages, and services
+ * from other regions to which it is connected. However a bundle running in a region is not protected from discovering
+ * bundles in other regions, e.g. by following wires using Wire Admin or similar services, so this is why regions are
+ * only weakly isolated from each other.
  * <p />
  * 
  * <strong>Concurrent Semantics</strong><br />
  * 
- * Implementations must be threadsafe.
+ * Implementations must be thread safe.
  * 
  */
 public interface Region {
 
     /**
-     * @return the name of the region
+     * Returns the name of the region.
+     * 
+     * @return the region name
      */
     String getName();
+
+    /**
+     * Associates a given bundle, which has therefore already been installed, with this region.
+     * <p>
+     * This method is typically used to associate the system bundle with a region. Note that the system bundle is not
+     * treated specially and in order to be fully visible in a region, it must either be associated with the region or
+     * imported from another region via a connection.
+     * <p>
+     * If the bundle is already associated with this region, takes no action and returns normally.
+     * <p>
+     * If the bundle is already associated with another region, throws BundleException with exception type
+     * INVALID_OPERATION.
+     * <p>
+     * If the bundle has the same bundle symbolic name and version as a bundle already present in the region or as a
+     * bundle import specified on a connection to another region, then BundleException with exception type
+     * DUPLICATE_BUNDLE_ERROR is thrown.
+     * 
+     * @param bundle the bundle to be associated with this region
+     * @throws BundleException if the bundle cannot be associated with the region
+     */
+    void addBundle(Bundle bundle) throws BundleException;
+
+    /**
+     * Associates the given bundle id with this region. If the given bundle id is already associated with this region,
+     * this is not an error and there is no effect.
+     * <p>
+     * This is useful when manipulating offline resolver states and bundle descriptions which do not correspond to
+     * bundles.
+     * 
+     * @param bundleId the bundle id to be associated with this region
+     */
+    void addBundle(long bundleId);
+
+    /**
+     * Installs a bundle and associates the bundle with this region. The bundle's location will have the region name
+     * prepended to the given location to ensure the location is unique across regions.
+     * <p>
+     * If the bundle has the same bundle symbolic name and version as a bundle already present in the region or as a
+     * bundle import specified on a connection to another region, then BundleException with exception type
+     * DUPLICATE_BUNDLE_ERROR is thrown.
+     * 
+     * @param location the bundle location string
+     * @param input a stream of the bundle's contents or <code>null</code>
+     * @return the installed Bundle
+     * @throws BundleException if the install fails
+     * @see BundleContext#installBundle(String, InputStream)
+     */
+    Bundle installBundle(String location, InputStream input) throws BundleException;
+
+    /**
+     * Installs a bundle and associates the bundle with this region. The bundle's location will have the region name
+     * prepended to the given location to ensure the location is unique across regions.
+     * <p>
+     * If the bundle has the same bundle symbolic name and version as a bundle already present in the region or as a
+     * bundle import specified on a connection to another region, then BundleException with exception type
+     * DUPLICATE_BUNDLE_ERROR is thrown.
+     * 
+     * 
+     * @param location the bundle location string
+     * @return the installed Bundle
+     * @throws BundleException if the install fails
+     * @see BundleContext#installBundle(String)
+     */
+    Bundle installBundle(String location) throws BundleException;
     
     /**
-     * Returns a {@link BundleContext} that can be used to access the encapsulated OSGi framework.
      * 
-     * @return a <code>BundleContext</code>
+     * Gets the bundle ids of the bundles associated with this region.
+     * 
+     * @return a set of bundle ids
      */
-    BundleContext getBundleContext();
+    Set<Long> getBundleIds();
+
+    /**
+     * Returns <code>true</code> if and only if the given bundle belongs to this region.
+     * 
+     * @param bundle a {@link Bundle}
+     * @return <code>true</code> if the given bundle belongs to this region and <code>false</code> otherwise
+     */
+    boolean contains(Bundle bundle);
+
+    /**
+     * Returns <code>true</code> if and only if a bundle with the given bundle id belongs to this region.
+     * 
+     * @param bundleId a bundle id
+     * @return <code>true</code> if a bundle with the given bundle id belongs to this region and <code>false</code>
+     *         otherwise
+     */
+    boolean contains(long bundleId);
+
+    /**
+     * Get the bundle in this region with the given symbolic name and version.
+     * 
+     * @param symbolicName
+     * @param version
+     * @return the bundle or <code>null</code> if there is no such bundle
+     */
+    Bundle getBundle(String symbolicName, Version version);
+
+    /**
+     * Connects this region to the given head region and associates the given {@link RegionFilter} with the connection.
+     * This region may then, subject to the region filter, see bundles, packages, and services visible in the head
+     * region.
+     * <p>
+     * If the filter allows the same bundle symbolic name and version as a bundle already present in this region or a
+     * filter connecting this region to a region other than the tail region, then BundleException with exception type
+     * DUPLICATE_BUNDLE_ERROR is thrown.
+     * <p>
+     * If the given source region is already connected to the given tail region, then BundleException with exception
+     * type UNSUPPORTED_OPERATION is thrown.
+     * 
+     * @param headRegion the region to connect this region to
+     * @param filter a {@link RegionFilter} which controls what is visible across the connection
+     * @throws BundleException if the connection was not created
+     */
+    void connectRegion(Region headRegion, RegionFilter filter) throws BundleException;
+
+    /**
+     * Removes the given bundle from this region. If the given bundle does not belong to this region, this is not an
+     * error and there is no effect.
+     * 
+     * @param bundle the bundle to be removed
+     */
+    void removeBundle(Bundle bundle);
+
+    /**
+     * Removes the given bundle id from this region. If the given bundle id is not associated with this region, this is
+     * not an error and there is no effect.
+     * 
+     * @param bundleId the bundle id to be removed
+     */
+    void removeBundle(long bundleId);
     
+    /**
+     * Gets a {@link Set} containing a snapshot of the {@link FilteredRegion FilteredRegions} attached to this tail
+     * region.
+     * 
+     * @return a {@link Set} of {@link FilteredRegion FilteredRegions} of head regions and region filters
+     */
+    Set<FilteredRegion> getEdges();
+    
+    /**
+     * Visit the subgraph connected to this region.
+     * 
+     * @param visitor a {@link RegionDigraphVisitor} to be called as the subgraph is navigated
+     */
+    void visitSubgraph(RegionDigraphVisitor visitor);
+
 }
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionDigraph.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionDigraph.java
new file mode 100644
index 0000000..3cd4190
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionDigraph.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * This file is part of the Virgo Web Server.
+ *
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    SpringSource, a division of VMware - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region;
+
+import java.util.Set;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * {@link RegionDigraph} is a <a href="http://en.wikipedia.org/wiki/Directed_graph">directed graph</a>, or
+ * <i>digraph</i>, of {@link Region Regions}. The regions form the nodes of the graph and the edges connect regions to
+ * other regions.
+ * <p>
+ * Each edge (r, s) of the digraph is directed from region r, known as the <i>tail</i> of the edge, to region s, known
+ * as the <i>head</i> of the edge.
+ * <p>
+ * Each edge is associated with a {@link RegionFilter}, making the digraph a <i>labelled</i> digraph. The region filter
+ * for edge (r, s) allows region r to see certain bundles, packages, and services visible in region s.
+ * <p>
+ * Although the digraph may contain cycles it does not contain any <i>loops</i> which are edges of the form (r, r) for
+ * some region r. Loopless digraphs are known as <i>simple</i> digraphs. So the digraph is a simple, labelled digraph.
+ * <p>
+ * The region digraph extends <code>Iterable<Region></code> and so a foreach statement may be used to iterate over (a
+ * snapshot of) the regions in the digraph, e.g.
+ * 
+ * <pre>
+ * for (Region r : regionDigraph) {
+ *   ...
+ * }
+ * </pre>
+ * <p>
+ * <strong>Concurrent Semantics</strong><br />
+ * 
+ * Implementations of this interface must be thread safe.
+ * 
+ */
+public interface RegionDigraph extends Iterable<Region> {
+
+    public interface FilteredRegion {
+
+        Region getRegion();
+
+        RegionFilter getFilter();
+    }
+
+    /**
+     * Create a {@link Region} with the given name. If a region with the given name already exists, then BundleException with
+     * exception type UNSUPPORTED_OPERATION is thrown.
+     * 
+     * @param regionName the name of the region
+     * @return the {@link Region} created
+     * @throws BundleException if the region was not created
+     */
+    Region createRegion(String regionName) throws BundleException;
+
+    /**
+     * Removes the given {@link Region} from the digraph along with any edges which have the given region as head or
+     * tail. If the given region is not present in the digraph, this is not an error and there is no effect.
+     * 
+     * @param region the {@link Region} to be removed
+     */
+    void removeRegion(Region region);
+    
+    /**
+     * Gets all the {@link Region Regions} in the digraph.
+     * 
+     * @return a set of {@link Region Regions}
+     */
+    Set<Region> getRegions();
+
+    /**
+     * Gets the {@link Region} in the digraph with the given name.
+     * 
+     * @param regionName the name of the region
+     * @return the {@link Region} or <code>null</code> if no such region is present in the digraph
+     */
+    Region getRegion(String regionName);
+
+    /**
+     * Gets the {@link Region} in the digraph containing the given bundle.
+     * 
+     * @param bundle the bundle to search for
+     * @return the {@link Region} which contains the given bundle or <code>null</code> if there is no such region
+     */
+    Region getRegion(Bundle bundle);
+
+    /**
+     * Gets the {@link Region} in the digraph containing a bundle with the given bundle id.
+     * 
+     * @param bundleId the bundleId of the bundle to search for
+     * @return the {@link Region} which contains a bundle with the given bundle or <code>null</code> if there is no such
+     *         region
+     */
+    Region getRegion(long bundleId);
+
+    /**
+     * Connects a given tail region to a given head region via an edge labelled with the given {@link RegionFilter}. The
+     * tail region may then, subject to the region filter, see bundles, packages, and services visible in the head
+     * region.
+     * <p>
+     * The given head and tail regions are added to the digraph if they are not already present.
+     * <p>
+     * If the given tail region is already connected to the given head region, then BundleException with exception type
+     * UNSUPPORTED_OPERATION is thrown.
+     * <p>
+     * If the given head and the given tail are identical, then BundleException with exception type
+     * UNSUPPORTED_OPERATION is thrown.
+     * 
+     * @param tailRegion the region at the tail of the new edge
+     * @param filter a {@link RegionFilter} which labels the new edge
+     * @param headRegion the region at the head of the new edge
+     * @throws BundleException if the edge was not created
+     */
+    void connect(Region tailRegion, RegionFilter filter, Region headRegion) throws BundleException;
+
+    /**
+     * Gets a {@link Set} containing a snapshot of the {@link FilteredRegion FilteredRegions} attached to the given tail
+     * region.
+     * 
+     * @param tailRegion the tail region whose edges are gotten
+     * @return a {@link Set} of {@link FilteredRegion FilteredRegions} of head regions and region filters
+     */
+    Set<FilteredRegion> getEdges(Region tailRegion);
+    
+    /**
+     * Visit the subgraph connected to the given region.
+     * 
+     * @param startingRegion the region at which to start
+     * @param visitor a {@link RegionDigraphVisitor} to be called as the subgraph is navigated
+     */
+    void visitSubgraph(Region startingRegion, RegionDigraphVisitor visitor);
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionDigraphVisitor.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionDigraphVisitor.java
new file mode 100644
index 0000000..ae486d9
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionDigraphVisitor.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * This file is part of the Virgo Web Server.
+ *
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    SpringSource, a division of VMware - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region;
+
+/**
+ * {@link RegionDigraphVisitor} is used to traverse a subgraph of a {@link RegionDigraph}.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * 
+ * Implementations of this interface must be thread safe.
+ */
+public interface RegionDigraphVisitor {
+
+    /**
+     * Visits the given region and determines whether or not to continue traversing.
+     * 
+     * @param region the region to visit
+     * @return <code>true</code> if the traversal is to continue and <code>false</code> otherwise
+     */
+    boolean visit(Region region);
+
+    /**
+     * Prepares to traverse an edge with the given {@link RegionFilter} and determines whether or not to traverse the
+     * edge.
+     * 
+     * @param regionFilter the {@link RegionFilter} of the edge to be traversed
+     * @return <code>true</code> if the edge is to be traversed and <code>false</code> otherwise
+     */
+    boolean preEdgeTraverse(RegionFilter regionFilter);
+
+    /**
+     * This is called after traversing an edge with the given {@link RegionFilter}.
+     * 
+     * @param regionFilter the {@link RegionFilter} of the edge that has just been traversed
+     */
+    void postEdgeTraverse(RegionFilter regionFilter);
+
+}
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionFilter.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionFilter.java
new file mode 100644
index 0000000..994dac1
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionFilter.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * This file is part of the Virgo Web Server.
+ *
+ * Copyright (c) 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    SpringSource, a division of VMware - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region;
+
+import java.util.Dictionary;
+import java.util.Map;
+
+import org.eclipse.virgo.util.osgi.VersionRange;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+/**
+ * A {@link RegionFilter} is associated with a connection from one region to another and determines the bundles,
+ * packages, and services which are visible across the connection.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * 
+ * Implementations must be thread safe.
+ * 
+ */
+public interface RegionFilter {
+
+    public static final RegionPackageImportPolicy ALL_PACKAGES = new RegionPackageImportPolicy() {
+
+        @Override
+        public boolean isImported(String packageName, Map<String, Object> attributes, Map<String, String> directives) {
+            return true;
+        }
+    };
+
+    public static final Filter ALL_SERVICES = new Filter() {
+
+        @Override
+        public boolean match(ServiceReference<?> reference) {
+            return true;
+        }
+
+        @Override
+        public boolean match(Dictionary<String, ?> dictionary) {
+            return true;
+        }
+
+        @Override
+        public boolean matchCase(Dictionary<String, ?> dictionary) {
+            return true;
+        }
+
+        @Override
+        public boolean matches(Map<String, ?> map) {
+            return true;
+        }
+    };
+
+    public static final RegionFilter TOP = new RegionFilter() {
+
+        @Override
+        public RegionFilter allowBundle(String bundleSymbolicName, VersionRange versionRange) {
+            return this;
+        }
+
+        @Override
+        public boolean isBundleAllowed(String bundleSymbolicName, Version bundleVersion) {
+            return true;
+        }
+
+        @Override
+        public RegionFilter setPackageImportPolicy(RegionPackageImportPolicy packageImportPolicy) {
+            throw new UnsupportedOperationException("TOP is immutable");
+        }
+
+        @Override
+        public RegionPackageImportPolicy getPackageImportPolicy() {
+            return ALL_PACKAGES;
+        }
+
+        @Override
+        public RegionFilter setServiceFilter(Filter serviceFilter) {
+            throw new UnsupportedOperationException("TOP is immutable");
+        }
+
+        @Override
+        public Filter getServiceFilter() {
+            return ALL_SERVICES;
+        }
+    };
+
+    /**
+     * Allows bundles with the given bundle symbolic name and bundle version in the given range to be imported.
+     * 
+     * Note that the system bundle has the symbolic name "org.eclipse.osgi".
+     * 
+     * @param bundleSymbolicName
+     * @param versionRange
+     * @return this {@link RegionFilter} for chaining purposes
+     */
+    RegionFilter allowBundle(String bundleSymbolicName, VersionRange versionRange);
+
+    /**
+     * Determines whether this filter allows the bundle with the given symbolic name and version
+     * 
+     * @param bundleSymbolicName the symbolic name of the bundle
+     * @param bundleVersion the {@link Version} of the bundle
+     * @return <code>true</code> if the bundle is allowed and <code>false</code>otherwise
+     */
+    boolean isBundleAllowed(String bundleSymbolicName, Version bundleVersion);
+
+    /**
+     * Sets the package import policy of this filter.
+     * 
+     * @param packageImportPolicy
+     * @return this {@link RegionFilter} for chaining purposes
+     */
+    RegionFilter setPackageImportPolicy(RegionPackageImportPolicy packageImportPolicy);
+
+    /**
+     * Gets the package import policy of this filter.
+     * 
+     * @return the package import policy or <code>null</code> if this has not been set
+     */
+    RegionPackageImportPolicy getPackageImportPolicy();
+
+    /**
+     * @param serviceFilter
+     * @return this {@link RegionFilter} for chaining purposes
+     * @see org.osgi.framework.Filter more information about service filters
+     */
+    RegionFilter setServiceFilter(Filter serviceFilter);
+
+    /**
+     * Gets the service filter of this filter.
+     * 
+     * @return the service filter or <code>null</code> if this has not been set
+     */
+    Filter getServiceFilter();
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionLifecycleListener.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionLifecycleListener.java
new file mode 100644
index 0000000..08477c0
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionLifecycleListener.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region;
+
+/**
+ * {@link RegionLifecycleListener} is a service interface to listen for regions being added to and deleted from the
+ * region digraph.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * Implementations of this interface must be thread safe.
+ */
+public interface RegionLifecycleListener {
+
+    /**
+     * Called after the given region is added to the digraph.
+     * 
+     * @param region the region which has been added
+     */
+    void regionAdded(Region region);
+
+    /**
+     * Called before the given region is removed from the digraph.
+     * 
+     * @param region the region which is about to be removed
+     */
+    void regionRemoving(Region region);
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java
index 9fa2a45..52257f4 100644
--- a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManager.java
@@ -11,36 +11,23 @@
 
 package org.eclipse.virgo.kernel.osgi.region;
 
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
 import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.HashMap;
 import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
 
+import org.eclipse.virgo.kernel.osgi.region.hook.RegionBundleEventHook;
+import org.eclipse.virgo.kernel.osgi.region.hook.RegionBundleFindHook;
+import org.eclipse.virgo.kernel.osgi.region.hook.RegionResolverHookFactory;
+import org.eclipse.virgo.kernel.osgi.region.hook.RegionServiceEventHook;
+import org.eclipse.virgo.kernel.osgi.region.hook.RegionServiceFindHook;
+import org.eclipse.virgo.kernel.osgi.region.internal.StandardRegionDigraph;
+import org.eclipse.virgo.kernel.osgi.region.management.internal.StandardManageableRegionDigraph;
+import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.launch.Framework;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventAdmin;
-import org.osgi.service.framework.CompositeBundle;
-import org.osgi.service.framework.CompositeBundleFactory;
-import org.osgi.service.framework.SurrogateBundle;
-
-import org.eclipse.virgo.osgi.launcher.parser.ArgumentParser;
-import org.eclipse.virgo.osgi.launcher.parser.BundleEntry;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
-import org.eclipse.virgo.kernel.core.Shutdown;
-import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkLogEvents;
+import org.osgi.framework.hooks.bundle.EventHook;
+import org.osgi.framework.hooks.bundle.FindHook;
+import org.osgi.framework.hooks.resolver.ResolverHookFactory;
 
 /**
  * Creates and manages the user {@link Region regions}.
@@ -51,322 +38,107 @@
  * Threadsafe.
  * 
  */
-@SuppressWarnings("deprecation")
 final class RegionManager {
 
-    private static final String USER_REGION_CONFIGURATION_PID = "org.eclipse.virgo.kernel.userregion";
-
-    private static final String PLUGGABLE_CLASS_LOADING_HOOK_CLASS_NAME = "org.eclipse.virgo.osgi.extensions.equinox.hooks.PluggableClassLoadingHook";
-
-    private static final String USER_REGION_PATH = "region.path";
-
-    private static final String USER_REGION_BASE_BUNDLES_PROPERTY = "baseBundles";
-
-    private static final String USER_REGION_PACKAGE_IMPORTS_PROPERTY = "packageImports";
-
-    private static final String USER_REGION_SERVICE_IMPORTS_PROPERTY = "serviceImports";
-
-    private static final String USER_REGION_SERVICE_EXPORTS_PROPERTY = "serviceExports";
-
-    private static final String USER_REGION_PROPERTIES_PROPERTY = "inheritedFrameworkProperties";
-
-    private static final String REGION_USER = "org.eclipse.virgo.region.user";
-
-    private static final String EVENT_REGION_STARTING = "org/eclipse/virgo/kernel/region/STARTING";
-
-    private static final String EVENT_PROPERTY_REGION_BUNDLECONTEXT = "region.bundleContext";
+    private static final String REGION_KERNEL = "org.eclipse.virgo.region.kernel";
 
     private final ServiceRegistrationTracker tracker = new ServiceRegistrationTracker();
 
     private final BundleContext bundleContext;
 
-    private final CompositeBundleFactory compositeBundleFactory;
+    private final ThreadLocal<Region> threadLocal;
 
-    private final ArgumentParser parser = new ArgumentParser();
+    private final String domain;
 
-    private final EventAdmin eventAdmin;
-
-    private final ServiceFactory<EventLogger> eventLoggerServiceFactory;
-
-    private volatile Framework childFramework;
-
-    private Dictionary<String, String> userRegionProperties;
-
-    private String regionPath;
-
-    private String regionBundles;
-
-    private String regionImports;
-
-    private String regionServiceImports;
-
-    private String regionServiceExports;
-
-    private String regionInheritedProperties;
-
-    public RegionManager(BundleContext bundleContext, CompositeBundleFactory compositeBundleFactory, EventAdmin eventAdmin,
-        ServiceFactory<EventLogger> eventLoggerServiceFactory, ConfigurationAdmin configAdmin, EventLogger eventLogger, Shutdown shutdown) {
+    public RegionManager(BundleContext bundleContext, String domain) {
         this.bundleContext = bundleContext;
-        this.compositeBundleFactory = compositeBundleFactory;
-        this.eventAdmin = eventAdmin;
-        this.eventLoggerServiceFactory = eventLoggerServiceFactory;
-        getRegionConfiguration(configAdmin, eventLogger, shutdown);
-    }
-
-    private void getRegionConfiguration(ConfigurationAdmin configAdmin, EventLogger eventLogger, Shutdown shutdown) {
-        try {
-            Configuration config = configAdmin.getConfiguration(USER_REGION_CONFIGURATION_PID, null);
-            
-            @SuppressWarnings("unchecked")
-            Dictionary<String, String> properties = (Dictionary<String, String>) config.getProperties();
-            
-            if (properties != null) {
-                this.userRegionProperties = properties;
-                this.regionPath = properties.get(USER_REGION_PATH);
-                this.regionBundles = properties.get(USER_REGION_BASE_BUNDLES_PROPERTY);
-                this.regionImports = properties.get(USER_REGION_PACKAGE_IMPORTS_PROPERTY);
-                this.regionServiceImports = properties.get(USER_REGION_SERVICE_IMPORTS_PROPERTY);
-                this.regionServiceExports = properties.get(USER_REGION_SERVICE_EXPORTS_PROPERTY);
-                this.regionInheritedProperties = properties.get(USER_REGION_PROPERTIES_PROPERTY);
-            } else {
-                eventLogger.log(OsgiFrameworkLogEvents.USER_REGION_CONFIGURATION_UNAVAILABLE);
-                shutdown.immediateShutdown();
-            }
-        } catch (Exception e) {
-            eventLogger.log(OsgiFrameworkLogEvents.USER_REGION_CONFIGURATION_UNAVAILABLE, e);
-            shutdown.immediateShutdown();
-        }
+        this.threadLocal = new ThreadLocal<Region>();
+        this.domain = domain;
     }
 
     public void start() throws BundleException {
-        createAndPublishUserRegion();
+        RegionDigraph regionDigraph = createRegionDigraph();
+        registerRegionHooks(regionDigraph);
     }
 
-    private void createAndPublishUserRegion() throws BundleException {
-
-        CompositeBundle compositeBundle = this.compositeBundleFactory.installCompositeBundle(createChildFrameworkConfig(), REGION_USER,
-            createCompositeBundleManifest());
-
-        childFramework = compositeBundle.getCompositeFramework();
-        compositeBundle.start();
-        childFramework.start();
-
-        SurrogateBundle surrogateBundle = compositeBundle.getSurrogateBundle();
-        BundleContext surrogateBundleContext = surrogateBundle.getBundleContext();
-
-        Map<String, Object> properties = new HashMap<String, Object>();
-        properties.put(EVENT_PROPERTY_REGION_BUNDLECONTEXT, surrogateBundleContext);
-        this.eventAdmin.sendEvent(new Event(EVENT_REGION_STARTING, properties));
-
-        setUserRegionBundleParentClassLoader(surrogateBundleContext);
-
-        registerEventLoggerServiceFactory(surrogateBundleContext);
-
-        initialiseUserRegionBundles(surrogateBundleContext);
-
-        registerRegionService(new ImmutableRegion(REGION_USER, surrogateBundleContext));
-        publishUserRegionsBundleContext(surrogateBundleContext);
+    private RegionDigraph createRegionDigraph() throws BundleException {
+        RegionDigraph regionDigraph = new StandardRegionDigraph(this.bundleContext, this.threadLocal);
+        registerDigraphMbean(regionDigraph);
+        createKernelRegion(regionDigraph);
+        registerRegionDigraph(regionDigraph, this.bundleContext);
+        return regionDigraph;
     }
 
-    private void registerEventLoggerServiceFactory(BundleContext surrogateBundleContext) {
-        surrogateBundleContext.registerService(EventLogger.class.getName(), this.eventLoggerServiceFactory, null);
+    private void registerDigraphMbean(RegionDigraph regionDigraph) {
+        StandardManageableRegionDigraph standardManageableRegionDigraph = new StandardManageableRegionDigraph(regionDigraph, this.domain, this.bundleContext);
+        standardManageableRegionDigraph.registerMBean();
     }
 
-    /**
-     * @param surrogateBundleContext
-     */
-    private void publishUserRegionsBundleContext(BundleContext surrogateBundleContext) {
-        Dictionary<String, String> properties = new Hashtable<String, String>();
-        properties.put("org.eclipse.virgo.kernel.regionContext", "true");
-        this.bundleContext.registerService(BundleContext.class.getName(), surrogateBundleContext, properties);
+    private Region createKernelRegion(RegionDigraph regionDigraph) throws BundleException {
+        Region kernelRegion = regionDigraph.createRegion(REGION_KERNEL);
+
+        for (Bundle bundle : this.bundleContext.getBundles()) {
+            kernelRegion.addBundle(bundle);
+        }
+
+        registerRegionService(kernelRegion);
+
+        return kernelRegion;
     }
 
-    private void setUserRegionBundleParentClassLoader(BundleContext surrogateBundleContext) throws BundleException {
-        ClassLoader surrogateClassLoader = surrogateBundleContext.getClass().getClassLoader();
-        try {
-            setUserRegionHookBundleParentClassLoader(surrogateClassLoader);
-        } catch (Exception e) {
-            throw new BundleException("Error setting user region hook bundle parent class loader", e);
+    private void registerRegionHooks(RegionDigraph regionDigraph) {
+        registerResolverHookFactory(new RegionResolverHookFactory(regionDigraph));
+
+        RegionBundleFindHook bundleFindHook = new RegionBundleFindHook(regionDigraph);
+
+        registerBundleFindHook(bundleFindHook);
+
+        registerBundleEventHook(new RegionBundleEventHook(regionDigraph, bundleFindHook, this.threadLocal));
+
+        RegionServiceFindHook serviceFindHook = new RegionServiceFindHook(regionDigraph);
+
+        registerServiceFindHook(serviceFindHook);
+
+        registerServiceEventHook(new RegionServiceEventHook(serviceFindHook));
+    }
+
+    private void registerRegionDigraph(RegionDigraph regionDigraph, BundleContext userRegionBundleContext) {
+        this.tracker.track(this.bundleContext.registerService(RegionDigraph.class, regionDigraph, null));
+        if (userRegionBundleContext != null) {
+            this.tracker.track(userRegionBundleContext.registerService(RegionDigraph.class, regionDigraph, null));
         }
     }
 
-    private void setUserRegionHookBundleParentClassLoader(ClassLoader parentClassLoader) throws ClassNotFoundException, SecurityException,
-        NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
-        Class<?> pluggableClassLoadingHookClass = parentClassLoader.loadClass(PLUGGABLE_CLASS_LOADING_HOOK_CLASS_NAME);
-
-        Object pluggableClassLoadingHookInstance = invokeGetInstance(pluggableClassLoadingHookClass);
-
-        invokeSetParent(pluggableClassLoadingHookClass, pluggableClassLoadingHookInstance, parentClassLoader);
+    private void registerServiceFindHook(org.osgi.framework.hooks.service.FindHook serviceFindHook) {
+        this.tracker.track(this.bundleContext.registerService(org.osgi.framework.hooks.service.FindHook.class, serviceFindHook, null));
     }
 
-    private Object invokeGetInstance(Class<?> pluggableClassLoadingHookClass) throws SecurityException, NoSuchMethodException,
-        IllegalArgumentException, IllegalAccessException, InvocationTargetException {
-        Class<?>[] parmTypes = {};
-        Method getInstanceMethod = pluggableClassLoadingHookClass.getDeclaredMethod("getInstance", parmTypes);
-        Object[] args = {};
-        return getInstanceMethod.invoke(null, args);
+    @SuppressWarnings("deprecation")
+    private void registerServiceEventHook(org.osgi.framework.hooks.service.EventHook serviceEventHook) {
+        this.tracker.track(this.bundleContext.registerService(org.osgi.framework.hooks.service.EventHook.class, serviceEventHook, null));
     }
 
-    private void invokeSetParent(Class<?> pluggableClassLoadingHookClass, Object pluggableClassLoadingHookInstance, ClassLoader parentClassLoader)
-        throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-        Class<?>[] parmTypes = { ClassLoader.class };
-        Method setParentMethod = pluggableClassLoadingHookClass.getDeclaredMethod("setBundleClassLoaderParent", parmTypes);
-        Object[] args = { parentClassLoader };
-        setParentMethod.invoke(pluggableClassLoadingHookInstance, args);
+    private void registerBundleFindHook(FindHook findHook) {
+        this.tracker.track(this.bundleContext.registerService(FindHook.class, findHook, null));
     }
 
-    private Map<String, String> createChildFrameworkConfig() {
-        HashMap<String, String> frameworkConfig = new HashMap<String, String>();
+    private void registerBundleEventHook(EventHook eventHook) {
+        this.tracker.track(this.bundleContext.registerService(EventHook.class, eventHook, null));
 
-        setUserConfiguredUserRegionProperties(frameworkConfig);
-
-        if (this.regionInheritedProperties != null) {
-            String[] inheritedProperties = this.regionInheritedProperties.split(",");
-            for (String property : inheritedProperties) {
-                propagatePropertyToUserRegion(frameworkConfig, property);
-            }
-        }
-
-        String userRegionImportsProperty = this.bundleContext.getProperty(USER_REGION_PROPERTIES_PROPERTY);
-        if (userRegionImportsProperty != null) {
-            for (String property : userRegionImportsProperty.split(",")) {
-                propagatePropertyToUserRegion(frameworkConfig, property);
-            }
-        }
-
-        return frameworkConfig;
     }
 
-    private void setUserConfiguredUserRegionProperties(HashMap<String, String> frameworkConfig) {
-        if (this.userRegionProperties != null) {
-            Enumeration<String> keys = this.userRegionProperties.keys();
-            while (keys.hasMoreElements()) {
-                String propertyName = keys.nextElement();
-                String propertyValue = this.userRegionProperties.get(propertyName);
-                frameworkConfig.put(propertyName, propertyValue);
-            }
-        }
-    }
-
-    private void propagatePropertyToUserRegion(HashMap<String, String> frameworkConfig, String propertyName) {
-        String propertyValue = this.bundleContext.getProperty(propertyName);
-        if (propertyValue != null) {
-            frameworkConfig.put(propertyName, propertyValue);
-        }
-    }
-
-    private Map<String, String> createCompositeBundleManifest() {
-        Map<String, String> compositeManifest = new HashMap<String, String>();
-
-        compositeManifest.put(Constants.BUNDLE_SYMBOLICNAME, REGION_USER);
-
-        String userRegionImportsProperty = this.regionImports != null ? this.regionImports
-            : this.bundleContext.getProperty(USER_REGION_PACKAGE_IMPORTS_PROPERTY);
-        if (userRegionImportsProperty != null) {
-            String expandedUserRegionImportsProperty = PackageImportWildcardExpander.expandPackageImportsWildcards(userRegionImportsProperty,
-                this.bundleContext);
-            compositeManifest.put(Constants.IMPORT_PACKAGE, expandedUserRegionImportsProperty);
-        }
-
-        configureServiceImportFilter(compositeManifest);
-        configureServiceExportFilter(compositeManifest);
-
-        return compositeManifest;
-    }
-
-    private void configureServiceImportFilter(Map<String, String> compositeManifest) {
-        String[] serviceImports = splitServices(this.regionServiceImports);
-        if (serviceImports != null) {
-            compositeManifest.put(CompositeBundleFactory.COMPOSITE_SERVICE_FILTER_IMPORT, createObjectClassesServiceFilter(serviceImports));
-        }
-    }
-
-    private void configureServiceExportFilter(Map<String, String> compositeManifest) {
-        String[] serviceExports = splitServices(this.regionServiceExports);
-        if (serviceExports != null) {
-            compositeManifest.put(CompositeBundleFactory.COMPOSITE_SERVICE_FILTER_EXPORT, createObjectClassesServiceFilter(serviceExports));
-        }
-    }
-
-    private String[] splitServices(String serviceString) {
-        String[] services = null;
-        if (serviceString != null) {
-            services = serviceString.split(",");
-        }
-        return services;
-    }
-
-    private String createObjectClassesServiceFilter(String[] serviceClassNames) {
-        StringBuffer importFilter = new StringBuffer();
-        importFilter.append("(|");
-        for (String className : serviceClassNames) {
-            importFilter.append(createObjectClassFilter(className));
-        }
-        importFilter.append(")");
-        return importFilter.toString();
-    }
-
-    private String createObjectClassFilter(String className) {
-        return "(objectClass=" + className + ")";
-    }
-
-    private void initialiseUserRegionBundles(BundleContext surrogateBundleContext) throws BundleException {
-        String userRegionPathProperty = this.regionPath != null ? this.regionPath
-            : this.bundleContext.getProperty(USER_REGION_PATH);
-        String userRegionBundlesProperty = this.regionBundles != null ? this.regionBundles
-            : this.bundleContext.getProperty(USER_REGION_BASE_BUNDLES_PROPERTY);
-
-
-        if (userRegionBundlesProperty != null) {
-            List<Bundle> bundlesToStart = new ArrayList<Bundle>();
-
-            for (BundleEntry entry : this.parser.parseBundleEntries(userRegionPathProperty, userRegionBundlesProperty)) {
-                Bundle bundle = surrogateBundleContext.installBundle(entry.getURI().toString());
-
-                if (entry.isAutoStart()) {
-                    bundlesToStart.add(bundle);
-                }
-            }
-
-            for (Bundle bundle : bundlesToStart) {
-                try {
-                    bundle.start();
-                } catch (BundleException e) {
-                    throw new BundleException("Failed to start bundle " + bundle.getSymbolicName() + " " + bundle.getVersion(), e);
-                }
-            }
-
-        }
+    private void registerResolverHookFactory(ResolverHookFactory resolverHookFactory) {
+        this.tracker.track(this.bundleContext.registerService(ResolverHookFactory.class, resolverHookFactory, null));
     }
 
     private void registerRegionService(Region region) {
         Dictionary<String, String> props = new Hashtable<String, String>();
         props.put("org.eclipse.virgo.kernel.region.name", region.getName());
-        this.tracker.track(this.bundleContext.registerService(Region.class.getName(), region, props));
+        this.tracker.track(this.bundleContext.registerService(Region.class, region, props));
     }
 
     public void stop() {
         this.tracker.unregisterAll();
     }
 
-    private static class ImmutableRegion implements Region {
-
-        private final String name;
-
-        private final BundleContext bundleContext;
-
-        public ImmutableRegion(String name, BundleContext bundleContext) {
-            this.name = name;
-            this.bundleContext = bundleContext;
-        }
-
-        public String getName() {
-            return name;
-        }
-
-        public BundleContext getBundleContext() {
-            return this.bundleContext;
-        }
-
-    }
 }
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionPackageImportPolicy.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionPackageImportPolicy.java
new file mode 100644
index 0000000..ff1abc8
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionPackageImportPolicy.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * This file is part of the Virgo Web Server.
+ *
+ * Copyright (c) 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    SpringSource, a division of VMware - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region;
+
+import java.util.Map;
+
+/**
+ * {@link RegionPackageImportPolicy} determines the package names that are imported into a region.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * 
+ * Implementations of this interface must be thread safe.
+ * 
+ */
+public interface RegionPackageImportPolicy {
+    
+    /**
+     * Returns <code>true</code> if and only if the package with the specified name exported with the specified
+     * attributes and directives is imported into the region.
+     * 
+     * @param packageName the name of the package
+     * @param attributes the package's export attributes
+     * @param directives the package's export directives
+     * @return <code>true</code> if and only if the package is imported
+     */
+    boolean isImported(String packageName, Map<String, Object> attributes, Map<String, String> directives);
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionSpanningException.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionSpanningException.java
new file mode 100644
index 0000000..fa5d475
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionSpanningException.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * This file is part of the Virgo Web Server.
+ *
+ * Copyright (c) 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    SpringSource, a division of VMware - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * {@link RegionSpanningException} is thrown when an attempt is made to determine the region a bundle belongs when the
+ * bundle spans multiple regions. The principle example is the system bundle which spans all regions.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * 
+ * Thread safe.
+ * 
+ */
+public class RegionSpanningException extends IndeterminateRegionException {
+
+
+    private static final long serialVersionUID = 545234523452345L;
+
+    /**
+     * Construct a {@link RegionSpanningException} for the given bundle.
+     * 
+     * @param bundleId the id of the bundle whose region cannot be uniquely determined
+     */
+    public RegionSpanningException(Long bundleId) {
+        super("Bundle with id '" + bundleId + "' spans multiple regions");
+    }
+    
+    /**
+     * Construct a {@link RegionSpanningException} for the given bundle.
+     * 
+     * @param bundle the bundle whose region cannot be uniquely determined
+     */
+    public RegionSpanningException(Bundle bundle) {
+        super("Bundle '" + bundle + "' spans multiple regions");
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/StandardRegionFilter.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/StandardRegionFilter.java
new file mode 100644
index 0000000..d18af63
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/StandardRegionFilter.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.virgo.util.math.OrderedPair;
+import org.eclipse.virgo.util.osgi.VersionRange;
+import org.osgi.framework.Filter;
+import org.osgi.framework.Version;
+
+/**
+ * {@link StandardRegionFilter} is the default implementation of {@link RegionFilter}.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+public final class StandardRegionFilter implements RegionFilter {
+
+    private final Object monitor = new Object();
+
+    private final Set<OrderedPair<String, VersionRange>> allowedBundles = new HashSet<OrderedPair<String, VersionRange>>();
+
+    private RegionPackageImportPolicy packageImportPolicy;
+
+    private Filter serviceFilter;
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public RegionFilter allowBundle(String bundleSymbolicName, VersionRange versionRange) {
+        synchronized (this.monitor) {
+            this.allowedBundles.add(createPair(bundleSymbolicName, versionRange));
+        }
+        return this;
+    }
+
+    private OrderedPair<String, VersionRange> createPair(String bundleSymbolicName, VersionRange versionRange) {
+        return new OrderedPair<String, VersionRange>(bundleSymbolicName, versionRange);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public RegionFilter setServiceFilter(Filter serviceFilter) {
+        synchronized (this.monitor) {
+            this.serviceFilter = serviceFilter;
+        }
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Filter getServiceFilter() {
+        synchronized (this.monitor) {
+            return this.serviceFilter;
+        }
+    }
+
+    @Override
+    public RegionPackageImportPolicy getPackageImportPolicy() {
+        synchronized (this.monitor) {
+            return this.packageImportPolicy;
+        }
+    }
+
+    @Override
+    public RegionFilter setPackageImportPolicy(RegionPackageImportPolicy packageImportPolicy) {
+        synchronized (this.monitor) {
+            this.packageImportPolicy = packageImportPolicy;
+        }
+        return this;
+    }
+
+    @Override
+    public boolean isBundleAllowed(String bundleSymbolicName, Version bundleVersion) {
+        synchronized (this.monitor) {
+            for (OrderedPair<String, VersionRange> allowedBundle : this.allowedBundles) {
+                if (allowedBundle.getFirst().equals(bundleSymbolicName) && allowedBundle.getSecond().includes(bundleVersion)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/eventlog/RegionAwareEventLoggerServiceFactory.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/eventlog/RegionAwareEventLoggerServiceFactory.java
deleted file mode 100644
index 6ba0874..0000000
--- a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/eventlog/RegionAwareEventLoggerServiceFactory.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 VMware Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *   VMware Inc. - initial contribution
- *******************************************************************************/
-
-package org.eclipse.virgo.kernel.osgi.region.eventlog;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceRegistration;
-
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.eclipse.virgo.medic.eventlog.EventLoggerFactory;
-
-/**
- * RegionAwareEventLoggerServiceFactory is a {@link ServiceFactory} for 
- * {@link EventLogger} instances in the user region. Medic's default ServiceFactory
- * cannot be used due to the nested framework service-sharing mechnism which
- * causes the wrong {@link Bundle} to be passed to {@link #getService(Bundle, ServiceRegistration)}
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * Thread-safe.
- *
- */
-final class RegionAwareEventLoggerServiceFactory implements ServiceFactory<EventLogger> {
-    
-    private final EventLoggerFactory eventLoggerFactory;
-    
-    /**
-     * @param eventLoggerFactory
-     */
-    public RegionAwareEventLoggerServiceFactory(EventLoggerFactory eventLoggerFactory) {
-        this.eventLoggerFactory = eventLoggerFactory;
-    }
-
-    /** 
-     * {@inheritDoc}
-     */
-    public EventLogger getService(Bundle bundle, ServiceRegistration<EventLogger> registration) {
-        return this.eventLoggerFactory.createEventLogger(bundle);
-    }
-
-    /** 
-     * {@inheritDoc}
-     */
-    public void ungetService(Bundle bundle, ServiceRegistration<EventLogger> registration, EventLogger service) {
-    }
-}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleEventHook.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleEventHook.java
new file mode 100644
index 0000000..57ff416
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleEventHook.java
@@ -0,0 +1,116 @@
+/*
+ * This file is part of the Eclipse Virgo project.
+ *
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    VMware Inc. - initial contribution
+ */
+
+package org.eclipse.virgo.kernel.osgi.region.hook;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.virgo.kernel.core.FatalKernelException;
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.hooks.bundle.EventHook;
+import org.osgi.framework.hooks.bundle.FindHook;
+
+/**
+ * {@link RegionBundleEventHook} manages the visibility of bundle events across regions according to the
+ * {@link RegionDigraph}.
+ * <p>
+ * The current implementation delegates to {@link RegionBundleFindHook}. This is likely to perform adequately because of
+ * the low frequency of bundle events and the typically small number of bundle listeners.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+public final class RegionBundleEventHook implements EventHook {
+
+    private final RegionDigraph regionDigraph;
+
+    private final FindHook bundleFindHook;
+
+    private final ThreadLocal<Region> threadLocal;
+
+    public RegionBundleEventHook(RegionDigraph regionDigraph, FindHook bundleFindBook, ThreadLocal<Region> threadLocal) {
+        this.regionDigraph = regionDigraph;
+        this.bundleFindHook = bundleFindBook;
+        this.threadLocal = threadLocal;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void event(BundleEvent event, Collection<BundleContext> contexts) {
+        Bundle eventBundle = event.getBundle();
+        if (event.getType() == BundleEvent.INSTALLED) {
+            bundleInstalled(eventBundle, event.getOrigin());
+        }
+        Iterator<BundleContext> i = contexts.iterator();
+        while (i.hasNext()) {
+            if (!find(i.next(), eventBundle)) {
+                i.remove();
+            }
+        }
+        if (event.getType() == BundleEvent.UNINSTALLED) {
+            bundleUninstalled(eventBundle);
+        }
+    }
+
+    private boolean find(BundleContext finderBundleContext, Bundle candidateBundle) {
+        Set<Bundle> candidates = new HashSet<Bundle>();
+        candidates.add(candidateBundle);
+        this.bundleFindHook.find(finderBundleContext, candidates);
+        return !candidates.isEmpty();
+    }
+
+    private void bundleInstalled(Bundle eventBundle, Bundle originBundle) {
+        /*
+         * BundleIdBasedRegion sets thread local to install bundles into arbitrary regions. If this is not set, the
+         * bundle inherits the region of the origin bundle.
+         */
+        Region installRegion = this.threadLocal.get();
+        if (installRegion != null) {
+            try {
+                installRegion.addBundle(eventBundle);
+            } catch (BundleException e) {
+                e.printStackTrace();
+                throw new FatalKernelException("Bundle could not be added to region", e);
+            }
+        } else {
+            Region originRegion = this.regionDigraph.getRegion(originBundle);
+            if (originRegion != null) {
+                try {
+                    originRegion.addBundle(eventBundle);
+                } catch (BundleException e) {
+                    e.printStackTrace();
+                    throw new FatalKernelException("Bundle could not be added to region", e);
+                }
+            }
+        }
+    }
+
+    private void bundleUninstalled(Bundle eventBundle) {
+        Region region = this.regionDigraph.getRegion(eventBundle);
+        if (region != null) {
+            region.removeBundle(eventBundle);
+        }
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleFindHook.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleFindHook.java
new file mode 100644
index 0000000..9d27abc
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleFindHook.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.hook;
+
+import java.util.Collection;
+import java.util.Set;
+
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.hooks.bundle.FindHook;
+
+/**
+ * {@link RegionBundleFindHook} manages the visibility of bundles across regions according to the {@link RegionDigraph}.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+public final class RegionBundleFindHook implements FindHook {
+
+    private final RegionDigraph regionDigraph;
+
+    public RegionBundleFindHook(RegionDigraph regionDigraph) {
+        this.regionDigraph = regionDigraph;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void find(BundleContext context, Collection<Bundle> bundles) {
+        if (context.getBundle().getBundleId() == 0L) {
+            return;
+        }
+
+        Region finderRegion = getRegion(context);
+        if (finderRegion == null) {
+            bundles.clear();
+            return;
+        }
+
+        Visitor visitor = new Visitor(bundles);
+        finderRegion.visitSubgraph(visitor);
+        Set<Bundle> allowed = visitor.getAllowed();
+
+        bundles.retainAll(allowed);
+    }
+    
+    private class Visitor extends RegionDigraphVisitorBase<Bundle> {
+        
+        private Visitor(Collection<Bundle> candidates) {
+            super(candidates);
+        }
+
+        /** 
+         * {@inheritDoc}
+         */
+        @Override
+        protected boolean contains(Region region, Bundle candidate) {
+            return region.contains(candidate);
+        }
+
+        /** 
+         * {@inheritDoc}
+         */
+        /** 
+         * {@inheritDoc}
+         */
+        @Override
+        protected boolean isAllowed(Bundle candidate, RegionFilter filter) {
+            return filter.isBundleAllowed(candidate.getSymbolicName(), candidate.getVersion());
+        }
+        
+    }
+    
+    private Region getRegion(BundleContext context) {
+        return this.regionDigraph.getRegion(context.getBundle());
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionDigraphVisitorBase.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionDigraphVisitorBase.java
new file mode 100644
index 0000000..84b8b7f
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionDigraphVisitorBase.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * This file is part of the Virgo Web Server.
+ *
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    SpringSource, a division of VMware - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.hook;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Stack;
+
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraphVisitor;
+import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
+
+/**
+ * {@link RegionDigraphVisitorBase} is an abstract base class for {@link RegionDigraphVisitor} implementations in the
+ * framework hooks.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * This class is thread safe.
+ */
+abstract class RegionDigraphVisitorBase<C> implements RegionDigraphVisitor {
+
+    private final Collection<C> allCandidates;
+
+    private final Stack<Set<C>> allowedStack = new Stack<Set<C>>();
+
+    private Object monitor = new Object();
+
+    private Set<C> allowed;
+
+    protected RegionDigraphVisitorBase(Collection<C> candidates) {
+        this.allCandidates = candidates;
+        synchronized (this.monitor) {
+            this.allowed = new HashSet<C>();
+        }
+    }
+
+    Set<C> getAllowed() {
+        synchronized (this.monitor) {
+            return this.allowed;
+        }
+    }
+
+    private void allow(C candidate) {
+        synchronized (this.monitor) {
+            this.allowed.add(candidate);
+        }
+    }
+
+    private void allow(Set<C> candidates) {
+        synchronized (this.monitor) {
+            this.allowed.addAll(candidates);
+        }
+    }
+
+    private void pushAllowed() {
+        synchronized (this.monitor) {
+            this.allowedStack.push(this.allowed);
+            this.allowed = new HashSet<C>();
+        }
+    }
+
+    private Set<C> popAllowed() {
+        synchronized (this.monitor) {
+            Set<C> a = this.allowed;
+            this.allowed = this.allowedStack.pop();
+            return a;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean visit(Region region) {
+        for (C candidate : this.allCandidates) {
+            if (contains(region, candidate)) {
+                allow(candidate);
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Determines whether the given region contains the given candidate.
+     * 
+     * @param region the {@link Region}
+     * @param candidate the candidate
+     * @return <code>true</code> if and only if the given region contains the given candidate
+     */
+    protected abstract boolean contains(Region region, C candidate);
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean preEdgeTraverse(RegionFilter regionFilter) {
+        pushAllowed();
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void postEdgeTraverse(RegionFilter regionFilter) {
+        Set<C> candidates = popAllowed();
+        filter(candidates, regionFilter);
+        allow(candidates);
+    }
+
+    private void filter(Set<C> candidates, RegionFilter filter) {
+        Iterator<C> i = candidates.iterator();
+        while (i.hasNext()) {
+            C candidate = i.next();
+            if (!isAllowed(candidate, filter)) {
+                i.remove();
+            }
+        }
+    }
+
+    /**
+     * Determines whether the given candidate is allowed by the given {@link RegionFilter}.
+     * 
+     * @param candidate the candidate
+     * @param filter the filter
+     * @return <code>true</code> if and only if the given candidate is allowed by the given filter
+     */
+    protected abstract boolean isAllowed(C candidate, RegionFilter filter);
+
+}
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHook.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHook.java
new file mode 100644
index 0000000..a0ab1cf
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHook.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.hook;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.osgi.service.resolver.BundleDescription;
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
+import org.eclipse.virgo.kernel.osgi.region.RegionPackageImportPolicy;
+import org.eclipse.virgo.kernel.serviceability.Assert;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.hooks.resolver.ResolverHook;
+import org.osgi.framework.wiring.BundleCapability;
+import org.osgi.framework.wiring.BundleRequirement;
+import org.osgi.framework.wiring.BundleRevision;
+
+/**
+ * {@link RegionResolverHook} manages the visibility of bundles across regions according to the {@link RegionDigraph}.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+final class RegionResolverHook implements ResolverHook {
+
+    private static final long INVALID_BUNDLE_ID = -1L;
+
+    private static final Boolean DEBUG = false;
+
+    private final RegionDigraph regionDigraph;
+
+    RegionResolverHook(RegionDigraph regionDigraph) {
+        this.regionDigraph = regionDigraph;
+    }
+
+    @Override
+    public void filterMatches(BundleRequirement requirement, Collection<BundleCapability> candidates) {
+        BundleRevision requirer = requirement.getRevision();
+        try {
+            if (DEBUG) {
+                debugEntry(requirer, candidates);
+            }
+
+            if (getBundleId(requirer) == 0L) {
+                return;
+            }
+
+            Region requirerRegion = getRegion(requirer);
+            if (requirerRegion == null) {
+                candidates.clear();
+                return;
+            }
+            
+            Visitor visitor = new Visitor(candidates);
+            requirerRegion.visitSubgraph(visitor);
+            Set<BundleCapability> allowed = visitor.getAllowed();
+
+            candidates.retainAll(allowed);
+        } finally {
+            if (DEBUG) {
+                debugExit(requirer, candidates);
+            }
+        }
+    }
+    
+    private class Visitor extends RegionDigraphVisitorBase<BundleCapability> {
+        
+        private Visitor(Collection<BundleCapability> candidates) {
+            super(candidates);
+        }
+
+        @Override
+        protected boolean contains(Region region, BundleCapability candidate) {
+            return region.equals(getRegion(candidate.getRevision()));
+        }
+
+        @Override
+        protected boolean isAllowed(BundleCapability candidate, RegionFilter filter) {
+            RegionPackageImportPolicy packageImportPolicy = filter.getPackageImportPolicy();
+            BundleRevision providerRevision = candidate.getRevision();
+            if (!filter.isBundleAllowed(providerRevision.getSymbolicName(), providerRevision.getVersion())) {
+                String namespace = candidate.getNamespace();
+                if (BundleRevision.PACKAGE_NAMESPACE.equals(namespace)) {
+                    if (!packageImportPolicy.isImported((String) candidate.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE), candidate.getAttributes(),
+                        candidate.getDirectives())) {
+                        return false;
+                    }
+                } else {
+                        return false;
+                }
+            }
+            return true;
+        }
+        
+    }
+
+    private Region getRegion(BundleRevision bundleRevision) {
+        Bundle bundle = bundleRevision.getBundle();
+        if (bundle != null) {
+            return getRegion(bundle);
+        }
+        Long bundleId = getBundleId(bundleRevision);
+        return getRegion(bundleId);
+    }
+
+    private Region getRegion(Long bundleId) {
+        return this.regionDigraph.getRegion(bundleId);
+    }
+
+    private Long getBundleId(BundleRevision bundleRevision) {
+        // For testability, use the bundle revision's bundle before casting to ResolverBundle.
+        Bundle bundle = bundleRevision.getBundle();
+        if (bundle != null) {
+            return bundle.getBundleId();
+        }
+        if (bundleRevision instanceof BundleDescription) {
+            BundleDescription bundleDescription = (BundleDescription) bundleRevision;
+            return bundleDescription.getBundleId();
+        }
+        Assert.isTrue(false, "Cannot determine bundle id of BundleRevision '%s'", bundleRevision);
+        return INVALID_BUNDLE_ID;
+    }
+
+    private Region getRegion(Bundle bundle) {
+        return this.regionDigraph.getRegion(bundle);
+    }
+
+    @Override
+    public void end() {
+    }
+
+    @Override
+    public void filterResolvable(Collection<BundleRevision> candidates) {
+    }
+
+    @Override
+    public void filterSingletonCollisions(BundleCapability singleton, Collection<BundleCapability> collisionCandidates) {
+        collisionCandidates.clear(); // XXX temporary hack in lieu of Borislav's changes
+    }
+
+    private void debugEntry(BundleRevision requirer, Collection<BundleCapability> candidates) {
+        System.out.println("Requirer: " + requirer.getSymbolicName() + "_" + requirer.getVersion() + "[" + getBundleId(requirer) + "]");
+        System.out.println("  Candidates: ");
+        Iterator<BundleCapability> i = candidates.iterator();
+        while (i.hasNext()) {
+            BundleCapability c = i.next();
+            String namespace = c.getNamespace();
+            if (BundleRevision.PACKAGE_NAMESPACE.equals(namespace)) {
+                BundleRevision providerRevision = c.getRevision();
+                String pkg = (String) c.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE);
+                System.out.println("    Package " + pkg + " from provider " + providerRevision.getSymbolicName() + "_"
+                    + providerRevision.getVersion() + "[" + getBundleId(providerRevision) + "]");
+                if (pkg.equals("slow")) {
+                    System.out.println(">>> put breakpoint here <<<");
+                }
+            } else {
+                BundleRevision providerRevision = c.getRevision();
+                System.out.println("    Bundle from provider " + providerRevision.getSymbolicName() + "_" + providerRevision.getVersion() + "["
+                    + getBundleId(providerRevision) + "]");
+            }
+        }
+    }
+
+    private void debugExit(BundleRevision requirer, Collection<BundleCapability> candidates) {
+        System.out.println("  Filtered candidates: ");
+        Iterator<BundleCapability> i = candidates.iterator();
+        while (i.hasNext()) {
+            BundleCapability c = i.next();
+            String namespace = c.getNamespace();
+            if (BundleRevision.PACKAGE_NAMESPACE.equals(namespace)) {
+                BundleRevision providerRevision = c.getRevision();
+                String pkg = (String) c.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE);
+                System.out.println("    Package " + pkg + " from provider " + providerRevision.getSymbolicName() + "_"
+                    + providerRevision.getVersion() + "[" + getBundleId(providerRevision) + "]");
+                if (pkg.equals("slow")) {
+                    System.out.println(">>> put breakpoint here <<<");
+                }
+            } else {
+                BundleRevision providerRevision = c.getRevision();
+                System.out.println("    Bundle from provider " + providerRevision.getSymbolicName() + "_" + providerRevision.getVersion() + "["
+                    + getBundleId(providerRevision) + "]");
+            }
+        }
+    }
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHookFactory.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHookFactory.java
new file mode 100644
index 0000000..57815cf
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHookFactory.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * This file is part of the Virgo Web Server.
+ *
+ * Copyright (c) 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    SpringSource, a division of VMware - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.hook;
+
+import java.util.Collection;
+
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.osgi.framework.hooks.resolver.ResolverHook;
+import org.osgi.framework.hooks.resolver.ResolverHookFactory;
+import org.osgi.framework.wiring.BundleRevision;
+
+/**
+ * {@link RegionResolverHook} constructs an instance of {@link RegionResolverHook} for a particular resolution
+ * operation.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * 
+ * Thread safe.
+ */
+public final class RegionResolverHookFactory implements ResolverHookFactory {
+
+    private final RegionDigraph regionDigraph;
+
+    public RegionResolverHookFactory(RegionDigraph regionDigraph) {
+        this.regionDigraph = regionDigraph;
+    }
+
+    @Override
+    public ResolverHook begin(Collection<BundleRevision> triggers) {
+        return new RegionResolverHook(this.regionDigraph);
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceEventHook.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceEventHook.java
new file mode 100644
index 0000000..56610ac
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceEventHook.java
@@ -0,0 +1,70 @@
+/*
+ * This file is part of the Eclipse Virgo project.
+ *
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    VMware Inc. - initial contribution
+ */
+
+package org.eclipse.virgo.kernel.osgi.region.hook;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.hooks.service.EventHook;
+import org.osgi.framework.hooks.service.FindHook;
+
+/**
+ * {@link RegionServiceEventHook} manages the visibility of service events across regions according to the
+ * {@link RegionDigraph}.
+ * <p>
+ * The current implementation delegates to {@link RegionServiceFindHook}. This is likely to perform adequately because
+ * of the relatively low frequency (compared to service lookups) of service events and the typically small number of
+ * service listeners.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+@SuppressWarnings("deprecation")
+public final class RegionServiceEventHook implements EventHook {
+
+    private final FindHook serviceFindHook;
+
+    public RegionServiceEventHook(FindHook bundleFindBook) {
+        this.serviceFindHook = bundleFindBook;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void event(ServiceEvent event, Collection<BundleContext> contexts) {
+        ServiceReference<?> eventBundle = event.getServiceReference();
+        Iterator<BundleContext> i = contexts.iterator();
+        while (i.hasNext()) {
+            if (!find(i.next(), eventBundle)) {
+                i.remove();
+            }
+        }
+    }
+
+    private boolean find(BundleContext finderBundleContext, ServiceReference<?> candidateServiceReference) {
+        Set<ServiceReference<?>> candidates = new HashSet<ServiceReference<?>>();
+        candidates.add(candidateServiceReference);
+        this.serviceFindHook.find(finderBundleContext, "", "", false, candidates);
+        return !candidates.isEmpty();
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceFindHook.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceFindHook.java
new file mode 100644
index 0000000..65d80c0
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceFindHook.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.hook;
+
+import java.util.Collection;
+import java.util.Set;
+
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.hooks.service.FindHook;
+
+/**
+ * {@link RegionServiceFindHook} manages the visibility of services across regions according to the
+ * {@link RegionDigraph}.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+public final class RegionServiceFindHook implements FindHook {
+
+    private final RegionDigraph regionDigraph;
+
+    public RegionServiceFindHook(RegionDigraph regionDigraph) {
+        this.regionDigraph = regionDigraph;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void find(BundleContext context, String name, String filter, boolean allServices, Collection<ServiceReference<?>> references) {
+        if (context.getBundle().getBundleId() == 0L) {
+            return;
+        }
+
+        Region finderRegion = getRegion(context);
+        if (finderRegion == null) {
+            references.clear();
+            return;
+        }
+
+        Visitor visitor = new Visitor(references);
+        finderRegion.visitSubgraph(visitor);
+        Set<ServiceReference<?>> allowed = visitor.getAllowed();
+
+        references.retainAll(allowed);
+    }
+
+    private class Visitor extends RegionDigraphVisitorBase<ServiceReference<?>> {
+
+        private Visitor(Collection<ServiceReference<?>> candidates) {
+            super(candidates);
+        }
+
+        /** 
+         * {@inheritDoc}
+         */
+        @Override
+        protected boolean contains(Region region, ServiceReference<?> candidate) {
+            return region.contains(candidate.getBundle());
+        }
+
+        /** 
+         * {@inheritDoc}
+         */
+        @Override
+        protected boolean isAllowed(ServiceReference<?> candidate, RegionFilter filter) {
+            return filter.getServiceFilter().match(candidate);
+        }
+
+    }
+
+    private Region getRegion(BundleContext context) {
+        return this.regionDigraph.getRegion(context.getBundle());
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/BundleIdBasedRegion.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/BundleIdBasedRegion.java
new file mode 100644
index 0000000..8ebb78f
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/BundleIdBasedRegion.java
@@ -0,0 +1,282 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.internal;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph.FilteredRegion;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraphVisitor;
+import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
+import org.eclipse.virgo.kernel.serviceability.NonNull;
+import org.eclipse.virgo.util.math.ConcurrentHashSet;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+
+/**
+ * {@link BundleIdBasedRegion} is an implementation of {@link Region} which keeps a track of the bundles in the region
+ * by recording their bundle identifiers.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+final class BundleIdBasedRegion implements Region {
+
+    private static final String REGION_LOCATION_DELIMITER = "@";
+
+    private static final String REFERENCE_SCHEME = "reference:";
+
+    private static final String FILE_SCHEME = "file:";
+
+    // A concurrent data structure ensures the contains method does not need synchronisation.
+    private final Set<Long> bundleIds = new ConcurrentHashSet<Long>();
+
+    // Updates do need synchronising to avoid races.
+    private final Object updateMonitor = new Object();
+
+    private final String regionName;
+
+    private final RegionDigraph regionDigraph;
+
+    private final BundleContext systemBundleContext;
+
+    private final ThreadLocal<Region> threadLocal;
+
+    BundleIdBasedRegion(@NonNull String regionName, @NonNull RegionDigraph regionDigraph, @NonNull BundleContext systemBundleContext,
+        @NonNull ThreadLocal<Region> threadLocal) {
+        this.regionName = regionName;
+        this.regionDigraph = regionDigraph;
+        this.systemBundleContext = systemBundleContext;
+        this.threadLocal = threadLocal;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getName() {
+        return this.regionName;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void addBundle(Bundle bundle) throws BundleException {
+        synchronized (this.updateMonitor) {
+            checkBundleNotAssociatedWithAnotherRegion(bundle);
+
+            this.bundleIds.add(bundle.getBundleId());
+        }
+    }
+
+    private void checkBundleNotAssociatedWithAnotherRegion(Bundle bundle) throws BundleException {
+        for (Region r : this.regionDigraph) {
+            if (!this.equals(r) && r.contains(bundle)) {
+                throw new BundleException("Bundle '" + bundle + "' is already associated with region '" + r + "'", BundleException.INVALID_OPERATION);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void addBundle(long bundleId) {
+        synchronized (this.updateMonitor) {
+            this.bundleIds.add(bundleId);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Bundle installBundle(String location, InputStream input) throws BundleException {
+        setRegionThreadLocal();
+        try {
+            return this.systemBundleContext.installBundle(this.regionName + REGION_LOCATION_DELIMITER + location, input);
+        } finally {
+            removeRegionThreadLocal();
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Bundle installBundle(String location) throws BundleException {
+        setRegionThreadLocal();
+        try {
+            return this.systemBundleContext.installBundle(this.regionName + REGION_LOCATION_DELIMITER + location, openBundleStream(location));
+        } finally {
+            removeRegionThreadLocal();
+        }
+    }
+
+    private void setRegionThreadLocal() {
+        this.threadLocal.set(this);
+    }
+
+    private void removeRegionThreadLocal() {
+        this.threadLocal.remove();
+    }
+
+    private InputStream openBundleStream(String location) throws BundleException {
+        String absoluteBundleUriString = getAbsoluteUriString(location);
+
+        try {
+            // Use the reference: scheme to obtain an InputStream for either a file or a directory.
+            return new URL(REFERENCE_SCHEME + absoluteBundleUriString).openStream();
+
+        } catch (MalformedURLException e) {
+            throw new BundleException("Location '" + location + "' resulted in an invalid bundle URI '" + absoluteBundleUriString + "'", e);
+        } catch (IOException e) {
+            throw new BundleException("Location '" + location + "' referred to an invalid bundle at URI '" + absoluteBundleUriString + "'", e);
+        }
+    }
+
+    private String getAbsoluteUriString(String location) throws BundleException {
+        if (!location.startsWith(FILE_SCHEME)) {
+            throw new BundleException("Cannot install from location '" + location + "' which did not start with '" + FILE_SCHEME + "'");
+        }
+
+        String filePath = location.substring(FILE_SCHEME.length());
+
+        return FILE_SCHEME + new File(filePath).getAbsolutePath();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Bundle getBundle(@NonNull String symbolicName, @NonNull Version version) {
+
+        // The following iteration is weakly consistent and will never throw ConcurrentModificationException.
+        for (long bundleId : this.bundleIds) {
+            Bundle bundle = this.systemBundleContext.getBundle(bundleId);
+            if (bundle != null && symbolicName.equals(bundle.getSymbolicName()) && version.equals(bundle.getVersion())) {
+                return bundle;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void connectRegion(Region headRegion, RegionFilter filter) throws BundleException {
+        synchronized (this.updateMonitor) {
+            this.regionDigraph.connect(this, filter, headRegion);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean contains(Bundle bundle) {
+        return this.bundleIds.contains(bundle.getBundleId());
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + this.regionName.hashCode();
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof BundleIdBasedRegion)) {
+            return false;
+        }
+        BundleIdBasedRegion other = (BundleIdBasedRegion) obj;
+        return this.regionName.equals(other.regionName);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean contains(long bundleId) {
+        return this.bundleIds.contains(bundleId);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void removeBundle(Bundle bundle) {
+        removeBundle(bundle.getBundleId());
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void removeBundle(long bundleId) {
+        synchronized (this.updateMonitor) {
+            this.bundleIds.remove(bundleId);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return getName();
+    }
+
+    @Override
+    public Set<Long> getBundleIds() {
+        Set<Long> bundleIds = new HashSet<Long>();
+        synchronized (this.updateMonitor) {
+            bundleIds.addAll(this.bundleIds);
+        }
+        return bundleIds;
+    }
+
+    /**
+     * @return
+     */
+    @Override
+    public Set<FilteredRegion> getEdges() {
+        return this.regionDigraph.getEdges(this);
+    }
+
+    @Override
+    public void visitSubgraph(RegionDigraphVisitor visitor) {
+       this.regionDigraph.visitSubgraph(this, visitor);
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/StandardRegionDigraph.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/StandardRegionDigraph.java
new file mode 100644
index 0000000..90caa68
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/StandardRegionDigraph.java
@@ -0,0 +1,309 @@
+/*******************************************************************************
+ * This file is part of the Virgo Web Server.
+ *
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    SpringSource, a division of VMware - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.internal;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraphVisitor;
+import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
+import org.eclipse.virgo.kernel.osgi.region.RegionLifecycleListener;
+import org.eclipse.virgo.kernel.serviceability.NonNull;
+import org.eclipse.virgo.util.math.OrderedPair;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * {@link StandardRegionDigraph} is the default implementation of {@link RegionDigraph}.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * 
+ * Thread safe.
+ * 
+ */
+public final class StandardRegionDigraph implements RegionDigraph {
+
+    private final Object monitor = new Object();
+
+    private final Set<Region> regions = new HashSet<Region>();
+
+    private final Map<OrderedPair<Region, Region>, RegionFilter> filter = new HashMap<OrderedPair<Region, Region>, RegionFilter>();
+
+    private final BundleContext systemBundleContext;
+
+    private final ThreadLocal<Region> threadLocal;
+
+    private SubgraphTraverser subgraphTraverser;
+
+    public StandardRegionDigraph(BundleContext bundleContext, ThreadLocal<Region> threadLocal) {
+        this.subgraphTraverser = new SubgraphTraverser();
+        this.systemBundleContext = bundleContext.getBundle(0L).getBundleContext();
+        this.threadLocal = threadLocal;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Region createRegion(String regionName) throws BundleException {
+        Region region = new BundleIdBasedRegion(regionName, this, this.systemBundleContext, this.threadLocal);
+        synchronized (this.monitor) {
+            if (getRegion(regionName) != null) {
+                throw new BundleException("Region '" + regionName + "' already exists", BundleException.UNSUPPORTED_OPERATION);
+            }
+            this.regions.add(region);
+        }
+        notifyAdded(region);
+        return region;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void connect(@NonNull Region tailRegion, @NonNull RegionFilter filter, @NonNull Region headRegion) throws BundleException {
+        if (headRegion.equals(tailRegion)) {
+            throw new BundleException("Cannot connect region '" + headRegion + "' to itself", BundleException.UNSUPPORTED_OPERATION);
+        }
+        OrderedPair<Region, Region> nodePair = new OrderedPair<Region, Region>(tailRegion, headRegion);
+        boolean tailAdded = false;
+        boolean headAdded = false;
+        synchronized (this.monitor) {
+            if (this.filter.containsKey(nodePair)) {
+                throw new BundleException("Region '" + tailRegion + "' is already connected to region '" + headRegion,
+                    BundleException.UNSUPPORTED_OPERATION);
+            } else {
+                checkFilterDoesNotAllowExistingBundle(tailRegion, filter);
+                tailAdded = this.regions.add(tailRegion);
+                headAdded = this.regions.add(headRegion);
+                this.filter.put(nodePair, filter);
+            }
+        }
+        if (tailAdded) {
+            notifyAdded(tailRegion);
+        }
+        if (headAdded) {
+            notifyAdded(headRegion);
+        }
+    }
+
+    private void checkFilterDoesNotAllowExistingBundle(Region tailRegion, RegionFilter filter) throws BundleException {
+        // TODO: enumerate the bundles in the region and check the filter does not allow any of them
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Iterator<Region> iterator() {
+        synchronized (this.monitor) {
+            Set<Region> snapshot = new HashSet<Region>(this.regions.size());
+            snapshot.addAll(this.regions);
+            return snapshot.iterator();
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Set<FilteredRegion> getEdges(Region tailRegion) {
+        Set<FilteredRegion> edges = new HashSet<FilteredRegion>();
+        synchronized (this.monitor) {
+            Set<OrderedPair<Region, Region>> regionPairs = this.filter.keySet();
+            for (OrderedPair<Region, Region> regionPair : regionPairs) {
+                if (tailRegion.equals(regionPair.getFirst())) {
+                    edges.add(new StandardFilteredRegion(regionPair.getSecond(), this.filter.get(regionPair)));
+                }
+            }
+        }
+        return edges;
+    }
+
+    private static class StandardFilteredRegion implements FilteredRegion {
+
+        private Region region;
+
+        private RegionFilter regionFilter;
+
+        private StandardFilteredRegion(Region region, RegionFilter regionFilter) {
+            this.region = region;
+            this.regionFilter = regionFilter;
+        }
+
+        @Override
+        public Region getRegion() {
+            return this.region;
+        }
+
+        @Override
+        public RegionFilter getFilter() {
+            return this.regionFilter;
+        }
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Region getRegion(@NonNull String regionName) {
+        synchronized (this.monitor) {
+            for (Region region : this) {
+                if (regionName.equals(region.getName())) {
+                    return region;
+                }
+            }
+            return null;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Region getRegion(Bundle bundle) {
+        synchronized (this.monitor) {
+            for (Region region : this) {
+                if (region.contains(bundle)) {
+                    return region;
+                }
+            }
+            return null;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Region getRegion(long bundleId) {
+        synchronized (this.monitor) {
+            for (Region region : this) {
+                if (region.contains(bundleId)) {
+                    return region;
+                }
+            }
+            return null;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void removeRegion(@NonNull Region region) {
+        notifyRemoving(region);
+        synchronized (this.monitor) {
+            this.regions.remove(region);
+            Iterator<OrderedPair<Region, Region>> i = this.filter.keySet().iterator();
+            while (i.hasNext()) {
+                OrderedPair<Region, Region> regionPair = i.next();
+                if (region.equals(regionPair.getFirst()) || region.equals(regionPair.getSecond())) {
+                    i.remove();
+                }
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        synchronized (this.monitor) {
+            StringBuffer s = new StringBuffer();
+            boolean first = true;
+            s.append("RegionDigraph{");
+            for (Region r : this) {
+                if (!first) {
+                    s.append(", ");
+                }
+                s.append(r);
+                first = false;
+            }
+            s.append("}");
+            s.append("[");
+            first = true;
+            for (OrderedPair<Region, Region> regionPair : this.filter.keySet()) {
+                if (!first) {
+                    s.append(", ");
+                }
+                s.append(regionPair.getFirst() + "->" + regionPair.getSecond());
+                first = false;
+            }
+            s.append("]");
+            return s.toString();
+        }
+    }
+
+    @Override
+    public Set<Region> getRegions() {
+        Set<Region> result = new HashSet<Region>();
+        synchronized (this.monitor) {
+            result.addAll(this.regions);
+        }
+        return result;
+    }
+
+    private void notifyAdded(Region region) {
+        Set<RegionLifecycleListener> listeners = getListeners();
+        for (RegionLifecycleListener listener : listeners) {
+            listener.regionAdded(region);
+        }
+    }
+
+    private void notifyRemoving(Region region) {
+        Set<RegionLifecycleListener> listeners = getListeners();
+        for (RegionLifecycleListener listener : listeners) {
+            listener.regionRemoving(region);
+        }
+    }
+
+    private Set<RegionLifecycleListener> getListeners() {
+        Set<RegionLifecycleListener> listeners = new HashSet<RegionLifecycleListener>();
+        try {
+            Collection<ServiceReference<RegionLifecycleListener>> listenerServiceReferences = this.systemBundleContext.getServiceReferences(
+                RegionLifecycleListener.class, null);
+            for (ServiceReference<RegionLifecycleListener> listenerServiceReference : listenerServiceReferences) {
+                RegionLifecycleListener regionLifecycleListener = this.systemBundleContext.getService(listenerServiceReference);
+                if (regionLifecycleListener != null) {
+                    listeners.add(regionLifecycleListener);
+                }
+            }
+        } catch (InvalidSyntaxException e) {
+            e.printStackTrace();
+        }
+        return listeners;
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    @Override
+    public void visitSubgraph(Region startingRegion, RegionDigraphVisitor visitor) {
+        this.subgraphTraverser.visitSubgraph(startingRegion, visitor);
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/SubgraphTraverser.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/SubgraphTraverser.java
new file mode 100644
index 0000000..21f8c6f
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/internal/SubgraphTraverser.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * This file is part of the Virgo Web Server.
+ *
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    SpringSource, a division of VMware - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.internal;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraphVisitor;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph.FilteredRegion;
+
+/**
+ * {@link SubgraphTraverser} is a utility for traversing a subgraph of a {@link RegionDigraph} calling a
+ * {@link RegionDigraphVisitor} on the way.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+final class SubgraphTraverser {
+
+    void visitSubgraph(Region startingRegion, RegionDigraphVisitor visitor) {
+        visitRemainingSubgraph(startingRegion, visitor, new HashSet<Region>());
+    }
+
+    private void visitRemainingSubgraph(Region r, RegionDigraphVisitor visitor, Set<Region> path) {
+        if (!path.contains(r)) {
+            if (visitor.visit(r)) {
+                traverseEdges(r, visitor, path);
+            }
+        }
+    }
+
+    private void traverseEdges(Region r, RegionDigraphVisitor visitor, Set<Region> path) {
+        for (FilteredRegion fr : r.getEdges()) {
+            if (visitor.preEdgeTraverse(fr.getFilter())) {
+                try {
+                    visitRemainingSubgraph(fr.getRegion(), visitor, extendPath(r, path));
+                } finally {
+                    visitor.postEdgeTraverse(fr.getFilter());
+                }
+            }
+        }
+    }
+
+    private Set<Region> extendPath(Region r, Set<Region> path) {
+        Set<Region> newPath = new HashSet<Region>(path);
+        newPath.add(r);
+        return newPath;
+    }
+
+}
\ No newline at end of file
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/ManageableRegion.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/ManageableRegion.java
new file mode 100644
index 0000000..1617a22
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/ManageableRegion.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.management;
+
+import javax.management.MXBean;
+
+import org.eclipse.virgo.kernel.osgi.region.Region;
+
+/**
+ * A {@link ManageableRegion} is a JMX representation of a {@link Region}.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+@MXBean
+public interface ManageableRegion {
+    
+    /**
+     * Returns the region name.
+     * 
+     * @return the region name
+     */
+    String getName();
+    
+    /**
+     * Returns the {@ManageableRegion}s that this region depends upon.
+     * 
+     * @return an array of {@link ManageableRegion}s
+     */
+    ManageableRegion[] getDependencies();
+    
+    /**
+     * Returns the bundle ids belonging to this region.
+     * 
+     * @return an array of bundle ids
+     */
+    long[] getBundleIds();
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/ManageableRegionDigraph.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/ManageableRegionDigraph.java
new file mode 100644
index 0000000..4dfc2b5
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/ManageableRegionDigraph.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.management;
+
+import javax.management.MXBean;
+
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+
+/**
+ * {@link ManageableRegionDigraph} is a JMX representation of the {@link RegionDigraph}.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+@MXBean
+public interface ManageableRegionDigraph {
+
+    /**
+     * Gets the {@link ManageableRegion}s in the digraph.
+     * 
+     * @return an array of {@link ManageableRegion}s
+     */
+    ManageableRegion[] getRegions();
+
+    /**
+     * Gets the {@link ManageableRegion} with the given name.
+     * 
+     * @param regionName the region name
+     * @return a {@link ManageableRegion} or <code>null</code> if there is no region with the given name
+     */
+    ManageableRegion getRegion(String regionName);
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/internal/RegionObjectNameCreator.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/internal/RegionObjectNameCreator.java
new file mode 100644
index 0000000..d57d87e
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/internal/RegionObjectNameCreator.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.management.internal;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.eclipse.virgo.kernel.osgi.region.management.ManageableRegion;
+
+/**
+ * {@link RegionObjectNameCreator} is responsible for creating {@link ObjectName}s for {@link ManageableRegion}s.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+final class RegionObjectNameCreator {
+
+    private final String domain;
+
+    RegionObjectNameCreator(String domain) {
+        this.domain = domain;
+    }
+
+    ObjectName getRegionObjectName(String regionName) {
+        try {
+            return new ObjectName(this.domain + ":type=Region,name=" + regionName);
+        } catch (MalformedObjectNameException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/internal/StandardManageableRegion.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/internal/StandardManageableRegion.java
new file mode 100644
index 0000000..2914d33
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/internal/StandardManageableRegion.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.management.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph.FilteredRegion;
+import org.eclipse.virgo.kernel.osgi.region.management.ManageableRegion;
+import org.eclipse.virgo.kernel.osgi.region.management.ManageableRegionDigraph;
+
+/**
+ * {@link StandardManageableRegion} is the default implementation of {@link ManageableRegion}.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+public class StandardManageableRegion implements ManageableRegion {
+
+    private final Region region;
+
+    private final ManageableRegionDigraph manageableRegionDigraph;
+
+    private final RegionDigraph regionDigraph;
+
+    public StandardManageableRegion(Region region, ManageableRegionDigraph manageableRegionDigraph, RegionDigraph regionDigraph) {
+        this.region = region;
+        this.manageableRegionDigraph = manageableRegionDigraph;
+        this.regionDigraph = regionDigraph;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getName() {
+        return region.getName();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ManageableRegion[] getDependencies() {
+        Set<FilteredRegion> edges = this.regionDigraph.getEdges(this.region);
+        List<ManageableRegion> dependencies = new ArrayList<ManageableRegion>();
+        for (FilteredRegion edge : edges) {
+            ManageableRegion manageableRegion = this.manageableRegionDigraph.getRegion(edge.getRegion().getName());
+            if (manageableRegion != null) {
+                dependencies.add(manageableRegion);
+            }
+        }
+        return dependencies.toArray(new ManageableRegion[dependencies.size()]);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public long[] getBundleIds() {
+        Set<Long> bundleIds = this.region.getBundleIds();
+        long[] result = new long[bundleIds.size()];
+        int i = 0;
+        for (Long bundleId : bundleIds) {
+            result[i++] = bundleId;
+        }
+        return result;
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/internal/StandardManageableRegionDigraph.java b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/internal/StandardManageableRegionDigraph.java
new file mode 100644
index 0000000..4b76c1e
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/management/internal/StandardManageableRegionDigraph.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.management.internal;
+
+import java.lang.management.ManagementFactory;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanRegistrationException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.eclipse.virgo.kernel.osgi.region.RegionLifecycleListener;
+import org.eclipse.virgo.kernel.osgi.region.management.ManageableRegion;
+import org.eclipse.virgo.kernel.osgi.region.management.ManageableRegionDigraph;
+import org.osgi.framework.BundleContext;
+
+/**
+ * {@link StandardManageableRegionDigraph} is a {@link ManageableRegionDigraph} that delegates to the
+ * {@link RegionDigraph}.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * Thread safe.
+ */
+public final class StandardManageableRegionDigraph implements ManageableRegionDigraph {
+
+    private final RegionDigraph regionDigraph;
+
+    private final String domain;
+
+    private final RegionObjectNameCreator regionObjectNameCreator;
+
+    private final Map<String, ManageableRegion> manageableRegions = new ConcurrentHashMap<String, ManageableRegion>();
+
+    private final BundleContext bundleContext;
+
+    private final Object monitor = new Object();
+
+    private final MBeanServer mbeanServer;
+
+    public StandardManageableRegionDigraph(RegionDigraph regionDigraph, String domain, BundleContext bundleContext) {
+        this.regionDigraph = regionDigraph;
+        this.domain = domain;
+        this.regionObjectNameCreator = new RegionObjectNameCreator(domain);
+        this.bundleContext = bundleContext;
+        this.mbeanServer = ManagementFactory.getPlatformMBeanServer();
+    }
+
+    private void registerRegionLifecycleListener() {
+        RegionLifecycleListener regionLifecycleListener = new RegionLifecycleListener() {
+
+            @Override
+            public void regionAdded(Region region) {
+                addRegion(region);
+            }
+
+            @Override
+            public void regionRemoving(Region region) {
+                removeRegion(region);
+            }
+
+        };
+        this.bundleContext.registerService(RegionLifecycleListener.class, regionLifecycleListener, null);
+    }
+
+    public void registerMBean() {
+        registerRegionLifecycleListener();
+        synchronized (this.monitor) {
+            // The following alien call is unavoidable to ensure consistency.
+            Set<Region> regions = this.regionDigraph.getRegions();
+            for (Region region : regions) {
+                addRegion(region);
+            }
+        }
+
+        ObjectName name;
+        try {
+            name = new ObjectName(this.domain + ":type=RegionDigraph");
+        } catch (MalformedObjectNameException e) {
+            e.printStackTrace();
+            throw new RuntimeException("Invalid domain name '" + this.domain + "'", e);
+        }
+
+        safelyRegisterMBean(this, name);
+    }
+
+    private void safelyRegisterMBean(Object mbean, ObjectName name) {
+        try {
+            try {
+                this.mbeanServer.registerMBean(mbean, name);
+            } catch (InstanceAlreadyExistsException e) {
+                // Recover as this happens when a JVM is reused.
+                this.mbeanServer.unregisterMBean(name);
+                this.mbeanServer.registerMBean(mbean, name);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("MBean registration failed", e);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ManageableRegion[] getRegions() {
+        List<ManageableRegion> regions = new ArrayList<ManageableRegion>();
+        synchronized (this.monitor) {
+            for (ManageableRegion manageableRegion : this.manageableRegions.values()) {
+                regions.add(manageableRegion);
+            }
+        }
+        return regions.toArray(new ManageableRegion[regions.size()]);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ManageableRegion getRegion(String regionName) {
+        return this.manageableRegions.get(regionName);
+    }
+
+    private void addRegion(Region region) {
+        StandardManageableRegion manageableRegion = new StandardManageableRegion(region, this, this.regionDigraph);
+        safelyRegisterMBean(manageableRegion, this.regionObjectNameCreator.getRegionObjectName(region.getName()));
+        synchronized (this.monitor) {
+            this.manageableRegions.put(region.getName(), manageableRegion);
+        }
+    }
+
+    private void removeRegion(Region region) {
+        String regionName = region.getName();
+        synchronized (this.monitor) {
+            this.manageableRegions.remove(regionName);
+        }
+        try {
+            this.mbeanServer.unregisterMBean(this.regionObjectNameCreator.getRegionObjectName(regionName));
+        } catch (MBeanRegistrationException e) {
+            e.printStackTrace();
+            throw new RuntimeException("Problem unregistering mbean", e);
+        } catch (InstanceNotFoundException e) {
+        }
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/resources/EventLogMessages.properties b/org.eclipse.virgo.kernel.osgi/src/main/resources/EventLogMessages.properties
deleted file mode 100644
index d4ff49a..0000000
--- a/org.eclipse.virgo.kernel.osgi/src/main/resources/EventLogMessages.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-#OSGI
-OF0001E=Region imports parsing failed: {}.
-OF0002W=No match found for region import: {}.
-#OF0003W Moved to the userregion bundle
-#OF0004W Moved to the userregion bundle
-OF0010E=User region configuration unavailable.
-OF0100I=OSGi telnet console available on port {}.
-OF0101E=Unable to start OSGi telnet console. Port {} is in use.
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/resources/META-INF/spring/osgi-framework-context.xml b/org.eclipse.virgo.kernel.osgi/src/main/resources/META-INF/spring/osgi-framework-context.xml
index e817546..c68c957 100644
--- a/org.eclipse.virgo.kernel.osgi/src/main/resources/META-INF/spring/osgi-framework-context.xml
+++ b/org.eclipse.virgo.kernel.osgi/src/main/resources/META-INF/spring/osgi-framework-context.xml
@@ -5,16 +5,7 @@
 	
 	<bean class="org.eclipse.virgo.kernel.osgi.region.RegionManager" init-method="start" destroy-method="stop">
 		<constructor-arg ref="bundleContext"/>
-		<constructor-arg ref="compositeBundleFactory"/>
-		<constructor-arg ref="eventAdmin"/>
-		<constructor-arg>
-			<bean class="org.eclipse.virgo.kernel.osgi.region.eventlog.RegionAwareEventLoggerServiceFactory">
-				<constructor-arg ref="eventLoggerFactory"/>
-			</bean>
-		</constructor-arg>
-		<constructor-arg ref="configAdmin"/>
-		<constructor-arg ref="eventLogger"/>
-		<constructor-arg ref="shutdown"/>
+		<constructor-arg type="java.lang.String" value="${domain}"/>
 	</bean>
-
+	
 </beans>
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/RegionManagerTests.java b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/RegionManagerTests.java
index 3ff3364..79bb0ae 100644
--- a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/RegionManagerTests.java
+++ b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/RegionManagerTests.java
@@ -11,83 +11,36 @@
 
 package org.eclipse.virgo.kernel.osgi.region;
 
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.isA;
-import static org.easymock.EasyMock.isNull;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
 import static org.junit.Assert.assertEquals;
 
-import java.util.Dictionary;
-import java.util.Hashtable;
 import java.util.List;
-import java.util.Map;
 
-import org.junit.Test;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.launch.Framework;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventAdmin;
-import org.osgi.service.framework.CompositeBundle;
-import org.osgi.service.framework.CompositeBundleFactory;
-import org.osgi.service.framework.SurrogateBundle;
-
-import org.eclipse.virgo.kernel.osgi.region.RegionManager;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.eclipse.virgo.kernel.core.Shutdown;
+import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
 import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
 import org.eclipse.virgo.teststubs.osgi.framework.StubServiceRegistration;
+import org.junit.Test;
+import org.osgi.framework.Version;
 
-/**
- */
-@SuppressWarnings("deprecation")
 public class RegionManagerTests {
 
     @Test
     public void testStartAndStop() throws Exception {
         StubBundleContext bundleContext = new StubBundleContext();
-        StubBundleContext surrogateBundleContext = new StubBundleContext();
         
-        Framework user = createMock(Framework.class);
-        SurrogateBundle surrogate = createMock(SurrogateBundle.class);
-        @SuppressWarnings("unchecked")
-        ServiceFactory<EventLogger> serviceFactory = createMock(ServiceFactory.class);
+        StubBundle stubUserRegionFactoryBundle = new StubBundle("org.eclipse.virgo.kernel.userregionfactory", new Version("2.2.0"));
+        bundleContext.addInstalledBundle(stubUserRegionFactoryBundle);
         
-        CompositeBundleFactory factory = createMock(CompositeBundleFactory.class);
-        CompositeBundle bundle = createMock(CompositeBundle.class);
-        
-        expect(factory.installCompositeBundle(isA(Map.class), isA(String.class), isA(Map.class))).andReturn(bundle);
-        expect(bundle.getCompositeFramework()).andReturn(user);
-        bundle.start();
-        expect(bundle.getSurrogateBundle()).andReturn(surrogate);
-        
-        expect(surrogate.getBundleContext()).andReturn(surrogateBundleContext);
-        
-        EventAdmin eventAdmin = createMock(EventAdmin.class);
-        eventAdmin.sendEvent(isA(Event.class));
-        
-        Dictionary<String, String> properties = new Hashtable<String, String>();
-        Configuration config = createMock(Configuration.class);
-        expect(config.getProperties()).andReturn(properties);
-        
-        ConfigurationAdmin configAdmin = createMock(ConfigurationAdmin.class);
-        expect(configAdmin.getConfiguration(isA(String.class), (String) isNull())).andReturn(config);
-        
-        EventLogger eventLogger = createMock(EventLogger.class);       
-        Shutdown shutdown = createMock(Shutdown.class);
-        
-        replay(factory, bundle, surrogate, eventAdmin, configAdmin, config);
-        RegionManager manager = new RegionManager(bundleContext, factory, eventAdmin, serviceFactory, configAdmin, eventLogger, shutdown);
+        StubBundle stubSystemBundle = new StubBundle(0L, "org.osgi.framework", new Version("0"), "");
+        bundleContext.addInstalledBundle(stubSystemBundle);
+                              
+       
+        RegionManager manager = new RegionManager(bundleContext, "test.domain");
         manager.start();
         
         List<StubServiceRegistration<Object>> serviceRegistrations = bundleContext.getServiceRegistrations();
-        assertEquals("Regions not registered", 2, serviceRegistrations.size());
+        assertEquals("Region services not registered", 9, serviceRegistrations.size());
         
         manager.stop();
-        verify(factory, bundle, surrogate, eventAdmin, configAdmin, config);
         
     }
 }
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleEventHookTests.java b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleEventHookTests.java
new file mode 100644
index 0000000..7c570f8
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleEventHookTests.java
@@ -0,0 +1,93 @@
+/*
+ * This file is part of the Eclipse Virgo project.
+ *
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    VMware Inc. - initial contribution
+ */
+
+package org.eclipse.virgo.kernel.osgi.region.hook;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.easymock.EasyMock;
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
+import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.hooks.bundle.EventHook;
+import org.osgi.framework.hooks.bundle.FindHook;
+
+public class RegionBundleEventHookTests {
+
+    private FindHook mockFindHook;
+
+    private BundleEvent bundleEvent;
+
+    private Collection<BundleContext> contexts;
+
+    private Bundle eventBundle;
+
+    private RegionDigraph mockRegionDigraph;
+
+    private ThreadLocal<Region> threadLocal;
+
+    @Before
+    public void setUp() throws Exception {
+        this.mockRegionDigraph = EasyMock.createMock(RegionDigraph.class);
+        this.mockFindHook = EasyMock.createMock(FindHook.class);
+        this.eventBundle = new StubBundle();
+        this.bundleEvent = new BundleEvent(BundleEvent.STARTED, this.eventBundle, this.eventBundle);
+        this.contexts = new HashSet<BundleContext>();
+        StubBundleContext stubListenerBundleContext = new StubBundleContext();
+        this.contexts.add(stubListenerBundleContext);
+        this.threadLocal = new ThreadLocal<Region>();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public void testEventAllowed() {
+        this.mockFindHook = new FindHook() {
+
+            @Override
+            public void find(BundleContext context, Collection<Bundle> bundles) {
+            }
+        };
+        EventHook eventHook = new RegionBundleEventHook(this.mockRegionDigraph, this.mockFindHook, this.threadLocal);
+        eventHook.event(this.bundleEvent, this.contexts);
+        assertEquals(1, this.contexts.size());
+    }
+
+    @Test
+    public void testEventNotAllowed() {
+        this.mockFindHook = new FindHook() {
+
+            @Override
+            public void find(BundleContext context, Collection<Bundle> bundles) {
+                bundles.clear();
+            }
+        };
+        EventHook eventHook = new RegionBundleEventHook(this.mockRegionDigraph, this.mockFindHook, this.threadLocal);
+        eventHook.event(this.bundleEvent, this.contexts);
+        assertTrue(this.contexts.isEmpty());
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleFindHookTests.java b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleFindHookTests.java
new file mode 100644
index 0000000..26a5071
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionBundleFindHookTests.java
@@ -0,0 +1,258 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.hook;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
+import org.eclipse.virgo.kernel.osgi.region.StandardRegionFilter;
+import org.eclipse.virgo.kernel.osgi.region.internal.StandardRegionDigraph;
+import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
+import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
+import org.eclipse.virgo.util.osgi.VersionRange;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+import org.osgi.framework.hooks.bundle.FindHook;
+
+public class RegionBundleFindHookTests {
+
+    private static final String BUNDLE_X = "X";
+
+    private static final Version BUNDLE_VERSION = new Version("0");
+
+    private long bundleId;
+
+    private static final String REGION_A = "RegionA";
+
+    private static final String BUNDLE_A = "BundleA";
+
+    private static final String REGION_B = "RegionB";
+
+    private static final String BUNDLE_B = "BundleB";
+
+    private static final String REGION_C = "RegionC";
+
+    private static final String BUNDLE_C = "BundleC";
+
+    private static final String REGION_D = "RegionD";
+
+    private static final String BUNDLE_D = "BundleD";
+
+    private StandardRegionDigraph digraph;
+
+    private FindHook bundleFindHook;
+
+    private Map<String, Region> regions;
+
+    private Map<String, Bundle> bundles;
+
+    private Collection<Bundle> candidates;
+
+    private ThreadLocal<Region> threadLocal;
+
+    @Before
+    public void setUp() throws Exception {
+        this.bundleId = 1L;
+        this.regions = new HashMap<String, Region>();
+        this.bundles = new HashMap<String, Bundle>();
+        
+        StubBundle stubSystemBundle = new StubBundle(0L, "osgi.framework", new Version("0"), "loc");
+        StubBundleContext stubBundleContext = new StubBundleContext();
+        stubBundleContext.addInstalledBundle(stubSystemBundle);
+        this.threadLocal = new ThreadLocal<Region>();
+        this.digraph = new StandardRegionDigraph(stubBundleContext, this.threadLocal);
+        this.bundleFindHook = new RegionBundleFindHook(this.digraph);
+        this.candidates = new HashSet<Bundle>();
+
+        // Create regions A, B, C, D containing bundles A, B, C, D, respectively.
+        createRegion(REGION_A, BUNDLE_A);
+        createRegion(REGION_B, BUNDLE_B);
+        createRegion(REGION_C, BUNDLE_C);
+        createRegion(REGION_D, BUNDLE_D);
+
+        createBundle(BUNDLE_X);
+
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public void testFindInSameRegion() {
+        this.candidates.add(bundle(BUNDLE_A));
+        this.bundleFindHook.find(bundleContext(BUNDLE_A), this.candidates);
+        assertTrue(this.candidates.contains(bundle(BUNDLE_A)));
+    }
+
+    @Test
+    public void testFindInDisconnectedRegion() {
+        this.candidates.add(bundle(BUNDLE_B));
+        this.bundleFindHook.find(bundleContext(BUNDLE_A), this.candidates);
+        assertFalse(this.candidates.contains(bundle(BUNDLE_B)));
+    }
+
+    @Test
+    public void testFindConnectedRegionAllowed() throws BundleException {
+        RegionFilter filter = createFilter(BUNDLE_B);
+        region(REGION_A).connectRegion(region(REGION_B), filter);
+
+        this.candidates.add(bundle(BUNDLE_B));
+        this.bundleFindHook.find(bundleContext(BUNDLE_A), this.candidates);
+        assertTrue(this.candidates.contains(bundle(BUNDLE_B)));
+    }
+
+    @Test
+    public void testFindConnectedRegionFiltering() throws BundleException {
+        region(REGION_A).connectRegion(region(REGION_B), createFilter(BUNDLE_B));
+        Bundle x = createBundle(BUNDLE_X);
+        region(REGION_B).addBundle(x);
+
+        this.candidates.add(bundle(BUNDLE_B));
+        this.candidates.add(x);
+        this.bundleFindHook.find(bundleContext(BUNDLE_A), this.candidates);
+        assertTrue(this.candidates.contains(bundle(BUNDLE_B)));
+        assertFalse(this.candidates.contains(x));
+    }
+
+    @Test
+    public void testFindTransitive() throws BundleException {
+        region(REGION_A).connectRegion(region(REGION_B), createFilter(BUNDLE_C));
+        region(REGION_B).connectRegion(region(REGION_C), createFilter(BUNDLE_C));
+        region(REGION_C).addBundle(bundle(BUNDLE_X));
+
+        this.candidates.add(bundle(BUNDLE_B));
+        this.candidates.add(bundle(BUNDLE_C));
+        this.candidates.add(bundle(BUNDLE_X));
+        this.bundleFindHook.find(bundleContext(BUNDLE_A), this.candidates);
+        assertTrue(this.candidates.contains(bundle(BUNDLE_C)));
+        assertFalse(this.candidates.contains(bundle(BUNDLE_B)));
+        assertFalse(this.candidates.contains(bundle(BUNDLE_X)));
+
+    }
+
+    @Test
+    public void testFindInCyclicGraph() throws BundleException {
+        region(REGION_D).addBundle(bundle(BUNDLE_X));
+
+        region(REGION_A).connectRegion(region(REGION_B), createFilter(BUNDLE_D, BUNDLE_X));
+        region(REGION_B).connectRegion(region(REGION_A), createFilter());
+
+        region(REGION_B).connectRegion(region(REGION_D), createFilter(BUNDLE_D));
+        region(REGION_D).connectRegion(region(REGION_B), createFilter());
+
+        region(REGION_B).connectRegion(region(REGION_C), createFilter(BUNDLE_X));
+        region(REGION_C).connectRegion(region(REGION_B), createFilter());
+
+        region(REGION_C).connectRegion(region(REGION_D), createFilter(BUNDLE_X));
+        region(REGION_D).connectRegion(region(REGION_C), createFilter());
+
+        region(REGION_A).connectRegion(region(REGION_C), createFilter());
+        region(REGION_C).connectRegion(region(REGION_A), createFilter());
+
+        region(REGION_D).connectRegion(region(REGION_A), createFilter());
+        region(REGION_A).connectRegion(region(REGION_D), createFilter());
+
+        // Find from region A.
+        this.candidates.add(bundle(BUNDLE_B));
+        this.candidates.add(bundle(BUNDLE_C));
+        this.candidates.add(bundle(BUNDLE_D));
+        this.candidates.add(bundle(BUNDLE_X));
+
+        this.bundleFindHook.find(bundleContext(BUNDLE_A), this.candidates);
+        assertEquals(2, this.candidates.size());
+        assertTrue(this.candidates.contains(bundle(BUNDLE_D)));
+        assertTrue(this.candidates.contains(bundle(BUNDLE_X)));
+
+        // Find from region B
+        this.candidates.add(bundle(BUNDLE_B));
+        this.candidates.add(bundle(BUNDLE_C));
+        this.candidates.add(bundle(BUNDLE_D));
+        this.candidates.add(bundle(BUNDLE_X));
+
+        this.bundleFindHook.find(bundleContext(BUNDLE_B), this.candidates);
+        assertEquals(3, this.candidates.size());
+        assertTrue(this.candidates.contains(bundle(BUNDLE_B)));
+        assertTrue(this.candidates.contains(bundle(BUNDLE_D)));
+        assertTrue(this.candidates.contains(bundle(BUNDLE_X)));
+    }
+
+    @Test
+    public void testFindFromSystemBundle() {
+        this.candidates.add(bundle(BUNDLE_A));
+
+        Bundle stubBundle = new StubBundle(0L, "sys", BUNDLE_VERSION, "");
+        this.bundleFindHook.find(stubBundle.getBundleContext(), this.candidates);
+        assertEquals(1, this.candidates.size());
+        assertTrue(this.candidates.contains(bundle(BUNDLE_A)));
+    }
+
+    @Test
+    public void testFindFromBundleInNoRegion() {
+        this.candidates.add(bundle(BUNDLE_A));
+
+        Bundle stranger = createBundle("stranger");
+        this.bundleFindHook.find(stranger.getBundleContext(), this.candidates);
+        assertEquals(0, this.candidates.size());
+    }
+
+    private Region createRegion(String regionName, String... bundleSymbolicNames) throws BundleException {
+        Region region = this.digraph.createRegion(regionName);
+        for (String bundleSymbolicName : bundleSymbolicNames) {
+            Bundle stubBundle = createBundle(bundleSymbolicName);
+            region.addBundle(stubBundle);
+        }
+        this.regions.put(regionName, region);
+        return region;
+    }
+
+    private Region region(String regionName) {
+        return this.regions.get(regionName);
+    }
+
+    private RegionFilter createFilter(String... bundleSymbolicNames) {
+        RegionFilter filter = new StandardRegionFilter();
+        for (String bundleSymbolicName : bundleSymbolicNames) {
+            filter.allowBundle(bundleSymbolicName, new VersionRange(BUNDLE_VERSION.toString()));
+        }
+        return filter;
+    }
+
+    private Bundle createBundle(String bundleSymbolicName) {
+        Bundle stubBundle = new StubBundle(this.bundleId++, bundleSymbolicName, BUNDLE_VERSION, "loc:" + bundleSymbolicName);
+        this.bundles.put(bundleSymbolicName, stubBundle);
+        return stubBundle;
+    }
+
+    private BundleContext bundleContext(String bundleSymbolicName) {
+        return bundle(bundleSymbolicName).getBundleContext();
+    }
+
+    private Bundle bundle(String bundleSymbolicName) {
+        Bundle bundleA = this.bundles.get(bundleSymbolicName);
+        return bundleA;
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHookTests.java b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHookTests.java
new file mode 100644
index 0000000..0e1d5db
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionResolverHookTests.java
@@ -0,0 +1,549 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.hook;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
+import org.eclipse.virgo.kernel.osgi.region.RegionPackageImportPolicy;
+import org.eclipse.virgo.kernel.osgi.region.StandardRegionFilter;
+import org.eclipse.virgo.kernel.osgi.region.internal.StandardRegionDigraph;
+import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
+import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
+import org.eclipse.virgo.util.osgi.VersionRange;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+import org.osgi.framework.hooks.resolver.ResolverHook;
+import org.osgi.framework.wiring.BundleCapability;
+import org.osgi.framework.wiring.BundleRequirement;
+import org.osgi.framework.wiring.BundleRevision;
+import org.osgi.framework.wiring.BundleWiring;
+
+public class RegionResolverHookTests {
+
+    private static final String PACKAGE_A = "package.a";
+
+    private static final String PACKAGE_B = "package.b";
+
+    private static final String PACKAGE_C = "package.c";
+
+    private static final String PACKAGE_D = "package.d";
+
+    private static final String PACKAGE_X = "package.x";
+
+    private static final String BUNDLE_X = "X";
+
+    private static final Version BUNDLE_VERSION = new Version("0");
+
+    private long bundleId;
+
+    private static final String REGION_A = "RegionA";
+
+    private static final String BUNDLE_A = "BundleA";
+
+    private static final String REGION_B = "RegionB";
+
+    private static final String BUNDLE_B = "BundleB";
+
+    private static final String REGION_C = "RegionC";
+
+    private static final String BUNDLE_C = "BundleC";
+
+    private static final String REGION_D = "RegionD";
+
+    private static final String BUNDLE_D = "BundleD";
+
+    private StandardRegionDigraph digraph;
+
+    private ResolverHook resolverHook;
+
+    private Map<String, Region> regions;
+
+    private Map<String, Bundle> bundles;
+
+    private Collection<BundleCapability> candidates;
+
+    private ThreadLocal<Region> threadLocal;
+
+    @Before
+    public void setUp() throws Exception {
+        this.bundleId = 1L;
+        this.regions = new HashMap<String, Region>();
+        this.bundles = new HashMap<String, Bundle>();
+        this.threadLocal = new ThreadLocal<Region>();
+        StubBundle stubSystemBundle = new StubBundle(0L, "osgi.framework", new Version("0"), "loc");
+        StubBundleContext stubBundleContext = new StubBundleContext();
+        stubBundleContext.addInstalledBundle(stubSystemBundle);
+        this.digraph = new StandardRegionDigraph(stubBundleContext, this.threadLocal);
+        this.resolverHook = new RegionResolverHook(this.digraph);
+        this.candidates = new HashSet<BundleCapability>();
+
+        // Create regions A, B, C, D containing bundles A, B, C, D, respectively.
+        createRegion(REGION_A, BUNDLE_A);
+        createRegion(REGION_B, BUNDLE_B);
+        createRegion(REGION_C, BUNDLE_C);
+        createRegion(REGION_D, BUNDLE_D);
+
+        createBundle(BUNDLE_X);
+
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public void testResolveInSameRegion() {
+        this.candidates.add(packageCapability(BUNDLE_A, PACKAGE_A));
+        this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
+        assertTrue(this.candidates.contains(packageCapability(BUNDLE_A, PACKAGE_A)));
+    }
+
+    @Test
+    public void testResolveInDisconnectedRegion() {
+        this.candidates.add(packageCapability(BUNDLE_B, PACKAGE_B));
+        this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
+        assertFalse(this.candidates.contains(packageCapability(BUNDLE_B, PACKAGE_B)));
+    }
+
+    @Test
+    public void testResolveConnectedRegionAllowed() throws BundleException {
+        RegionFilter filter = createFilter(PACKAGE_B);
+        region(REGION_A).connectRegion(region(REGION_B), filter);
+
+        this.candidates.add(packageCapability(BUNDLE_B, PACKAGE_B));
+        this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
+        assertTrue(this.candidates.contains(packageCapability(BUNDLE_B, PACKAGE_B)));
+    }
+
+    @Test
+    public void testResolveBundleCapabilityConnectedRegionAllowed() throws BundleException {
+        RegionFilter filter = createBundleFilter(BUNDLE_B, BUNDLE_VERSION);
+        region(REGION_A).connectRegion(region(REGION_B), filter);
+
+        this.candidates.add(bundleCapability(BUNDLE_B));
+        this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
+        assertTrue(this.candidates.contains(bundleCapability(BUNDLE_B)));
+    }
+
+    @Test
+    public void testResolveConnectedRegionFiltering() throws BundleException {
+        region(REGION_A).connectRegion(region(REGION_B), createFilter(PACKAGE_B));
+        Bundle x = createBundle(BUNDLE_X);
+        region(REGION_B).addBundle(x);
+
+        this.candidates.add(packageCapability(BUNDLE_B, PACKAGE_B));
+        this.candidates.add(packageCapability(BUNDLE_X, PACKAGE_X));
+        this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
+        assertTrue(this.candidates.contains(packageCapability(BUNDLE_B, PACKAGE_B)));
+        assertFalse(this.candidates.contains(packageCapability(BUNDLE_X, PACKAGE_X)));
+    }
+
+    @Test
+    public void testResolveBundleConnectedRegionFiltering() throws BundleException {
+        RegionFilter filter = createBundleFilter(BUNDLE_B, BUNDLE_VERSION);
+        region(REGION_A).connectRegion(region(REGION_B), filter);
+        Bundle x = createBundle(BUNDLE_X);
+        region(REGION_B).addBundle(x);
+
+        this.candidates.add(bundleCapability(BUNDLE_B));
+        this.candidates.add(bundleCapability(BUNDLE_X));
+        this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
+        assertTrue(this.candidates.contains(bundleCapability(BUNDLE_B)));
+        assertFalse(this.candidates.contains(bundleCapability(BUNDLE_X)));
+    }
+
+    @Test
+    public void testResolveTransitive() throws BundleException {
+        region(REGION_A).connectRegion(region(REGION_B), createFilter(PACKAGE_C));
+        region(REGION_B).connectRegion(region(REGION_C), createFilter(PACKAGE_C));
+        region(REGION_C).addBundle(bundle(BUNDLE_X));
+
+        this.candidates.add(packageCapability(BUNDLE_B, PACKAGE_B));
+        this.candidates.add(packageCapability(BUNDLE_C, PACKAGE_C));
+        this.candidates.add(packageCapability(BUNDLE_X, PACKAGE_X));
+        this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
+        assertTrue(this.candidates.contains(packageCapability(BUNDLE_C, PACKAGE_C)));
+        assertFalse(this.candidates.contains(packageCapability(BUNDLE_B, PACKAGE_B)));
+        assertFalse(this.candidates.contains(packageCapability(BUNDLE_X, PACKAGE_X)));
+
+    }
+
+    @Test
+    public void testResolveInCyclicGraph() throws BundleException {
+        region(REGION_D).addBundle(bundle(BUNDLE_X));
+
+        region(REGION_A).connectRegion(region(REGION_B), createFilter(PACKAGE_D, PACKAGE_X));
+        region(REGION_B).connectRegion(region(REGION_A), createFilter());
+
+        region(REGION_B).connectRegion(region(REGION_D), createFilter(PACKAGE_D));
+        region(REGION_D).connectRegion(region(REGION_B), createFilter());
+
+        region(REGION_B).connectRegion(region(REGION_C), createFilter(PACKAGE_X));
+        region(REGION_C).connectRegion(region(REGION_B), createFilter());
+
+        region(REGION_C).connectRegion(region(REGION_D), createFilter(PACKAGE_X));
+        region(REGION_D).connectRegion(region(REGION_C), createFilter());
+
+        region(REGION_A).connectRegion(region(REGION_C), createFilter());
+        region(REGION_C).connectRegion(region(REGION_A), createFilter());
+
+        region(REGION_D).connectRegion(region(REGION_A), createFilter());
+        region(REGION_A).connectRegion(region(REGION_D), createFilter());
+
+        // Find from region A.
+        this.candidates.add(packageCapability(BUNDLE_B, PACKAGE_B));
+        this.candidates.add(packageCapability(BUNDLE_C, PACKAGE_C));
+        this.candidates.add(packageCapability(BUNDLE_D, PACKAGE_D));
+        this.candidates.add(packageCapability(BUNDLE_X, PACKAGE_X));
+
+        this.resolverHook.filterMatches(bundleRequirement(BUNDLE_A), this.candidates);
+        assertEquals(2, this.candidates.size());
+        assertTrue(this.candidates.contains(packageCapability(BUNDLE_D, PACKAGE_D)));
+        assertTrue(this.candidates.contains(packageCapability(BUNDLE_X, PACKAGE_X)));
+
+        // Find from region B
+        this.candidates.add(packageCapability(BUNDLE_B, PACKAGE_B));
+        this.candidates.add(packageCapability(BUNDLE_C, PACKAGE_C));
+        this.candidates.add(packageCapability(BUNDLE_D, PACKAGE_D));
+        this.candidates.add(packageCapability(BUNDLE_X, PACKAGE_X));
+
+        this.resolverHook.filterMatches(bundleRequirement(BUNDLE_B), this.candidates);
+        assertEquals(3, this.candidates.size());
+        assertTrue(this.candidates.contains(packageCapability(BUNDLE_B, PACKAGE_B)));
+        assertTrue(this.candidates.contains(packageCapability(BUNDLE_D, PACKAGE_D)));
+        assertTrue(this.candidates.contains(packageCapability(BUNDLE_X, PACKAGE_X)));
+    }
+
+    @Test
+    public void testResolveFromSystemBundle() {
+        this.candidates.add(packageCapability(BUNDLE_A, PACKAGE_A));
+
+        Bundle stubBundle = new StubBundle(0L, "sys", BUNDLE_VERSION, "");
+        this.resolverHook.filterMatches(new StubBundleRequirement(stubBundle), this.candidates);
+        assertEquals(1, this.candidates.size());
+        assertTrue(this.candidates.contains(packageCapability(BUNDLE_A, PACKAGE_A)));
+    }
+
+    @Test
+    public void testResolveFromBundleInNoRegion() {
+        this.candidates.add(packageCapability(BUNDLE_A, PACKAGE_A));
+
+        Bundle stranger = createBundle("stranger");
+        this.resolverHook.filterMatches(new StubBundleRequirement(stranger), this.candidates);
+        assertEquals(0, this.candidates.size());
+    }
+
+    @Test
+    public void testUnimplementedMethods() {
+        this.resolverHook.filterResolvable(null);
+        this.resolverHook.end();
+    }
+
+    private BundleCapability packageCapability(final String bundleSymbolicName, String packageName) {
+        return new StubPackageCapability(bundleSymbolicName, packageName);
+    }
+
+    private BundleCapability bundleCapability(String bundleSymbolicName) {
+        return new StubBundleCapability(bundleSymbolicName);
+    }
+
+    private Region createRegion(String regionName, String... bundleSymbolicNames) throws BundleException {
+        Region region = this.digraph.createRegion(regionName);
+        for (String bundleSymbolicName : bundleSymbolicNames) {
+            Bundle stubBundle = createBundle(bundleSymbolicName);
+            region.addBundle(stubBundle);
+        }
+        this.regions.put(regionName, region);
+        return region;
+    }
+
+    private Region region(String regionName) {
+        return this.regions.get(regionName);
+    }
+
+    private RegionFilter createFilter(final String... packageNames) {
+        RegionFilter filter = new StandardRegionFilter();
+        filter.setPackageImportPolicy(new RegionPackageImportPolicy() {
+
+            @Override
+            public boolean isImported(String packageName, Map<String, Object> attributes, Map<String, String> directives) {
+                for (String pkg : packageNames) {
+                    if (packageName.equals(pkg)) {
+                        return true;
+                    }
+                }
+                return false;
+            }
+        });
+        return filter;
+    }
+
+    private RegionFilter createBundleFilter(String bundleSymbolicName, Version bundleVersion) {
+        RegionFilter filter = new StandardRegionFilter();
+        filter.allowBundle(bundleSymbolicName, new VersionRange(bundleVersion.toString()));
+        return filter;
+    }
+
+    private Bundle createBundle(String bundleSymbolicName) {
+        Bundle stubBundle = new StubBundle(this.bundleId++, bundleSymbolicName, BUNDLE_VERSION, "loc:" + bundleSymbolicName);
+        this.bundles.put(bundleSymbolicName, stubBundle);
+        return stubBundle;
+    }
+    
+    private BundleRequirement bundleRequirement(String bundleSymbolicName) {
+        return new StubBundleRequirement(bundle(bundleSymbolicName));
+    }
+
+    private Bundle bundle(String bundleSymbolicName) {
+        Bundle bundleA = this.bundles.get(bundleSymbolicName);
+        return bundleA;
+    }
+
+    private final class StubPackageCapability implements BundleCapability {
+
+        private final String bundleSymbolicName;
+
+        private final String packageName;
+
+        private StubPackageCapability(String bundleSymbolicName, String packageName) {
+            this.bundleSymbolicName = bundleSymbolicName;
+            this.packageName = packageName;
+        }
+
+        @Override
+        public String getNamespace() {
+            return BundleRevision.PACKAGE_NAMESPACE;
+        }
+
+        @Override
+        public Map<String, String> getDirectives() {
+            return new HashMap<String, String>();
+        }
+
+        @Override
+        public Map<String, Object> getAttributes() {
+            HashMap<String, Object> attributes = new HashMap<String, Object>();
+            attributes.put(BundleRevision.PACKAGE_NAMESPACE, this.packageName);
+            return attributes;
+        }
+
+        @Override
+        public BundleRevision getRevision() {
+            return new StubBundleRevision(bundle(this.bundleSymbolicName));
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + getOuterType().hashCode();
+            result = prime * result + (this.bundleSymbolicName == null ? 0 : this.bundleSymbolicName.hashCode());
+            result = prime * result + (this.packageName == null ? 0 : this.packageName.hashCode());
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (!(obj instanceof StubPackageCapability)) {
+                return false;
+            }
+            StubPackageCapability other = (StubPackageCapability) obj;
+            if (!getOuterType().equals(other.getOuterType())) {
+                return false;
+            }
+            if (this.bundleSymbolicName == null) {
+                if (other.bundleSymbolicName != null) {
+                    return false;
+                }
+            } else if (!this.bundleSymbolicName.equals(other.bundleSymbolicName)) {
+                return false;
+            }
+            if (this.packageName == null) {
+                if (other.packageName != null) {
+                    return false;
+                }
+            } else if (!this.packageName.equals(other.packageName)) {
+                return false;
+            }
+            return true;
+        }
+
+        private RegionResolverHookTests getOuterType() {
+            return RegionResolverHookTests.this;
+        }
+
+    }
+
+    private final class StubBundleCapability implements BundleCapability {
+
+        private final String bundleSymbolicName;
+
+        private StubBundleCapability(String bundleSymbolicName) {
+            this.bundleSymbolicName = bundleSymbolicName;
+        }
+
+        @Override
+        public String getNamespace() {
+            return BundleRevision.BUNDLE_NAMESPACE;
+        }
+
+        @Override
+        public Map<String, String> getDirectives() {
+            return new HashMap<String, String>();
+        }
+
+        @Override
+        public Map<String, Object> getAttributes() {
+            HashMap<String, Object> attributes = new HashMap<String, Object>();
+            return attributes;
+        }
+
+        @Override
+        public BundleRevision getRevision() {
+            return new StubBundleRevision(bundle(this.bundleSymbolicName));
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + getOuterType().hashCode();
+            result = prime * result + ((bundleSymbolicName == null) ? 0 : bundleSymbolicName.hashCode());
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj)
+                return true;
+            if (obj == null)
+                return false;
+            if (!(obj instanceof StubBundleCapability))
+                return false;
+            StubBundleCapability other = (StubBundleCapability) obj;
+            if (!getOuterType().equals(other.getOuterType()))
+                return false;
+            if (bundleSymbolicName == null) {
+                if (other.bundleSymbolicName != null)
+                    return false;
+            } else if (!bundleSymbolicName.equals(other.bundleSymbolicName))
+                return false;
+            return true;
+        }
+
+        private RegionResolverHookTests getOuterType() {
+            return RegionResolverHookTests.this;
+        }
+
+    }
+    
+    private final class StubBundleRequirement implements BundleRequirement {
+        
+        private final StubBundleRevision bundleRevision;
+
+        private StubBundleRequirement(Bundle bundle) {
+            this.bundleRevision = new StubBundleRevision(bundle);
+        }
+
+        @Override
+        public String getNamespace() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Map<String, String> getDirectives() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Map<String, Object> getAttributes() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public BundleRevision getRevision() {
+            return this.bundleRevision;
+        }
+
+        @Override
+        public boolean matches(BundleCapability capability) {
+            throw new UnsupportedOperationException();
+        }
+        
+    }
+
+    private final class StubBundleRevision implements BundleRevision {
+
+        private final Bundle bundle;
+
+        private StubBundleRevision(Bundle bundle) {
+            this.bundle = bundle;
+        }
+
+        @Override
+        public Bundle getBundle() {
+            return this.bundle;
+        }
+
+        @Override
+        public String getSymbolicName() {
+            return this.bundle.getSymbolicName();
+        }
+
+        @Override
+        public Version getVersion() {
+            return this.bundle.getVersion();
+        }
+
+        @Override
+        public List<BundleCapability> getDeclaredCapabilities(String namespace) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public int getTypes() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public List<BundleRequirement> getDeclaredRequirements(String namespace) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public BundleWiring getWiring() {
+            throw new UnsupportedOperationException();
+        }
+
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceEventHookTests.java b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceEventHookTests.java
new file mode 100644
index 0000000..4055393
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceEventHookTests.java
@@ -0,0 +1,91 @@
+/*
+ * This file is part of the Eclipse Virgo project.
+ *
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    VMware Inc. - initial contribution
+ */
+
+package org.eclipse.virgo.kernel.osgi.region.hook;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.easymock.EasyMock;
+import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
+import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
+import org.eclipse.virgo.teststubs.osgi.framework.StubServiceReference;
+import org.eclipse.virgo.teststubs.osgi.framework.StubServiceRegistration;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.hooks.service.EventHook;
+import org.osgi.framework.hooks.service.FindHook;
+
+@SuppressWarnings("deprecation")
+public class RegionServiceEventHookTests {
+
+    private FindHook mockFindHook;
+
+    private ServiceEvent serviceEvent;
+
+    private Collection<BundleContext> contexts;
+
+    private Bundle eventBundle;
+
+    @Before
+    public void setUp() throws Exception {
+        this.mockFindHook = EasyMock.createMock(FindHook.class);
+        this.eventBundle = new StubBundle();
+        StubServiceReference<Object> stubServiceReference = new StubServiceReference<Object>(new StubServiceRegistration<Object>(
+            (StubBundleContext) this.eventBundle.getBundleContext(), Object.class.getName()));
+        this.serviceEvent = new ServiceEvent(ServiceEvent.REGISTERED, stubServiceReference);
+        this.contexts = new HashSet<BundleContext>();
+        StubBundleContext stubListenerBundleContext = new StubBundleContext();
+        this.contexts.add(stubListenerBundleContext);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public void testEventAllowed() {
+        this.mockFindHook = new FindHook() {
+
+            @Override
+            public void find(BundleContext context, String name, String filter, boolean allServices, Collection<ServiceReference<?>> references) {
+            }
+        };
+        EventHook eventHook = new RegionServiceEventHook(this.mockFindHook);
+        eventHook.event(this.serviceEvent, this.contexts);
+        assertEquals(1, this.contexts.size());
+    }
+
+    @Test
+    public void testEventNotAllowed() {
+        this.mockFindHook = new FindHook() {
+
+            @Override
+            public void find(BundleContext context, String name, String filter, boolean allServices, Collection<ServiceReference<?>> references) {
+                references.clear();
+            }
+        };
+        EventHook eventHook = new RegionServiceEventHook(this.mockFindHook);
+        eventHook.event(this.serviceEvent, this.contexts);
+        assertTrue(this.contexts.isEmpty());
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceFindHookTests.java b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceFindHookTests.java
new file mode 100644
index 0000000..c6602f8
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/hook/RegionServiceFindHookTests.java
@@ -0,0 +1,308 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.hook;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
+import org.eclipse.virgo.kernel.osgi.region.StandardRegionFilter;
+import org.eclipse.virgo.kernel.osgi.region.internal.StandardRegionDigraph;
+import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
+import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
+import org.eclipse.virgo.teststubs.osgi.framework.StubServiceReference;
+import org.eclipse.virgo.teststubs.osgi.framework.StubServiceRegistration;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+import org.osgi.framework.hooks.service.FindHook;
+
+/**
+ * This testcase was based on {@link RegionBundleFindHookTests}.
+ */
+public class RegionServiceFindHookTests {
+
+    private static final String BUNDLE_X = "X";
+
+    private static final Version BUNDLE_VERSION = new Version("0");
+
+    private long bundleId;
+
+    private static final String REGION_A = "RegionA";
+
+    private static final String BUNDLE_A = "BundleA";
+
+    private static final String REGION_B = "RegionB";
+
+    private static final String BUNDLE_B = "BundleB";
+
+    private static final String REGION_C = "RegionC";
+
+    private static final String BUNDLE_C = "BundleC";
+
+    private static final String REGION_D = "RegionD";
+
+    private static final String BUNDLE_D = "BundleD";
+
+    private StandardRegionDigraph digraph;
+
+    private FindHook bundleFindHook;
+
+    private Map<String, Region> regions;
+
+    private Map<String, Bundle> bundles;
+
+    private Map<String, ServiceReference<Object>> serviceReferences;
+
+    private Collection<ServiceReference<?>> candidates;
+
+    private ThreadLocal<Region> threadLocal;
+
+    @Before
+    public void setUp() throws Exception {
+        this.bundleId = 1L;
+        this.regions = new HashMap<String, Region>();
+        this.bundles = new HashMap<String, Bundle>();
+        this.serviceReferences = new HashMap<String, ServiceReference<Object>>();
+        
+        StubBundle stubSystemBundle = new StubBundle(0L, "osgi.framework", new Version("0"), "loc");
+        StubBundleContext stubBundleContext = new StubBundleContext();
+        stubBundleContext.addInstalledBundle(stubSystemBundle);
+        this.threadLocal = new ThreadLocal<Region>();
+        this.digraph = new StandardRegionDigraph(stubBundleContext, this.threadLocal);
+        this.bundleFindHook = new RegionServiceFindHook(this.digraph);
+        this.candidates = new HashSet<ServiceReference<?>>();
+
+        // Create regions A, B, C, D containing bundles A, B, C, D, respectively.
+        createRegion(REGION_A, BUNDLE_A);
+        createRegion(REGION_B, BUNDLE_B);
+        createRegion(REGION_C, BUNDLE_C);
+        createRegion(REGION_D, BUNDLE_D);
+
+        createBundle(BUNDLE_X);
+
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public void testFindInSameRegion() {
+        this.candidates.add(serviceReference(BUNDLE_A));
+        this.bundleFindHook.find(bundleContext(BUNDLE_A), "", "", false, this.candidates);
+        assertTrue(this.candidates.contains(serviceReference(BUNDLE_A)));
+    }
+
+    @Test
+    public void testFindInDisconnectedRegion() {
+        this.candidates.add(serviceReference(BUNDLE_B));
+        this.bundleFindHook.find(bundleContext(BUNDLE_A), "", "", false, this.candidates);
+        assertFalse(this.candidates.contains(serviceReference(BUNDLE_B)));
+    }
+
+    @Test
+    public void testFindConnectedRegionAllowed() throws BundleException {
+        RegionFilter filter = createFilter(BUNDLE_B);
+        region(REGION_A).connectRegion(region(REGION_B), filter);
+
+        this.candidates.add(serviceReference(BUNDLE_B));
+        this.bundleFindHook.find(bundleContext(BUNDLE_A), "", "", false, this.candidates);
+        assertTrue(this.candidates.contains(serviceReference(BUNDLE_B)));
+    }
+
+    @Test
+    public void testFindConnectedRegionFiltering() throws BundleException {
+        region(REGION_A).connectRegion(region(REGION_B), createFilter(BUNDLE_B));
+        Bundle x = createBundle(BUNDLE_X);
+        region(REGION_B).addBundle(x);
+
+        this.candidates.add(serviceReference(BUNDLE_B));
+        this.candidates.add(serviceReference(BUNDLE_X));
+        this.bundleFindHook.find(bundleContext(BUNDLE_A), "", "", false, this.candidates);
+        assertTrue(this.candidates.contains(serviceReference(BUNDLE_B)));
+        assertFalse(this.candidates.contains(serviceReference(BUNDLE_X)));
+    }
+
+    @Test
+    public void testFindTransitive() throws BundleException {
+        region(REGION_A).connectRegion(region(REGION_B), createFilter(BUNDLE_C));
+        region(REGION_B).connectRegion(region(REGION_C), createFilter(BUNDLE_C));
+        region(REGION_C).addBundle(bundle(BUNDLE_X));
+
+        this.candidates.add(serviceReference(BUNDLE_B));
+        this.candidates.add(serviceReference(BUNDLE_C));
+        this.bundleFindHook.find(bundleContext(BUNDLE_A), "", "", false, this.candidates);
+        assertTrue(this.candidates.contains(serviceReference(BUNDLE_C)));
+        assertFalse(this.candidates.contains(serviceReference(BUNDLE_B)));
+        assertFalse(this.candidates.contains(serviceReference(BUNDLE_X)));
+
+    }
+
+    @Test
+    public void testFindInCyclicGraph() throws BundleException {
+        region(REGION_D).addBundle(bundle(BUNDLE_X));
+
+        region(REGION_A).connectRegion(region(REGION_B), createFilter(BUNDLE_D, BUNDLE_X));
+        region(REGION_B).connectRegion(region(REGION_A), createFilter());
+
+        region(REGION_B).connectRegion(region(REGION_D), createFilter(BUNDLE_D));
+        region(REGION_D).connectRegion(region(REGION_B), createFilter());
+
+        region(REGION_B).connectRegion(region(REGION_C), createFilter(BUNDLE_X));
+        region(REGION_C).connectRegion(region(REGION_B), createFilter());
+
+        region(REGION_C).connectRegion(region(REGION_D), createFilter(BUNDLE_X));
+        region(REGION_D).connectRegion(region(REGION_C), createFilter());
+
+        region(REGION_A).connectRegion(region(REGION_C), createFilter());
+        region(REGION_C).connectRegion(region(REGION_A), createFilter());
+
+        region(REGION_D).connectRegion(region(REGION_A), createFilter());
+        region(REGION_A).connectRegion(region(REGION_D), createFilter());
+
+        // Find from region A.
+        this.candidates.add(serviceReference(BUNDLE_B));
+        this.candidates.add(serviceReference(BUNDLE_C));
+        this.candidates.add(serviceReference(BUNDLE_D));
+        this.candidates.add(serviceReference(BUNDLE_X));
+
+        this.bundleFindHook.find(bundleContext(BUNDLE_A), "", "", false, this.candidates);
+        assertEquals(2, this.candidates.size());
+        assertTrue(this.candidates.contains(serviceReference(BUNDLE_D)));
+        assertTrue(this.candidates.contains(serviceReference(BUNDLE_X)));
+
+        // Find from region B
+        this.candidates.add(serviceReference(BUNDLE_B));
+        this.candidates.add(serviceReference(BUNDLE_C));
+        this.candidates.add(serviceReference(BUNDLE_D));
+        this.candidates.add(serviceReference(BUNDLE_X));
+
+        this.bundleFindHook.find(bundleContext(BUNDLE_B), "", "", false, this.candidates);
+        assertEquals(3, this.candidates.size());
+        assertTrue(this.candidates.contains(serviceReference(BUNDLE_B)));
+        assertTrue(this.candidates.contains(serviceReference(BUNDLE_D)));
+        assertTrue(this.candidates.contains(serviceReference(BUNDLE_X)));
+    }
+
+    @Test
+    public void testFindFromSystemBundle() {
+        this.candidates.add(serviceReference(BUNDLE_A));
+
+        Bundle stubBundle = new StubBundle(0L, "sys", BUNDLE_VERSION, "");
+        this.bundleFindHook.find(stubBundle.getBundleContext(), "", "", false, this.candidates);
+        assertEquals(1, this.candidates.size());
+        assertTrue(this.candidates.contains(serviceReference(BUNDLE_A)));
+    }
+
+    @Test
+    public void testFindFromBundleInNoRegion() {
+        this.candidates.add(serviceReference(BUNDLE_A));
+
+        Bundle stranger = createBundle("stranger");
+        this.bundleFindHook.find(stranger.getBundleContext(), "", "", false, this.candidates);
+        assertEquals(0, this.candidates.size());
+    }
+
+    private Region createRegion(String regionName, String... bundleSymbolicNames) throws BundleException {
+        Region region = this.digraph.createRegion(regionName);
+        for (String bundleSymbolicName : bundleSymbolicNames) {
+            Bundle stubBundle = createBundle(bundleSymbolicName);
+            region.addBundle(stubBundle);
+        }
+        this.regions.put(regionName, region);
+        return region;
+    }
+
+    private Region region(String regionName) {
+        return this.regions.get(regionName);
+    }
+
+    private RegionFilter createFilter(final String... referenceNames) {
+        RegionFilter filter = new StandardRegionFilter();
+        Filter f = new Filter() {
+
+            @Override
+            public boolean match(ServiceReference<?> reference) {
+                for (String referenceName : referenceNames) {
+                    if (reference.getBundle().getSymbolicName().equals(referenceName)) {
+                        return true;
+                    }
+                }
+                return false;
+            }
+
+            @Override
+            public boolean match(Dictionary<String, ?> dictionary) {
+                // TODO Auto-generated method stub
+                return false;
+            }
+
+            @Override
+            public boolean matchCase(Dictionary<String, ?> dictionary) {
+                // TODO Auto-generated method stub
+                return false;
+            }
+
+            @Override
+            public boolean matches(Map<String, ?> map) {
+                // TODO Auto-generated method stub
+                return false;
+            }
+        };
+        filter.setServiceFilter(f);
+        return filter;
+    }
+
+    private Bundle createBundle(String bundleSymbolicName) {
+        Bundle stubBundle = new StubBundle(this.bundleId++, bundleSymbolicName, BUNDLE_VERSION, "loc:" + bundleSymbolicName);
+        this.bundles.put(bundleSymbolicName, stubBundle);
+        createServiceReference(stubBundle, bundleSymbolicName);
+        return stubBundle;
+    }
+
+    private StubServiceReference<Object> createServiceReference(Bundle stubBundle, String referenceName) {
+        StubServiceRegistration<Object> stubServiceRegistration = new StubServiceRegistration<Object>(
+            (StubBundleContext) stubBundle.getBundleContext(), Object.class.getName());
+        StubServiceReference<Object> stubServiceReference = new StubServiceReference<Object>(stubServiceRegistration);
+        this.serviceReferences.put(referenceName, stubServiceReference);
+        return stubServiceReference;
+    }
+
+    private BundleContext bundleContext(String bundleSymbolicName) {
+        return bundle(bundleSymbolicName).getBundleContext();
+    }
+
+    private Bundle bundle(String bundleSymbolicName) {
+        Bundle bundleA = this.bundles.get(bundleSymbolicName);
+        return bundleA;
+    }
+
+    private ServiceReference<Object> serviceReference(String referenceName) {
+        return this.serviceReferences.get(referenceName);
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/internal/BundleIdBasedRegionTests.java b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/internal/BundleIdBasedRegionTests.java
new file mode 100644
index 0000000..a868ba2
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/internal/BundleIdBasedRegionTests.java
@@ -0,0 +1,304 @@
+/*******************************************************************************
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.internal;
+
+import static org.junit.Assert.*;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.easymock.EasyMock;
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph.FilteredRegion;
+import org.eclipse.virgo.util.math.OrderedPair;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+
+public class BundleIdBasedRegionTests {
+
+    private static final String OTHER_REGION_NAME = "other";
+
+    private static final String BUNDLE_SYMBOLIC_NAME = "b";
+
+    private static final String BUNDLE_SYMBOLIC_NAME_2 = "c";
+
+    private static final Version BUNDLE_VERSION = new Version("1");
+
+    private static final long BUNDLE_ID = 1L;
+
+    private static final long BUNDLE_ID_2 = 2L;
+
+    private static final String REGION_NAME = "reg";
+
+    private static final long TEST_BUNDLE_ID = 99L;
+
+    private Bundle mockBundle;
+
+    private RegionDigraph mockGraph;
+
+    private Iterator<Region> regionIterator;
+
+    private BundleContext mockBundleContext;
+
+    private Region mockRegion;
+
+    private Region mockRegion2;
+
+    private RegionFilter mockRegionFilter;
+
+    private ThreadLocal<Region> threadLocal;
+
+    @Before
+    public void setUp() throws Exception {
+        this.threadLocal = new ThreadLocal<Region>();
+        this.mockBundle = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(this.mockBundle.getSymbolicName()).andReturn(BUNDLE_SYMBOLIC_NAME).anyTimes();
+        EasyMock.expect(this.mockBundle.getVersion()).andReturn(BUNDLE_VERSION).anyTimes();
+        EasyMock.expect(this.mockBundle.getBundleId()).andReturn(BUNDLE_ID).anyTimes();
+
+        this.mockBundleContext = EasyMock.createMock(BundleContext.class);
+        EasyMock.expect(this.mockBundleContext.getBundle(BUNDLE_ID)).andReturn(this.mockBundle).anyTimes();
+
+        this.mockRegion = EasyMock.createMock(Region.class);
+        this.mockRegion2 = EasyMock.createMock(Region.class);
+
+        this.mockRegionFilter = EasyMock.createMock(RegionFilter.class);
+
+        this.regionIterator = new Iterator<Region>() {
+
+            @Override
+            public boolean hasNext() {
+                return false;
+            }
+
+            @Override
+            public Region next() {
+                return null;
+            }
+
+            @Override
+            public void remove() {
+            }
+        };
+        this.mockGraph = EasyMock.createMock(RegionDigraph.class);
+        this.mockGraph.connect(EasyMock.isA(Region.class), EasyMock.eq(this.mockRegionFilter), EasyMock.eq(this.mockRegion));
+        EasyMock.expectLastCall().anyTimes();
+    }
+
+    private void replayMocks() {
+        EasyMock.replay(this.mockBundleContext, this.mockBundle, this.mockRegion, this.mockRegion2, this.mockRegionFilter, this.mockGraph);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        EasyMock.verify(this.mockBundleContext, this.mockBundle, this.mockRegion, this.mockRegion2, this.mockRegionFilter, this.mockGraph);
+    }
+
+    @Test
+    public void testGetName() {
+        defaultSetUp();
+
+        Region r = new BundleIdBasedRegion(REGION_NAME, this.mockGraph, this.mockBundleContext, this.threadLocal);
+        assertEquals(REGION_NAME, r.getName());
+    }
+
+    private void defaultSetUp() {
+        EasyMock.expect(this.mockGraph.iterator()).andReturn(this.regionIterator).anyTimes();
+        EasyMock.expect(this.mockGraph.getEdges(EasyMock.isA(Region.class))).andReturn(new HashSet<FilteredRegion>()).anyTimes();
+        replayMocks();
+    }
+
+    @Test
+    public void testAddBundle() throws BundleException {
+        EasyMock.expect(this.mockGraph.iterator()).andReturn(this.regionIterator).anyTimes();
+
+        HashSet<FilteredRegion> edges = new HashSet<FilteredRegion>();
+        edges.add(new FilteredRegion() {
+
+            @Override
+            public Region getRegion() {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            @Override
+            public RegionFilter getFilter() {
+                return mockRegionFilter;
+            }
+        });
+        EasyMock.expect(this.mockGraph.getEdges(EasyMock.isA(Region.class))).andReturn(edges).anyTimes();
+        Set<OrderedPair<String, Version>> allowedBundles = new HashSet<OrderedPair<String, Version>>();
+        allowedBundles.add(new OrderedPair<String, Version>(BUNDLE_SYMBOLIC_NAME_2, BUNDLE_VERSION));
+        replayMocks();
+
+        Region r = new BundleIdBasedRegion(REGION_NAME, this.mockGraph, this.mockBundleContext, this.threadLocal);
+        r.addBundle(this.mockBundle);
+    }
+
+    @Test
+    public void testAddExistingBundle() throws BundleException {
+        defaultSetUp();
+
+        Region r = new BundleIdBasedRegion(REGION_NAME, this.mockGraph, this.mockBundleContext, this.threadLocal);
+        r.addBundle(this.mockBundle);
+        r.addBundle(this.mockBundle);
+    }
+
+    // This restriction was removed, so no exception should be thrown.
+    public void testAddConflictingBundle() throws BundleException {
+        defaultSetUp();
+
+        Bundle mockBundle2 = EasyMock.createMock(Bundle.class);
+        EasyMock.expect(mockBundle2.getSymbolicName()).andReturn(BUNDLE_SYMBOLIC_NAME).anyTimes();
+        EasyMock.expect(mockBundle2.getVersion()).andReturn(BUNDLE_VERSION).anyTimes();
+        EasyMock.expect(mockBundle2.getBundleId()).andReturn(BUNDLE_ID_2).anyTimes();
+        EasyMock.replay(mockBundle2);
+
+        Region r = new BundleIdBasedRegion(REGION_NAME, this.mockGraph, this.mockBundleContext, this.threadLocal);
+        r.addBundle(this.mockBundle);
+        r.addBundle(mockBundle2);
+    }
+
+    @Test(expected = BundleException.class)
+    public void testAddBundlePresentInAnotherRegion() throws BundleException {
+        this.regionIterator = new Iterator<Region>() {
+
+            private int next = 2;
+
+            @Override
+            public boolean hasNext() {
+                return this.next > 0;
+            }
+
+            @Override
+            public Region next() {
+                switch (next--) {
+                    case 2:
+                        return mockRegion;
+                    default:
+                        return mockRegion2;
+                }
+            }
+
+            @Override
+            public void remove() {
+            }
+        };
+        EasyMock.expect(this.mockGraph.iterator()).andReturn(this.regionIterator).anyTimes();
+        EasyMock.expect(this.mockGraph.getEdges(EasyMock.isA(Region.class))).andReturn(new HashSet<FilteredRegion>()).anyTimes();
+        EasyMock.expect(this.mockRegion.contains(EasyMock.eq(this.mockBundle))).andReturn(true).anyTimes();
+        EasyMock.expect(this.mockRegion2.contains(EasyMock.eq(this.mockBundle))).andReturn(false).anyTimes();
+
+        replayMocks();
+
+        Region r = new BundleIdBasedRegion(REGION_NAME, this.mockGraph, this.mockBundleContext, this.threadLocal);
+        r.addBundle(this.mockBundle);
+    }
+
+    @Test
+    public void testInstallBundleStringInputStream() {
+        defaultSetUp();
+
+        // TODO
+    }
+
+    @Test
+    public void testInstallBundleString() {
+        defaultSetUp();
+
+        // TODO
+    }
+
+    @Test
+    public void testContains() throws BundleException {
+        defaultSetUp();
+
+        Region r = new BundleIdBasedRegion(REGION_NAME, this.mockGraph, this.mockBundleContext, this.threadLocal);
+        r.addBundle(this.mockBundle);
+        assertTrue(r.contains(this.mockBundle));
+    }
+
+    @Test
+    public void testDoesNotContain() throws BundleException {
+        defaultSetUp();
+
+        Region r = new BundleIdBasedRegion(REGION_NAME, this.mockGraph, this.mockBundleContext, this.threadLocal);
+        assertFalse(r.contains(this.mockBundle));
+    }
+
+    @Test
+    public void testGetBundle() throws BundleException {
+        defaultSetUp();
+
+        Region r = new BundleIdBasedRegion(REGION_NAME, this.mockGraph, this.mockBundleContext, this.threadLocal);
+        r.addBundle(this.mockBundle);
+        assertEquals(this.mockBundle, r.getBundle(BUNDLE_SYMBOLIC_NAME, BUNDLE_VERSION));
+    }
+
+    @Test
+    public void testGetBundleNotFound() throws BundleException {
+        defaultSetUp();
+
+        Region r = new BundleIdBasedRegion(REGION_NAME, this.mockGraph, this.mockBundleContext, this.threadLocal);
+        r.addBundle(this.mockBundle);
+        assertNull(r.getBundle(BUNDLE_SYMBOLIC_NAME_2, BUNDLE_VERSION));
+    }
+
+    @Test
+    public void testConnectRegion() throws BundleException {
+        defaultSetUp();
+
+        Region r = new BundleIdBasedRegion(REGION_NAME, this.mockGraph, this.mockBundleContext, this.threadLocal);
+        r.connectRegion(this.mockRegion, this.mockRegionFilter);
+    }
+
+    @Test
+    public void testEquals() {
+        defaultSetUp();
+
+        Region r = new BundleIdBasedRegion(REGION_NAME, this.mockGraph, this.mockBundleContext, this.threadLocal);
+        Region s = new BundleIdBasedRegion(REGION_NAME, this.mockGraph, this.mockBundleContext, this.threadLocal);
+        assertEquals(r, r);
+        assertEquals(r, s);
+        assertEquals(r.hashCode(), s.hashCode());
+    }
+
+    @Test
+    public void testNotEqual() {
+        defaultSetUp();
+
+        Region r = new BundleIdBasedRegion(REGION_NAME, this.mockGraph, this.mockBundleContext, this.threadLocal);
+        Region s = new BundleIdBasedRegion(OTHER_REGION_NAME, this.mockGraph, this.mockBundleContext, this.threadLocal);
+        assertFalse(r.equals(s));
+        assertFalse(r.equals(null));
+    }
+
+    @Test
+    public void testAddRemoveBundleId() {
+        defaultSetUp();
+        Region r = new BundleIdBasedRegion(REGION_NAME, this.mockGraph, this.mockBundleContext, this.threadLocal);
+        r.addBundle(TEST_BUNDLE_ID);
+        assertTrue(r.contains(TEST_BUNDLE_ID));
+        r.removeBundle(TEST_BUNDLE_ID);
+        assertFalse(r.contains(TEST_BUNDLE_ID));
+
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/internal/StandardRegionDigraphTests.java b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/internal/StandardRegionDigraphTests.java
new file mode 100644
index 0000000..83d9e26
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/internal/StandardRegionDigraphTests.java
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * This file is part of the Virgo Web Server.
+ *
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    SpringSource, a division of VMware - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.osgi.region.internal;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.Set;
+
+import org.easymock.EasyMock;
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph.FilteredRegion;
+import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
+import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
+import org.eclipse.virgo.util.math.OrderedPair;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+
+public class StandardRegionDigraphTests {
+
+    private RegionDigraph digraph;
+
+    private Region mockRegion1;
+
+    private Region mockRegion2;
+
+    private Region mockRegion3;
+
+    private RegionFilter regionFilter1;
+
+    private RegionFilter regionFilter2;
+
+    private Bundle mockBundle;
+
+    @Before
+    public void setUp() throws Exception {
+        StubBundle stubSystemBundle = new StubBundle(0L, "osgi.framework", new Version("0"), "loc");
+        StubBundleContext stubBundleContext = new StubBundleContext();
+        stubBundleContext.addInstalledBundle(stubSystemBundle);
+        this.digraph = new StandardRegionDigraph(stubBundleContext, new ThreadLocal<Region>());
+       
+        this.mockRegion1 = EasyMock.createMock(Region.class);
+        EasyMock.expect(this.mockRegion1.getName()).andReturn("mockRegion1").anyTimes();
+      
+        this.mockRegion2 = EasyMock.createMock(Region.class);
+        EasyMock.expect(this.mockRegion2.getName()).andReturn("mockRegion2").anyTimes();
+
+        this.mockRegion3 = EasyMock.createMock(Region.class);
+        EasyMock.expect(this.mockRegion3.getName()).andReturn("mockRegion3").anyTimes();
+
+        this.regionFilter1 = EasyMock.createMock(RegionFilter.class);
+        this.regionFilter2 = EasyMock.createMock(RegionFilter.class);
+        this.mockBundle = EasyMock.createMock(Bundle.class);
+    }
+
+    private void setDefaultMockFilters() {
+        setMockFilterAllowedBundles(this.regionFilter1);
+        setMockFilterAllowedBundles(this.regionFilter2);
+    }
+
+    private void setMockFilterAllowedBundles(RegionFilter regionFilter) {
+        EasyMock.expect(regionFilter.isBundleAllowed(EasyMock.isA(String.class), EasyMock.isA(Version.class))).andReturn(false).anyTimes();
+    }
+
+    private void setMockFilterAllowedBundle(RegionFilter regionFilter, OrderedPair<String, Version> bundle) {
+        EasyMock.expect(regionFilter.isBundleAllowed(EasyMock.eq(bundle.getFirst()), EasyMock.eq(bundle.getSecond()))).andReturn(true).anyTimes();
+        EasyMock.expect(regionFilter.isBundleAllowed(EasyMock.not(EasyMock.eq(bundle.getFirst())), EasyMock.eq(bundle.getSecond()))).andReturn(false).anyTimes();
+        EasyMock.expect(regionFilter.isBundleAllowed(EasyMock.eq(bundle.getFirst()), EasyMock.not(EasyMock.eq(bundle.getSecond())))).andReturn(false).anyTimes();
+        EasyMock.expect(regionFilter.isBundleAllowed(EasyMock.not(EasyMock.eq(bundle.getFirst())), EasyMock.not(EasyMock.eq(bundle.getSecond())))).andReturn(false).anyTimes();
+    }
+
+    private void replayMocks() {
+        EasyMock.replay(this.mockRegion1, this.mockRegion2, this.mockRegion3, this.regionFilter1, this.regionFilter2, this.mockBundle);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        EasyMock.verify(this.mockRegion1, this.mockRegion2, this.mockRegion3, this.regionFilter1, this.regionFilter2, this.mockBundle);
+    }
+
+    @Test
+    public void testConnect() throws BundleException {
+        setDefaultMockFilters();
+        replayMocks();
+
+        this.digraph.connect(this.mockRegion1, this.regionFilter1, this.mockRegion2);
+    }
+
+    @Test
+    public void testConnectWithFilterContents() throws BundleException {
+        OrderedPair<String, Version> b1 = new OrderedPair<String, Version>("b1", new Version("0"));
+        setMockFilterAllowedBundle(this.regionFilter1, b1);
+        EasyMock.expect(this.mockRegion1.getBundle(b1.getFirst(), b1.getSecond())).andReturn(null).anyTimes();
+
+        OrderedPair<String, Version> b2 = new OrderedPair<String, Version>("b2", new Version("0"));
+        setMockFilterAllowedBundle(this.regionFilter2, b2);
+        EasyMock.expect(this.mockRegion1.getBundle(b2.getFirst(), b2.getSecond())).andReturn(null).anyTimes();
+
+        replayMocks();
+
+        this.digraph.connect(this.mockRegion1, this.regionFilter1, this.mockRegion2);
+        this.digraph.connect(this.mockRegion1, this.regionFilter2, this.mockRegion3);
+    }
+
+    @Test(expected = BundleException.class)
+    public void testConnectLoop() throws BundleException {
+        setDefaultMockFilters();
+        replayMocks();
+
+        this.digraph.connect(this.mockRegion1, this.regionFilter1, this.mockRegion1);
+    }
+
+    @Test(expected = BundleException.class)
+    public void testDuplicateConnection() throws BundleException {
+        setDefaultMockFilters();
+        replayMocks();
+
+        this.digraph.connect(this.mockRegion1, this.regionFilter1, this.mockRegion2);
+        this.digraph.connect(this.mockRegion1, this.regionFilter2, this.mockRegion2);
+    }
+
+    @Test
+    public void testGetEdges() throws BundleException {
+        setDefaultMockFilters();
+        replayMocks();
+
+        this.digraph.connect(this.mockRegion1, this.regionFilter1, this.mockRegion2);
+        this.digraph.connect(this.mockRegion1, this.regionFilter2, this.mockRegion3);
+        this.digraph.connect(this.mockRegion2, this.regionFilter2, this.mockRegion1);
+
+        Set<FilteredRegion> edges = this.digraph.getEdges(this.mockRegion1);
+
+        assertEquals(2, edges.size());
+
+        for (FilteredRegion edge : edges) {
+            if (edge.getRegion().equals(this.mockRegion2)) {
+                assertEquals(this.regionFilter1, edge.getFilter());
+            } else if (edge.getRegion().equals(this.mockRegion3)) {
+                assertEquals(this.regionFilter2, edge.getFilter());
+            } else {
+                fail("unexpected edge");
+            }
+        }
+    }
+
+    @Test
+    public void testRemoveRegion() throws BundleException {
+        setDefaultMockFilters();
+        replayMocks();
+
+        this.digraph.connect(this.mockRegion1, this.regionFilter1, this.mockRegion2);
+        this.digraph.connect(this.mockRegion2, this.regionFilter2, this.mockRegion1);
+        assertNotNull(this.digraph.getRegion("mockRegion1"));
+        assertNotNull(this.digraph.getRegion("mockRegion2"));
+        this.digraph.removeRegion(this.mockRegion1);
+        assertNull(this.digraph.getRegion("mockRegion1"));
+        assertNotNull(this.digraph.getRegion("mockRegion2"));
+    }
+    
+    @Test
+    public void testGetRegions() throws BundleException {
+        setDefaultMockFilters();
+        replayMocks();
+        
+        this.digraph.connect(this.mockRegion1, this.regionFilter1, this.mockRegion2);
+        Set<Region> regions = this.digraph.getRegions();
+        assertEquals(2, regions.size());
+        assertTrue(regions.contains(this.mockRegion1));
+        assertTrue(regions.contains(this.mockRegion2));
+    }
+    
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/internal/StandardRegionFilterTests.java b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/internal/StandardRegionFilterTests.java
new file mode 100644
index 0000000..47768ab
--- /dev/null
+++ b/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/internal/StandardRegionFilterTests.java
@@ -0,0 +1,84 @@
+/*
+ * This file is part of the Eclipse Virgo project.
+ *
+ * Copyright (c) 2011 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    VMware Inc. - initial contribution
+ */
+
+package org.eclipse.virgo.kernel.osgi.region.internal;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.easymock.EasyMock;
+import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
+import org.eclipse.virgo.kernel.osgi.region.RegionPackageImportPolicy;
+import org.eclipse.virgo.kernel.osgi.region.StandardRegionFilter;
+import org.eclipse.virgo.util.osgi.VersionRange;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Filter;
+import org.osgi.framework.Version;
+
+public class StandardRegionFilterTests {
+
+    private static final String BUNDLE_SYMBOLIC_NAME = "A";
+
+    private static final Version BUNDLE_VERSION = new Version("0");
+
+    private RegionFilter regionFilter;
+
+    private Filter mockFilter;
+
+    private RegionPackageImportPolicy packageImportPolicy;
+
+    @Before
+    public void setUp() throws Exception {
+        this.regionFilter = new StandardRegionFilter();
+        this.mockFilter = EasyMock.createMock(Filter.class);
+        this.packageImportPolicy = EasyMock.createMock(RegionPackageImportPolicy.class);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+    }
+
+    @Test
+    public void testAllowBundle() {
+        this.regionFilter.allowBundle(BUNDLE_SYMBOLIC_NAME, VersionRange.NATURAL_NUMBER_RANGE);
+        assertTrue(this.regionFilter.isBundleAllowed(BUNDLE_SYMBOLIC_NAME, BUNDLE_VERSION));
+    }
+    
+    @Test
+    public void testBundleNotAllowed() {
+        assertFalse(this.regionFilter.isBundleAllowed(BUNDLE_SYMBOLIC_NAME, BUNDLE_VERSION));
+    }
+
+    @Test
+    public void testBundleNotAllowedInRange() {
+        this.regionFilter.allowBundle(BUNDLE_SYMBOLIC_NAME, new VersionRange("1"));
+
+        assertFalse(this.regionFilter.isBundleAllowed(BUNDLE_SYMBOLIC_NAME, BUNDLE_VERSION));
+    }
+
+    @Test
+    public void testSetPackageImportPolicy() {
+        this.regionFilter.setPackageImportPolicy(this.packageImportPolicy);
+        assertEquals(this.packageImportPolicy, this.regionFilter.getPackageImportPolicy());
+    }
+
+    @Test
+    public void testSetServiceFilter() {
+        this.regionFilter.setServiceFilter(this.mockFilter);
+        assertEquals(this.mockFilter, this.regionFilter.getServiceFilter());
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/template.mf b/org.eclipse.virgo.kernel.osgi/template.mf
index bac37a0..0fcc54a 100644
--- a/org.eclipse.virgo.kernel.osgi/template.mf
+++ b/org.eclipse.virgo.kernel.osgi/template.mf
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Virgo Kernel OSGi integration
 Bundle-SymbolicName: org.eclipse.virgo.kernel.osgi
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
 Excluded-Exports: 
  *.internal.*
 Excluded-Imports: 
@@ -19,5 +19,7 @@
  org.eclipse.osgi.*;version="0",
  org.osgi.framework.*;version="0",
  org.osgi.service.*;version="0",
+ org.osgi.util.*;version="0",
  org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",
- org.springframework.*;version="${org.springframework:[2.5.6, =.+1)}"
+ org.springframework.*;version="${org.springframework:[2.5.6, =.+1)}",
+ javax.management;version="0"
diff --git a/org.eclipse.virgo.kernel.osgicommand/.classpath b/org.eclipse.virgo.kernel.osgicommand/.classpath
index 1266f14..0b700a8 100644
--- a/org.eclipse.virgo.kernel.osgicommand/.classpath
+++ b/org.eclipse.virgo.kernel.osgicommand/.classpath
@@ -9,8 +9,8 @@
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.services"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.shell"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/org.eclipse.virgo.kernel.osgicommand/src/main/java/org/eclipse/virgo/kernel/osgicommand/Activator.java b/org.eclipse.virgo.kernel.osgicommand/src/main/java/org/eclipse/virgo/kernel/osgicommand/Activator.java
index ebd6d8a..c041d3a 100644
--- a/org.eclipse.virgo.kernel.osgicommand/src/main/java/org/eclipse/virgo/kernel/osgicommand/Activator.java
+++ b/org.eclipse.virgo.kernel.osgicommand/src/main/java/org/eclipse/virgo/kernel/osgicommand/Activator.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * This file is part of the Virgo Web Server.
  *
- * Copyright (c) 2010 Eclipse Foundation.
+ * Copyright (c) 2010 VMware Inc.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
diff --git a/org.eclipse.virgo.kernel.osgicommand/src/main/java/org/eclipse/virgo/kernel/osgicommand/internal/OsgiKernelShellCommand.java b/org.eclipse.virgo.kernel.osgicommand/src/main/java/org/eclipse/virgo/kernel/osgicommand/internal/OsgiKernelShellCommand.java
index 4386820..6971b33 100644
--- a/org.eclipse.virgo.kernel.osgicommand/src/main/java/org/eclipse/virgo/kernel/osgicommand/internal/OsgiKernelShellCommand.java
+++ b/org.eclipse.virgo.kernel.osgicommand/src/main/java/org/eclipse/virgo/kernel/osgicommand/internal/OsgiKernelShellCommand.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * This file is part of the Virgo Web Server.
  *
- * Copyright (c) 2010 Eclipse Foundation.
+ * Copyright (c) 2010 VMware Inc.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
diff --git a/org.eclipse.virgo.kernel.osgicommand/src/test/java/org/eclipse/virgo/kernel/osgicommand/helper/ClassLoadingHelperTests.java b/org.eclipse.virgo.kernel.osgicommand/src/test/java/org/eclipse/virgo/kernel/osgicommand/helper/ClassLoadingHelperTests.java
index bf37e9d..90735de 100644
--- a/org.eclipse.virgo.kernel.osgicommand/src/test/java/org/eclipse/virgo/kernel/osgicommand/helper/ClassLoadingHelperTests.java
+++ b/org.eclipse.virgo.kernel.osgicommand/src/test/java/org/eclipse/virgo/kernel/osgicommand/helper/ClassLoadingHelperTests.java
@@ -108,7 +108,6 @@
         verify(bundle);

     }

 

-    @SuppressWarnings("rawtypes")

     @Test

     public void testTryToLoadMissingBundle() throws Exception {

         assertNull("Class [" + CLASS_NAME + "] found, while no bundle is specified",

@@ -129,7 +128,8 @@
         verify(bundle);

     }

 

-    @Test

+    @SuppressWarnings("rawtypes")

+	@Test

     public void testTryToLoadExistingClass() throws Exception {

         Bundle bundle = createMock(Bundle.class);

 

diff --git a/org.eclipse.virgo.kernel.osgicommand/src/test/java/org/eclipse/virgo/kernel/osgicommand/internal/commands/classloading/ClassLoadingCommandProviderTests.java b/org.eclipse.virgo.kernel.osgicommand/src/test/java/org/eclipse/virgo/kernel/osgicommand/internal/commands/classloading/ClassLoadingCommandProviderTests.java
index 47bfdf1..5384648 100644
--- a/org.eclipse.virgo.kernel.osgicommand/src/test/java/org/eclipse/virgo/kernel/osgicommand/internal/commands/classloading/ClassLoadingCommandProviderTests.java
+++ b/org.eclipse.virgo.kernel.osgicommand/src/test/java/org/eclipse/virgo/kernel/osgicommand/internal/commands/classloading/ClassLoadingCommandProviderTests.java
@@ -221,7 +221,7 @@
         verify(bundle, bundleContext, packageAdmin, packageAdminServiceReference);

     }

 

-    @SuppressWarnings({ "rawtypes", "unchecked" })

+    @SuppressWarnings("rawtypes")

     @Test

     public void testClLoadWithBundleIdAndExistingClass() throws Exception {

         Bundle bundle = createMock(Bundle.class);

diff --git a/org.eclipse.virgo.kernel.osgicommand/template.mf b/org.eclipse.virgo.kernel.osgicommand/template.mf
index 50d39d3..d35ac8f 100644
--- a/org.eclipse.virgo.kernel.osgicommand/template.mf
+++ b/org.eclipse.virgo.kernel.osgicommand/template.mf
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Virgo Kernel osgi console command extension
 Bundle-SymbolicName: org.eclipse.virgo.kernel.osgicommand
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
 Import-Template: 
  org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",
  org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
diff --git a/org.eclipse.virgo.kernel.services/.classpath b/org.eclipse.virgo.kernel.services/.classpath
index 98790dc..fefe6aa 100644
--- a/org.eclipse.virgo.kernel.services/.classpath
+++ b/org.eclipse.virgo.kernel.services/.classpath
@@ -24,29 +24,29 @@
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-2.2.0.D-20101207151510.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-sources-2.2.0.D-20101207151510.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
 	<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar">
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar">
 		<attributes>
 			<attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/2.2.0.D-20101207150849/org.eclipse.virgo.medic.core-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/1.0.0.CI-B20/org.eclipse.virgo.medic.core-sources-1.0.0.CI-B20.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/1.0.0.CI-B20/org.eclipse.virgo.medic.core-sources-1.0.0.CI-B20.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-sources-1.6.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-sources-1.6.1.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-2.2.0.D-20101207145338.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-sources-2.2.0.D-20101207145338.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-sources-3.0.0.M02.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/2.2.0.D-20101207150035/org.eclipse.virgo.util.math-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/2.2.0.D-20101207150035/org.eclipse.virgo.util.math-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-sources-2.2.0.D-20101207150035.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-sources-1.2.1.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-sources-2.2.0.D-20101207150849.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-sources-3.0.0.M02.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.artifact"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/org.eclipse.virgo.kernel.services/src/main/java/org/eclipse/virgo/kernel/services/repository/internal/EmptyRepository.java b/org.eclipse.virgo.kernel.services/src/main/java/org/eclipse/virgo/kernel/services/repository/internal/EmptyRepository.java
index c0c966c..ad90213 100644
--- a/org.eclipse.virgo.kernel.services/src/main/java/org/eclipse/virgo/kernel/services/repository/internal/EmptyRepository.java
+++ b/org.eclipse.virgo.kernel.services/src/main/java/org/eclipse/virgo/kernel/services/repository/internal/EmptyRepository.java
@@ -86,6 +86,20 @@
         /**
          * {@inheritDoc}
          */
+         public Query setVersionRangeFilter(VersionRange versionRange) {
+             return this;
+         }
+
+         /**
+          * {@inheritDoc}
+          */
+         public Query setVersionRangeFilter(VersionRange versionRange, VersionRangeMatchingStrategy strategy) {
+             return this;
+         }
+
+        /**
+         * {@inheritDoc}
+         */
         public Set<RepositoryAwareArtifactDescriptor> run() {
             return Collections.<RepositoryAwareArtifactDescriptor> emptySet();
         }
diff --git a/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/concurrent-context.xml b/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/concurrent-context.xml
index 453fb92..9f262ff 100644
--- a/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/concurrent-context.xml
+++ b/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/concurrent-context.xml
@@ -1,33 +1,35 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
-	xmlns:util="http://www.springframework.org/schema/util"
-	xsi:schemaLocation="http://www.springframework.org/schema/osgi  
-       http://www.springframework.org/schema/osgi/spring-osgi.xsd
-       http://www.springframework.org/schema/util 
-       http://www.springframework.org/schema/util/spring-util-2.5.xsd
-       http://www.springframework.org/schema/beans   
-       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
-
-	<reference id="dumpGenerator" interface="org.eclipse.virgo.medic.dump.DumpGenerator"/>
-
-	<reference id="eventLogger" interface="org.eclipse.virgo.medic.eventlog.EventLogger"/>
-	
-	<reference id="tracingService" interface="org.eclipse.virgo.kernel.shim.serviceability.TracingService" />
-
-	<beans:bean id="exporter" class="org.eclipse.virgo.kernel.services.concurrent.management.JmxExecutorServiceExporter" destroy-method="destroy">
-		<beans:constructor-arg value="${domain}"/>
-	</beans:bean>
-
-	<beans:bean id="deadlockMonitor" class="org.eclipse.virgo.kernel.services.concurrent.monitor.DeadlockMonitor" init-method="start" destroy-method="stop">
-		<beans:constructor-arg>
-			<beans:bean class="org.eclipse.virgo.kernel.services.concurrent.KernelScheduledThreadPoolExecutor">
-				<beans:constructor-arg value="1"/>
-				<beans:constructor-arg value="deadlock-monitor"/>
-				<beans:constructor-arg ref="tracingService"/>
-			</beans:bean>
-		</beans:constructor-arg>
-		<beans:constructor-arg ref="dumpGenerator"/>
-		<beans:constructor-arg ref="eventLogger"/>
-	</beans:bean>
-</beans:beans>
+<?xml version="1.0" encoding="UTF-8"?>

+<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"

+	xmlns:util="http://www.springframework.org/schema/util"

+	xsi:schemaLocation="http://www.springframework.org/schema/osgi  

+       http://www.springframework.org/schema/osgi/spring-osgi.xsd

+       http://www.springframework.org/schema/util 

+       http://www.springframework.org/schema/util/spring-util-2.5.xsd

+       http://www.springframework.org/schema/beans   

+       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

+

+

+	<reference id="dumpGenerator" interface="org.eclipse.virgo.medic.dump.DumpGenerator"/>

+

+	<reference id="eventLogger" interface="org.eclipse.virgo.medic.eventlog.EventLogger"/>

+	

+	<reference id="tracingService" interface="org.eclipse.virgo.kernel.shim.serviceability.TracingService" />

+	

+	<reference id="kernelConfig" interface="org.eclipse.virgo.kernel.core.KernelConfig"/>

+

+	<beans:bean id="exporter" class="org.eclipse.virgo.kernel.services.concurrent.management.JmxExecutorServiceExporter" destroy-method="destroy">

+		<beans:constructor-arg value="#{kernelConfig.getProperty('domain')}"/>

+	</beans:bean>

+

+	<beans:bean id="deadlockMonitor" class="org.eclipse.virgo.kernel.services.concurrent.monitor.DeadlockMonitor" init-method="start" destroy-method="stop">

+		<beans:constructor-arg>

+			<beans:bean class="org.eclipse.virgo.kernel.services.concurrent.KernelScheduledThreadPoolExecutor">

+				<beans:constructor-arg value="1"/>

+				<beans:constructor-arg value="deadlock-monitor"/>

+				<beans:constructor-arg ref="tracingService"/>

+			</beans:bean>

+		</beans:constructor-arg>

+		<beans:constructor-arg ref="dumpGenerator"/>

+		<beans:constructor-arg ref="eventLogger"/>

+	</beans:bean>

+</beans:beans>

diff --git a/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/configuration-context.xml b/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/configuration-context.xml
deleted file mode 100644
index b368be7..0000000
--- a/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/configuration-context.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xmlns:osgi="http://www.springframework.org/schema/osgi"
-	xmlns:context="http://www.springframework.org/schema/context"
-	xmlns:osgi-compendium="http://www.springframework.org/schema/osgi-compendium"
-	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
-		http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd
-		http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.2.xsd">
-
-	<osgi-compendium:cm-properties id="kernelConfig" persistent-id="org.eclipse.virgo.kernel"/>
-	
-	<context:property-placeholder properties-ref="kernelConfig"/>
-	
-</beans>
diff --git a/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/io-context.xml b/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/io-context.xml
index c0b4683..0990c34 100644
--- a/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/io-context.xml
+++ b/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/io-context.xml
@@ -1,20 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xmlns:beans="http://www.springframework.org/schema/beans"
-	xsi:schemaLocation="http://www.springframework.org/schema/osgi  
-       http://www.springframework.org/schema/osgi/spring-osgi.xsd
-       http://www.springframework.org/schema/beans   
-       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
-	<beans:bean id="workAreaFactory" class="org.eclipse.virgo.kernel.services.work.WorkAreaServiceFactory">
-		<beans:constructor-arg value="${work.directory}"/>
-	</beans:bean>
-	
-	<beans:bean id="kernelWorkArea" class="org.eclipse.virgo.kernel.services.work.StandardWorkArea">
-		<beans:constructor-arg value="${work.directory}"/>
-		<beans:constructor-arg value="#{bundleContext.bundle}"/>
-	</beans:bean>
-	
-	<service interface="org.eclipse.virgo.kernel.services.work.WorkArea" ref="workAreaFactory"/>
-</beans:beans>
+<?xml version="1.0" encoding="UTF-8"?>

+<beans:beans xmlns="http://www.springframework.org/schema/osgi"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:beans="http://www.springframework.org/schema/beans"

+	xsi:schemaLocation="http://www.springframework.org/schema/osgi  

+       http://www.springframework.org/schema/osgi/spring-osgi.xsd

+       http://www.springframework.org/schema/beans   

+       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

+

+	<beans:bean id="workAreaFactory" class="org.eclipse.virgo.kernel.services.work.WorkAreaServiceFactory">

+		<beans:constructor-arg value="#{kernelConfig.getProperty('work.directory')}"/>

+	</beans:bean>

+	

+	<beans:bean id="kernelWorkArea" class="org.eclipse.virgo.kernel.services.work.StandardWorkArea">

+		<beans:constructor-arg value="#{kernelConfig.getProperty('work.directory')}"/>

+		<beans:constructor-arg value="#{bundleContext.bundle}"/>

+	</beans:bean>

+	

+	<service interface="org.eclipse.virgo.kernel.services.work.WorkArea" ref="workAreaFactory"/>

+	

+	<reference id="kernelConfig" interface="org.eclipse.virgo.kernel.core.KernelConfig"/>

+	

+</beans:beans>

diff --git a/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/repository-context.xml b/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/repository-context.xml
index f802eda..2335409 100644
--- a/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/repository-context.xml
+++ b/org.eclipse.virgo.kernel.services/src/main/resources/META-INF/spring/repository-context.xml
@@ -1,62 +1,67 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xmlns:osgi="http://www.springframework.org/schema/osgi"
-	xmlns:osgi-compendium="http://www.springframework.org/schema/osgi-compendium"
-	xsi:schemaLocation="http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd
-		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-		http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.2.xsd">
-
-	<bean id="repository" class="org.eclipse.virgo.kernel.services.repository.internal.RepositoryFactoryBean" destroy-method="destroy">
-		<constructor-arg>
-			<osgi-compendium:cm-properties persistent-id="org.eclipse.virgo.repository"/>
-		</constructor-arg>
-		<constructor-arg ref="eventLogger"/>
-		<constructor-arg ref="repositoryFactory"/>
-		<constructor-arg value="${work.directory}"/>
-		<constructor-arg >
-		<set>
-			<ref bean="bundleBridge"/>
-			<ref bean="libraryBridge"/>
-			<ref bean="parBridge"/>
-			<ref bean="planBridge"/>
-			<ref bean="propertiesBridge"/>
-		</set>
-		</constructor-arg>		
-		<constructor-arg value="${domain}"/>
-	</bean>
-	
-	<bean id="bundleBridge" class="org.eclipse.virgo.kernel.artifact.bundle.BundleBridge">
-		<constructor-arg ref="hashGenerator"/>
-	</bean>
-	<osgi:service ref="bundleBridge" interface="org.eclipse.virgo.repository.ArtifactBridge"/>
-	
-	<bean id="libraryBridge" class="org.eclipse.virgo.kernel.artifact.library.LibraryBridge">
-		<constructor-arg ref="hashGenerator"/>
-	</bean>
-	<osgi:service ref="libraryBridge" interface="org.eclipse.virgo.repository.ArtifactBridge"/>
-	
-	<bean id="parBridge" class="org.eclipse.virgo.kernel.artifact.par.ParBridge">
-		<constructor-arg ref="hashGenerator"/>
-	</bean>
-	<osgi:service ref="parBridge" interface="org.eclipse.virgo.repository.ArtifactBridge"/>
-	
-	<bean id="planBridge" class="org.eclipse.virgo.kernel.artifact.plan.PlanBridge">
-		<constructor-arg ref="hashGenerator"/>
-	</bean>
-	<osgi:service ref="planBridge" interface="org.eclipse.virgo.repository.ArtifactBridge"/>
-	
-	<bean id="propertiesBridge" class="org.eclipse.virgo.kernel.artifact.properties.PropertiesBridge">
-		<constructor-arg ref="hashGenerator"/>
-	</bean>
-	<osgi:service ref="propertiesBridge" interface="org.eclipse.virgo.repository.ArtifactBridge"/>
-	
-	<osgi:reference id="repositoryFactory" interface="org.eclipse.virgo.repository.RepositoryFactory" />
-	
-	<osgi:reference id="eventLogger" interface="org.eclipse.virgo.medic.eventlog.EventLogger" />
-	
-	<osgi:service ref="repository" interface="org.eclipse.virgo.repository.Repository"/>
-
-	<osgi:reference id="hashGenerator" interface="org.eclipse.virgo.repository.HashGenerator"/>
-
-</beans>
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:osgi="http://www.springframework.org/schema/osgi"

+	xmlns:osgi-compendium="http://www.springframework.org/schema/osgi-compendium"

+	xsi:schemaLocation="http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd

+		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

+		http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium-1.2.xsd">

+

+	<bean id="repository" class="org.eclipse.virgo.kernel.services.repository.internal.RepositoryFactoryBean" destroy-method="destroy">

+		<constructor-arg>

+			<osgi-compendium:cm-properties persistent-id="org.eclipse.virgo.repository"/>

+		</constructor-arg>

+		<constructor-arg ref="eventLogger"/>

+		<constructor-arg ref="repositoryFactory"/>

+		<constructor-arg value="#{kernelConfig.getProperty('work.directory')}"/>

+		<constructor-arg >

+		<set>

+			<ref bean="bundleBridge"/>

+			<ref bean="libraryBridge"/>

+			<ref bean="parBridge"/>

+			<ref bean="planBridge"/>

+			<ref bean="propertiesBridge"/>

+		</set>

+		</constructor-arg>		

+		<constructor-arg value="#{kernelConfig.getProperty('domain')}"/>

+	</bean>

+	

+	<bean id="bundleBridge" class="org.eclipse.virgo.kernel.artifact.bundle.BundleBridge">

+		<constructor-arg ref="hashGenerator"/>

+	</bean>

+	<osgi:service ref="bundleBridge" interface="org.eclipse.virgo.repository.ArtifactBridge"/>

+	

+	<bean id="libraryBridge" class="org.eclipse.virgo.kernel.artifact.library.LibraryBridge">

+		<constructor-arg ref="hashGenerator"/>

+	</bean>

+	<osgi:service ref="libraryBridge" interface="org.eclipse.virgo.repository.ArtifactBridge"/>

+	

+	<bean id="parBridge" class="org.eclipse.virgo.kernel.artifact.par.ParBridge">

+		<constructor-arg ref="hashGenerator"/>

+	</bean>

+	<osgi:service ref="parBridge" interface="org.eclipse.virgo.repository.ArtifactBridge"/>

+	

+	<bean id="planBridge" class="org.eclipse.virgo.kernel.artifact.plan.PlanBridge">

+		<constructor-arg ref="hashGenerator"/>

+	</bean>

+	<osgi:service ref="planBridge" interface="org.eclipse.virgo.repository.ArtifactBridge"/>

+	

+	<bean id="propertiesBridge" class="org.eclipse.virgo.kernel.artifact.properties.PropertiesBridge">

+		<constructor-arg ref="hashGenerator"/>

+		<constructor-arg>

+		  <osgi:reference interface="org.osgi.service.cm.ConfigurationAdmin"/>

+		</constructor-arg>

+	</bean>

+	<osgi:service ref="propertiesBridge" interface="org.eclipse.virgo.repository.ArtifactBridge"/>

+	

+	<osgi:reference id="repositoryFactory" interface="org.eclipse.virgo.repository.RepositoryFactory" />

+	

+	<osgi:reference id="eventLogger" interface="org.eclipse.virgo.medic.eventlog.EventLogger" />

+	

+	<osgi:service ref="repository" interface="org.eclipse.virgo.repository.Repository"/>

+

+	<osgi:reference id="hashGenerator" interface="org.eclipse.virgo.repository.HashGenerator"/>

+	

+	<osgi:reference id="kernelConfig" interface="org.eclipse.virgo.kernel.core.KernelConfig"/>

+

+</beans>

diff --git a/org.eclipse.virgo.kernel.services/template.mf b/org.eclipse.virgo.kernel.services/template.mf
index d7ebed9..6e06cb1 100644
--- a/org.eclipse.virgo.kernel.services/template.mf
+++ b/org.eclipse.virgo.kernel.services/template.mf
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Virgo Kernel Services
 Bundle-SymbolicName: org.eclipse.virgo.kernel.services
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
 Excluded-Exports: 
  *.internal.*
 Import-Template: 
@@ -13,6 +13,7 @@
  org.aspectj.*;version="${org.aspectj:[=.=.=.=, +1)}",
  org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",
  org.osgi.framework.*;version="0",
+ org.osgi.service.cm.*;version="0",
  org.springframework.*;version="${org.springframework:[2.5.6, =.+1)}",
  javax.management.*;version="0",
  javax.xml.*;version="0",
diff --git a/org.eclipse.virgo.kernel.shell/.classpath b/org.eclipse.virgo.kernel.shell/.classpath
index 6961c4d..d67fb59 100644
--- a/org.eclipse.virgo.kernel.shell/.classpath
+++ b/org.eclipse.virgo.kernel.shell/.classpath
@@ -21,30 +21,31 @@
 		</attributes>
 	</classpathentry>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-3.3.0.v20110110.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.4.0/com.springsource.org.junit-sources-4.4.0.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar">
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar">
 		<attributes>
 			<attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/2.2.0.D-20101207150849/org.eclipse.virgo.medic.core-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/1.0.0.CI-B20/org.eclipse.virgo.medic.core-sources-1.0.0.CI-B20.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.0.0.M02/org.eclipse.virgo.medic.core-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/1.0.0.CI-B20/org.eclipse.virgo.medic.core-sources-1.0.0.CI-B20.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-sources-1.6.1.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-2.2.0.D-20101207145338.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-sources-2.2.0.D-20101207145338.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.osgi/org.osgi.compendium/4.1.0/org.osgi.compendium-4.1.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-sources-2.2.0.D-20101207150849.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-sources-3.0.0.M02.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.deployer"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-2.2.0.D-20101207151510.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-sources-2.2.0.D-20101207151510.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.model"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.equinox.event/1.2.100.v20110110/org.eclipse.equinox.event-1.2.100.v20110110.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/org.eclipse.virgo.kernel.shell/ivy.xml b/org.eclipse.virgo.kernel.shell/ivy.xml
index c010b46..0aac208 100644
--- a/org.eclipse.virgo.kernel.shell/ivy.xml
+++ b/org.eclipse.virgo.kernel.shell/ivy.xml
@@ -19,6 +19,7 @@
 	<dependencies>
 <!-- RUNTIME -->
 		<dependency org="org.eclipse.osgi" name="org.eclipse.osgi" rev="${org.eclipse.osgi}" conf="compile->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="compile->runtime"/>
 		<dependency org="org.eclipse.virgo.repository" name="org.eclipse.virgo.repository" rev="${org.eclipse.virgo.repository}" conf="compile->compile"/>
 		<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.osgi" rev="latest.integration" conf="compile->compile"/>
 		<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.model" rev="latest.integration" conf="compile->compile"/>
@@ -31,7 +32,7 @@
 		<dependency org="org.springframework" name="org.springframework.core" rev="${org.springframework}" conf="compile->runtime"/>
 		<dependency org="org.springframework" name="org.springframework.beans" rev="${org.springframework}" conf="compile->runtime"/>
 		<dependency org="org.springframework" name="org.springframework.context" rev="${org.springframework}" conf="compile->runtime"/>
-		<dependency org='org.apache.felix' name='org.apache.felix.eventadmin' rev='${org.apache.felix.eventadmin}' conf='compile->compile'/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.event" rev="${org.eclipse.equinox.event}" conf="compile->runtime"/>
 <!-- COMPILE -->
 		<dependency org="org.eclipse.virgo.medic" name="org.eclipse.virgo.medic.core" rev="${org.eclipse.virgo.medic}" conf="runtime->runtime"/>
 <!-- TEST -->
diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/CommandExecutor.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/CommandExecutor.java
index f0aa3c6..8fc7bb5 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/CommandExecutor.java
+++ b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/CommandExecutor.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * This file is part of the Virgo Web Server.
  *
- * Copyright (c) 2010 Eclipse Foundation.
+ * Copyright (c) 2010 VMware Inc.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/LinePrinter.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/LinePrinter.java
index 33f41a8..ffc97cc 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/LinePrinter.java
+++ b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/LinePrinter.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * This file is part of the Virgo Web Server.
  *
- * Copyright (c) 2010 Eclipse Foundation.
+ * Copyright (c) 2010 VMware Inc.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/SessionCommandExecutor.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/SessionCommandExecutor.java
index 26eba1a..aa0aab3 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/SessionCommandExecutor.java
+++ b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/SessionCommandExecutor.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * This file is part of the Virgo Web Server.
  *
- * Copyright (c) 2010 Eclipse Foundation.
+ * Copyright (c) 2010 VMware Inc.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/SingleSessionCommandExecutor.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/SingleSessionCommandExecutor.java
index d41129f..21258b8 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/SingleSessionCommandExecutor.java
+++ b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/internal/SingleSessionCommandExecutor.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * This file is part of the Virgo Web Server.
  *
- * Copyright (c) 2010 Eclipse Foundation.
+ * Copyright (c) 2010 VMware Inc.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelper.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelper.java
index 8a40f78..b85a819 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelper.java
+++ b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelper.java
@@ -13,6 +13,7 @@
 
 import java.lang.management.ManagementFactory;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -174,11 +175,24 @@
      * {@inheritDoc}
      */
     public ArtifactAccessor getArtifact(String type, String name, String version) {
+        
         MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
         try {
             ObjectName objectName = new ObjectName(String.format(ARTIFACT_MBEAN_QUERY, type, name, version));
             ArtifactAccessorPointer pointer = buildArtifactAccessorPointer(objectName);
             
+            //TODO work around until 337211 is done
+            if ("-".equals(pointer.getState())) {
+                Map<String, Object> attributes = new TreeMap<String, Object>();
+                attributes.put(TYPE_ATTRIBUTE, "Region");
+                attributes.put(NAME_ATTRIBUTE, name);
+                attributes.put(VERSION_ATTRIBUTE, version);
+                attributes.put(STATE_ATTRIBUTE, "-");    
+                attributes.put("atomic", false);       
+                attributes.put("scoped", false); 
+                return new StandardArtifactAccessor(attributes, new HashMap<String, String>(),  new HashSet<ArtifactAccessorPointer>());
+            }
+            
             if(pointer != null) {
                 Map<String, Object> attributes = new TreeMap<String, Object>();
                 attributes.put(TYPE_ATTRIBUTE, pointer.getType());
@@ -230,8 +244,18 @@
             String dependentVersion = objectName.getKeyProperty("version");
 
             ManageableArtifact dependantArtifact = JMX.newMXBeanProxy(mBeanServer, objectName, ManageableArtifact.class);
-            String state = dependantArtifact.getState();
-            
+            String state;
+            if(dependantArtifact != null){
+                //TODO work around until 337211 is done
+                try {
+                    state = dependantArtifact.getState();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    state = "-";
+                }
+            } else {
+                state = "-";
+            }
             if (dependentType != null && dependentName != null && dependentVersion != null) {
                 result = new StandardArtifactAccessorPointer(dependentType, dependentName, dependentVersion, state);
             }
diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardQuasiLiveFramework.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardQuasiLiveFramework.java
index 66e4772..61a3189 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardQuasiLiveFramework.java
+++ b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardQuasiLiveFramework.java
@@ -43,7 +43,7 @@
     
     private final QuasiFramework quasiFramework;
     
-    private final BundleContext bundleContext;
+    private final BundleContext systemBundleContext;
 
     /**
      * Takes in the {@link QuasiFramework} to be decorated with the extra functionality 
@@ -54,7 +54,7 @@
      */
     public StandardQuasiLiveFramework(QuasiFramework quasiFramework, BundleContext bundleContext) {
         this.quasiFramework = quasiFramework;
-        this.bundleContext = bundleContext;
+        this.systemBundleContext = bundleContext.getBundle(0L).getBundleContext();
     }
 
     /** 
@@ -65,7 +65,7 @@
         if(quasiBundle == null){
             return null;
         }
-        Bundle rawBundle = this.bundleContext.getBundle(bundleId);
+        Bundle rawBundle = this.systemBundleContext.getBundle(bundleId);
         return new StandardQuasiLiveBundle(this, quasiBundle, rawBundle);
     }
 
@@ -78,7 +78,7 @@
         Bundle rawBundle;
         
         for(QuasiBundle quasiBundle : quasiBundles){
-            rawBundle = this.bundleContext.getBundle(quasiBundle.getBundleId());
+            rawBundle = this.systemBundleContext.getBundle(quasiBundle.getBundleId());
             quasiLiveBundles.add(new StandardQuasiLiveBundle(this, quasiBundle, rawBundle));
         }
         
@@ -120,4 +120,11 @@
         return this.quasiFramework.getBundle(name, version);
     }
 
+    /** 
+     * {@inheritDoc}
+     */
+    @Override
+    public void destroy() {
+    }
+
 }
diff --git a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardStateService.java b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardStateService.java
index a7ccadd..3e02008 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardStateService.java
+++ b/org.eclipse.virgo.kernel.shell/src/main/java/org/eclipse/virgo/kernel/shell/state/internal/StandardStateService.java
@@ -14,14 +14,9 @@
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map.Entry;
 import java.util.SortedMap;
 import java.util.TreeMap;
-import java.util.Map.Entry;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.springframework.util.AntPathMatcher;
 
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiExportPackage;
@@ -29,30 +24,64 @@
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiFrameworkFactory;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiImportPackage;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiResolutionFailure;
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
 import org.eclipse.virgo.kernel.shell.state.QuasiLiveBundle;
 import org.eclipse.virgo.kernel.shell.state.QuasiLiveService;
 import org.eclipse.virgo.kernel.shell.state.QuasiPackage;
 import org.eclipse.virgo.kernel.shell.state.StateService;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.springframework.util.AntPathMatcher;
 
 /**
  * 
  */
 final public class StandardStateService implements StateService {
+    
+    private static final String REGION_KERNEL = "org.eclipse.virgo.region.kernel";
 
     private final QuasiFrameworkFactory quasiFrameworkFactory;
 
     private final BundleContext bundleContext;
 
-    public StandardStateService(QuasiFrameworkFactory quasiFrameworkFactory, BundleContext bundleContext) {
+    private final RegionDigraph regionDigraph;
+
+    private final Region kernelRegion;
+    
+    public StandardStateService(QuasiFrameworkFactory quasiFrameworkFactory, BundleContext bundleContext, RegionDigraph regionDigraph) {
         this.quasiFrameworkFactory = quasiFrameworkFactory;
         this.bundleContext = bundleContext;
+        this.regionDigraph = regionDigraph;
+        this.kernelRegion = getKernelRegion(regionDigraph);
+    }
+
+    private Region getKernelRegion(RegionDigraph regionDigraph) {
+        return regionDigraph.getRegion(REGION_KERNEL);
     }
 
     /**
      * {@inheritDoc}
      */
     public List<QuasiBundle> getAllBundles(File source) {
-        return this.getQuasiFramework(source).getBundles();
+        List<QuasiBundle> bundles = this.getQuasiFramework(source).getBundles();
+        if (source == null) {
+            List<QuasiBundle> userRegionBundles = new ArrayList<QuasiBundle>();
+            for (QuasiBundle bundle : bundles) {
+                long bundleId = bundle.getBundleId();
+                if (bundleId == 0L || !this.kernelRegion.equals(getRegion(bundleId))) {
+                    userRegionBundles.add(bundle);
+                }
+            }
+            return userRegionBundles;
+        } else {
+            return bundles;
+        }
+    }
+
+    private Region getRegion(long bundleId) {
+        return this.regionDigraph.getRegion(bundleId);
     }
 
     /**
diff --git a/org.eclipse.virgo.kernel.shell/src/main/resources/META-INF/spring/module-context.xml b/org.eclipse.virgo.kernel.shell/src/main/resources/META-INF/spring/module-context.xml
index 76b8fe3..6835911 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/resources/META-INF/spring/module-context.xml
+++ b/org.eclipse.virgo.kernel.shell/src/main/resources/META-INF/spring/module-context.xml
@@ -28,8 +28,9 @@
 	<bean id="stateService" class="org.eclipse.virgo.kernel.shell.state.internal.StandardStateService">
 		<constructor-arg ref="quasiFrameworkFactory" />
 		<constructor-arg ref="userRegionBundleContext" />
+		<constructor-arg ref="regionDigraph" />
 	</bean>
-
+	
 	<bean id="installCommand" class="org.eclipse.virgo.kernel.shell.internal.commands.InstallCommand"/>
 
 	<bean id="bundleCommands" class="org.eclipse.virgo.kernel.shell.internal.commands.BundleCommands">
diff --git a/org.eclipse.virgo.kernel.shell/src/main/resources/META-INF/spring/osgi-context.xml b/org.eclipse.virgo.kernel.shell/src/main/resources/META-INF/spring/osgi-context.xml
index bc6bfb1..11c7404 100644
--- a/org.eclipse.virgo.kernel.shell/src/main/resources/META-INF/spring/osgi-context.xml
+++ b/org.eclipse.virgo.kernel.shell/src/main/resources/META-INF/spring/osgi-context.xml
@@ -28,7 +28,9 @@
 	<osgi:reference id="deployer" interface="org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer"/>
 
     <osgi:service ref="modelAccessorHelper" interface="org.eclipse.virgo.kernel.shell.model.helper.RamAccessorHelper" />
-
+    
+    <osgi:reference id="regionDigraph" interface="org.eclipse.virgo.kernel.osgi.region.RegionDigraph" />
+    
 <!-- SERVICES FOR THE TYPE CONVERTERS -->
 
 	<osgi:service ref="longConverter" interface="org.eclipse.virgo.kernel.shell.Converter">
diff --git a/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelperTests.java b/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelperTests.java
index c9a19a2..8d76e53 100644
--- a/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelperTests.java
+++ b/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/model/helper/StandardRamAccessorHelperTests.java
@@ -194,7 +194,11 @@
     @Test
     public void testGetArtifactNotExist() {
         ArtifactAccessor artifact = this.ramAccessorHelper.getArtifact(TYPE, NAME, VERSION);
-        assertNull(artifact);
+        assertNotNull(artifact);
+        // This accommodates the workaround to bug 337211.
+        assertEquals("Region", artifact.getType());
+        assertEquals(NAME, artifact.getName());
+        assertEquals(VERSION, artifact.getVersion());
     }
     
 }
diff --git a/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/state/internal/StandardStateServiceTests.java b/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/state/internal/StandardStateServiceTests.java
index a6096e9..f06f161 100644
--- a/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/state/internal/StandardStateServiceTests.java
+++ b/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/state/internal/StandardStateServiceTests.java
@@ -18,16 +18,18 @@
 import java.io.File;
 import java.util.List;
 
-import org.junit.Before;
-import org.junit.Test;
-
+import org.easymock.EasyMock;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiFrameworkFactory;
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
 import org.eclipse.virgo.kernel.shell.state.QuasiLiveService;
-import org.eclipse.virgo.kernel.shell.state.internal.StandardStateService;
 import org.eclipse.virgo.kernel.shell.stubs.StubQuasiFrameworkFactory;
-
+import org.eclipse.virgo.teststubs.osgi.framework.StubBundle;
 import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Version;
 
 /**
  * <p>
@@ -48,25 +50,41 @@
     private StubBundleContext stubBundleContext;
 
     private QuasiFrameworkFactory stubQuasiFrameworkFactory;
-    
-	/**
-	 * @throws java.lang.Exception
-	 */
-	@Before
-	public void setUp() throws Exception {
-	    this.stubBundleContext = new StubBundleContext();
-	    this.stubQuasiFrameworkFactory = new StubQuasiFrameworkFactory();
-	    this.standardStateService = new StandardStateService(this.stubQuasiFrameworkFactory, this.stubBundleContext);
-	}
 
-	@Test	
-	public void getAllBundlesNullDump() {
-	    List<QuasiBundle> result = this.standardStateService.getAllBundles(null);
-	    assertNotNull(result);
-	    assertEquals(1, result.size());
-	}
-    
-    @Test      
+    private Region mockUserRegion;
+
+    private RegionDigraph mockRegionDigraph;
+
+    private Region mockKernelRegion;
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @Before
+    public void setUp() throws Exception {
+        this.stubBundleContext = new StubBundleContext();
+        
+        StubBundle stubSystemBundle = new StubBundle(0L, "stub.system.bundle", Version.emptyVersion, "stubLocation");
+        this.stubBundleContext.addInstalledBundle(stubSystemBundle);
+        
+        this.stubQuasiFrameworkFactory = new StubQuasiFrameworkFactory();
+        this.mockUserRegion = EasyMock.createMock(Region.class);
+        this.mockKernelRegion = EasyMock.createMock(Region.class);
+        this.mockRegionDigraph = EasyMock.createMock(RegionDigraph.class);
+        EasyMock.expect(this.mockRegionDigraph.getRegion(EasyMock.anyLong())).andReturn(this.mockUserRegion).anyTimes();
+        EasyMock.expect(this.mockRegionDigraph.getRegion(EasyMock.eq("org.eclipse.virgo.region.kernel"))).andReturn(this.mockKernelRegion).anyTimes();
+        EasyMock.replay(this.mockUserRegion, this.mockKernelRegion, this.mockRegionDigraph);
+        this.standardStateService = new StandardStateService(this.stubQuasiFrameworkFactory, this.stubBundleContext, this.mockRegionDigraph);
+    }
+
+    @Test
+    public void getAllBundlesNullDump() {
+        List<QuasiBundle> result = this.standardStateService.getAllBundles(null);
+        assertNotNull(result);
+        assertEquals(1, result.size());
+    }
+
+    @Test
     public void getAllBundlesFromDump() {
         List<QuasiBundle> result = this.standardStateService.getAllBundles(TEST_DUMP_FILE);
         assertNotNull(result);
diff --git a/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/stubs/StubQuasiFramework.java b/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/stubs/StubQuasiFramework.java
index 702a868..b6ad470 100644
--- a/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/stubs/StubQuasiFramework.java
+++ b/org.eclipse.virgo.kernel.shell/src/test/java/org/eclipse/virgo/kernel/shell/stubs/StubQuasiFramework.java
@@ -83,4 +83,8 @@
         return null;
     }
 
+    @Override
+    public void destroy() {
+    }
+
 }
diff --git a/org.eclipse.virgo.kernel.shell/template.mf b/org.eclipse.virgo.kernel.shell/template.mf
index 00c4a5b..4a34526 100644
--- a/org.eclipse.virgo.kernel.shell/template.mf
+++ b/org.eclipse.virgo.kernel.shell/template.mf
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Virgo Kernel Admin Shell
 Bundle-SymbolicName: org.eclipse.virgo.kernel.shell
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
 Import-Template: 
  org.eclipse.virgo.repository.*;version="${org.eclipse.virgo.repository:[=.=.=, =.+1)}",
  org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",
@@ -17,6 +17,8 @@
  org.ietf.jgss.*;version="0",
  org.eclipse.osgi.*;version="0",
  org.osgi.framework.*;version="0",
+ org.osgi.service.*;version="0",
+ org.osgi.util.*;version="0",
  org.osgi.service.cm.*;version="0",
  org.osgi.service.event.*;version="0",
  javax.management.*;version="0"
diff --git a/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfiguration.java b/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfiguration.java
index 3180047..7f30af0 100644
--- a/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfiguration.java
+++ b/org.eclipse.virgo.kernel.shutdown/src/main/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfiguration.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * This file is part of the Virgo Web Server.
  *
- * Copyright (c) 2010 Eclipse Foundation.
+ * Copyright (c) 2010 VMware Inc.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
diff --git a/org.eclipse.virgo.kernel.shutdown/src/main/resources/META-INF/MANIFEST.MF b/org.eclipse.virgo.kernel.shutdown/src/main/resources/META-INF/MANIFEST.MF
index fd9b3bd..bf9e5ef 100644
--- a/org.eclipse.virgo.kernel.shutdown/src/main/resources/META-INF/MANIFEST.MF
+++ b/org.eclipse.virgo.kernel.shutdown/src/main/resources/META-INF/MANIFEST.MF
@@ -1,5 +1,5 @@
 Manifest-Version: 1.0

 Bundle-ManifestVersion: 2

-Bundle-Version: 2.2.0

+Bundle-Version: 3.0.0

 Bundle-Name: Virgo Kernel Shutdown Client

 Bundle-SymbolicName: org.eclipse.virgo.kernel.shutdown

diff --git a/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfigurationTests.java b/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfigurationTests.java
index 9571918..5d29d43 100644
--- a/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfigurationTests.java
+++ b/org.eclipse.virgo.kernel.shutdown/src/test/java/org/eclipse/virgo/kernel/shutdown/KernelAuthenticationConfigurationTests.java
@@ -1,7 +1,7 @@
 /*******************************************************************************
  * This file is part of the Virgo Web Server.
  *
- * Copyright (c) 2010 Eclipse Foundation.
+ * Copyright (c) 2010 VMware Inc.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
diff --git a/org.eclipse.virgo.kernel.smoketest/.classpath b/org.eclipse.virgo.kernel.smoketest/.classpath
index d9e2517..40fe127 100644
--- a/org.eclipse.virgo.kernel.smoketest/.classpath
+++ b/org.eclipse.virgo.kernel.smoketest/.classpath
@@ -5,6 +5,6 @@
 	<classpathentry kind="src" path="src/test/java"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-sources-2.2.0.D-20101207150035.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/org.eclipse.virgo.kernel.stubs/.classpath b/org.eclipse.virgo.kernel.stubs/.classpath
index 05ed686..862dcb5 100644
--- a/org.eclipse.virgo.kernel.stubs/.classpath
+++ b/org.eclipse.virgo.kernel.stubs/.classpath
@@ -22,10 +22,10 @@
 	</classpathentry>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.deployer"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-sources-2.2.0.D-20101207150035.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-3.0.0.M02.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.artifact"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
 	<classpathentry kind="output" path="target/classes"/>
diff --git a/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubInstallArtifact.java b/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubInstallArtifact.java
index bc69b5d..fd9de68 100644
--- a/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubInstallArtifact.java
+++ b/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubInstallArtifact.java
@@ -17,16 +17,14 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.osgi.framework.Version;
-
-import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
-
 import org.eclipse.virgo.kernel.artifact.fs.ArtifactFS;
-import org.eclipse.virgo.kernel.core.Signal;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
+import org.eclipse.virgo.kernel.install.artifact.InstallArtifact;
 import org.eclipse.virgo.kernel.serviceability.NonNull;
 import org.eclipse.virgo.util.common.ThreadSafeArrayListTree;
 import org.eclipse.virgo.util.common.Tree;
+import org.osgi.framework.Version;
 
 public class StubInstallArtifact implements InstallArtifact {
 
@@ -142,7 +140,7 @@
         start(null);
     }
 
-    public void start(Signal signal) throws DeploymentException {
+    public void start(AbortableSignal signal) throws DeploymentException {
         if (signal != null) {
             signal.signalSuccessfulCompletion();
         }
diff --git a/org.eclipse.virgo.kernel.stubs/template.mf b/org.eclipse.virgo.kernel.stubs/template.mf
index daaa3fe..6dbf6d4 100644
--- a/org.eclipse.virgo.kernel.stubs/template.mf
+++ b/org.eclipse.virgo.kernel.stubs/template.mf
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Virgo Kernel Unit Test Stubs
 Bundle-SymbolicName: org.eclipse.virgo.kernel.stubs
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
 Import-Template: 
  org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",
  org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
diff --git a/org.eclipse.virgo.kernel.test/.classpath b/org.eclipse.virgo.kernel.test/.classpath
index 11cb9b4..8566ce4 100644
--- a/org.eclipse.virgo.kernel.test/.classpath
+++ b/org.eclipse.virgo.kernel.test/.classpath
@@ -4,23 +4,22 @@
 	<classpathentry kind="src" path="src/main/resources"/>
 	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
 	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.deployer"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.test/org.eclipse.virgo.test.framework/2.2.0.D-20101207150629/org.eclipse.virgo.test.framework-2.2.0.D-20101207150629.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.test/org.eclipse.virgo.test.framework/2.2.0.D-20101207150629/org.eclipse.virgo.test.framework-sources-2.2.0.D-20101207150629.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.test/org.eclipse.virgo.test.framework/3.0.0.M02/org.eclipse.virgo.test.framework-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.test/org.eclipse.virgo.test.framework/3.0.0.M02/org.eclipse.virgo.test.framework-sources-3.0.0.M02.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-1.2.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework.osgi/org.springframework.osgi.core/1.2.1/org.springframework.osgi.core-sources-1.2.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.core/3.0.0.RELEASE/org.springframework.core-sources-3.0.0.RELEASE.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/2.2.0.D-20101207145732/org.eclipse.virgo.osgi.launcher-2.2.0.D-20101207145732.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/3.0.0.M02/org.eclipse.virgo.osgi.launcher-3.0.0.M02.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.osgi/org.osgi.compendium/4.1.0/org.osgi.compendium-4.1.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgicommand"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/org.eclipse.virgo.kernel.test/.project b/org.eclipse.virgo.kernel.test/.project
index 5781bd1..ac8c005 100644
--- a/org.eclipse.virgo.kernel.test/.project
+++ b/org.eclipse.virgo.kernel.test/.project
@@ -20,11 +20,6 @@
 			<arguments>
 			</arguments>
 		</buildCommand>
-		<buildCommand>
-			<name>com.springsource.server.ide.bundlor.core.builder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
 	</buildSpec>
 	<natures>
 		<nature>com.springsource.server.ide.facet.core.bundlenature</nature>
diff --git a/org.eclipse.virgo.kernel.test/ivy.xml b/org.eclipse.virgo.kernel.test/ivy.xml
index f7186e9..397e50c 100644
--- a/org.eclipse.virgo.kernel.test/ivy.xml
+++ b/org.eclipse.virgo.kernel.test/ivy.xml
@@ -18,14 +18,17 @@
 
 	<dependencies>
 		<!-- build -->
-		<dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="compile->runtime"/>
-		<dependency org="org.eclipse.equinox" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="compile->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.cm" rev="${org.eclipse.equinox.cm}" conf="compile->runtime"/>
 
 		<dependency org="org.springframework.osgi" name="org.springframework.osgi.core" rev="${org.springframework.osgi}" conf="compile->runtime"/>
 
 		<!-- testing -->
 		<dependency org="org.junit" name="com.springsource.org.junit" rev="${org.junit}" conf="test->runtime"/>
 		<dependency org="org.easymock" name="com.springsource.org.easymock" rev="${org.easymock}" conf="test->runtime"/>
+		
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.ds" rev="${org.eclipse.equinox.ds}" conf="test->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.util" rev="${org.eclipse.equinox.util}" conf="test->runtime"/>
+		<dependency org="org.eclipse.osgi" name="org.eclipse.osgi.services" rev="${org.eclipse.osgi.services}" conf="test->runtime"/>
 
 		<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.core" rev="latest.integration" conf="test->compile"/>
 		<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.osgi" rev="latest.integration" conf="test->compile"/>
diff --git a/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/concurrent/test/ApplicationContextDependencyMonitorIntegrationTests.java b/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/concurrent/test/ApplicationContextDependencyMonitorIntegrationTests.java
index 8502aef..747c578 100644
--- a/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/concurrent/test/ApplicationContextDependencyMonitorIntegrationTests.java
+++ b/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/concurrent/test/ApplicationContextDependencyMonitorIntegrationTests.java
@@ -22,22 +22,20 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceReference;
-
+import org.eclipse.virgo.kernel.core.AbortableSignal;
+import org.eclipse.virgo.kernel.core.BundleStarter;
 import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkUtils;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiFramework;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiFrameworkFactory;
 import org.eclipse.virgo.kernel.test.AbstractKernelIntegrationTest;
 import org.eclipse.virgo.kernel.test.ManifestUtils;
-
-import org.eclipse.virgo.kernel.core.BundleStarter;
-import org.eclipse.virgo.kernel.core.Signal;
 import org.eclipse.virgo.util.osgi.manifest.BundleManifest;
 import org.eclipse.virgo.util.osgi.manifest.BundleManifestFactory;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
 
 /**
  */
@@ -60,7 +58,7 @@
         
         final CountDownLatch latch = new CountDownLatch(1);
         
-        bundleStarter.start(quickConsumer, new Signal() {
+        bundleStarter.start(quickConsumer, new AbortableSignal() {
             public void signalFailure(Throwable cause) {
                 cause.printStackTrace();
             }
@@ -68,6 +66,10 @@
             public void signalSuccessfulCompletion() {
                 latch.countDown();
             }
+
+			public void signalAborted() {
+				new RuntimeException("Start aborted").printStackTrace();
+			}
         });
                        
         assertTrue(latch.await(20, TimeUnit.SECONDS));
diff --git a/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/osgi/test/QuasiFrameworkIntegrationTests.java b/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/osgi/test/QuasiFrameworkIntegrationTests.java
index 5b1b4bb..774067a 100644
--- a/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/osgi/test/QuasiFrameworkIntegrationTests.java
+++ b/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/osgi/test/QuasiFrameworkIntegrationTests.java
@@ -15,6 +15,7 @@
 import java.net.URISyntaxException;
 import java.util.List;
 
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -69,6 +70,11 @@
         this.quasiFramework = this.quasiFrameworkFactory.create();
         Assert.assertNotNull(this.quasiFramework);
     }
+    
+    @After
+    public void tearDown() {
+        this.quasiFramework.destroy();
+    }
 
     @Test
     public void testInstall() throws Exception {
diff --git a/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/osgi/test/RegionTests.java b/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/osgi/test/RegionTests.java
index eb668b1..6bf51bc 100644
--- a/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/osgi/test/RegionTests.java
+++ b/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/osgi/test/RegionTests.java
@@ -36,7 +36,6 @@
         
         Region userRegion = (Region) this.kernelContext.getService(serviceReferences[0]);
         assertNotNull(userRegion);
-        assertNotNull(userRegion.getBundleContext());
     }
 
     private ServiceReference<?>[] lookupRegionServices(String name) throws InvalidSyntaxException {
diff --git a/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/osgicommand/helper/test/ClassLoadingHelperIntegrationTests.java b/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/osgicommand/helper/test/ClassLoadingHelperIntegrationTests.java
index 205ee8a..bffdbe0 100644
--- a/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/osgicommand/helper/test/ClassLoadingHelperIntegrationTests.java
+++ b/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/osgicommand/helper/test/ClassLoadingHelperIntegrationTests.java
@@ -26,13 +26,10 @@
 import org.junit.runner.RunWith;

 import org.osgi.framework.Bundle;

 import org.osgi.framework.BundleContext;

-import org.osgi.framework.ServiceReference;

-import org.osgi.service.packageadmin.PackageAdmin;

 

 /**

  * Class for integration testing {@link org.eclipse.virgo.kernel.osgicommand.helper.ClassLoadingHelper}

  */

-@SuppressWarnings("deprecation")

 @RunWith(DmKernelTestRunner.class)

 public class ClassLoadingHelperIntegrationTests extends AbstractKernelIntegrationTest {

     private static final String SHELL_COMMANDS_BUNDLE_NAME = "org.eclipse.virgo.kernel.osgicommand";

@@ -56,15 +53,14 @@
         // execute initialization code

         super.setup();

 

-        // get osgicommand bundle

-        ServiceReference<PackageAdmin> reference = context.getServiceReference(PackageAdmin.class);

-        PackageAdmin packageAdmin = context.getService(reference);

-        Bundle[] bundles = packageAdmin.getBundles(SHELL_COMMANDS_BUNDLE_NAME, null);

-        assertNotNull("No bundles with symbolic name [" + SHELL_COMMANDS_BUNDLE_NAME + "] found in bundles set " + Arrays.toString(context.getBundles()),

-                      bundles);

-        assertTrue("Found [" + bundles.length + "] bundles with symbolic name [" + SHELL_COMMANDS_BUNDLE_NAME + "] in bundles set " + Arrays.toString(context.getBundles()),

-                   bundles.length == 1);

-        this.shellCommandsBundle = bundles[0];

+        for (Bundle bundle : context.getBundles()) {

+            if (SHELL_COMMANDS_BUNDLE_NAME.equals(bundle.getSymbolicName())) {

+               this.shellCommandsBundle = bundle; 

+            }

+        }

+        

+        assertNotNull("No bundles with symbolic name [" + SHELL_COMMANDS_BUNDLE_NAME + "] found in bundles " + context.getBundles(),

+                      this.shellCommandsBundle);

 

         // get this bundle

         this.currentBundle = context.getBundle();

diff --git a/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/test/AbstractKernelIntegrationTest.java b/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/test/AbstractKernelIntegrationTest.java
index ad8f461..d52a11f 100644
--- a/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/test/AbstractKernelIntegrationTest.java
+++ b/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/test/AbstractKernelIntegrationTest.java
@@ -16,20 +16,16 @@
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
+import org.eclipse.virgo.kernel.osgi.framework.OsgiFramework;
+import org.eclipse.virgo.test.framework.dmkernel.DmKernelTestRunner;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.runner.RunWith;
-import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.ServiceReference;
-import org.osgi.service.framework.SurrogateBundle;
-
-import org.eclipse.virgo.kernel.osgi.framework.OsgiFramework;
-import org.eclipse.virgo.test.framework.dmkernel.DmKernelTestRunner;
 
 @RunWith(DmKernelTestRunner.class)
-@SuppressWarnings("deprecation")
 public abstract class AbstractKernelIntegrationTest {
     
     protected volatile BundleContext kernelContext;
@@ -45,10 +41,11 @@
             this.framework = this.context.getService(serviceReference);
         }
         
-        Bundle bundle = this.context.getBundle(1);
-        if (bundle instanceof SurrogateBundle) {
-            this.kernelContext = ((SurrogateBundle)bundle).getCompositeBundleContext();
-        }
+        this.kernelContext = getKernelContext();
+    }
+
+    private BundleContext getKernelContext() {
+        return this.context.getBundle(0L).getBundleContext();
     }
 
     @BeforeClass
diff --git a/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/test/StandardBundleStarterSignallingTests.java b/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/test/StandardBundleStarterSignallingTests.java
index 3e63d5c..588d367 100644
--- a/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/test/StandardBundleStarterSignallingTests.java
+++ b/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/test/StandardBundleStarterSignallingTests.java
@@ -11,21 +11,21 @@
 
 package org.eclipse.virgo.kernel.test;
 
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
 
+import org.eclipse.virgo.kernel.core.AbortableSignal;
 import org.eclipse.virgo.kernel.core.BundleStarter;
-import org.eclipse.virgo.kernel.core.Signal;
 import org.junit.Before;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.ServiceReference;
 
-
 /**
  */
 public class StandardBundleStarterSignallingTests extends AbstractKernelIntegrationTest {
@@ -48,6 +48,7 @@
         while (!ts.isComplete()) {
             Thread.sleep(100);
         }
+        assertFalse(ts.isAborted());
         assertNull(ts.getCause());
     }
 
@@ -61,6 +62,7 @@
         while (!ts.isComplete()) {
             Thread.sleep(100);
         }
+        assertFalse(ts.isAborted());
         assertNull(ts.getCause());
     }
 
@@ -73,10 +75,28 @@
         while (!ts.isComplete()) {
             Thread.sleep(100);
         }
+        assertFalse(ts.isAborted());
         assertNotNull(ts.getCause());
     }
 
     @Test
+    public void signalAbort() throws Exception {
+        Bundle bundle = installBundle(new File("src/test/resources/monitor/lazy"));
+        assertNotNull(bundle);        
+        TestSignal ts = new TestSignal();
+        this.monitor.start(bundle, ts);
+        while (bundle.getState() != Bundle.STARTING) {
+            Thread.sleep(100);
+        }
+        bundle.stop();
+        while (!ts.isComplete()) {
+            Thread.sleep(100);
+        }
+        assertNull(ts.getCause());
+        assertTrue(ts.isAborted());
+    }
+
+    @Test
     public void signalNonDm() throws Exception {
         Bundle bundle = installBundle(new File("src/test/resources/monitor/nondm"));
         assertNotNull(bundle);     
@@ -84,6 +104,7 @@
         this.monitor.start(bundle, ts);
         waitForComplete(ts, 1000);
         assertTrue(ts.isComplete());
+        assertFalse(ts.isAborted());
         assertNull(ts.getCause());
     }
 
@@ -269,15 +290,16 @@
         return this.context.installBundle(bundleFile.toURI().toString());               
     }
     
-    private static class TestSignal implements Signal {
-        
+    private static class TestSignal implements AbortableSignal {
+
         private volatile boolean complete = false;
         
+        private volatile boolean aborted = false;
+        
         private volatile Throwable cause = null;
 
         public void signalSuccessfulCompletion() {
             this.complete = true;
-            
         }
 
         public void signalFailure(Throwable t) {
@@ -285,10 +307,19 @@
             this.cause = t;
         }
         
+		public void signalAborted() {
+            this.complete = true;
+            this.aborted = true;
+		}
+        
         public boolean isComplete() {
             return this.complete;
         }
         
+        public boolean isAborted() {
+            return this.aborted;
+        }
+        
         public Throwable getCause() {
             return this.cause;
         }
diff --git a/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/test/TestSignal.java b/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/test/TestSignal.java
index 570e118..8105d27 100644
--- a/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/test/TestSignal.java
+++ b/org.eclipse.virgo.kernel.test/src/test/java/org/eclipse/virgo/kernel/test/TestSignal.java
@@ -19,10 +19,9 @@
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 
-import org.eclipse.virgo.kernel.core.Signal;
+import org.eclipse.virgo.kernel.core.AbortableSignal;
 
-
-public final class TestSignal implements Signal {
+public final class TestSignal implements AbortableSignal {
     
     private final AtomicReference<Throwable> causeReference = new AtomicReference<Throwable>(null);
     
@@ -34,7 +33,6 @@
     public void signalFailure(Throwable cause) {
         causeReference.set(cause);
         completionLatch.countDown();
-        
     }
 
     /** 
@@ -43,6 +41,10 @@
     public void signalSuccessfulCompletion() {
         completionLatch.countDown();
     }
+
+	public void signalAborted() {
+        completionLatch.countDown();
+	}  
     
     public void assertSuccessfulCompletionSignalled(long msTimeout) throws InterruptedException {
         assertTrue(completionLatch.await(msTimeout, TimeUnit.MILLISECONDS));
@@ -52,5 +54,10 @@
     public void assertFailureSignalled(long msTimeout) throws InterruptedException {
         assertTrue(completionLatch.await(msTimeout, TimeUnit.MILLISECONDS));
         assertNotNull(causeReference.get());
-    }        
+    }
+
+	public void assertsignalAborted(long msTimeout) throws InterruptedException {
+        assertTrue(completionLatch.await(msTimeout, TimeUnit.MILLISECONDS));
+        assertNull(causeReference.get());
+	}      
 }
diff --git a/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/MANIFEST.MF b/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/MANIFEST.MF
index a1bd2e8..afded3d 100644
--- a/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/MANIFEST.MF
+++ b/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/MANIFEST.MF
@@ -1,34 +1,32 @@
 Manifest-Version: 1.0

-Export-Package: org.eclipse.virgo.kernel.concurrent.test;version="2.2.

+Export-Package: org.eclipse.virgo.kernel.concurrent.test;version="3.0.

  0";uses:="org.eclipse.virgo.kernel.core,org.eclipse.virgo.kernel.test

- ,org.junit",org.eclipse.virgo.kernel.dm.test;version="2.2.0";uses:="o

+ ,org.junit",org.eclipse.virgo.kernel.dm.test;version="3.0.0";uses:="o

  rg.eclipse.virgo.kernel.test,org.junit",org.eclipse.virgo.kernel.ffdc

- .test;version="2.2.0";uses:="org.eclipse.virgo.kernel.test,org.junit"

- ,org.eclipse.virgo.kernel.osgi.test;version="2.2.0";uses:="org.eclips

+ .test;version="3.0.0";uses:="org.eclipse.virgo.kernel.test,org.junit"

+ ,org.eclipse.virgo.kernel.osgi.test;version="3.0.0";uses:="org.eclips

  e.virgo.kernel.test,org.junit",org.eclipse.virgo.kernel.osgicommand.h

- elper.test;version="2.2.0";uses:="org.eclipse.virgo.kernel.test,org.j

- unit,org.junit.runner",org.eclipse.virgo.kernel.test;version="2.2.0";

+ elper.test;version="3.0.0";uses:="org.eclipse.virgo.kernel.test,org.j

+ unit,org.junit.runner",org.eclipse.virgo.kernel.test;version="3.0.0";

  uses:="org.eclipse.virgo.kernel.core,org.junit,org.junit.runner"

 Bundle-ClassPath: .,quasi/simpleexporter.jar,quasi/simpleimporter.jar,

  QuickConsumer.jar,SlowService.jar,quasi/simpleexporter.jar,quasi/simp

  leimporter.jar,QuickConsumer.jar,SlowService.jar

-Bundle-Version: 2.2.0

+Bundle-Version: 3.0.0

 Tool: Bundlor 1.0.0.RELEASE

 Bundle-Name: Virgo Kernel Test

 Bundle-ManifestVersion: 2

 Bundle-SymbolicName: org.eclipse.virgo.kernel.test

 Import-Package: javax.management;version="0",org.eclipse.virgo.kernel.

- core;version="[2.2.0,3)",org.eclipse.virgo.kernel.deployer.core;versi

- on="[2.2.0,3)",org.eclipse.virgo.kernel.osgi.framework;version="[2.2.

- 0,3)",org.eclipse.virgo.kernel.osgi.quasi;version="[2.2.0,3)",org.ecl

- ipse.virgo.kernel.osgi.region;version="[2.2.0,3)",org.eclipse.virgo.k

- ernel.osgicommand.helper;version="[2.2.0,3)",org.eclipse.virgo.util.i

- o;version="[2.2.0,3)",org.eclipse.virgo.util.osgi.manifest;version="[

- 2.2.0,3)",org.junit;version="[4.7.0,5)",org.junit.runner;version="[4.

- 7.0,5)",org.osgi.framework;version="0",org.osgi.service.framework;ver

- sion="0",org.osgi.service.packageadmin;version="0",org.springframewor

- k.context;version="[2.5.6,3.1)",org.springframework.jmx.export;versio

- n="[2.5.6,3.1)",org.springframework.osgi.context.support;version="[1.

- 2.1,2)",org.springframework.osgi.service.importer.support;version="[1

- .2.1,2)"

+ core;version="[3.0.0,4)",org.eclipse.virgo.kernel.deployer.core;versi

+ on="[3.0.0,4)",org.eclipse.virgo.kernel.osgi.framework;version="[3.0.

+ 0,4)",org.eclipse.virgo.kernel.osgi.quasi;version="[3.0.0,4)",org.ecl

+ ipse.virgo.kernel.osgi.region;version="[3.0.0,4)",org.eclipse.virgo.k

+ ernel.osgicommand.helper;version="[3.0.0,4)",org.eclipse.virgo.util.i

+ o;version="[3.0.0,4)",org.eclipse.virgo.util.osgi.manifest;version="[

+ 3.0.0,4)",org.junit;version="[4.7.0,5)",org.junit.runner;version="[4.

+ 7.0,5)",org.osgi.framework;version="0",org.springframework.context;ve

+ rsion="[2.5.6,3.1)",org.springframework.jmx.export;version="[2.5.6,3.

+ 1)",org.springframework.osgi.context.support;version="[1.2.1,2)",org.

+ springframework.osgi.service.importer.support;version="[1.2.1,2)"

 

diff --git a/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/test.config.properties b/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/test.config.properties
index 42f12ee..73fb8ee 100644
--- a/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/test.config.properties
+++ b/org.eclipse.virgo.kernel.test/src/test/resources/META-INF/test.config.properties
@@ -4,10 +4,10 @@
  file:../ivy-cache/repository/org.aspectj/com.springsource.org.aspectj.runtime/${org.aspectj}/com.springsource.org.aspectj.runtime-${org.aspectj}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.medic/org.eclipse.virgo.medic/${org.eclipse.virgo.medic}/org.eclipse.virgo.medic-${org.eclipse.virgo.medic}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.osgi.services/${org.eclipse.osgi.services}/org.eclipse.osgi.services-${org.eclipse.osgi.services}.jar,\
- file:../ivy-cache/repository/org.eclipse.equinox/org.eclipse.equinox.cm/${org.eclipse.equinox.cm}/org.eclipse.equinox.cm-${org.eclipse.equinox.cm}.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.cm/${org.eclipse.equinox.cm}/org.eclipse.equinox.cm-${org.eclipse.equinox.cm}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/${org.eclipse.virgo.medic}/org.eclipse.virgo.medic.core-${org.eclipse.virgo.medic}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/${org.eclipse.virgo.util}/org.eclipse.virgo.util.osgi-${org.eclipse.virgo.util}.jar@start,\
- file:../ivy-cache/repository/org.apache.felix/org.apache.felix.eventadmin/${org.apache.felix.eventadmin}/org.apache.felix.eventadmin-${org.apache.felix.eventadmin}.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.event/${org.eclipse.equinox.event}/org.eclipse.equinox.event-${org.eclipse.equinox.event}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.common/${org.eclipse.virgo.util}/org.eclipse.virgo.util.common-${org.eclipse.virgo.util}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.io/${org.eclipse.virgo.util}/org.eclipse.virgo.util.io-${org.eclipse.virgo.util}.jar@start,\
  file:../ivy-cache/repository/org.eclipse.virgo.util/org.eclipse.virgo.util.jmx/${org.eclipse.virgo.util}/org.eclipse.virgo.util.jmx-${org.eclipse.virgo.util}.jar,\
@@ -28,13 +28,16 @@
  file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar@start,\
  file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-1.2.1.jar,\
  file:../ivy-cache/repository/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.ds/1.3.0.v20110124-0830/org.eclipse.equinox.ds-1.3.0.v20110124-0830.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.util/1.0.200.v20100503/org.eclipse.equinox.util-1.0.200.v20100503.jar@start,\
  file:../org.eclipse.virgo.kernel.artifact/target/classes@start,\
  file:../org.eclipse.virgo.kernel.services/target/classes@start,\
- file:../org.eclipse.virgo.kernel.osgi/target/classes@start,\
  file:../org.eclipse.virgo.kernel.deployer/target/classes@start,\
  file:../org.eclipse.virgo.kernel.model/target/classes@start,\
  file:../org.eclipse.virgo.kernel.kerneldmfragment/target/classes,\
  file:../org.eclipse.virgo.kernel.shell/target/classes@start,\
+ file:../org.eclipse.virgo.kernel.osgi/target/classes@start,\
+ file:../org.eclipse.virgo.kernel.userregionfactory/target/classes@start,\
  file:../org.eclipse.virgo.kernel.osgicommand/target/classes@start
 
 org.eclipse.virgo.test.properties.include=file:../build.versions,file:../build.properties
@@ -45,6 +48,9 @@
 osgi.compatibility.bootdelegation=false
 osgi.clean=true
 osgi.configuration.area=target
+org.osgi.framework.bsnversion=multiple
+
+osgi.console=2401
 
 org.apache.felix.eventadmin.Timeout=0
 
diff --git a/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties b/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
index 88c4238..6784910 100644
--- a/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
+++ b/org.eclipse.virgo.kernel.test/src/test/resources/config/org.eclipse.virgo.kernel.userregion.properties
@@ -9,11 +9,16 @@
  file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.extender/1.2.1/org.springframework.osgi.extender-1.2.1.jar@start,\
  file:../ivy-cache/repository/org.springframework.osgi/org.springframework.osgi.io/1.2.1/org.springframework.osgi.io-1.2.1.jar,\
  file:../ivy-cache/repository/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.ds/1.3.0.v20110124-0830/org.eclipse.equinox.ds-1.3.0.v20110124-0830.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.equinox.util/1.0.200.v20100503/org.eclipse.equinox.util-1.0.200.v20100503.jar@start,\
+ file:../ivy-cache/repository/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-3.3.0.v20110110.jar,\
  file:../org.eclipse.virgo.kernel.agent.dm/target/classes@start,\
  file:../org.eclipse.virgo.kernel.deployer.dm/target/classes@start,\
  file:../org.eclipse.virgo.kernel.dmfragment/target/classes,\
  file:../org.eclipse.virgo.kernel.userregion/target/classes@start,\
  file:../org.eclipse.virgo.kernel.osgicommand/target/classes@start
+ 
+bundleImports = org.eclipse.osgi;bundle-version="0"
 
 packageImports =\
  org.eclipse.virgo.kernel.artifact.*;version="0",\
@@ -43,6 +48,8 @@
  org.slf4j.spi;version="[1.6.1,2)"
 
 serviceImports =\
+ org.eclipse.virgo.kernel.osgi.region.Region,\
+ org.eclipse.virgo.kernel.osgi.region.RegionDigraph,\
  org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer,\
  org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser,\
  org.eclipse.virgo.kernel.install.artifact.ScopeServiceRepository,\
@@ -54,11 +61,15 @@
  org.eclipse.virgo.medic.eventlog.EventLoggerFactory,\
  org.eclipse.virgo.repository.Repository,\
  org.eclipse.virgo.kernel.core.Shutdown,\
+ org.osgi.framework.hooks.resolver.ResolverHookFactory,\
  org.osgi.service.cm.ConfigurationAdmin,\
  org.osgi.service.event.EventAdmin,\
+ org.eclipse.virgo.medic.eventlog.EventLogger,\
  org.eclipse.virgo.medic.dump.DumpGenerator,\
  org.eclipse.virgo.kernel.shim.scope.ScopeFactory,\
- org.eclipse.virgo.kernel.shim.serviceability.TracingService
+ org.eclipse.virgo.kernel.shim.serviceability.TracingService,\
+ org.eclipse.osgi.service.resolver.PlatformAdmin,\
+ org.osgi.service.packageadmin.PackageAdmin
 
 serviceExports =\
  org.eclipse.virgo.kernel.install.artifact.InstallArtifactLifecycleListener,\
@@ -70,15 +81,9 @@
  org.eclipse.virgo.kernel.osgi.framework.OsgiFramework,\
  org.eclipse.virgo.kernel.osgi.framework.ImportExpander,\
  org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil,\
+ org.eclipse.virgo.kernel.osgi.region.Region,\
  org.osgi.service.event.EventHandler,\
  org.osgi.service.cm.ConfigurationListener,\
  org.osgi.service.cm.ManagedService,\
- org.osgi.service.cm.ManagedServiceFactory
-
-inheritedFrameworkProperties =\
- osgi.java.profile,\
- osgi.parentClassloader,\
- osgi.context.bootdelegation,\
- osgi.compatibility.bootdelegation,\
- osgi.java.profile.bootdelegation,\
- osgi.hook.configurators.include
+ org.osgi.service.cm.ManagedServiceFactory,\
+ org.osgi.framework.BundleContext
diff --git a/org.eclipse.virgo.kernel.test/src/test/resources/initial-artifact-plan/com.springsource.kernel.test.userregion.springdm.plan b/org.eclipse.virgo.kernel.test/src/test/resources/initial-artifact-plan/com.springsource.kernel.test.userregion.springdm.plan
index 0e5d15f..9c7f8b0 100644
--- a/org.eclipse.virgo.kernel.test/src/test/resources/initial-artifact-plan/com.springsource.kernel.test.userregion.springdm.plan
+++ b/org.eclipse.virgo.kernel.test/src/test/resources/initial-artifact-plan/com.springsource.kernel.test.userregion.springdm.plan
@@ -1,10 +1,10 @@
-<plan name="org.eclipse.virgo.kernel.test.userregion.springdm" version="2.1" scoped="false" atomic="false"
+<plan name="org.eclipse.virgo.kernel.test.userregion.springdm" version="3.0" scoped="false" atomic="false"
                 xmlns="http://www.springsource.org/schema/dm-server/plan"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="
                         http://www.springsource.org/schema/dm-server/plan 
                         http://www.springsource.org/schema/dm-server/plan/springsource-dm-server-plan.xsd">
 
-        <artifact type="bundle" name="com.springsource.kernel.agent.dm" version="[2.2, 3.0)"/>
-        <artifact type="bundle" name="org.eclipse.virgo.kernel.deployer.dm" version="[2.2, 3.0)"/>
+        <artifact type="bundle" name="com.springsource.kernel.agent.dm" version="[3.0, 4.0)"/>
+        <artifact type="bundle" name="org.eclipse.virgo.kernel.deployer.dm" version="[3.0, 4.0)"/>
 </plan>
diff --git a/org.eclipse.virgo.kernel.test/src/test/resources/monitor/lazy/META-INF/MANIFEST.MF b/org.eclipse.virgo.kernel.test/src/test/resources/monitor/lazy/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..0188db8
--- /dev/null
+++ b/org.eclipse.virgo.kernel.test/src/test/resources/monitor/lazy/META-INF/MANIFEST.MF
@@ -0,0 +1,4 @@
+Manifest-Version: 1
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: monitor.lazy
+Bundle-ActivationPolicy: lazy
diff --git a/org.eclipse.virgo.kernel.test/src/test/resources/monitor/lazy/META-INF/spring/context.xml b/org.eclipse.virgo.kernel.test/src/test/resources/monitor/lazy/META-INF/spring/context.xml
new file mode 100644
index 0000000..974f02f
--- /dev/null
+++ b/org.eclipse.virgo.kernel.test/src/test/resources/monitor/lazy/META-INF/spring/context.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans:beans xmlns="http://www.springframework.org/schema/osgi"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:beans="http://www.springframework.org/schema/beans"
+	xsi:schemaLocation="http://www.springframework.org/schema/osgi  
+       http://www.springframework.org/schema/osgi/spring-osgi.xsd
+       http://www.springframework.org/schema/beans   
+       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+       
+      
+</beans:beans>
diff --git a/org.eclipse.virgo.kernel.test/template.mf b/org.eclipse.virgo.kernel.test/template.mf
index cea124e..26e6a80 100644
--- a/org.eclipse.virgo.kernel.test/template.mf
+++ b/org.eclipse.virgo.kernel.test/template.mf
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Virgo Kernel Test
 Bundle-SymbolicName: org.eclipse.virgo.kernel.test
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
 Import-Template: 
  org.eclipse.virgo.kernel.*;version="${version:[=.=.=, +1)}",
  org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, +1)}",
diff --git a/org.eclipse.virgo.kernel.userregion/.classpath b/org.eclipse.virgo.kernel.userregion/.classpath
index 40a7695..3d671b2 100644
--- a/org.eclipse.virgo.kernel.userregion/.classpath
+++ b/org.eclipse.virgo.kernel.userregion/.classpath
@@ -22,27 +22,27 @@
 	</classpathentry>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/2.2.0.D-20101207150849/org.eclipse.virgo.medic-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-sources-1.6.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-1.6.1.jar" sourcepath="/KERNEL_IVY_CACHE/org.slf4j/com.springsource.slf4j.nop/1.6.1/com.springsource.slf4j.nop-sources-1.6.1.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.aspectj/com.springsource.org.aspectj.runtime/1.6.6.RELEASE/com.springsource.org.aspectj.runtime-1.6.6.RELEASE.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-2.2.0.D-20101207151510.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/2.2.0.D-20101207151510/org.eclipse.virgo.repository-sources-2.2.0.D-20101207151510.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.2.0.D-20101207150035/org.eclipse.virgo.util.common-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/2.2.0.D-20101207150035/org.eclipse.virgo.util.math-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/2.2.0.D-20101207150035/org.eclipse.virgo.util.math-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/2.2.0.D-20101207145732/org.eclipse.virgo.osgi.extensions.equinox-2.2.0.D-20101207145732.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/2.0.0.D-20090913205430/org.eclipse.virgo.osgi.extensions.equinox-sources-2.0.0.D-20090913205430.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/2.2.0.D-20101207150035/org.eclipse.virgo.util.io-sources-2.2.0.D-20101207150035.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-2.2.0.D-20101207150035.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-sources-2.2.0.D-20101207150035.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-3.0.0.D-20110309170144.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.repository/org.eclipse.virgo.repository/3.0.0.D-20110309170144/org.eclipse.virgo.repository-sources-3.0.0.D-20110309170144.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/3.0.0.M02/org.eclipse.virgo.util.common-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.math/3.0.0.M02/org.eclipse.virgo.util.math-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/3.0.0.M02/org.eclipse.virgo.osgi.extensions.equinox-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.extensions.equinox/2.0.0.D-20090913205430/org.eclipse.virgo.osgi.extensions.equinox-sources-2.0.0.D-20090913205430.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.0.0.M02/org.eclipse.virgo.util.io-sources-3.0.0.M02.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-sources-3.0.0.M02.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.services"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/2.2.0.D-20101207145338/org.eclipse.virgo.teststubs.osgi-2.2.0.D-20101207145338.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/1.0.0.CI-B39/org.eclipse.virgo.teststubs.osgi-sources-1.0.0.CI-B39.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-2.2.0.D-20101207150849.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/2.2.0.D-20101207150849/org.eclipse.virgo.medic.test-sources-2.2.0.D-20101207150849.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/1.0.0.CI-B39/org.eclipse.virgo.teststubs.osgi-sources-1.0.0.CI-B39.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.test/3.0.0.M02/org.eclipse.virgo.medic.test-sources-3.0.0.M02.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.artifact"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.deployer"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.apache.felix/org.apache.felix.eventadmin/1.0.0/org.apache.felix.eventadmin-1.0.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.apache.felix/org.apache.felix.eventadmin/1.0.0/org.apache.felix.eventadmin-sources-1.0.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-3.3.0.v20101018.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20101018/org.eclipse.osgi.services-sources-3.3.0.v20101018.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-3.3.0.v20110110.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110110/org.eclipse.osgi.services-sources-3.3.0.v20110110.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.equinox.event/1.2.100.v20110110/org.eclipse.equinox.event-1.2.100.v20110110.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/org.eclipse.virgo.kernel.userregion/ivy.xml b/org.eclipse.virgo.kernel.userregion/ivy.xml
index 85b109b..8bbf7e9 100644
--- a/org.eclipse.virgo.kernel.userregion/ivy.xml
+++ b/org.eclipse.virgo.kernel.userregion/ivy.xml
@@ -18,6 +18,7 @@
         <dependency org="org.eclipse.virgo.medic" name='org.eclipse.virgo.medic' rev='${org.eclipse.virgo.medic}' conf='aspects, compile->runtime' />
         <dependency org="org.eclipse.virgo.medic" name="org.eclipse.virgo.medic.test" rev="${org.eclipse.virgo.medic}" conf="test->runtime"/>
         <dependency org="org.eclipse.osgi" name='org.eclipse.osgi' rev='${org.eclipse.osgi}' conf='compile->compile' />
+		<dependency org="org.eclipse.osgi" name="org.eclipse.equinox.event" rev="${org.eclipse.equinox.event}" conf="compile->compile"/>
         <dependency org="org.slf4j" name='com.springsource.slf4j.api' rev='${org.slf4j}' conf='compile->runtime' />
         <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.services" rev="latest.integration" conf="compile->compile"/>
         <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.artifact" rev="latest.integration" conf="compile->compile"/> 
diff --git a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/Activator.java b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/Activator.java
index dadecb4..e82de77 100644
--- a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/Activator.java
+++ b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/Activator.java
@@ -31,6 +31,7 @@
 import org.eclipse.virgo.kernel.osgi.framework.OsgiServiceHolder;
 import org.eclipse.virgo.kernel.osgi.framework.PackageAdminUtil;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiFrameworkFactory;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
 import org.eclipse.virgo.kernel.shim.scope.ScopeFactory;
 import org.eclipse.virgo.kernel.userregion.internal.equinox.EquinoxHookRegistrar;
 import org.eclipse.virgo.kernel.userregion.internal.equinox.EquinoxOsgiFramework;
@@ -43,6 +44,7 @@
 import org.eclipse.virgo.kernel.userregion.internal.quasi.StandardResolutionFailureDetective;
 import org.eclipse.virgo.medic.dump.DumpContributor;
 import org.eclipse.virgo.medic.eventlog.EventLogger;
+import org.eclipse.virgo.medic.eventlog.EventLoggerFactory;
 import org.eclipse.virgo.osgi.extensions.equinox.hooks.MetaInfResourceClassLoaderDelegateHook;
 import org.eclipse.virgo.repository.Repository;
 import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
@@ -91,7 +93,9 @@
         Repository repository = OsgiFrameworkUtils.getService(context, Repository.class).getService();
         PackageAdmin packageAdmin = OsgiFrameworkUtils.getService(context, PackageAdmin.class).getService();
 
-        EventLogger eventLogger = OsgiFrameworkUtils.getService(context, EventLogger.class).getService();
+        EventLogger eventLogger = OsgiFrameworkUtils.getService(context, EventLoggerFactory.class).getService().createEventLogger(context.getBundle());
+        
+        RegionDigraph regionDigraph = OsgiFrameworkUtils.getService(context, RegionDigraph.class).getService();
 
         ImportExpansionHandler importExpansionHandler = createImportExpansionHandler(context, packageAdmin, repository, eventLogger);
         this.registrationTracker.track(context.registerService(ImportExpander.class.getName(), importExpansionHandler, null));
@@ -104,7 +108,7 @@
         DumpContributor dumpContributor = createResolutionDumpContributor(context);
         this.registrationTracker.track(context.registerService(DumpContributor.class.getName(), dumpContributor, null));
 
-        QuasiFrameworkFactory quasiFrameworkFactory = createQuasiFrameworkFactory(context, rfd, repository, bundleTransformerHandler);
+        QuasiFrameworkFactory quasiFrameworkFactory = createQuasiFrameworkFactory(context, rfd, repository, bundleTransformerHandler, regionDigraph);
         this.registrationTracker.track(context.registerService(QuasiFrameworkFactory.class.getName(), quasiFrameworkFactory, null));
 
         EquinoxHookRegistrar hookRegistrar = createHookRegistrar(context, packageAdmin, bundleTransformerHandler);
@@ -138,8 +142,8 @@
     }
 
     private QuasiFrameworkFactory createQuasiFrameworkFactory(BundleContext bundleContext, ResolutionFailureDetective detective,
-        Repository repository, TransformedManifestProvidingBundleFileWrapper bundleTransformerHandler) {
-        return new StandardQuasiFrameworkFactory(bundleContext, detective, repository, bundleTransformerHandler);
+        Repository repository, TransformedManifestProvidingBundleFileWrapper bundleTransformerHandler, RegionDigraph regionDigraph) {
+        return new StandardQuasiFrameworkFactory(bundleContext, detective, repository, bundleTransformerHandler, regionDigraph);
     }
 
     private TransformedManifestProvidingBundleFileWrapper createBundleTransformationHandler(ImportExpansionHandler importExpander) {
diff --git a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/InitialArtifactDeployer.java b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/InitialArtifactDeployer.java
index 7dda4a2..4c02d41 100644
--- a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/InitialArtifactDeployer.java
+++ b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/InitialArtifactDeployer.java
@@ -25,7 +25,7 @@
 import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
 import org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 import org.eclipse.virgo.medic.eventlog.EventLogger;
 import org.eclipse.virgo.util.common.StringUtils;
 
diff --git a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/equinox/UsesAnalyser.java b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/equinox/UsesAnalyser.java
index 1833132..9e5dacf 100644
--- a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/equinox/UsesAnalyser.java
+++ b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/equinox/UsesAnalyser.java
@@ -292,7 +292,7 @@
 
     private final static String stringOf(BundleDescription bundle) {
         StringBuilder sb = new StringBuilder("'");
-        sb.append(bundle.getSymbolicName()).append("_").append(bundle.getVersion()).append("'");
+        sb.append(bundle.getSymbolicName()).append("_").append(bundle.getVersion()).append("[").append(bundle.getBundleId()).append("]").append("'");
         return sb.toString();
     }
 
diff --git a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/importexpansion/AbstractTrackedPackageImports.java b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/importexpansion/AbstractTrackedPackageImports.java
index b2b1919..b6e14df 100644
--- a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/importexpansion/AbstractTrackedPackageImports.java
+++ b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/importexpansion/AbstractTrackedPackageImports.java
@@ -133,10 +133,7 @@
         Map<String, String> targetAttributes = targetPackageImport.getAttributes();
         Map<String, String> sourceAttributes = sourceImportToMerge.getAttributes();
 
-        mergeVersionRanges(targetPackageImport, sourceImportToMerge);
-
-        mergeBundleVersionRanges(targetPackageImport, sourceImportToMerge);
-
+        // Merge attributes before versions so, for example, conflicting bundle symbolic names take precedence over disjoint bundle version ranges.
         for (Entry<String, String> sourceAttributeEntry : sourceAttributes.entrySet()) {
             String sourceAttributeName = sourceAttributeEntry.getKey();
             if (!isVersionAttribute(sourceAttributeName)) {
@@ -146,13 +143,17 @@
                     if (!targetAttributeValue.equals(sourceAttributeValue)) {
                         throw new ImportMergeException(targetPackageImport.getPackageName(), getPackageSources(targetPackageImport),
                             "conflicting values '" + sourceAttributeValue + "', '" + targetAttributeValue + "' of attribute '" + sourceAttributeName
-                                + "'");
+                            + "'");
                     }
                 } else {
                     targetAttributes.put(sourceAttributeName, sourceAttributeValue);
                 }
             }
         }
+        
+        mergeVersionRanges(targetPackageImport, sourceImportToMerge);
+
+        mergeBundleVersionRanges(targetPackageImport, sourceImportToMerge);
     }
 
     /**
diff --git a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/DependencyCalculator.java b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/DependencyCalculator.java
index 6bd9bc9..d535649 100644
--- a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/DependencyCalculator.java
+++ b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/DependencyCalculator.java
@@ -37,23 +37,24 @@
 import org.eclipse.osgi.service.resolver.StateObjectFactory;
 import org.eclipse.osgi.service.resolver.VersionConstraint;
 import org.eclipse.osgi.service.resolver.VersionRange;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Version;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
+import org.eclipse.virgo.kernel.artifact.bundle.BundleBridge;
 import org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependenciesException;
 import org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyDependenciesException;
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph.FilteredRegion;
+import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
 import org.eclipse.virgo.kernel.userregion.internal.equinox.ResolutionDumpContributor;
 import org.eclipse.virgo.kernel.userregion.internal.quasi.ResolutionFailureDetective.ResolverErrorsHolder;
-
-import org.eclipse.virgo.kernel.artifact.bundle.BundleBridge;
 import org.eclipse.virgo.medic.dump.DumpGenerator;
 import org.eclipse.virgo.repository.ArtifactDescriptor;
 import org.eclipse.virgo.repository.Attribute;
 import org.eclipse.virgo.repository.Query;
 import org.eclipse.virgo.repository.Repository;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Calculates the dependencies of a given set of {@link BundleDescription BundleDescriptions}.
@@ -66,11 +67,13 @@
  */
 public final class DependencyCalculator {
 
+    private static final String REGION_LOCATION_DELIMITER = "@";
+
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
     private final ResolutionFailureDetective detective;
 
-    private final AtomicLong bundleId = new AtomicLong(System.currentTimeMillis());
+    private final AtomicLong nextBundleId = new AtomicLong(System.currentTimeMillis());
 
     private final Repository repository;
 
@@ -80,12 +83,14 @@
 
     private final DumpGenerator dumpGenerator;
 
+    private Region coregion;
+
     public DependencyCalculator(StateObjectFactory stateObjectFactory, ResolutionFailureDetective detective, Repository repository,
         BundleContext bundleContext) {
         this.repository = repository;
         this.detective = detective;
         this.stateObjectFactory = stateObjectFactory;
-        this.dumpGenerator = (DumpGenerator) bundleContext.getService(bundleContext.getServiceReference(DumpGenerator.class.getName()));
+        this.dumpGenerator = bundleContext.getService(bundleContext.getServiceReference(DumpGenerator.class));
     }
 
     /**
@@ -108,63 +113,69 @@
      * returned depending on whether cloning some bundles may improve the chances of satisfying the constraints.
      * 
      * @param state the <code>State</code> to satisfy against.
+     * @param coregion the coregion containing the side-state bundles
      * @param bundles the bundles to calculate dependencies for.
      * @return an array of descriptions of bundles that need to be added to the state to satisfy constraints.
-     * @throws BundleException 
-     * @throws UnableToSatisfyDependenciesException 
+     * @throws BundleException
+     * @throws UnableToSatisfyDependenciesException
      */
-    public BundleDescription[] calculateDependencies(State state, BundleDescription[] bundles) throws BundleException,
+    public BundleDescription[] calculateDependencies(State state, Region coregion, BundleDescription[] bundles) throws BundleException,
         UnableToSatisfyDependenciesException {
         this.logger.info("Calculating missing dependencies of bundle(s) '{}'", bundles);
         synchronized (this.monitor) {
+            this.coregion = coregion;
+            try {
+                doSatisfyConstraints(bundles, state);
 
-            doSatisfyConstraints(bundles, state);
+                StateDelta delta = state.resolve(bundles);
 
-            StateDelta delta = state.resolve(bundles);
+                for (BundleDescription description : bundles) {
+                    if (!description.isResolved()) {
+                        generateDump(state);
 
-            for (BundleDescription description : bundles) {
-                if (!description.isResolved()) {
-                    generateDump(state);
+                        ResolverErrorsHolder reh = new ResolverErrorsHolder();
+                        String failure = this.detective.generateFailureDescription(state, description, reh);
 
-                    ResolverErrorsHolder reh = new ResolverErrorsHolder();
-                    String failure = this.detective.generateFailureDescription(state, description, reh);
-
-                    ResolverError[] resolverErrors = reh.getResolverErrors();
-                    if (resolverErrors != null) {
-                        for (ResolverError resolverError : resolverErrors) {
-                            if (resolverError.getType() == ResolverError.IMPORT_PACKAGE_USES_CONFLICT) {
-                                VersionConstraint unsatisfiedConstraint = resolverError.getUnsatisfiedConstraint();
-                                if ((unsatisfiedConstraint instanceof ImportPackageSpecification)) {
-                                    ImportPackageSpecification importPackageSpecification = (ImportPackageSpecification) unsatisfiedConstraint;
-                                    this.logger.debug("Uses conflict: package '{}' version '{}' bundle '{}' version '{}'", new Object[] {
-                                        importPackageSpecification.getName(), importPackageSpecification.getVersionRange(),
-                                        importPackageSpecification.getBundleSymbolicName(), importPackageSpecification.getBundleVersionRange() });
+                        ResolverError[] resolverErrors = reh.getResolverErrors();
+                        if (resolverErrors != null) {
+                            for (ResolverError resolverError : resolverErrors) {
+                                if (resolverError.getType() == ResolverError.IMPORT_PACKAGE_USES_CONFLICT) {
+                                    VersionConstraint unsatisfiedConstraint = resolverError.getUnsatisfiedConstraint();
+                                    if (unsatisfiedConstraint instanceof ImportPackageSpecification) {
+                                        ImportPackageSpecification importPackageSpecification = (ImportPackageSpecification) unsatisfiedConstraint;
+                                        this.logger.debug("Uses conflict: package '{}' version '{}' bundle '{}' version '{}'", new Object[] {
+                                            importPackageSpecification.getName(), importPackageSpecification.getVersionRange(),
+                                            importPackageSpecification.getBundleSymbolicName(), importPackageSpecification.getBundleVersionRange() });
+                                    }
                                 }
                             }
                         }
+
+                        throw new UnableToSatisfyBundleDependenciesException(description.getSymbolicName(), description.getVersion(), failure, state,
+                            reh.getResolverErrors());
                     }
-
-                    throw new UnableToSatisfyBundleDependenciesException(description.getSymbolicName(), description.getVersion(), failure, state,
-                        reh.getResolverErrors());
                 }
+
+                BundleDelta[] deltas = delta.getChanges(BundleDelta.ADDED, false);
+                Set<BundleDescription> newBundles = new HashSet<BundleDescription>();
+
+                for (BundleDelta bundleDelta : deltas) {
+                    newBundles.add(bundleDelta.getBundle());
+                }
+
+                Set<BundleDescription> dependenciesSet = getNewTransitiveDependencies(new HashSet<BundleDescription>(Arrays.asList(bundles)),
+                    newBundles);
+
+                List<BundleDescription> dependencies = new ArrayList<BundleDescription>(dependenciesSet);
+                this.logger.info("The dependencies of '{}' are '{}'", Arrays.toString(bundles), dependencies);
+
+                Collections.sort(dependencies, new BundleDescriptionComparator());
+
+                BundleDescription[] dependencyDescriptions = dependencies.toArray(new BundleDescription[dependencies.size()]);
+                return dependencyDescriptions;
+            } finally {
+                this.coregion = null;
             }
-
-            BundleDelta[] deltas = delta.getChanges(BundleDelta.ADDED, false);
-            Set<BundleDescription> newBundles = new HashSet<BundleDescription>();
-
-            for (BundleDelta bundleDelta : deltas) {
-                newBundles.add(bundleDelta.getBundle());
-            }
-
-            Set<BundleDescription> dependenciesSet = getNewTransitiveDependencies(new HashSet<BundleDescription>(Arrays.asList(bundles)), newBundles);
-
-            List<BundleDescription> dependencies = new ArrayList<BundleDescription>(dependenciesSet);
-            this.logger.info("The dependencies of '{}' are '{}'", Arrays.toString(bundles), dependencies);
-
-            Collections.sort(dependencies, new BundleDescriptionComparator());
-
-            BundleDescription[] dependencyDescriptions = dependencies.toArray(new BundleDescription[dependencies.size()]);
-            return dependencyDescriptions;
         }
     }
 
@@ -249,6 +260,7 @@
         for (BundleDescription constraintSatisfier : constraintsSatisfiers) {
             if (!isBundlePresentInState(constraintSatisfier.getName(), constraintSatisfier.getVersion(), state)) {
                 state.addBundle(constraintSatisfier);
+                this.coregion.addBundle(constraintSatisfier.getBundleId());
                 doSatisfyConstraints(constraintSatisfier, state);
             }
         }
@@ -340,23 +352,37 @@
     }
 
     private boolean isBundlePresentInState(String bundleSymbolicName, Version version, State state) {
-        return state.getBundle(bundleSymbolicName, version) != null;
+        BundleDescription[] bundleDescriptions = state.getBundles(bundleSymbolicName);
+        for (BundleDescription bundleDescription : bundleDescriptions) {
+            if (bundleDescription.getVersion().equals(version)) {
+                //XXX Refactoring required here. This temporary code only traverses the coregion and user region.
+                Set<FilteredRegion> edges = this.coregion.getEdges();
+                FilteredRegion edge = edges.iterator().next();
+                Region userRegion = edge.getRegion();
+                RegionFilter filter = edge.getFilter();
+                long bundleId = bundleDescription.getBundleId();
+                if ((bundleId == 0L || this.coregion.contains(bundleId) || (filter.isBundleAllowed(bundleSymbolicName, version) && userRegion.contains(bundleId)))) {
+                    return true;
+                }
+            }
+
+        }
+        return false;
     }
 
     private BundleDescription createBundleDescription(ArtifactDescriptor artifact, State state) throws BundleException {
         Dictionary<String, String> manifest = BundleBridge.convertToDictionary(artifact);
         try {
             URI uri = artifact.getUri();
-            if ("file".equals(uri.getScheme())) {
-                return this.stateObjectFactory.createBundleDescription(state, manifest, new File(uri).getAbsolutePath(),
-                    this.bundleId.getAndIncrement());
-            } else {
-                return this.stateObjectFactory.createBundleDescription(state, manifest, uri.toString(), this.bundleId.getAndIncrement());
-            }
+            String installLocation = "file".equals(uri.getScheme()) ? new File(uri).getAbsolutePath() : uri.toString();
+            BundleDescription bundleDescription = this.stateObjectFactory.createBundleDescription(state, manifest, this.coregion.getName()
+                + REGION_LOCATION_DELIMITER + installLocation, this.nextBundleId.getAndIncrement());
+            this.coregion.addBundle(bundleDescription.getBundleId());
+            return bundleDescription;
         } catch (RuntimeException e) {
             throw new BundleException("Unable to read bundle at '" + artifact.getUri() + "'", e);
         } catch (BundleException be) {
-        	throw new BundleException("Failed to create BundleDescriptor for artifact at '" + artifact.getUri() + "'", be);
+            throw new BundleException("Failed to create BundleDescriptor for artifact at '" + artifact.getUri() + "'", be);
         }
     }
 
@@ -371,6 +397,6 @@
     }
 
     public long getNextBundleId() {
-        return this.bundleId.getAndIncrement();
+        return this.nextBundleId.getAndIncrement();
     }
 }
diff --git a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StandardQuasiFramework.java b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StandardQuasiFramework.java
index edb8fe9..987b1fc 100644
--- a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StandardQuasiFramework.java
+++ b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StandardQuasiFramework.java
@@ -12,7 +12,11 @@
 package org.eclipse.virgo.kernel.userregion.internal.quasi;
 
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
 import java.net.URI;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Dictionary;
@@ -20,6 +24,7 @@
 import java.util.List;
 import java.util.Set;
 
+import org.eclipse.osgi.internal.resolver.StateImpl;
 import org.eclipse.osgi.service.resolver.BundleDescription;
 import org.eclipse.osgi.service.resolver.ImportPackageSpecification;
 import org.eclipse.osgi.service.resolver.PlatformAdmin;
@@ -28,25 +33,30 @@
 import org.eclipse.osgi.service.resolver.StateHelper;
 import org.eclipse.osgi.service.resolver.StateObjectFactory;
 import org.eclipse.osgi.service.resolver.VersionConstraint;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
+import org.eclipse.virgo.kernel.core.FatalKernelException;
 import org.eclipse.virgo.kernel.osgi.framework.ManifestTransformer;
 import org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyDependenciesException;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiFramework;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiResolutionFailure;
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
 import org.eclipse.virgo.kernel.userregion.internal.equinox.TransformedManifestProvidingBundleFileWrapper;
 import org.eclipse.virgo.kernel.userregion.internal.quasi.ResolutionFailureDetective.ResolverErrorsHolder;
 import org.eclipse.virgo.repository.Repository;
 import org.eclipse.virgo.util.common.StringUtils;
 import org.eclipse.virgo.util.osgi.VersionRange;
 import org.eclipse.virgo.util.osgi.manifest.BundleManifest;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+import org.osgi.framework.hooks.resolver.ResolverHookFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * {@link StandardQuasiFramework} is the default implementation of {@link QuasiFramework}.
@@ -59,6 +69,14 @@
  */
 final class StandardQuasiFramework implements QuasiFramework {
 
+    private static final String REGION_LOCATION_DELIMITER = "@";
+
+    private static final String COREGION_SUFFIX = ".coregion";
+
+    private static final String REFERENCE_SCHEME = "reference:";
+
+    private static final String FILE_SCHEME = "file:";
+
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
     private final Object monitor = new Object();
@@ -71,7 +89,7 @@
      * Track the bundles which are explicitly installed. These are input to the resolve method.
      */
     private final List<StandardQuasiBundle> installedQuasiBundles = new ArrayList<StandardQuasiBundle>();
-    
+
     private volatile BundleDescription[] otherBundles;
 
     private final ResolutionFailureDetective detective;
@@ -81,17 +99,44 @@
     private final DependencyCalculator dependencyCalculator;
 
     private final StateHelper stateHelper;
-    
+
     private final TransformedManifestProvidingBundleFileWrapper bundleTransformationHandler;
 
-    StandardQuasiFramework(BundleContext bundleContext, State state, PlatformAdmin platformAdmin, ResolutionFailureDetective detective, Repository repository, TransformedManifestProvidingBundleFileWrapper bundleTransformationHandler) {
+    private final RegionDigraph regionDigraph;
+
+    private Region coregion;
+
+    private final Region userRegion;
+
+    StandardQuasiFramework(BundleContext bundleContext, State state, PlatformAdmin platformAdmin, ResolutionFailureDetective detective,
+        Repository repository, TransformedManifestProvidingBundleFileWrapper bundleTransformationHandler, RegionDigraph regionDigraph) {
         this.bundleContext = bundleContext;
         this.state = state;
         this.stateObjectFactory = platformAdmin.getFactory();
         this.detective = detective;
-        this.dependencyCalculator = new DependencyCalculator(platformAdmin.getFactory(), this.detective, repository, this.bundleContext);
         this.stateHelper = platformAdmin.getStateHelper();
         this.bundleTransformationHandler = bundleTransformationHandler;
+        this.regionDigraph = regionDigraph;
+        this.userRegion = regionDigraph.getRegion("org.eclipse.virgo.region.user");
+        setResolverHookFactory();
+
+        this.dependencyCalculator = new DependencyCalculator(platformAdmin.getFactory(), this.detective, repository, this.bundleContext);
+    }
+
+    private void setResolverHookFactory() {
+        // XXX Bug 332771: Temporary workaround since the resolver hook is not driven by default for State resolutions
+        if (this.state instanceof StateImpl) {
+            // Following not used as ServiceRegistry is a bit fiddly to get
+            // ResolverHookFactory resolverHookFactory = new CoreResolverHookFactory(xx,yy);
+            // ((StateImpl) this.state).setResolverHookFactory(resolverHookFactory);
+
+            ServiceReference<ResolverHookFactory> ref = this.bundleContext.getServiceReference(ResolverHookFactory.class);
+            if (ref != null) {
+                ResolverHookFactory resolverHookFactory = this.bundleContext.getService(ref);
+                ((StateImpl) this.state).setResolverHookFactory(resolverHookFactory);
+                this.bundleContext.ungetService(ref);
+            }
+        }
     }
 
     /**
@@ -99,19 +144,36 @@
      */
     public QuasiBundle install(URI location, BundleManifest bundleManifest) throws BundleException {
         synchronized (this.monitor) {
+            createCoregionIfNecessary();
             StandardQuasiBundle qb = doInstall(location, bundleManifest);
             this.installedQuasiBundles.add(qb);
             return qb;
         }
     }
 
+    private void createCoregionIfNecessary() {
+        synchronized (this.monitor) {
+            if (this.coregion == null) {
+                try {
+                    this.coregion = this.regionDigraph.createRegion(this.userRegion.getName() + COREGION_SUFFIX);
+                    this.userRegion.connectRegion(this.coregion, RegionFilter.TOP);
+                    this.coregion.connectRegion(this.userRegion, RegionFilter.TOP);
+                } catch (BundleException e) {
+                    // should never happen
+                    throw new FatalKernelException("Failed to create coregion", e);
+                }
+            }
+        }
+    }
+
     private StandardQuasiBundle doInstall(URI location, BundleManifest bundleManifest) throws BundleException {
         try {
             Dictionary<String, String> manifest = bundleManifest.toDictionary();
             String installLocation = "file".equals(location.getScheme()) ? new File(location).getAbsolutePath() : location.toString();
-            BundleDescription bundleDescription = this.stateObjectFactory.createBundleDescription(this.state, manifest, installLocation,
-                nextBundleId());
+            BundleDescription bundleDescription = this.stateObjectFactory.createBundleDescription(this.state, manifest, this.coregion.getName()
+                + REGION_LOCATION_DELIMITER + installLocation, nextBundleId());
             this.state.addBundle(bundleDescription);
+            this.coregion.addBundle(bundleDescription.getBundleId());
             return new StandardQuasiBundle(bundleDescription, bundleManifest, this.stateHelper);
         } catch (RuntimeException e) {
             throw new BundleException("Unable to read bundle at '" + location + "'", e);
@@ -145,7 +207,7 @@
     public QuasiBundle getBundle(long bundleId) {
         QuasiBundle quasiBundle = null;
         BundleDescription bundleDescription = this.state.getBundle(bundleId);
-        if (bundleDescription!= null) {
+        if (bundleDescription != null) {
             quasiBundle = new StandardQuasiBundle(bundleDescription, null, this.stateHelper);
         }
         return quasiBundle;
@@ -157,7 +219,7 @@
     public QuasiBundle getBundle(String name, Version version) {
         QuasiBundle quasiBundle = null;
         BundleDescription bundleDescription = this.state.getBundle(name, version);
-        if (bundleDescription!= null) {
+        if (bundleDescription != null) {
             quasiBundle = new StandardQuasiBundle(bundleDescription, null, this.stateHelper);
         }
         return quasiBundle;
@@ -169,8 +231,8 @@
     public List<QuasiResolutionFailure> resolve() {
         synchronized (this.monitor) {
             BundleDescription[] bundles = getBundleDescriptionArray();
-            BundleDescription[] dependencies = getDependencies(bundles);            
-            
+            BundleDescription[] dependencies = getDependencies(bundles);
+
             this.otherBundles = dependencies;
 
             List<QuasiResolutionFailure> failures = getFailures();
@@ -189,12 +251,14 @@
         BundleDescription bundleDescription = this.state.getBundle(bundleId);
         ResolverErrorsHolder reh = new ResolverErrorsHolder();
         String failureDescription = this.detective.generateFailureDescription(this.state, bundleDescription, reh);
-        return this.processResolverErrors(reh.getResolverErrors(), new StandardQuasiBundle(bundleDescription, null, this.stateHelper), failureDescription);
+        return this.processResolverErrors(reh.getResolverErrors(), new StandardQuasiBundle(bundleDescription, null, this.stateHelper),
+            failureDescription);
     }
 
     private BundleDescription[] getDependencies(BundleDescription[] bundles) {
+        createCoregionIfNecessary();
         try {
-            return this.dependencyCalculator.calculateDependencies(this.state, bundles);
+            return this.dependencyCalculator.calculateDependencies(this.state, this.coregion, bundles);
         } catch (BundleException e) {
             return new BundleDescription[0];
         } catch (UnableToSatisfyDependenciesException utsde) {
@@ -215,8 +279,8 @@
         }
         return failures;
     }
-    
-    private List<QuasiResolutionFailure> processResolverErrors(ResolverError[] resolverErrors, QuasiBundle quasiBundle, String failureDescription){
+
+    private List<QuasiResolutionFailure> processResolverErrors(ResolverError[] resolverErrors, QuasiBundle quasiBundle, String failureDescription) {
         List<QuasiResolutionFailure> processedResolverErrors = new ArrayList<QuasiResolutionFailure>();
         boolean added = false;
         if (resolverErrors != null) {
@@ -242,16 +306,17 @@
         return processedResolverErrors;
     }
 
-    private PackageQuasiResolutionFailure createPackageResolutionFailure(QuasiBundle quasiBundle, String failureDescription, VersionConstraint unsatisfiedConstraint) {
+    private PackageQuasiResolutionFailure createPackageResolutionFailure(QuasiBundle quasiBundle, String failureDescription,
+        VersionConstraint unsatisfiedConstraint) {
         ImportPackageSpecification importPackageSpecification = (ImportPackageSpecification) unsatisfiedConstraint;
         String pkgName = importPackageSpecification.getName();
         VersionRange pkgVersionRange = convertVersionRange(importPackageSpecification.getVersionRange());
         String bundleSymbolicName = importPackageSpecification.getBundleSymbolicName();
         VersionRange bundleVersionRange = convertVersionRange(importPackageSpecification.getBundleVersionRange());
-        this.logger.debug("Missing import: package '{}' version '{}' bundle '{}' version '{}'", new Object[] { pkgName, pkgVersionRange,
-            bundleSymbolicName, bundleVersionRange });
-        return new PackageQuasiResolutionFailure(failureDescription, quasiBundle, pkgName, pkgVersionRange,
-            bundleSymbolicName, bundleVersionRange);
+        long bundleId = importPackageSpecification.getBundle().getBundleId();
+        this.logger.debug("Missing import: package '{}' version '{}' bundle '{}' version '{}' id '{}'", new Object[] { pkgName, pkgVersionRange,
+            bundleSymbolicName, bundleVersionRange, bundleId });
+        return new PackageQuasiResolutionFailure(failureDescription, quasiBundle, pkgName, pkgVersionRange, bundleSymbolicName, bundleVersionRange);
     }
 
     private PackageUsesQuasiResolutionFailure createPackagesUsesResolutionFailure(QuasiBundle quasiBundle, String failureDescription,
@@ -261,10 +326,11 @@
         VersionRange pkgVersionRange = convertVersionRange(importPackageSpecification.getVersionRange());
         String bundleSymbolicName = importPackageSpecification.getBundleSymbolicName();
         VersionRange bundleVersionRange = convertVersionRange(importPackageSpecification.getBundleVersionRange());
-        this.logger.debug("Uses conflict: package '{}' version '{}' bundle '{}' version '{}'", new Object[] { pkgName, pkgVersionRange,
-            bundleSymbolicName, bundleVersionRange });
-        return new PackageUsesQuasiResolutionFailure(failureDescription, quasiBundle, pkgName,
-            pkgVersionRange, bundleSymbolicName, bundleVersionRange);
+        long bundleId = importPackageSpecification.getBundle().getBundleId();
+        this.logger.debug("Uses conflict: package '{}' version '{}' bundle '{}' version '{}' id '{}'", new Object[] { pkgName, pkgVersionRange,
+            bundleSymbolicName, bundleVersionRange, bundleId });
+        return new PackageUsesQuasiResolutionFailure(failureDescription, quasiBundle, pkgName, pkgVersionRange, bundleSymbolicName,
+            bundleVersionRange);
     }
 
     private static VersionRange convertVersionRange(org.eclipse.osgi.service.resolver.VersionRange versionRange) {
@@ -291,7 +357,7 @@
                 if (!failures.isEmpty()) {
                     throw new BundleException("Commit resolution failed: '" + failures.toString() + "'");
                 }
-            } else {            
+            } else {
                 try {
                     Set<Long> installedQuasiBundles = installQuasiBundles();
                     List<Bundle> installedDependencies = installOtherBundles(installedQuasiBundles);
@@ -322,8 +388,7 @@
             }
         }
     }
-    
-    
+
     // TODO Move this method into utils project
     private static boolean isFragmentBundle(Bundle bundle) {
         String fragmentHostHeader = (String) bundle.getHeaders().get(Constants.FRAGMENT_HOST);
@@ -336,7 +401,7 @@
             if (!installedQuasiBundles.contains(otherBundle.getBundleId())) {
                 try {
                     Bundle bundle = installBundleDescription(otherBundle);
-                    installedBundles.add(bundle);                       
+                    installedBundles.add(bundle);
                 } catch (BundleException e) {
                     for (Bundle bundle : installedBundles) {
                         try {
@@ -359,20 +424,28 @@
             String location = description.getLocation();
             ManifestTransformer manifestTransformer = new QuasiManifestTransformer(quasiBundle.getBundleManifest());
             this.bundleTransformationHandler.pushManifestTransformer(manifestTransformer);
-            
+
             try {
-                URI locationUri = new File(location).toURI();
-                Bundle bundle = this.bundleContext.installBundle(locationUri.toString());                
+                URI locationUri = new File(stripRegionTag(location)).toURI();
+                Bundle bundle = doInstallBundleInternal(locationUri.toString());
                 quasiBundle.setBundle(bundle);
                 installed.add(description.getBundleId());
             } finally {
                 this.bundleTransformationHandler.popManifestTransformer();
             }
-            
+
         }
         return installed;
     }
 
+    private String stripRegionTag(String location) {
+        int atPos = location.indexOf(REGION_LOCATION_DELIMITER);
+        if (atPos != -1) {
+            return location.substring(atPos + 1);
+        }
+        return location;
+    }
+
     private static final class QuasiManifestTransformer implements ManifestTransformer {
 
         private final BundleManifest bundleManifest;
@@ -390,13 +463,38 @@
     }
 
     private Bundle installBundleDescription(BundleDescription description) throws BundleException {
-        String location = description.getLocation();
+        String location = stripRegionTag(description.getLocation());
         String installLocation = location.startsWith("http:") ? location : new File(location).toURI().toString();
         return doInstallBundleInternal(installLocation);
     }
 
     private Bundle doInstallBundleInternal(String location) throws BundleException {
-        return this.bundleContext.installBundle(location);
+        return this.userRegion.installBundle(location, openBundleStream(location));
+    }
+
+    private InputStream openBundleStream(String location) throws BundleException {
+        String absoluteBundleUriString = getAbsoluteUriString(location);
+
+        try {
+            // Use the reference: scheme to obtain an InputStream for either a file or a directory.
+            return new URL(REFERENCE_SCHEME + absoluteBundleUriString).openStream();
+
+        } catch (MalformedURLException e) {
+            throw new BundleException("Invalid bundle URI '" + absoluteBundleUriString + "'", e);
+        } catch (IOException e) {
+            throw new BundleException("Invalid bundle at URI '" + absoluteBundleUriString + "'", e);
+        }
+    }
+
+    private String getAbsoluteUriString(String bundleUriString) throws BundleException {
+
+        if (!bundleUriString.startsWith(FILE_SCHEME)) {
+            throw new BundleException("'" + bundleUriString + "' which did not start with '" + FILE_SCHEME + "'");
+        }
+
+        String filePath = bundleUriString.substring(FILE_SCHEME.length());
+
+        return FILE_SCHEME + new File(filePath).getAbsolutePath();
     }
 
     private void uninstallQuasiBundles() {
@@ -412,4 +510,16 @@
             }
         }
     }
+
+    @Override
+    public void destroy() {
+        Region coregionCopy;
+        synchronized (this.monitor) {
+            coregionCopy = this.coregion;
+            this.coregion = null;
+        }
+        if (coregionCopy != null) {
+            this.regionDigraph.removeRegion(coregionCopy);
+        }
+    }
 }
diff --git a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StandardQuasiFrameworkFactory.java b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StandardQuasiFrameworkFactory.java
index ec91088..78297c9 100644
--- a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StandardQuasiFrameworkFactory.java
+++ b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StandardQuasiFrameworkFactory.java
@@ -20,18 +20,18 @@
 import org.eclipse.osgi.service.resolver.PlatformAdmin;
 import org.eclipse.osgi.service.resolver.State;
 import org.eclipse.osgi.service.resolver.StateObjectFactory;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkUtils;
 import org.eclipse.virgo.kernel.osgi.framework.OsgiServiceHolder;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiFramework;
 import org.eclipse.virgo.kernel.osgi.quasi.QuasiFrameworkFactory;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
 import org.eclipse.virgo.kernel.userregion.internal.equinox.TransformedManifestProvidingBundleFileWrapper;
 import org.eclipse.virgo.repository.Repository;
 import org.eclipse.virgo.util.io.FileSystemUtils;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * {@link StandardQuasiFrameworkFactory} is the default implementation of {@link QuasiFrameworkFactory}.
@@ -58,7 +58,9 @@
     
     private final TransformedManifestProvidingBundleFileWrapper bundleTransformationHandler;
 
-    public StandardQuasiFrameworkFactory(BundleContext bundleContext, ResolutionFailureDetective detective, Repository repository, TransformedManifestProvidingBundleFileWrapper bundleTransformationHandler) {
+    private final RegionDigraph userRegion;
+
+    public StandardQuasiFrameworkFactory(BundleContext bundleContext, ResolutionFailureDetective detective, Repository repository, TransformedManifestProvidingBundleFileWrapper bundleTransformationHandler, RegionDigraph regionDigraph) {
         this.bundleContext = bundleContext;
         this.platformAdmin = getPlatformAdminService(bundleContext);
         this.detective = detective;
@@ -66,20 +68,21 @@
         ServiceReference<PlatformAdmin> platformAdminServiceReference = bundleContext.getServiceReference(PlatformAdmin.class);
         this.stateManager = (StateManager) bundleContext.getService(platformAdminServiceReference);
         this.bundleTransformationHandler = bundleTransformationHandler;
+        this.userRegion = regionDigraph;
     }
 
     /**
      * {@inheritDoc}
      */
     public QuasiFramework create() {
-        return new StandardQuasiFramework(this.bundleContext, createState(), this.platformAdmin, this.detective, this.repository, this.bundleTransformationHandler);
+        return new StandardQuasiFramework(this.bundleContext, createState(), this.platformAdmin, this.detective, this.repository, this.bundleTransformationHandler, this.userRegion);
     }
     
     /** 
      * {@inheritDoc}
      */
     public QuasiFramework create(File stateDump) {
-        return new StandardQuasiFramework(this.bundleContext, readStateDump(stateDump), this.platformAdmin, this.detective, this.repository, this.bundleTransformationHandler);
+        return new StandardQuasiFramework(this.bundleContext, readStateDump(stateDump), this.platformAdmin, this.detective, this.repository, this.bundleTransformationHandler, this.userRegion);
     }
 
     @SuppressWarnings("deprecation")
diff --git a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StandardResolutionFailureDetective.java b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StandardResolutionFailureDetective.java
index 638b4ed..488f3f7 100644
--- a/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StandardResolutionFailureDetective.java
+++ b/org.eclipse.virgo.kernel.userregion/src/main/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StandardResolutionFailureDetective.java
@@ -221,8 +221,9 @@
 
     private void formatUsesConflict(ResolverError resolverError, StringBuilder sb, State state) {
         VersionConstraint unsatisfiedConstraint = resolverError.getUnsatisfiedConstraint();
+        BundleDescription bundle = resolverError.getBundle();
         sb.append("Uses violation: <").append(unsatisfiedConstraint)
-        .append("> in bundle <").append(resolverError.getBundle()).append(">\n");
+        .append("> in bundle <").append(bundle).append("[").append(bundle.getBundleId()).append("]").append(">\n");
         
         AnalysedUsesConflict[] usesConflicts = this.usesAnalyser.getUsesConflicts(state, resolverError);            
         if (usesConflicts==null || usesConflicts.length==0) {
diff --git a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/InitialArtifactDeployerTests.java b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/InitialArtifactDeployerTests.java
index c4ea92b..d83b3bc 100644
--- a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/InitialArtifactDeployerTests.java
+++ b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/InitialArtifactDeployerTests.java
@@ -31,7 +31,7 @@
 import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer;
 import org.eclipse.virgo.kernel.deployer.core.DeployUriNormaliser;
 import org.eclipse.virgo.kernel.deployer.core.DeploymentException;
-import org.eclipse.virgo.kernel.deployer.core.ApplicationDeployer.DeploymentOptions;
+import org.eclipse.virgo.kernel.deployer.core.DeploymentOptions;
 import org.eclipse.virgo.kernel.userregion.internal.InitialArtifactDeployer;
 import org.eclipse.virgo.kernel.userregion.internal.KernelStartedAwaiter;
 import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
diff --git a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/equinox/AbstractOsgiFrameworkLaunchingTests.java b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/equinox/AbstractOsgiFrameworkLaunchingTests.java
index 9f1285e..4106ed0 100644
--- a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/equinox/AbstractOsgiFrameworkLaunchingTests.java
+++ b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/equinox/AbstractOsgiFrameworkLaunchingTests.java
@@ -23,6 +23,28 @@
 
 import org.eclipse.osgi.launch.Equinox;
 import org.eclipse.osgi.service.resolver.PlatformAdmin;
+import org.eclipse.virgo.kernel.artifact.bundle.BundleBridge;
+import org.eclipse.virgo.kernel.artifact.library.LibraryBridge;
+import org.eclipse.virgo.kernel.osgi.framework.ImportExpander;
+import org.eclipse.virgo.kernel.osgi.quasi.QuasiFramework;
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.eclipse.virgo.kernel.osgi.region.internal.StandardRegionDigraph;
+import org.eclipse.virgo.kernel.services.repository.internal.RepositoryFactoryBean;
+import org.eclipse.virgo.kernel.userregion.internal.importexpansion.ImportExpansionHandler;
+import org.eclipse.virgo.kernel.userregion.internal.quasi.StandardQuasiFrameworkFactory;
+import org.eclipse.virgo.kernel.userregion.internal.quasi.StandardResolutionFailureDetective;
+import org.eclipse.virgo.medic.dump.DumpGenerator;
+import org.eclipse.virgo.medic.eventlog.EventLogger;
+import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
+import org.eclipse.virgo.osgi.extensions.equinox.EquinoxLauncherConfiguration;
+import org.eclipse.virgo.osgi.extensions.equinox.ExtendedEquinoxLauncher;
+import org.eclipse.virgo.osgi.extensions.equinox.hooks.PluggableClassLoadingHook;
+import org.eclipse.virgo.repository.ArtifactBridge;
+import org.eclipse.virgo.repository.Repository;
+import org.eclipse.virgo.repository.RepositoryFactory;
+import org.eclipse.virgo.repository.internal.RepositoryBundleActivator;
+import org.eclipse.virgo.util.io.FileSystemUtils;
 import org.junit.After;
 import org.junit.Before;
 import org.osgi.framework.BundleContext;
@@ -31,30 +53,6 @@
 import org.osgi.service.packageadmin.ExportedPackage;
 import org.osgi.service.packageadmin.PackageAdmin;
 
-import org.eclipse.virgo.kernel.osgi.framework.ImportExpander;
-import org.eclipse.virgo.kernel.osgi.quasi.QuasiFramework;
-import org.eclipse.virgo.kernel.services.repository.internal.RepositoryFactoryBean;
-import org.eclipse.virgo.kernel.userregion.internal.equinox.EquinoxOsgiFramework;
-import org.eclipse.virgo.kernel.userregion.internal.equinox.KernelClassLoaderCreator;
-import org.eclipse.virgo.kernel.userregion.internal.equinox.TransformedManifestProvidingBundleFileWrapper;
-import org.eclipse.virgo.kernel.userregion.internal.importexpansion.ImportExpansionHandler;
-import org.eclipse.virgo.kernel.userregion.internal.quasi.StandardQuasiFrameworkFactory;
-import org.eclipse.virgo.kernel.userregion.internal.quasi.StandardResolutionFailureDetective;
-
-import org.eclipse.virgo.osgi.extensions.equinox.EquinoxLauncherConfiguration;
-import org.eclipse.virgo.osgi.extensions.equinox.ExtendedEquinoxLauncher;
-import org.eclipse.virgo.osgi.extensions.equinox.hooks.PluggableClassLoadingHook;
-import org.eclipse.virgo.kernel.artifact.bundle.BundleBridge;
-import org.eclipse.virgo.kernel.artifact.library.LibraryBridge;
-import org.eclipse.virgo.medic.dump.DumpGenerator;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.eclipse.virgo.medic.test.eventlog.MockEventLogger;
-import org.eclipse.virgo.repository.ArtifactBridge;
-import org.eclipse.virgo.repository.Repository;
-import org.eclipse.virgo.repository.RepositoryFactory;
-import org.eclipse.virgo.repository.internal.RepositoryBundleActivator;
-import org.eclipse.virgo.util.io.FileSystemUtils;
-
 @SuppressWarnings("deprecation")
 public abstract class AbstractOsgiFrameworkLaunchingTests {
 
@@ -74,10 +72,14 @@
 
     private ServiceRegistration<DumpGenerator> dumpGeneratorRegistration;
 
+    private ServiceRegistration<RegionDigraph> regionDigraphRegistration;
+
     private Equinox equinox;
 
     protected QuasiFramework quasiFramework;
 
+    private ThreadLocal<Region> threadLocal;
+
     @Before
     public void setUp() throws Exception {
 
@@ -89,6 +91,9 @@
 
         // Uncomment this line to enable Equinox debugging
         // FrameworkProperties.setProperty("osgi.debug", "src/test/resources/debug.options");
+
+        // Uncomment thils line to enable Equinox console
+        // FrameworkProperties.setProperty("osgi.console", "2401");
         EquinoxLauncherConfiguration launcherConfiguration = new EquinoxLauncherConfiguration();
         launcherConfiguration.setClean(true);
         URI targetURI = new File("./target").toURI();
@@ -109,10 +114,17 @@
 
         };
 
+        this.threadLocal = new ThreadLocal<Region>();
+        RegionDigraph regionDigraph = new StandardRegionDigraph(this.bundleContext, this.threadLocal);
+
+        Region userRegion = regionDigraph.createRegion("org.eclipse.virgo.region.user");
+        userRegion.addBundle(this.bundleContext.getBundle());
+
         final EventLogger mockEventLogger = new MockEventLogger();
 
         eventLoggerRegistration = bundleContext.registerService(EventLogger.class, mockEventLogger, null);
         dumpGeneratorRegistration = bundleContext.registerService(DumpGenerator.class, dumpGenerator, null);
+        regionDigraphRegistration = bundleContext.registerService(RegionDigraph.class, regionDigraph, null);
 
         this.repositoryBundleActivator = new RepositoryBundleActivator();
         this.repositoryBundleActivator.start(bundleContext);
@@ -145,7 +157,7 @@
 
         PluggableClassLoadingHook.getInstance().setClassLoaderCreator(new KernelClassLoaderCreator());
         StandardResolutionFailureDetective detective = new StandardResolutionFailureDetective(platformAdmin);
-        this.quasiFramework = new StandardQuasiFrameworkFactory(bundleContext, detective, repository, bundleFileWrapper).create();
+        this.quasiFramework = new StandardQuasiFrameworkFactory(bundleContext, detective, repository, bundleFileWrapper, regionDigraph).create();
     }
 
     private ImportExpander createImportExpander(PackageAdmin packageAdmin) {
@@ -172,6 +184,11 @@
             this.dumpGeneratorRegistration = null;
         }
 
+        if (this.regionDigraphRegistration != null) {
+            this.regionDigraphRegistration.unregister();
+            this.regionDigraphRegistration = null;
+        }
+
         if (this.eventLoggerRegistration != null) {
             this.eventLoggerRegistration.unregister();
             this.eventLoggerRegistration = null;
diff --git a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/BundleDescriptionComparatorTests.java b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/BundleDescriptionComparatorTests.java
index a562d8c..299aa08 100644
--- a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/BundleDescriptionComparatorTests.java
+++ b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/BundleDescriptionComparatorTests.java
@@ -27,13 +27,12 @@
 import org.eclipse.osgi.service.resolver.ImportPackageSpecification;
 import org.eclipse.osgi.service.resolver.NativeCodeSpecification;
 import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.virgo.kernel.userregion.internal.quasi.BundleDescriptionComparator;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Version;
+import org.osgi.framework.wiring.BundleRequirement;
 import org.osgi.framework.wiring.BundleWiring;
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.WiredCapability;
+import org.osgi.framework.wiring.BundleCapability;
 
 
 public class BundleDescriptionComparatorTests {
@@ -253,12 +252,7 @@
         }
 
         @Override
-        public WiredCapability getWiredCapability() {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public List<Capability> getDeclaredCapabilities(String namespace) {
+        public List<BundleCapability> getDeclaredCapabilities(String namespace) {
             throw new UnsupportedOperationException();
         }
 
@@ -288,7 +282,22 @@
         }
 
         @Override
-        public BundleWiring getBundleWiring() {
+        public BundleCapability getCapability() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Map<String, Object> getAttributes() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public List<BundleRequirement> getDeclaredRequirements(String namespace) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public BundleWiring getWiring() {
             throw new UnsupportedOperationException();
         }
     }
diff --git a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBaseDescription.java b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBaseDescription.java
index 3a59f2d..0b18622 100644
--- a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBaseDescription.java
+++ b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBaseDescription.java
@@ -16,18 +16,8 @@
 import org.eclipse.osgi.service.resolver.BaseDescription;
 import org.eclipse.osgi.service.resolver.BundleDescription;
 import org.osgi.framework.Version;
-import org.osgi.framework.wiring.WiredCapability;
+import org.osgi.framework.wiring.BundleCapability;
 
-
-/**
- * TODO Document StubBaseDescription
- * <p />
- *
- * <strong>Concurrent Semantics</strong><br />
- *
- * TODO Document concurrent semantics of StubBaseDescription
- *
- */
 public class StubBaseDescription implements BaseDescription {
 
     private BundleDescription supplier;
@@ -80,7 +70,7 @@
      * {@inheritDoc}
      */
     @Override
-    public WiredCapability getWiredCapability() {
+    public BundleCapability getCapability() {
         throw new UnsupportedOperationException();
     }
 
diff --git a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleDescription.java b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleDescription.java
index a8e6919..e96e062 100644
--- a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleDescription.java
+++ b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleDescription.java
@@ -28,12 +28,10 @@
 import org.eclipse.osgi.service.resolver.VersionRange;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Version;
+import org.osgi.framework.wiring.BundleRequirement;
 import org.osgi.framework.wiring.BundleWiring;
-import org.osgi.framework.wiring.Capability;
-import org.osgi.framework.wiring.WiredCapability;
+import org.osgi.framework.wiring.BundleCapability;
 
-/**
- */
 public class StubBundleDescription implements BundleDescription {
 
     private String bsn;
@@ -182,6 +180,11 @@
                 throw new UnsupportedOperationException();
             }
 
+            @Override
+            public BundleRequirement getRequirement() {
+                throw new UnsupportedOperationException();
+            }
+
         };
     }
 
@@ -400,15 +403,7 @@
      * {@inheritDoc}
      */
     @Override
-    public WiredCapability getWiredCapability() {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public List<Capability> getDeclaredCapabilities(String namespace) {
+    public List<BundleCapability> getDeclaredCapabilities(String namespace) {
         throw new UnsupportedOperationException();
     }
     
@@ -456,7 +451,25 @@
      * {@inheritDoc}
      */
     @Override
-    public BundleWiring getBundleWiring() {
+    public BundleCapability getCapability() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Map<String, Object> getAttributes() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public List<BundleRequirement> getDeclaredRequirements(String namespace) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public BundleWiring getWiring() {
         throw new UnsupportedOperationException();
     }
 
diff --git a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleSpecification.java b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleSpecification.java
index 23aacf9..d8e5c34 100644
--- a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleSpecification.java
+++ b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubBundleSpecification.java
@@ -15,9 +15,8 @@
 import org.eclipse.osgi.service.resolver.BundleDescription;
 import org.eclipse.osgi.service.resolver.BundleSpecification;
 import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.wiring.BundleRequirement;
 
-/**
- */
 public class StubBundleSpecification implements BundleSpecification {
 
     private String name;
@@ -100,4 +99,9 @@
         this.supplier = supplier;
     }
 
+    @Override
+    public BundleRequirement getRequirement() {
+        throw new UnsupportedOperationException();
+    }
+
 }
diff --git a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubExportPackageDescription.java b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubExportPackageDescription.java
index ad31e24..9e869c8 100644
--- a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubExportPackageDescription.java
+++ b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubExportPackageDescription.java
@@ -16,10 +16,8 @@
 import org.eclipse.osgi.service.resolver.BundleDescription;
 import org.eclipse.osgi.service.resolver.ExportPackageDescription;
 import org.osgi.framework.Version;
-import org.osgi.framework.wiring.WiredCapability;
+import org.osgi.framework.wiring.BundleCapability;
 
-/**
- */
 public class StubExportPackageDescription extends StubParameterised implements ExportPackageDescription {
 
     private String name;
@@ -100,7 +98,7 @@
      * {@inheritDoc}
      */
     @Override
-    public WiredCapability getWiredCapability() {
+    public BundleCapability getCapability() {
         throw new UnsupportedOperationException();
     }
 
diff --git a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubImportPackageSpecification.java b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubImportPackageSpecification.java
index bb1c3ed..75df7e4 100644
--- a/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubImportPackageSpecification.java
+++ b/org.eclipse.virgo.kernel.userregion/src/test/java/org/eclipse/virgo/kernel/userregion/internal/quasi/StubImportPackageSpecification.java
@@ -15,6 +15,7 @@
 import org.eclipse.osgi.service.resolver.BundleDescription;
 import org.eclipse.osgi.service.resolver.ImportPackageSpecification;
 import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.wiring.BundleRequirement;
 
 /**
  */
@@ -106,4 +107,9 @@
         this.supplier = supplier;
     }
 
+    @Override
+    public BundleRequirement getRequirement() {
+        throw new UnsupportedOperationException();
+    }
+
 }
diff --git a/org.eclipse.virgo.kernel.userregion/template.mf b/org.eclipse.virgo.kernel.userregion/template.mf
index 5f77e51..e937ca1 100644
--- a/org.eclipse.virgo.kernel.userregion/template.mf
+++ b/org.eclipse.virgo.kernel.userregion/template.mf
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Virgo Kernel user region management
 Bundle-SymbolicName: org.eclipse.virgo.kernel.userregion
-Bundle-Version: 2.2.0
+Bundle-Version: 3.0.0
 Excluded-Exports: 
  *.internal.*
 Excluded-Imports: 
@@ -18,6 +18,8 @@
  org.eclipse.osgi.*;version="0",
  org.osgi.framework.*;version="0",
  org.osgi.service.*;version="0",
+ org.osgi.util.*;version="0",
  org.slf4j.*;version="${org.slf4j:[=.=.=, +1)}",
  org.springframework.*;version="${org.springframework:[2.5.6, =.+1)}"
 Bundle-Activator: org.eclipse.virgo.kernel.userregion.internal.Activator
+Import-Package: org.eclipse.virgo.medic.log;version="0"
diff --git a/org.eclipse.virgo.kernel.userregionfactory/.classpath b/org.eclipse.virgo.kernel.userregionfactory/.classpath
new file mode 100644
index 0000000..09a00e1
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregionfactory/.classpath
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry kind="src" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-2.3.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.easymock/com.springsource.org.easymock/2.3.0/com.springsource.org.easymock-sources-2.3.0.jar"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/>
+	<classpathentry kind="src" path="/org.eclipse.virgo.kernel.osgi"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.0.0.M02/org.eclipse.virgo.medic-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/1.0.0.CI-B20/org.eclipse.virgo.medic-sources-1.0.0.CI-B20.jar">
+		<attributes>
+			<attribute name="org.eclipse.ajdt.aspectpath" value="org.eclipse.ajdt.aspectpath"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/3.0.0.M02/org.eclipse.virgo.osgi.launcher-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.osgi/org.eclipse.virgo.osgi.launcher/2.2.0.D-20101207145732/org.eclipse.virgo.osgi.launcher-sources-2.2.0.D-20101207145732.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/3.0.0.M02/org.eclipse.virgo.util.osgi-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.2.0.D-20101207150035/org.eclipse.virgo.util.osgi-sources-2.2.0.D-20101207150035.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/3.0.0.M02/org.eclipse.virgo.util.parser.manifest-3.0.0.M02.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.parser.manifest/2.2.0.D-20101207150035/org.eclipse.virgo.util.parser.manifest-sources-2.2.0.D-20101207150035.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.teststubs/org.eclipse.virgo.teststubs.osgi/3.0.0.M02/org.eclipse.virgo.teststubs.osgi-3.0.0.M02.jar"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/org.eclipse.virgo.kernel.userregionfactory/.project b/org.eclipse.virgo.kernel.userregionfactory/.project
new file mode 100644
index 0000000..95e6550
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregionfactory/.project
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.virgo.kernel.userregionfactory</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.wst.common.project.facet.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.springsource.server.ide.bundlor.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.springframework.ide.eclipse.core.springbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.springsource.server.ide.facet.core.bundlenature</nature>
+		<nature>org.springframework.ide.eclipse.core.springnature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+	</natures>
+</projectDescription>
diff --git a/org.eclipse.virgo.kernel.userregionfactory/.settings/com.springsource.server.ide.bundlor.core.prefs b/org.eclipse.virgo.kernel.userregionfactory/.settings/com.springsource.server.ide.bundlor.core.prefs
new file mode 100644
index 0000000..97cdd5e
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregionfactory/.settings/com.springsource.server.ide.bundlor.core.prefs
@@ -0,0 +1,5 @@
+#Mon Oct 18 12:33:27 BST 2010
+com.springsource.server.ide.bundlor.core.bundlor.generated.manifest.autoformatting=false
+com.springsource.server.ide.bundlor.core.byte.code.scanning=true
+com.springsource.server.ide.bundlor.core.template.properties.files=../build.properties;../build.versions
+eclipse.preferences.version=1
diff --git a/org.eclipse.virgo.kernel.userregionfactory/.settings/org.eclipse.wst.common.project.facet.core.xml b/org.eclipse.virgo.kernel.userregionfactory/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 0000000..801f856
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregionfactory/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+  <installed facet="com.springsource.server.bundle" version="1.0"/>
+</faceted-project>
diff --git a/org.eclipse.virgo.kernel.userregionfactory/.springBeans b/org.eclipse.virgo.kernel.userregionfactory/.springBeans
new file mode 100644
index 0000000..55e47c5
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregionfactory/.springBeans
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beansProjectDescription>
+	<version>1</version>
+	<pluginVersion><![CDATA[2.5.0.201010141000-RC1]]></pluginVersion>
+	<configSuffixes>
+		<configSuffix><![CDATA[xml]]></configSuffix>
+	</configSuffixes>
+	<enableImports><![CDATA[false]]></enableImports>
+	<configs>
+	</configs>
+	<configSets>
+	</configSets>
+</beansProjectDescription>
diff --git a/org.eclipse.virgo.kernel.userregionfactory/build.xml b/org.eclipse.virgo.kernel.userregionfactory/build.xml
new file mode 100644
index 0000000..dba0197
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregionfactory/build.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="org.eclipse.virgo.kernel.userregionfactory">
+
+	<property file="${basedir}/../build.properties"/>
+	<property file="${basedir}/../build.versions"/>
+	<import file="${basedir}/../virgo-build/standard/default.xml"/>
+
+</project>
diff --git a/org.eclipse.virgo.kernel.userregionfactory/ivy.xml b/org.eclipse.virgo.kernel.userregionfactory/ivy.xml
new file mode 100644
index 0000000..aae5384
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregionfactory/ivy.xml
@@ -0,0 +1,34 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<?xml-stylesheet type="text/xsl" href="http://ivyrep.jayasoft.org/ivy-doc.xsl"?>
+<ivy-module xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://incubator.apache.org/ivy/schemas/ivy.xsd' version='1.3'>
+
+    <info organisation='org.eclipse.virgo.kernel' module='${ant.project.name}'/>
+
+    <configurations>
+        <include file='${virgo.build.dir}/common/default-ivy-configurations.xml'/>
+    </configurations>
+
+    <publications>
+        <artifact name='${ant.project.name}'/>
+        <artifact name='${ant.project.name}-sources' ext='jar' type='src'/>
+    </publications>
+
+    <dependencies>
+        <dependency org="org.eclipse.osgi" name='org.eclipse.osgi' rev='${org.eclipse.osgi}' conf='compile->compile' />
+        <dependency org='org.eclipse.virgo.medic' name='org.eclipse.virgo.medic' rev='${org.eclipse.virgo.medic}' conf='aspects, compile->runtime'/>
+        <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.osgi" rev="latest.integration" conf="compile->compile"/>
+        <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.core" rev="latest.integration" conf="compile->compile"/>
+        <dependency org="org.eclipse.virgo.osgi" name="org.eclipse.virgo.osgi.launcher" rev="${org.eclipse.virgo.osgi}" conf="compile->compile"/>
+        <dependency org='org.eclipse.virgo.util' name='org.eclipse.virgo.util.osgi' rev='${org.eclipse.virgo.util}' conf='compile->compile' />
+		<!-- TEST -->
+		<dependency org="org.junit" name="com.springsource.org.junit" rev="${org.junit}" conf="test->runtime"/>
+        <dependency org="org.slf4j" name="com.springsource.slf4j.nop" rev="${org.slf4j}" conf="test->runtime"/>
+        <dependency org="org.junit" name="com.springsource.org.junit" rev="${org.junit}" conf="test->runtime"/>
+        <dependency org="org.easymock" name="com.springsource.org.easymock" rev="${org.easymock}" conf="test->runtime"/>
+        <dependency org="org.eclipse.virgo.medic" name="org.eclipse.virgo.medic.test" rev="${org.eclipse.virgo.medic}" conf="test->runtime"/>
+        <dependency org='org.eclipse.virgo.teststubs' name='org.eclipse.virgo.teststubs.osgi' rev='${org.eclipse.virgo.teststubs}' conf='test->runtime'/>	
+        
+        <override org="org.slf4j" rev="${org.slf4j}"/>
+    </dependencies>
+
+</ivy-module>
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/resources/.gitignore b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/.gitignore
similarity index 100%
copy from org.eclipse.virgo.kernel.osgi/src/test/resources/.gitignore
copy to org.eclipse.virgo.kernel.userregionfactory/src/main/java/.gitignore
diff --git a/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/Activator.java b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/Activator.java
new file mode 100644
index 0000000..d2c4207
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/Activator.java
@@ -0,0 +1,333 @@
+/*******************************************************************************
+ * This file is part of the Virgo Web Server.
+ *
+ * Copyright (c) 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    SpringSource, a division of VMware - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.userregionfactory;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.eclipse.virgo.kernel.core.Shutdown;
+import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkUtils;
+import org.eclipse.virgo.kernel.osgi.framework.OsgiServiceHolder;
+import org.eclipse.virgo.kernel.osgi.region.Region;
+import org.eclipse.virgo.kernel.osgi.region.RegionDigraph;
+import org.eclipse.virgo.kernel.osgi.region.RegionFilter;
+import org.eclipse.virgo.kernel.osgi.region.StandardRegionFilter;
+import org.eclipse.virgo.medic.eventlog.EventLogger;
+import org.eclipse.virgo.osgi.launcher.parser.ArgumentParser;
+import org.eclipse.virgo.osgi.launcher.parser.BundleEntry;
+import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
+import org.eclipse.virgo.util.osgi.manifest.BundleManifest;
+import org.eclipse.virgo.util.osgi.manifest.BundleManifestFactory;
+import org.eclipse.virgo.util.osgi.manifest.RequireBundle;
+import org.eclipse.virgo.util.osgi.manifest.RequiredBundle;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+
+/**
+ * {@link Activator} initialises the user region factory bundle.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * 
+ * Not thread safe.
+ * 
+ */
+public final class Activator implements BundleActivator {
+
+    private static final String CLASS_LIST_SEPARATOR = ",";
+
+    private static final long MAX_SECONDS_WAIT_FOR_SERVICE = 30;
+
+    private static final long MAX_MILLIS_WAIT_FOR_SERVICE = TimeUnit.SECONDS.toMillis(MAX_SECONDS_WAIT_FOR_SERVICE);
+
+    private static final String USER_REGION_CONFIGURATION_PID = "org.eclipse.virgo.kernel.userregion";
+
+    private static final String USER_REGION_BASE_BUNDLES_PROPERTY = "baseBundles";
+
+    private static final String USER_REGION_PACKAGE_IMPORTS_PROPERTY = "packageImports";
+
+    private static final String USER_REGION_SERVICE_IMPORTS_PROPERTY = "serviceImports";
+
+    private static final String USER_REGION_BUNDLE_IMPORTS_PROPERTY = "bundleImports";
+
+    private static final String USER_REGION_SERVICE_EXPORTS_PROPERTY = "serviceExports";
+
+    private static final String USER_REGION_BUNDLE_CONTEXT_SERVICE_PROPERTY = "org.eclipse.virgo.kernel.regionContext";
+
+    private static final String REGION_USER = "org.eclipse.virgo.region.user";
+
+    private static final String EVENT_REGION_STARTING = "org/eclipse/virgo/kernel/region/STARTING";
+
+    private static final String EVENT_PROPERTY_REGION_BUNDLECONTEXT = "region.bundleContext";
+
+    private EventAdmin eventAdmin;
+
+    private String regionBundles;
+
+    private String regionPackageImports;
+
+    private String regionServiceImports;
+
+    private String regionBundleImports;
+
+    private String regionServiceExports;
+
+    private BundleContext bundleContext;
+
+    private final ArgumentParser parser = new ArgumentParser();
+
+    private final ServiceRegistrationTracker tracker = new ServiceRegistrationTracker();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void start(BundleContext bundleContext) throws Exception {
+        this.bundleContext = bundleContext;
+        RegionDigraph regionDigraph = getPotentiallyDelayedService(bundleContext, RegionDigraph.class);
+        this.eventAdmin = getPotentiallyDelayedService(bundleContext, EventAdmin.class);
+        ConfigurationAdmin configAdmin = getPotentiallyDelayedService(bundleContext, ConfigurationAdmin.class);
+        EventLogger eventLogger = getPotentiallyDelayedService(bundleContext, EventLogger.class);
+        Shutdown shutdown = getPotentiallyDelayedService(bundleContext, Shutdown.class);
+        getRegionConfiguration(configAdmin, eventLogger, shutdown);
+
+        createUserRegion(regionDigraph, eventLogger);
+    }
+
+    private void getRegionConfiguration(ConfigurationAdmin configAdmin, EventLogger eventLogger, Shutdown shutdown) {
+        try {
+            Configuration config = configAdmin.getConfiguration(USER_REGION_CONFIGURATION_PID, null);
+
+            @SuppressWarnings("unchecked")
+            Dictionary<String, String> properties = config.getProperties();
+
+            if (properties != null) {
+                this.regionBundles = properties.get(USER_REGION_BASE_BUNDLES_PROPERTY);
+                this.regionPackageImports = properties.get(USER_REGION_PACKAGE_IMPORTS_PROPERTY);
+                this.regionServiceImports = properties.get(USER_REGION_SERVICE_IMPORTS_PROPERTY);
+                this.regionBundleImports = properties.get(USER_REGION_BUNDLE_IMPORTS_PROPERTY);
+                this.regionServiceExports = properties.get(USER_REGION_SERVICE_EXPORTS_PROPERTY);
+            } else {
+                eventLogger.log(UserRegionFactoryLogEvents.USER_REGION_CONFIGURATION_UNAVAILABLE);
+                shutdown.immediateShutdown();
+            }
+        } catch (Exception e) {
+            eventLogger.log(UserRegionFactoryLogEvents.USER_REGION_CONFIGURATION_UNAVAILABLE, e);
+            shutdown.immediateShutdown();
+        }
+    }
+
+    private void createUserRegion(RegionDigraph regionDigraph, EventLogger eventLogger) throws BundleException {
+
+        BundleContext systemBundleContext = getSystemBundleContext();
+        Bundle userRegionFactoryBundle = this.bundleContext.getBundle();
+
+        Region kernelRegion = getKernelRegion(regionDigraph);
+        kernelRegion.removeBundle(userRegionFactoryBundle);
+
+        Region userRegion = regionDigraph.createRegion(REGION_USER);
+        userRegion.addBundle(userRegionFactoryBundle);
+
+        RegionFilter kernelFilter = createKernelFilter(systemBundleContext, eventLogger);
+        userRegion.connectRegion(kernelRegion, kernelFilter);
+
+        RegionFilter userRegionFilter = createUserRegionFilter();
+        kernelRegion.connectRegion(userRegion, userRegionFilter);
+
+        notifyUserRegionStarting(this.bundleContext);
+
+        initialiseUserRegionBundles(userRegion);
+
+        registerRegionService(userRegion);
+        publishUserRegionBundleContext(this.bundleContext);
+    }
+
+    private RegionFilter createUserRegionFilter() throws BundleException {
+        RegionFilter userRegionFilter = new StandardRegionFilter();
+        Filter serviceFilter;
+        try {
+            serviceFilter = this.bundleContext.createFilter(classesToFilter(this.regionServiceExports));
+        } catch (InvalidSyntaxException e) {
+            throw new BundleException("Invalid " + USER_REGION_SERVICE_EXPORTS_PROPERTY + "in user region configuration: '"
+                + this.regionServiceExports + "'", e);
+        }
+        userRegionFilter.setServiceFilter(serviceFilter);
+
+        return userRegionFilter;
+    }
+
+    private Region getKernelRegion(RegionDigraph regionDigraph) {
+        return regionDigraph.iterator().next();
+    }
+
+    private RegionFilter createKernelFilter(BundleContext systemBundleContext, EventLogger eventLogger) throws BundleException {
+        RegionFilter kernelFilter = new StandardRegionFilter();
+        allowImportedBundles(kernelFilter, eventLogger);
+        kernelFilter.setPackageImportPolicy(createUserRegionPackageImportPolicy(systemBundleContext, eventLogger));
+        Filter serviceFilter;
+        try {
+            serviceFilter = this.bundleContext.createFilter(classesToFilter(this.regionServiceImports));
+        } catch (InvalidSyntaxException e) {
+            throw new BundleException("Invalid " + USER_REGION_SERVICE_IMPORTS_PROPERTY + "in user region configuration: '"
+                + this.regionServiceImports + "'", e);
+        }
+        kernelFilter.setServiceFilter(serviceFilter);
+        return kernelFilter;
+    }
+
+    private void allowImportedBundles(RegionFilter kernelFilter, EventLogger eventLogger) {
+        String userRegionBundleImports = this.regionBundleImports != null ? this.regionBundleImports
+            : this.bundleContext.getProperty(USER_REGION_BUNDLE_IMPORTS_PROPERTY);
+
+        RequireBundle bundleImportsAsRequireBundle = representBundleImportsAsRequireBundle(userRegionBundleImports, eventLogger);
+        List<RequiredBundle> importedBundles = bundleImportsAsRequireBundle.getRequiredBundles();
+        for (RequiredBundle importedBundle : importedBundles) {
+            kernelFilter.allowBundle(importedBundle.getBundleSymbolicName(), importedBundle.getBundleVersion());
+        }
+    }
+
+    private RequireBundle representBundleImportsAsRequireBundle(String userRegionBundleImportsProperty, EventLogger eventLogger) {
+        Dictionary<String, String> headers = new Hashtable<String, String>();
+        headers.put("Require-Bundle", userRegionBundleImportsProperty);
+        BundleManifest manifest = BundleManifestFactory.createBundleManifest(headers, new UserRegionFactoryParserLogger(eventLogger));
+        return manifest.getRequireBundle();
+    }
+
+    private String classesToFilter(String classList) {
+        if (classList == null) {
+            return "";
+        }
+        String[] classes = classList.split(CLASS_LIST_SEPARATOR);
+        if (classes.length == 0) {
+            return "";
+        }
+        StringBuffer filter = new StringBuffer();
+        filter.append("(|");
+        for (String className : classes) {
+            filter.append("(objectClass=").append(className).append(")");
+        }
+        filter.append(")");
+        return filter.toString();
+    }
+
+    private UserRegionPackageImportPolicy createUserRegionPackageImportPolicy(BundleContext systemBundleContext, EventLogger eventLogger) {
+        String userRegionImportsProperty = this.regionPackageImports != null ? this.regionPackageImports
+            : this.bundleContext.getProperty(USER_REGION_PACKAGE_IMPORTS_PROPERTY);
+        String expandedUserRegionImportsProperty = null;
+        if (userRegionImportsProperty != null) {
+            expandedUserRegionImportsProperty = PackageImportWildcardExpander.expandPackageImportsWildcards(userRegionImportsProperty,
+                systemBundleContext, eventLogger);
+        }
+
+        return new UserRegionPackageImportPolicy(expandedUserRegionImportsProperty);
+    }
+
+    private BundleContext getSystemBundleContext() {
+        return this.bundleContext.getBundle(0L).getBundleContext();
+    }
+
+    private void notifyUserRegionStarting(BundleContext userRegionBundleContext) {
+        Map<String, Object> properties = new HashMap<String, Object>();
+        properties.put(EVENT_PROPERTY_REGION_BUNDLECONTEXT, userRegionBundleContext);
+        this.eventAdmin.sendEvent(new Event(EVENT_REGION_STARTING, properties));
+    }
+
+    private void initialiseUserRegionBundles(Region userRegion) throws BundleException {
+
+        String userRegionBundlesProperty = this.regionBundles != null ? this.regionBundles
+            : this.bundleContext.getProperty(USER_REGION_BASE_BUNDLES_PROPERTY);
+
+        if (userRegionBundlesProperty != null) {
+            List<Bundle> bundlesToStart = new ArrayList<Bundle>();
+
+            for (BundleEntry entry : this.parser.parseBundleEntries(userRegionBundlesProperty)) {
+                URI uri = entry.getURI();
+                Bundle bundle = userRegion.installBundle(uri.toString());
+
+                if (entry.isAutoStart()) {
+                    bundlesToStart.add(bundle);
+                }
+            }
+
+            for (Bundle bundle : bundlesToStart) {
+                try {
+                    bundle.start();
+                } catch (BundleException e) {
+                    throw new BundleException("Failed to start bundle " + bundle.getSymbolicName() + " " + bundle.getVersion(), e);
+                }
+            }
+        }
+    }
+
+    private void registerRegionService(Region region) {
+        Dictionary<String, String> props = new Hashtable<String, String>();
+        props.put("org.eclipse.virgo.kernel.region.name", region.getName());
+        this.tracker.track(this.bundleContext.registerService(Region.class, region, props));
+    }
+
+    private void publishUserRegionBundleContext(BundleContext userRegionBundleContext) {
+        Dictionary<String, String> properties = new Hashtable<String, String>();
+        properties.put(USER_REGION_BUNDLE_CONTEXT_SERVICE_PROPERTY, "true");
+        this.bundleContext.registerService(BundleContext.class, userRegionBundleContext, properties);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void stop(BundleContext context) throws Exception {
+    }
+
+    private static <T> T getPotentiallyDelayedService(BundleContext context, Class<T> serviceClass) throws TimeoutException, InterruptedException {
+        T service = null;
+        OsgiServiceHolder<T> serviceHolder;
+        long millisWaited = 0;
+        while (service == null && millisWaited <= MAX_MILLIS_WAIT_FOR_SERVICE) {
+            try {
+                serviceHolder = OsgiFrameworkUtils.getService(context, serviceClass);
+                if (serviceHolder != null) {
+                    service = serviceHolder.getService();
+                } else {
+                    millisWaited += sleepABitMore();
+                }
+            } catch (IllegalStateException e) {
+            }
+        }
+        if (service == null) {
+            throw new TimeoutException(serviceClass.getName());
+        }
+        return service;
+    }
+
+    private static long sleepABitMore() throws InterruptedException {
+        long before = System.currentTimeMillis();
+        Thread.sleep(100);
+        return System.currentTimeMillis() - before;
+    }
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/PackageImportWildcardExpander.java b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpander.java
similarity index 85%
rename from org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/PackageImportWildcardExpander.java
rename to org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpander.java
index 8888f3d..eff809c 100644
--- a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/PackageImportWildcardExpander.java
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpander.java
@@ -9,7 +9,7 @@
  *   VMware Inc. - initial contribution
  *******************************************************************************/
 
-package org.eclipse.virgo.kernel.osgi.region;
+package org.eclipse.virgo.kernel.userregionfactory;
 
 import java.util.ArrayList;
 import java.util.Dictionary;
@@ -18,20 +18,17 @@
 import java.util.List;
 import java.util.Set;
 
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.ExportedPackage;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-
-import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkLogEvents;
 import org.eclipse.virgo.kernel.serviceability.Assert;
 import org.eclipse.virgo.medic.eventlog.EventLogger;
 import org.eclipse.virgo.util.osgi.manifest.BundleManifest;
 import org.eclipse.virgo.util.osgi.manifest.BundleManifestFactory;
 import org.eclipse.virgo.util.osgi.manifest.DynamicImportPackage;
 import org.eclipse.virgo.util.osgi.manifest.DynamicallyImportedPackage;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
 
 /**
  * {@link PackageImportWildcardExpander} expands the wildcards in a string containing the body of an import package
@@ -48,17 +45,10 @@
 
     private static final String wildcard = "*";
 
-    static String expandPackageImportsWildcards(String userRegionImportsProperty, BundleContext bundleContext) {
-        ServiceReference<EventLogger> eventLoggerServiceReference = bundleContext.getServiceReference(EventLogger.class);
-        EventLogger eventLogger = bundleContext.getService(eventLoggerServiceReference);
+    static String expandPackageImportsWildcards(String userRegionImportsProperty, BundleContext systemBundleContext, EventLogger eventLogger) {
+        String[] exportedPackageNames = getExportedPackageNames(systemBundleContext);
 
-        String[] exportedPackageNames = getExportedPackageNames(bundleContext);
-
-        String expandedUserRegionImportsProperty = expandWildcards(userRegionImportsProperty, exportedPackageNames, eventLogger);
-
-        bundleContext.ungetService(eventLoggerServiceReference);
-
-        return expandedUserRegionImportsProperty;
+        return expandWildcards(userRegionImportsProperty, exportedPackageNames, eventLogger);
     }
 
     private static String[] getExportedPackageNames(BundleContext bundleContext) {
@@ -66,7 +56,7 @@
         for (ExportedPackage exportedPackage : getExportedPackages(bundleContext)) {
             exportedPackageNames.add(exportedPackage.getName());
         }
-        return exportedPackageNames.toArray(new String[] {});
+        return exportedPackageNames.toArray(new String[exportedPackageNames.size()]);
     }
 
     private static ExportedPackage[] getExportedPackages(BundleContext bundleContext) {
@@ -90,7 +80,7 @@
         Dictionary<String, String> headers = new Hashtable<String, String>();
         headers.put("DynamicImport-Package", userRegionImportsProperty);
 
-        BundleManifest manifest = BundleManifestFactory.createBundleManifest(headers, new RegionManagerParserLogger(eventLogger));
+        BundleManifest manifest = BundleManifestFactory.createBundleManifest(headers, new UserRegionFactoryParserLogger(eventLogger));
         return manifest.getDynamicImportPackage();
     }
 
@@ -134,7 +124,7 @@
             }
         }
         if (expansions.isEmpty()) {
-            eventLogger.log(OsgiFrameworkLogEvents.REGION_IMPORT_NO_MATCH, wildcardedPackageName);
+            eventLogger.log(UserRegionFactoryLogEvents.REGION_IMPORT_NO_MATCH, wildcardedPackageName);
         }
         return expansions;
     }
diff --git a/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryLogEvents.java b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryLogEvents.java
new file mode 100644
index 0000000..7d1ba06
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryLogEvents.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   VMware Inc. - initial contribution
+ ******************************************************************************/
+
+package org.eclipse.virgo.kernel.userregionfactory;
+
+import org.eclipse.virgo.kernel.serviceability.LogEventDelegate;
+import org.eclipse.virgo.medic.eventlog.Level;
+import org.eclipse.virgo.medic.eventlog.LogEvent;
+
+/**
+ * {@link org.eclipse.virgo.medic.eventlog.LogEvent} for the OSGi provisioning bundle.
+ * <p/>
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * 
+ * Threadsafe.
+ * 
+ */
+public enum UserRegionFactoryLogEvents implements LogEvent {
+
+    REGION_IMPORTS_PARSE_FAILED(1, Level.ERROR), //
+    REGION_IMPORT_NO_MATCH(2, Level.WARNING), //
+    USER_REGION_CONFIGURATION_UNAVAILABLE(10, Level.ERROR);
+
+    private static final String PREFIX = "UF";
+
+    private final LogEventDelegate delegate;
+
+    private UserRegionFactoryLogEvents(int code, Level level) {
+        this.delegate = new LogEventDelegate(PREFIX, code, level);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getEventCode() {
+        return this.delegate.getEventCode();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Level getLevel() {
+        return this.delegate.getLevel();
+    }
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManagerParserLogger.java b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryParserLogger.java
similarity index 68%
rename from org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManagerParserLogger.java
rename to org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryParserLogger.java
index bb25f6a..d36ca6c 100644
--- a/org.eclipse.virgo.kernel.osgi/src/main/java/org/eclipse/virgo/kernel/osgi/region/RegionManagerParserLogger.java
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionFactoryParserLogger.java
@@ -9,14 +9,13 @@
  *   VMware Inc. - initial contribution
  *******************************************************************************/
 
-package org.eclipse.virgo.kernel.osgi.region;
+package org.eclipse.virgo.kernel.userregionfactory;
 
-import org.eclipse.virgo.kernel.osgi.framework.OsgiFrameworkLogEvents;
 import org.eclipse.virgo.medic.eventlog.EventLogger;
 import org.eclipse.virgo.util.osgi.manifest.parse.ParserLogger;
 
 /**
- * {@link RegionManagerParserLogger} maps OSGi bundle manifest parsing errors to a log message.
+ * {@link UserRegionFactoryParserLogger} maps OSGi bundle manifest parsing errors to a log message.
  * <p />
  * 
  * <strong>Concurrent Semantics</strong><br />
@@ -24,11 +23,11 @@
  * This class is thread safe.
  * 
  */
-final class RegionManagerParserLogger implements ParserLogger {
+final class UserRegionFactoryParserLogger implements ParserLogger {
 
     private final EventLogger eventLogger;
 
-    public RegionManagerParserLogger(EventLogger eventLogger) {
+    public UserRegionFactoryParserLogger(EventLogger eventLogger) {
         this.eventLogger = eventLogger;
     }
 
@@ -37,6 +36,6 @@
     }
 
     public void outputErrorMsg(Exception re, String item) {
-        this.eventLogger.log(OsgiFrameworkLogEvents.REGION_IMPORTS_PARSE_FAILED, re, item);
+        this.eventLogger.log(UserRegionFactoryLogEvents.REGION_IMPORTS_PARSE_FAILED, re, item);
     }
 }
diff --git a/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicy.java b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicy.java
new file mode 100644
index 0000000..06a85b1
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/main/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicy.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * This file is part of the Virgo Web Server.
+ *
+ * Copyright (c) 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    SpringSource, a division of VMware - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.userregionfactory;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.eclipse.virgo.kernel.osgi.region.RegionPackageImportPolicy;
+import org.eclipse.virgo.util.osgi.manifest.BundleManifest;
+import org.eclipse.virgo.util.osgi.manifest.BundleManifestFactory;
+import org.eclipse.virgo.util.osgi.manifest.ImportedPackage;
+import org.osgi.framework.Version;
+
+/**
+ * {@link UserRegionPackageImportPolicy} is a {@link RegionPackageImportPolicy} for a user region.
+ * <p />
+ * 
+ * <strong>Concurrent Semantics</strong><br />
+ * 
+ * Thread safe.
+ * 
+ */
+class UserRegionPackageImportPolicy implements RegionPackageImportPolicy {
+
+    private static final String MANDATORY_ATTRIBUTE_NAME_SEPARATOR = ",";
+
+    private static final String MANDATORY_DIRECTIVE_NAME = "mandatory";
+
+    private static final String VERSION_ATTRIBUTE_NAME = "version";
+
+    private static final String WILDCARD = "*";
+
+    private final Map<String, ImportedPackage> importedPackages = new HashMap<String, ImportedPackage>();
+
+    /**
+     * Construct a {@link UserRegionPackageImportPolicy} for the specified import package list which must not contain
+     * wildcards.
+     * 
+     * @param regionImports a string representing a list of imported packages
+     */
+    UserRegionPackageImportPolicy(String regionImports) {
+        if (regionImports != null && !regionImports.isEmpty()) {
+            if (regionImports.contains(WILDCARD)) {
+                throw new IllegalArgumentException("Wildcards not supported in region imports: '" + regionImports + "'");
+            }
+            BundleManifest manifest = BundleManifestFactory.createBundleManifest();
+            manifest.setHeader("Import-Package", regionImports);
+            List<ImportedPackage> list = manifest.getImportPackage().getImportedPackages();
+            for (ImportedPackage importedPackage : list) {
+                String packageName = importedPackage.getPackageName();
+                this.importedPackages.put(packageName, importedPackage);
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isImported(String packageName, Map<String, Object> exportAttributes, Map<String, String> exportDirectives) {
+        ImportedPackage importedPackage = this.importedPackages.get(packageName);
+        if (importedPackage != null) {
+            Map<String, String> importAttributes = importedPackage.getAttributes();
+            Set<String> importAttributeNames = importAttributes.keySet();
+
+            // Check any attribute values match.
+            for (String importAttributeName : importAttributeNames) {
+                if (exportAttributes == null) {
+                    return false;
+                }
+                Object exportAttributeValue = exportAttributes.get(importAttributeName);
+                if (importAttributeName.equals(VERSION_ATTRIBUTE_NAME)) {
+                    if (exportAttributeValue != null && exportAttributeValue instanceof Version) {
+                        Version exportVersion = (Version) exportAttributeValue;
+                        String importAttributeValue = importAttributes.get(importAttributeName);
+                        VersionRange importVersion = new VersionRange(importAttributeValue);
+                        if (!importVersion.isIncluded(exportVersion)) {
+                            return false;
+                        }
+                    } else {
+                        return false;
+                    }
+                } else {
+                    if (exportAttributeValue != null && exportAttributeValue instanceof String) {
+                        String exportAttributeValueString = (String) exportAttributeValue;
+                        String importAttributeValue = importAttributes.get(importAttributeName);
+                        if (!exportAttributeValueString.equals(importAttributeValue)) {
+                            return false;
+                        }
+                    } else {
+                        return false;
+                    }
+                }
+
+            }
+
+            // Check mandatory attributes are present.
+            if (exportDirectives != null) {
+                String mandatoryDirectiveValue = exportDirectives.get(MANDATORY_DIRECTIVE_NAME);
+                if (mandatoryDirectiveValue != null) {
+                    for (String mandatoryAttribute : mandatoryDirectiveValue.split(MANDATORY_ATTRIBUTE_NAME_SEPARATOR)) {
+                        if (!importAttributeNames.contains(mandatoryAttribute)) {
+                            return false;
+                        }
+                    }
+                }
+            }
+            return true;
+        }
+
+        return false;
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/resources/.gitignore b/org.eclipse.virgo.kernel.userregionfactory/src/main/resources/.gitignore
similarity index 100%
copy from org.eclipse.virgo.kernel.osgi/src/test/resources/.gitignore
copy to org.eclipse.virgo.kernel.userregionfactory/src/main/resources/.gitignore
diff --git a/org.eclipse.virgo.kernel.userregionfactory/src/main/resources/EventLogMessages.properties b/org.eclipse.virgo.kernel.userregionfactory/src/main/resources/EventLogMessages.properties
new file mode 100644
index 0000000..340bb1f
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/main/resources/EventLogMessages.properties
@@ -0,0 +1,16 @@
+################################################################################
+# Copyright (c) 2011 SAP AG
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#    Hristo Iliev, SAP AG - initial contribution
+################################################################################
+
+# User region factory
+UF0001E=Region imports parsing failed: {}.
+UF0002W=No match found for region import: {}.
+
+UF0010E=User region configuration unavailable.
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/resources/.gitignore b/org.eclipse.virgo.kernel.userregionfactory/src/test/java/.gitignore
similarity index 100%
copy from org.eclipse.virgo.kernel.osgi/src/test/resources/.gitignore
copy to org.eclipse.virgo.kernel.userregionfactory/src/test/java/.gitignore
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/PackageImportWildcardExpanderTests.java b/org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpanderTests.java
similarity index 88%
rename from org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/PackageImportWildcardExpanderTests.java
rename to org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpanderTests.java
index e8b5486..c3896e6 100644
--- a/org.eclipse.virgo.kernel.osgi/src/test/java/org/eclipse/virgo/kernel/osgi/region/PackageImportWildcardExpanderTests.java
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/PackageImportWildcardExpanderTests.java
@@ -9,7 +9,7 @@
  *   VMware Inc. - initial contribution
  *******************************************************************************/
 
-package org.eclipse.virgo.kernel.osgi.region;
+package org.eclipse.virgo.kernel.userregionfactory;
 
 import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.expect;
@@ -22,7 +22,6 @@
 import org.osgi.service.packageadmin.ExportedPackage;
 import org.osgi.service.packageadmin.PackageAdmin;
 
-import org.eclipse.virgo.kernel.osgi.region.PackageImportWildcardExpander;
 import org.eclipse.virgo.medic.eventlog.EventLogger;
 import org.eclipse.virgo.teststubs.osgi.framework.StubBundleContext;
 
@@ -45,7 +44,6 @@
 
         this.mockEventLogger = createMock(EventLogger.class);
         replay(this.mockEventLogger);
-        this.stubBundleContext.registerService(EventLogger.class.getName(), this.mockEventLogger, null);
 
         this.mockPackageAdmin = createMock(PackageAdmin.class);
         this.exportedPackages = new ExportedPackage[] { createdMockExportedPackage("q"), createdMockExportedPackage("r.a"),
@@ -64,13 +62,13 @@
 
     @Test
     public void testNoWildcards() {
-        String expansion = PackageImportWildcardExpander.expandPackageImportsWildcards("p,r", this.stubBundleContext);
+        String expansion = PackageImportWildcardExpander.expandPackageImportsWildcards("p,r", this.stubBundleContext, mockEventLogger);
         assertEquals("Incorrect expansion", "p,r", expansion);
     }
 
     @Test
     public void testWildcards() {
-        String expansion = PackageImportWildcardExpander.expandPackageImportsWildcards("r.*", this.stubBundleContext);
+        String expansion = PackageImportWildcardExpander.expandPackageImportsWildcards("r.*", this.stubBundleContext, mockEventLogger);
         assertEquals("Incorrect expansion", "r.a,r.b.c", expansion);
     }
 
diff --git a/org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicyTests.java b/org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicyTests.java
new file mode 100644
index 0000000..308470d
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregionfactory/src/test/java/org/eclipse/virgo/kernel/userregionfactory/UserRegionPackageImportPolicyTests.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * This file is part of the Virgo Web Server.
+ *
+ * Copyright (c) 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    SpringSource, a division of VMware - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.virgo.kernel.userregionfactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.virgo.kernel.osgi.region.RegionPackageImportPolicy;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.Version;
+import org.osgi.framework.wiring.BundleRevision;
+
+public class UserRegionPackageImportPolicyTests {
+
+    @Test
+    public void testNullPackageString() {
+        new UserRegionPackageImportPolicy(null);
+    }
+
+    @Test
+    public void testEmptyPackageString() {
+        new UserRegionPackageImportPolicy("");
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testWildcard() {
+        new UserRegionPackageImportPolicy("*");
+    }
+
+    @Test
+    public void testPackageStringWithArbitraryAttribute() {
+        UserRegionPackageImportPolicy userRegionPackageImportPolicy = createUserRegionPackageImportPolicy("p;pa=pv,q");
+        Assert.assertFalse(userRegionPackageImportPolicy.isImported("p", null, null));
+        Map<String, Object> attributes = createAttributes("p");
+        attributes.put("pa", "pv");
+        Assert.assertTrue(userRegionPackageImportPolicy.isImported("p", attributes, null));
+
+    }
+
+    private UserRegionPackageImportPolicy createUserRegionPackageImportPolicy(String regionImports) {
+        UserRegionPackageImportPolicy userRegionPackageImportPolicy = new UserRegionPackageImportPolicy(regionImports);
+        return userRegionPackageImportPolicy;
+    }
+
+    @Test
+    public void testPackageStringWithoutArbitraryAttribute() {
+        RegionPackageImportPolicy userRegionPackageImportPolicy = createUserRegionPackageImportPolicy("p,q");
+        Map<String, Object> attributes = createAttributes("p");
+        attributes.put("pa", "pv");
+        Assert.assertTrue(userRegionPackageImportPolicy.isImported("p", attributes, null));
+
+    }
+
+    private Map<String, Object> createAttributes(String packageName) {
+        Map<String, Object> attributes = new HashMap<String, Object>();
+        attributes.put(BundleRevision.PACKAGE_NAMESPACE, packageName);
+        return attributes;
+    }
+
+    @Test
+    public void testPackageStringWithMandatoryAttribute() {
+        RegionPackageImportPolicy userRegionPackageImportPolicy = createUserRegionPackageImportPolicy("p;pa=pv");
+        Assert.assertFalse(userRegionPackageImportPolicy.isImported("p", null, null));
+        Map<String, Object> attributes = createAttributes("p");
+        attributes.put("pa", "pv");
+        Map<String, String> directives = createMandatoryDirective("pa");
+        Assert.assertTrue(userRegionPackageImportPolicy.isImported("p", attributes, directives));
+    }
+
+    @Test
+    public void testPackageStringWithoutMandatoryAttribute() {
+        RegionPackageImportPolicy userRegionPackageImportPolicy = createUserRegionPackageImportPolicy("p");
+        Map<String, Object> attributes = createAttributes("p");
+        attributes.put("pa", "pv");
+        Map<String, String> directives = createMandatoryDirective("pa");
+        Assert.assertFalse(userRegionPackageImportPolicy.isImported("p", attributes, directives));
+    }
+
+    private Map<String, String> createMandatoryDirective(String attributes) {
+        Map<String, String> directives = new HashMap<String, String>();
+        directives.put("mandatory", attributes);
+        return directives;
+    }
+
+    @Test
+    public void testPackageStringWithVersion() {
+        RegionPackageImportPolicy userRegionPackageImportPolicy = createUserRegionPackageImportPolicy("p;version=2,q");
+        Assert.assertFalse(userRegionPackageImportPolicy.isImported("p", null, null));
+        Map<String, Object> attributes = new HashMap<String, Object>();
+        attributes.put("version", new Version("2.0.0"));
+        Assert.assertTrue(userRegionPackageImportPolicy.isImported("p", attributes, null));
+
+    }
+
+    @Test
+    public void testPackages() {
+        RegionPackageImportPolicy userRegionPackageImportPolicy = createUserRegionPackageImportPolicy("p,q");
+        Assert.assertTrue(userRegionPackageImportPolicy.isImported("p", null, null));
+        Assert.assertTrue(userRegionPackageImportPolicy.isImported("q", null, null));
+        Assert.assertFalse(userRegionPackageImportPolicy.isImported("r", null, null));
+    }
+
+}
diff --git a/org.eclipse.virgo.kernel.osgi/src/test/resources/.gitignore b/org.eclipse.virgo.kernel.userregionfactory/src/test/resources/.gitignore
similarity index 100%
rename from org.eclipse.virgo.kernel.osgi/src/test/resources/.gitignore
rename to org.eclipse.virgo.kernel.userregionfactory/src/test/resources/.gitignore
diff --git a/org.eclipse.virgo.kernel.userregionfactory/template.mf b/org.eclipse.virgo.kernel.userregionfactory/template.mf
new file mode 100644
index 0000000..228ea8c
--- /dev/null
+++ b/org.eclipse.virgo.kernel.userregionfactory/template.mf
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Virgo Kernel User Region Factory
+Bundle-SymbolicName: org.eclipse.virgo.kernel.userregionfactory
+Bundle-Version: 2.2.0
+Import-Template: 
+ org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}",
+ org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
+ org.eclipse.osgi.framework.*;version="0",
+ org.eclipse.osgi.service.resolver.*;version="0",
+ org.osgi.framework.*;version="0",
+ org.osgi.service.*;version="0",
+ org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}"
+Import-Package: org.aspectj.lang;version="0"
+Bundle-Activator: org.eclipse.virgo.kernel.userregionfactory.Activator
+Excluded-Imports: org.easymock,
+ org.eclipse.virgo.osgi.launcher.*,
+ org.eclipse.virgo.teststubs.*
+Excluded-Exports: *
diff --git a/org.eclipse.virgo.kernel/ivy.xml b/org.eclipse.virgo.kernel/ivy.xml
index 7202037..2f8adbe 100644
--- a/org.eclipse.virgo.kernel/ivy.xml
+++ b/org.eclipse.virgo.kernel/ivy.xml
@@ -25,6 +25,7 @@
 		<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.model" rev="latest.integration"/>
 		<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.services" rev="latest.integration"/>
 		<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.shell" rev="latest.integration"/>
+		<dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.userregionfactory" rev="latest.integration"/>
 	</dependencies>
 
 </ivy-module>
diff --git a/test-apps/bundle-update/class.load.after.update/but.C/.classpath b/test-apps/bundle-update/class.load.after.update/but.C/.classpath
index 409591e..56e5372 100644
--- a/test-apps/bundle-update/class.load.after.update/but.C/.classpath
+++ b/test-apps/bundle-update/class.load.after.update/but.C/.classpath
@@ -3,6 +3,6 @@
 	<classpathentry kind="src" path="src/main/java"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/but.b.after"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="output" path="target"/>
 </classpath>
diff --git a/test-apps/quartz-scheduler/quartz.bundle.a/.classpath b/test-apps/quartz-scheduler/quartz.bundle.a/.classpath
index 765e03b..7f5b2ae 100644
--- a/test-apps/quartz-scheduler/quartz.bundle.a/.classpath
+++ b/test-apps/quartz-scheduler/quartz.bundle.a/.classpath
@@ -4,7 +4,7 @@
 	<classpathentry kind="src" path="src/main/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/com.opensymphony.quartz/com.springsource.org.quartz/1.6.0/com.springsource.org.quartz-1.6.0.jar" sourcepath="/KERNEL_IVY_CACHE/com.opensymphony.quartz/com.springsource.org.quartz/1.6.0/com.springsource.org.quartz-sources-1.6.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context.support/3.0.0.RELEASE/org.springframework.context.support-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context.support/3.0.0.RELEASE/org.springframework.context.support-sources-3.0.0.RELEASE.jar"/>
diff --git a/test-apps/quartz-scheduler/quartz.bundle.b/.classpath b/test-apps/quartz-scheduler/quartz.bundle.b/.classpath
index 765e03b..7f5b2ae 100644
--- a/test-apps/quartz-scheduler/quartz.bundle.b/.classpath
+++ b/test-apps/quartz-scheduler/quartz.bundle.b/.classpath
@@ -4,7 +4,7 @@
 	<classpathentry kind="src" path="src/main/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/com.opensymphony.quartz/com.springsource.org.quartz/1.6.0/com.springsource.org.quartz-1.6.0.jar" sourcepath="/KERNEL_IVY_CACHE/com.opensymphony.quartz/com.springsource.org.quartz/1.6.0/com.springsource.org.quartz-sources-1.6.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context.support/3.0.0.RELEASE/org.springframework.context.support-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context.support/3.0.0.RELEASE/org.springframework.context.support-sources-3.0.0.RELEASE.jar"/>
diff --git a/test-apps/quartz-scheduler/quartz.bundle.same1/.classpath b/test-apps/quartz-scheduler/quartz.bundle.same1/.classpath
index 765e03b..7f5b2ae 100644
--- a/test-apps/quartz-scheduler/quartz.bundle.same1/.classpath
+++ b/test-apps/quartz-scheduler/quartz.bundle.same1/.classpath
@@ -4,7 +4,7 @@
 	<classpathentry kind="src" path="src/main/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/com.opensymphony.quartz/com.springsource.org.quartz/1.6.0/com.springsource.org.quartz-1.6.0.jar" sourcepath="/KERNEL_IVY_CACHE/com.opensymphony.quartz/com.springsource.org.quartz/1.6.0/com.springsource.org.quartz-sources-1.6.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context.support/3.0.0.RELEASE/org.springframework.context.support-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context.support/3.0.0.RELEASE/org.springframework.context.support-sources-3.0.0.RELEASE.jar"/>
diff --git a/test-apps/quartz-scheduler/quartz.bundle.same2/.classpath b/test-apps/quartz-scheduler/quartz.bundle.same2/.classpath
index 765e03b..7f5b2ae 100644
--- a/test-apps/quartz-scheduler/quartz.bundle.same2/.classpath
+++ b/test-apps/quartz-scheduler/quartz.bundle.same2/.classpath
@@ -4,7 +4,7 @@
 	<classpathentry kind="src" path="src/main/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/com.opensymphony.quartz/com.springsource.org.quartz/1.6.0/com.springsource.org.quartz-1.6.0.jar" sourcepath="/KERNEL_IVY_CACHE/com.opensymphony.quartz/com.springsource.org.quartz/1.6.0/com.springsource.org.quartz-sources-1.6.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-sources-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-sources-3.7.0.v20110224.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.beans/3.0.0.RELEASE/org.springframework.beans-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context/3.0.0.RELEASE/org.springframework.context-sources-3.0.0.RELEASE.jar"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.springframework/org.springframework.context.support/3.0.0.RELEASE/org.springframework.context.support-3.0.0.RELEASE.jar" sourcepath="/KERNEL_IVY_CACHE/org.springframework/org.springframework.context.support/3.0.0.RELEASE/org.springframework.context.support-sources-3.0.0.RELEASE.jar"/>
diff --git a/test-apps/service-scoping/scoping.service.module.b/.classpath b/test-apps/service-scoping/scoping.service.module.b/.classpath
index 8af0f39..f8b4fca 100644
--- a/test-apps/service-scoping/scoping.service.module.b/.classpath
+++ b/test-apps/service-scoping/scoping.service.module.b/.classpath
@@ -6,6 +6,6 @@
 	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-4.7.0.jar" sourcepath="/KERNEL_IVY_CACHE/org.junit/com.springsource.org.junit/4.7.0/com.springsource.org.junit-sources-4.7.0.jar"/>
-	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20101022/org.eclipse.osgi-3.7.0.v20101022.jar"/>
+	<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.0.v20110224/org.eclipse.osgi-3.7.0.v20110224.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>