[jboss-cvs] JBossAS SVN: r101766 - in projects/jboss-osgi/projects/runtime/framework/trunk: core and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 3 04:56:17 EST 2010


Author: thomas.diesler at jboss.com
Date: 2010-03-03 04:56:16 -0500 (Wed, 03 Mar 2010)
New Revision: 101766

Added:
   projects/jboss-osgi/projects/runtime/framework/trunk/core/
   projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml
   projects/jboss-osgi/projects/runtime/framework/trunk/core/scripts/
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java
Removed:
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContextFactory.java
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/LazyVirtualFileHandler.java
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/bundle/
   projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/scripts/
   projects/jboss-osgi/projects/runtime/framework/trunk/src/
Modified:
   projects/jboss-osgi/projects/runtime/framework/trunk/.classpath
   projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
Log:
split framework into modules

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/.classpath	2010-03-03 09:42:26 UTC (rev 101765)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/.classpath	2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,9 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
-	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
-	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
-	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
 	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="output" path="target/classes"/>

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml (from rev 101762, projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml	2010-03-03 09:56:16 UTC (rev 101766)
@@ -0,0 +1,373 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+  <!-- ====================================================================== -->
+  <!--                                                                        -->
+  <!--  JBoss, the OpenSource J2EE webOS                                      -->
+  <!--                                                                        -->
+  <!--  Distributable under LGPL license.                                     -->
+  <!--  See terms of license at http://www.gnu.org.                           -->
+  <!--                                                                        -->
+  <!-- ====================================================================== -->
+
+  <!-- $Id$ -->
+
+  <!-- 
+     Set these VM properties in your IDE debugger
+     
+     -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target}
+     -Dlog4j.configuration=log4j-console.xml
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <name>JBossOSGi Framework - Core</name>
+  <groupId>org.jboss.osgi.runtime</groupId>
+  <artifactId>jboss-osgi-framework</artifactId>
+  <packaging>bundle</packaging>
+
+  <parent>
+    <groupId>org.jboss.osgi.runtime</groupId>
+    <artifactId>jboss-osgi-framework-parent</artifactId>
+    <version>1.0.0.Alpha4-SNAPSHOT</version>
+  </parent>
+
+  <dependencies>
+    <dependency>
+      <groupId>biz.aQute</groupId>
+      <artifactId>bnd</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.cl</groupId>
+      <artifactId>jboss-classloader</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.cl</groupId>
+      <artifactId>jboss-classloading</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.cl</groupId>
+      <artifactId>jboss-classloading-vfs</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-client</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-client-spi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-core-spi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-impl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-structure-spi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-vfs-spi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-vfs</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-jmx</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.kernel</groupId>
+      <artifactId>jboss-kernel</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.kernel</groupId>
+      <artifactId>jboss-jmx-aop-mc-int</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.kernel</groupId>
+      <artifactId>jboss-jmx-mc-int</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.kernel</groupId>
+      <artifactId>jboss-dependency</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-spi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-mdr</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi</groupId>
+      <artifactId>jboss-osgi-spi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.runtime</groupId>
+      <artifactId>jboss-osgi-deployers</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.runtime</groupId>
+      <artifactId>jboss-osgi-deployment</artifactId>
+    </dependency>
+
+    <!-- OSGi Dependencies -->
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
+    </dependency>
+
+    <!-- Test bundles dependencies -->
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.configadmin</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.osgi.core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.osgi.compendium</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.log</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.osgi.core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.osgi.compendium</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.metatype</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.osgi.core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.osgi.compendium</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-apache-xerces</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-common</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-common-core</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-husky</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-jaxb</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.jmx</groupId>
+      <artifactId>jboss-osgi-jmx</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.jndi</groupId>
+      <artifactId>jboss-osgi-jndi</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-reflect</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-xml-binding</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.web</groupId>
+      <artifactId>pax-web-jetty-bundle</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- Test Dependencies -->
+    <dependency>
+      <groupId>org.jboss.test</groupId>
+      <artifactId>jboss-test</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.jboss</groupId>
+          <artifactId>jboss-common-core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.jboss.logging</groupId>
+          <artifactId>jboss-logging-spi</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi</groupId>
+      <artifactId>jboss-osgi-testing</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>bundles</id>
+            <phase>test-compile</phase>
+            <goals>
+              <goal>directory-single</goal>
+            </goals>
+            <configuration>
+              <finalName>test-libs</finalName>
+              <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+              <appendAssemblyId>false</appendAssemblyId>
+              <descriptors>
+                <descriptor>scripts/assembly-bundles.xml</descriptor>
+              </descriptors>
+            </configuration>
+          </execution>
+          <execution>
+            <id>all</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+            <configuration>
+              <descriptors>
+                <descriptor>scripts/assembly-all.xml</descriptor>
+              </descriptors>
+              <archive>
+                <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+              </archive>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>build-test-jars</id>
+            <phase>test-compile</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <tasks>
+                <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+                <property name="tests.output.dir" value="${project.build.directory}" />
+                <ant antfile="scripts/antrun-test-jars.xml" />
+              </tasks>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-idea-plugin</artifactId>
+        <configuration>
+          <downloadSources>true</downloadSources>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>org.jboss.osgi.framework</Bundle-SymbolicName>
+            <Bundle-Name>JBossOSGi Framework</Bundle-Name>
+            <Bundle-Version>${version}</Bundle-Version>
+            <Export-Package>
+              org.osgi.framework;version="1.5",
+              org.osgi.framework.launch;version="1.0",
+              org.osgi.framework.hooks.service;version="1.0",
+              org.osgi.service.packageadmin;version="1.2",
+              org.osgi.service.startlevel;version="1.1",
+              org.osgi.util.tracker;version="1.4"
+             </Export-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <argLine>-Xmx512m</argLine>
+          <systemProperties>
+            <property>
+              <name>log4j.output.dir</name>
+              <value>${project.build.directory}</value>
+            </property>
+            <property>
+              <name>org.jboss.osgi.framework.launch.bootstrapPath</name>
+              <value>bootstrap/jboss-osgi-bootstrap.xml</value>
+            </property>
+            <property>
+              <name>org.jboss.osgi.husky.Invoker</name>
+              <value>org.jboss.osgi.husky.internal.AbstractInvoker</value>
+            </property>
+            <property>
+              <name>test.archive.directory</name>
+              <value>${project.build.directory}/test-libs</value>
+            </property>
+          </systemProperties>
+          <excludes>
+            <!-- excludes listed here need to have a jira issue associated 
+            <exclude>org/jboss/test/osgi/service/ServiceMixUnitTestCase.class</exclude>
+            -->
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/scripts (from rev 101664, projects/jboss-osgi/projects/runtime/framework/trunk/scripts)

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/src (from rev 101664, projects/jboss-osgi/projects/runtime/framework/trunk/src)

Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java	2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java	2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,280 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.osgi.framework.bundle;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.osgi.deployment.deployer.Deployment;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
-import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.AdminPermission;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-/**
- * The abstract state of a user deployed {@link Bundle} or Fragment.
- * 
- * @author Thomas.Diesler at jboss.com
- * @since 25-Dec-2009
- */
-public abstract class AbstractDeployedBundleState extends AbstractBundleState
-{
-   /** Used to generate a unique id */
-   private static final AtomicLong bundleIDGenerator = new AtomicLong();
-
-   /** The bundle id */
-   private long bundleId;
-
-   /** The bundle location */
-   private String location;
-
-   /** The bundle root file */
-   private VirtualFile rootFile;
-
-   /** The list of deployment units */
-   private List<DeploymentUnit> units = new ArrayList<DeploymentUnit>();
-
-   /** The headers localized with the default locale */
-   Dictionary<String, String> headersOnUninstall;
-
-   /**
-    * Create a new BundleState.
-    * @throws IllegalArgumentException for a null parameter
-    */
-   public AbstractDeployedBundleState(OSGiBundleManager bundleManager, DeploymentUnit unit)
-   {
-      super(bundleManager);
-      
-      if (unit == null)
-         throw new IllegalArgumentException("Null deployment unit");
-
-      // The bundle location is not necessarily the bundle root url
-      // The framework is expected to preserve the location passed into installBundle(String)
-      Deployment dep = unit.getAttachment(Deployment.class);
-      location = (dep != null ? dep.getLocation() : unit.getName());
-      rootFile = (dep != null ? dep.getRoot() : ((VFSDeploymentUnit)unit).getRoot());
-
-      bundleId = bundleIDGenerator.incrementAndGet();
-
-      addDeploymentUnit(unit);
-   }
-
-   /**
-    * Get the root file for this bundle 
-    */
-   public VirtualFile getRoot()
-   {
-      return rootFile;
-   }
-
-   @Override
-   public OSGiMetaData getOSGiMetaData()
-   {
-      DeploymentUnit unit = getDeploymentUnit();
-      OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
-      return osgiMetaData;
-   }
-
-   public long getBundleId()
-   {
-      return bundleId;
-   }
-
-   /**
-    * Get the DeploymentUnit that was added last.
-    * 
-    * Initially, an OSGiBundleState is associated with just one DeploymentUnit.
-    * A sucessful call to {@link #update()} or its variants pushes an additional
-    * DeploymentUnit to the stack.   
-    * 
-    * @return the unit that corresponds to the last sucessful update.
-    */
-   public DeploymentUnit getDeploymentUnit()
-   {
-      int index = (units.size() - 1);
-      return units.get(index);
-   }
-
-   /**
-    * Add a DeploymentUnit to the list.
-    * 
-    * @see {@link OSGiBundleManager#updateBundle(DeployedBundleState, InputStream)}
-    */
-   void addDeploymentUnit(DeploymentUnit unit)
-   {
-      unit.getMutableMetaData().addMetaData(unit, DeploymentUnit.class);
-      units.add(unit);
-   }
-
-   /**
-    * Get the list of DeploymentUnits.
-    * 
-    * @see {@link OSGiBundleManager#uninstallBundle(DeployedBundleState)}
-    */
-   List<DeploymentUnit> getDeploymentUnits()
-   {
-      return Collections.unmodifiableList(units);
-   }
-
-   public String getLocation()
-   {
-      return location;
-   }
-
-   @Override
-   public Dictionary<String, String> getHeaders(String locale)
-   {
-      // This method must continue to return Manifest header information while this bundle is in the UNINSTALLED state, 
-      // however the header values must only be available in the raw and default locale values
-      if (getState() == Bundle.UNINSTALLED)
-         return headersOnUninstall;
-
-      return super.getHeaders(locale);
-   }
-
-   public URL getEntry(String path)
-   {
-      checkInstalled();
-      if (noAdminPermission(AdminPermission.RESOURCE))
-         return null;
-   
-      return getEntryInternal(path);
-   }
-
-   @SuppressWarnings("rawtypes")
-   public Enumeration getEntryPaths(String path)
-   {
-      checkInstalled();
-      if (noAdminPermission(AdminPermission.RESOURCE))
-         return null;
-   
-      DeploymentUnit unit = getDeploymentUnit();
-      if (unit instanceof VFSDeploymentUnit)
-      {
-         VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
-         VirtualFile root = vfsDeploymentUnit.getRoot();
-         if (path.startsWith("/"))
-            path = path.substring(1);
-         try
-         {
-            VirtualFile child = root.getChild(path);
-            if (child != null)
-               return new VFSEntryPathsEnumeration(root, child);
-         }
-         catch (IOException e)
-         {
-            throw new RuntimeException("Error determining entry paths for " + root + " path=" + path);
-         }
-   
-      }
-      return null;
-   }
-   
-   @Override
-   protected URL getEntryInternal(String path)
-   {
-      DeploymentUnit unit = getDeploymentUnit();
-      if (unit instanceof VFSDeploymentUnit)
-      {
-         VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
-
-         if (path.startsWith("/"))
-            path = path.substring(1);
-
-         return vfsDeploymentUnit.getResourceLoader().getResource(path);
-      }
-      return null;
-   }
-   
-   public void uninstall() throws BundleException
-   {
-      checkAdminPermission(AdminPermission.LIFECYCLE); 
-
-      // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown
-      if (getState() == Bundle.UNINSTALLED)
-         throw new IllegalStateException("Bundle already uninstalled: " + this);
-      
-      // Cache the headers in the default locale 
-      headersOnUninstall = getHeaders(null);
-      
-      getBundleManager().uninstallBundle(this);
-   }
-
-   @SuppressWarnings("rawtypes")
-   public Enumeration findEntries(String path, String filePattern, boolean recurse)
-   {
-      if (path == null)
-         throw new IllegalArgumentException("Null path");
-   
-      checkInstalled();
-      if (noAdminPermission(AdminPermission.RESOURCE))
-         return null;
-   
-      // [TODO] fragments
-      resolveBundle();
-   
-      if (filePattern == null)
-         filePattern = "*";
-   
-      DeploymentUnit unit = getDeploymentUnit();
-      if (unit instanceof VFSDeploymentUnit)
-      {
-         VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
-         VirtualFile root = vfsDeploymentUnit.getRoot();
-         if (path.startsWith("/"))
-            path = path.substring(1);
-         try
-         {
-            VirtualFile child = root.getChild(path);
-            if (child != null)
-               return new VFSFindEntriesEnumeration(root, child, filePattern, recurse);
-         }
-         catch (IOException e)
-         {
-            throw new RuntimeException("Error finding entries for " + root + " path=" + path + " pattern=" + filePattern + " recurse=" + recurse);
-         }
-   
-      }
-      return null;
-   }
-
-   /**
-    * Try to resolve the bundle
-    * @return true when resolved
-    */
-   protected boolean resolveBundle()
-   {
-      PackageAdminPlugin packageAdmin = getBundleManager().getPlugin(PackageAdminPlugin.class);
-      return packageAdmin.resolveBundles(new Bundle[] { this });
-   }
-}

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java (from rev 101762, projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java	2010-03-03 09:56:16 UTC (rev 101766)
@@ -0,0 +1,281 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.bundle;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.osgi.deployment.deployer.Deployment;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * The abstract state of a user deployed {@link Bundle} or Fragment.
+ * 
+ * @author Thomas.Diesler at jboss.com
+ * @since 25-Dec-2009
+ */
+public abstract class AbstractDeployedBundleState extends AbstractBundleState
+{
+   /** Used to generate a unique id */
+   private static final AtomicLong bundleIDGenerator = new AtomicLong();
+
+   /** The bundle id */
+   private long bundleId;
+
+   /** The bundle location */
+   private String location;
+
+   /** The bundle root file */
+   private VirtualFile rootFile;
+
+   /** The list of deployment units */
+   private List<DeploymentUnit> units = new ArrayList<DeploymentUnit>();
+
+   /** The headers localized with the default locale */
+   Dictionary<String, String> headersOnUninstall;
+
+   /**
+    * Create a new BundleState.
+    * @throws IllegalArgumentException for a null parameter
+    */
+   public AbstractDeployedBundleState(OSGiBundleManager bundleManager, DeploymentUnit unit)
+   {
+      super(bundleManager);
+      
+      if (unit == null)
+         throw new IllegalArgumentException("Null deployment unit");
+
+      // The bundle location is not necessarily the bundle root url
+      // The framework is expected to preserve the location passed into installBundle(String)
+      Deployment dep = unit.getAttachment(Deployment.class);
+      location = (dep != null ? dep.getLocation() : unit.getName());
+      rootFile = (dep != null ? (VirtualFile)AbstractVFS.adapt(dep.getRoot()) : ((VFSDeploymentUnit)unit).getRoot());
+
+      bundleId = bundleIDGenerator.incrementAndGet();
+
+      addDeploymentUnit(unit);
+   }
+
+   /**
+    * Get the root file for this bundle 
+    */
+   public VirtualFile getRoot()
+   {
+      return rootFile;
+   }
+
+   @Override
+   public OSGiMetaData getOSGiMetaData()
+   {
+      DeploymentUnit unit = getDeploymentUnit();
+      OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
+      return osgiMetaData;
+   }
+
+   public long getBundleId()
+   {
+      return bundleId;
+   }
+
+   /**
+    * Get the DeploymentUnit that was added last.
+    * 
+    * Initially, an OSGiBundleState is associated with just one DeploymentUnit.
+    * A sucessful call to {@link #update()} or its variants pushes an additional
+    * DeploymentUnit to the stack.   
+    * 
+    * @return the unit that corresponds to the last sucessful update.
+    */
+   public DeploymentUnit getDeploymentUnit()
+   {
+      int index = (units.size() - 1);
+      return units.get(index);
+   }
+
+   /**
+    * Add a DeploymentUnit to the list.
+    * 
+    * @see {@link OSGiBundleManager#updateBundle(DeployedBundleState, InputStream)}
+    */
+   void addDeploymentUnit(DeploymentUnit unit)
+   {
+      unit.getMutableMetaData().addMetaData(unit, DeploymentUnit.class);
+      units.add(unit);
+   }
+
+   /**
+    * Get the list of DeploymentUnits.
+    * 
+    * @see {@link OSGiBundleManager#uninstallBundle(DeployedBundleState)}
+    */
+   List<DeploymentUnit> getDeploymentUnits()
+   {
+      return Collections.unmodifiableList(units);
+   }
+
+   public String getLocation()
+   {
+      return location;
+   }
+
+   @Override
+   public Dictionary<String, String> getHeaders(String locale)
+   {
+      // This method must continue to return Manifest header information while this bundle is in the UNINSTALLED state, 
+      // however the header values must only be available in the raw and default locale values
+      if (getState() == Bundle.UNINSTALLED)
+         return headersOnUninstall;
+
+      return super.getHeaders(locale);
+   }
+
+   public URL getEntry(String path)
+   {
+      checkInstalled();
+      if (noAdminPermission(AdminPermission.RESOURCE))
+         return null;
+   
+      return getEntryInternal(path);
+   }
+
+   @SuppressWarnings("rawtypes")
+   public Enumeration getEntryPaths(String path)
+   {
+      checkInstalled();
+      if (noAdminPermission(AdminPermission.RESOURCE))
+         return null;
+   
+      DeploymentUnit unit = getDeploymentUnit();
+      if (unit instanceof VFSDeploymentUnit)
+      {
+         VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
+         VirtualFile root = vfsDeploymentUnit.getRoot();
+         if (path.startsWith("/"))
+            path = path.substring(1);
+         try
+         {
+            VirtualFile child = root.getChild(path);
+            if (child != null)
+               return new VFSEntryPathsEnumeration(root, child);
+         }
+         catch (IOException e)
+         {
+            throw new RuntimeException("Error determining entry paths for " + root + " path=" + path);
+         }
+   
+      }
+      return null;
+   }
+   
+   @Override
+   protected URL getEntryInternal(String path)
+   {
+      DeploymentUnit unit = getDeploymentUnit();
+      if (unit instanceof VFSDeploymentUnit)
+      {
+         VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
+
+         if (path.startsWith("/"))
+            path = path.substring(1);
+
+         return vfsDeploymentUnit.getResourceLoader().getResource(path);
+      }
+      return null;
+   }
+   
+   public void uninstall() throws BundleException
+   {
+      checkAdminPermission(AdminPermission.LIFECYCLE); 
+
+      // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown
+      if (getState() == Bundle.UNINSTALLED)
+         throw new IllegalStateException("Bundle already uninstalled: " + this);
+      
+      // Cache the headers in the default locale 
+      headersOnUninstall = getHeaders(null);
+      
+      getBundleManager().uninstallBundle(this);
+   }
+
+   @SuppressWarnings("rawtypes")
+   public Enumeration findEntries(String path, String filePattern, boolean recurse)
+   {
+      if (path == null)
+         throw new IllegalArgumentException("Null path");
+   
+      checkInstalled();
+      if (noAdminPermission(AdminPermission.RESOURCE))
+         return null;
+   
+      // [TODO] fragments
+      resolveBundle();
+   
+      if (filePattern == null)
+         filePattern = "*";
+   
+      DeploymentUnit unit = getDeploymentUnit();
+      if (unit instanceof VFSDeploymentUnit)
+      {
+         VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
+         VirtualFile root = vfsDeploymentUnit.getRoot();
+         if (path.startsWith("/"))
+            path = path.substring(1);
+         try
+         {
+            VirtualFile child = root.getChild(path);
+            if (child != null)
+               return new VFSFindEntriesEnumeration(root, child, filePattern, recurse);
+         }
+         catch (IOException e)
+         {
+            throw new RuntimeException("Error finding entries for " + root + " path=" + path + " pattern=" + filePattern + " recurse=" + recurse);
+         }
+   
+      }
+      return null;
+   }
+
+   /**
+    * Try to resolve the bundle
+    * @return true when resolved
+    */
+   protected boolean resolveBundle()
+   {
+      PackageAdminPlugin packageAdmin = getBundleManager().getPlugin(PackageAdminPlugin.class);
+      return packageAdmin.resolveBundles(new Bundle[] { this });
+   }
+}

Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,1561 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.osgi.framework.bundle;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.deployers.client.spi.DeployerClient;
-import org.jboss.deployers.client.spi.IncompleteDeploymentException;
-import org.jboss.deployers.client.spi.IncompleteDeployments;
-import org.jboss.deployers.client.spi.MissingDependency;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.kernel.Kernel;
-import org.jboss.logging.Logger;
-import org.jboss.osgi.deployment.deployer.Deployment;
-import org.jboss.osgi.deployment.deployer.DeploymentFactory;
-import org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
-import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
-import org.jboss.osgi.framework.plugins.AutoInstallPlugin;
-import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
-import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
-import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
-import org.jboss.osgi.framework.plugins.Plugin;
-import org.jboss.osgi.framework.plugins.ResolverPlugin;
-import org.jboss.osgi.framework.plugins.ServicePlugin;
-import org.jboss.osgi.framework.util.URLHelper;
-import org.jboss.osgi.spi.util.BundleInfo;
-import org.jboss.util.platform.Java;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.Version;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * OSGiBundleManager.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler at jboss.com
- * @author <a href="ales.justin at jboss.org">Ales Justin</a>
- * @version $Revision: 1.1 $
- */
-public class OSGiBundleManager
-{
-   /** The log */
-   private static final Logger log = Logger.getLogger(OSGiBundleManager.class);
-
-   /** The bundle manager's bean name: OSGiBundleManager */
-   public static final String BEAN_BUNDLE_MANAGER = "OSGiBundleManager";
-   /** The framework execution environment */
-   private static String OSGi_FRAMEWORK_EXECUTIONENVIRONMENT;
-   /** The framework language */
-   private static String OSGi_FRAMEWORK_LANGUAGE = Locale.getDefault().getISO3Language(); // REVIEW correct?
-   /** The os name */
-   private static String OSGi_FRAMEWORK_OS_NAME;
-   /** The os version */
-   private static String OSGi_FRAMEWORK_OS_VERSION;
-   /** The os version */
-   private static String OSGi_FRAMEWORK_PROCESSOR;
-   /** The framework vendor */
-   private static String OSGi_FRAMEWORK_VENDOR = "jboss.org";
-   /** The framework version. This is the version of the org.osgi.framework package in r4v42 */
-   private static String OSGi_FRAMEWORK_VERSION = "1.5";
-   /** The bundles by id */
-   private List<AbstractBundleState> allBundles = new CopyOnWriteArrayList<AbstractBundleState>();
-   /** The kernel */
-   private Kernel kernel;
-   /** The main deployer */
-   private DeployerClient deployerClient;
-   /** The executor */
-   private Executor executor;
-   /** The system bundle */
-   private OSGiSystemState systemBundle;
-   /** The registered manager plugins */
-   private Map<Class<?>, Plugin> plugins = Collections.synchronizedMap(new LinkedHashMap<Class<?>, Plugin>());
-   /** The frame work properties */
-   private Map<String, Object> properties = new ConcurrentHashMap<String, Object>();
-   /** The framework stop monitor*/
-   private AtomicInteger stopMonitor = new AtomicInteger(0);
-
-   static
-   {
-      AccessController.doPrivileged(new PrivilegedAction<Object>()
-      {
-         public Object run()
-         {
-            List<String> execEnvironments = new ArrayList<String>();
-            if (Java.isCompatible(Java.VERSION_1_5))
-               execEnvironments.add("J2SE-1.5");
-            if (Java.isCompatible(Java.VERSION_1_6))
-               execEnvironments.add("JavaSE-1.6");
-
-            String envlist = execEnvironments.toString();
-            envlist = envlist.substring(1, envlist.length() - 1);
-            OSGi_FRAMEWORK_EXECUTIONENVIRONMENT = envlist;
-
-            OSGi_FRAMEWORK_OS_NAME = System.getProperty("os.name");
-            OSGi_FRAMEWORK_OS_VERSION = System.getProperty("os.version");
-            OSGi_FRAMEWORK_PROCESSOR = System.getProperty("os.arch");
-
-            System.setProperty("org.osgi.vendor.framework", "org.jboss.osgi.plugins.framework");
-            return null;
-         }
-      });
-   }
-
-   /**
-    * Create a new OSGiBundleManager.
-    * 
-    * @param kernel the kernel
-    * @param deployerClient the deployer client
-    * @param registry the deployment registry
-    * @throws IllegalArgumentException for a null parameter
-    */
-   public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient)
-   {
-      this(kernel, deployerClient, null);
-   }
-
-   /**
-    * Create a new OSGiBundleManager.
-    * 
-    * @param kernel the kernel
-    * @param deployerClient the deployer client
-    * @param registry the deployment registry
-    * @param executor the executor
-    * @throws IllegalArgumentException for a null parameter
-    */
-   public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient, Executor executor)
-   {
-      if (kernel == null)
-         throw new IllegalArgumentException("Null kernel");
-      if (deployerClient == null)
-         throw new IllegalArgumentException("Null deployerClient");
-      if (deployerClient instanceof MainDeployerStructure == false)
-         throw new IllegalArgumentException("Deployer client does not implement " + MainDeployerStructure.class.getName());
-
-      this.kernel = kernel;
-      this.deployerClient = deployerClient;
-
-      // TODO thread factory
-      if (executor == null)
-         executor = Executors.newFixedThreadPool(10);
-
-      this.executor = executor;
-   }
-
-   public void start()
-   {
-      // Create the system Bundle
-      systemBundle = new OSGiSystemState(this);
-      addBundle(systemBundle);
-   }
-
-   public void stop()
-   {
-      // nothing to do
-   }
-
-   /**
-    * Get the kernel
-    *
-    * @return the kernel
-    */
-   public Kernel getKernel()
-   {
-      return kernel;
-   }
-
-   /**
-    * Get the deployerClient.
-    *
-    * @return the deployerClient.
-    */
-   public DeployerClient getDeployerClient()
-   {
-      return deployerClient;
-   }
-
-   /**
-    * Set the framework properties
-    *
-    * @param properties the properties
-    */
-   public void setProperties(Map<String, Object> props)
-   {
-      properties.putAll(props);
-
-      // Init default framework properties
-      if (getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT) == null)
-         setProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, OSGi_FRAMEWORK_EXECUTIONENVIRONMENT);
-      if (getProperty(Constants.FRAMEWORK_LANGUAGE) == null)
-         setProperty(Constants.FRAMEWORK_LANGUAGE, OSGi_FRAMEWORK_LANGUAGE);
-      if (getProperty(Constants.FRAMEWORK_OS_NAME) == null)
-         setProperty(Constants.FRAMEWORK_OS_NAME, OSGi_FRAMEWORK_OS_NAME);
-      if (getProperty(Constants.FRAMEWORK_OS_VERSION) == null)
-         setProperty(Constants.FRAMEWORK_OS_VERSION, OSGi_FRAMEWORK_OS_VERSION);
-      if (getProperty(Constants.FRAMEWORK_PROCESSOR) == null)
-         setProperty(Constants.FRAMEWORK_PROCESSOR, OSGi_FRAMEWORK_PROCESSOR);
-      if (getProperty(Constants.FRAMEWORK_VENDOR) == null)
-         setProperty(Constants.FRAMEWORK_VENDOR, OSGi_FRAMEWORK_VENDOR);
-      if (getProperty(Constants.FRAMEWORK_VERSION) == null)
-         setProperty(Constants.FRAMEWORK_VERSION, OSGi_FRAMEWORK_VERSION);
-   }
-
-   /**
-    * Get a property
-    *
-    * @param key the property key
-    * @return the property
-    * @throws SecurityException if the caller doesn't have the relevant property permission
-    */
-   public String getProperty(String key)
-   {
-      Object value = properties.get(key);
-      if (value == null)
-         value = System.getProperty(key);
-
-      if (value instanceof String == false)
-         return null;
-
-      return (String)value;
-   }
-
-   /**
-    * Set a property. This is used at the frame work init state.
-    * 
-    * @param key the prperty key
-    * @param value the property value
-    */
-   public void setProperty(String key, String value)
-   {
-      properties.put(key, value);
-   }
-
-   /**
-    * Get a plugin that is registered with the bundle manager.
-    * 
-    * @param <T> the pluging type
-    * @param clazz the plugin type
-    * @return the plugin
-    * @throws IllegalStateException if the requested plugin class is not registered
-    */
-   @SuppressWarnings("unchecked")
-   public <T extends Plugin> T getPlugin(Class<T> clazz)
-   {
-      T plugin = (T)plugins.get(clazz);
-      if (plugin == null)
-         throw new IllegalStateException("Cannot obtain plugin for: " + clazz.getName());
-
-      return plugin;
-   }
-
-   /**
-    * Get an optional plugin that is registered with the bundle manager.
-    * 
-    * @param <T> the pluging type
-    * @param clazz the plugin type
-    * @return The plugin instance or null if the requested plugin class is not registered
-    */
-   @SuppressWarnings("unchecked")
-   public <T extends Plugin> T getOptionalPlugin(Class<T> clazz)
-   {
-      return (T)plugins.get(clazz);
-   }
-
-   /**
-    * Add a plugin
-    * 
-    * @param plugin the plugin
-    */
-   public void addPlugin(Plugin plugin)
-   {
-      Class<?> key = getPluginKey(plugin);
-      log.debug("Add plugin: " + key.getName());
-      plugins.put(key, plugin);
-
-      // In case a service plugin gets added after the framework is started
-      if (isFrameworkActive() == true && plugin instanceof ServicePlugin)
-      {
-         ServicePlugin servicePlugin = (ServicePlugin)plugin;
-         servicePlugin.startService();
-      }
-   }
-
-   /**
-    * Get the key for a given plugin
-    *
-    * @param plugin the plugin
-    * @return the class
-    */
-   private Class<?> getPluginKey(Plugin plugin)
-   {
-      if (plugin == null)
-         throw new IllegalArgumentException("Null plugin");
-
-      Class<?> clazz = plugin.getClass();
-      Class<?> key = getPluginKey(plugin, clazz);
-
-      // If the plugin could not be added by Interface, use the clazz directly
-      return (key != null ? key : clazz);
-   }
-
-   /**
-    * Get the plugin key by scanning the interfaces for the given clazz.
-    *
-    * @param plugin the plugin
-    * @param clazz the class
-    * @return The first interface that extends Plugin.
-    */
-   private Class<?> getPluginKey(Plugin plugin, Class<?> clazz)
-   {
-      // Scan the interfaces on the class
-      for (Class<?> interf : clazz.getInterfaces())
-      {
-         if (interf == Plugin.class || interf == ServicePlugin.class)
-            continue;
-
-         if (Plugin.class.isAssignableFrom(interf))
-         {
-            return interf;
-         }
-      }
-
-      // Interface not found, try the plugin's superclass 
-      Class<?> superclass = clazz.getSuperclass();
-      if (Plugin.class.isAssignableFrom(superclass))
-         return getPluginKey(plugin, superclass);
-
-      return null;
-   }
-
-   /**
-    * Remove a plugin
-    * 
-    * @param plugin the plugin to remove
-    */
-   public void removePlugin(Plugin plugin)
-   {
-      Class<?> key = getPluginKey(plugin);
-      log.debug("Remove plugin: " + key.getName());
-      plugins.remove(key);
-   }
-
-   /**
-    * Are we active
-    * @return true when the system is active
-    */
-   public boolean isFrameworkActive()
-   {
-      // We are active if the system bundle is ACTIVE
-      AbstractBundleState bundleState = getSystemBundle();
-      return bundleState.getState() == Bundle.ACTIVE;
-   }
-
-   /**
-    * Install a bundle from an URL.
-    * 
-    * @param url the url of the bundle
-    * @return the bundle state
-    * @throws BundleException for any error
-    */
-   public AbstractBundleState installBundle(URL url) throws BundleException
-   {
-      if (url == null)
-         throw new BundleException("Null url");
-
-      return installBundle(url.toExternalForm(), null);
-   }
-
-   /**
-    * Install a bundle from an input stream.
-    * 
-    * @param location the bundle's location identifier
-    * @param input an optional input stream to read the bundle content from
-    * @return the bundle state
-    * @throws BundleException for any error
-    */
-   public AbstractBundleState installBundle(String location, InputStream input) throws BundleException
-   {
-      if (location == null)
-         throw new BundleException("Null location");
-
-      URL locationURL;
-
-      // Get the location URL
-      if (input != null)
-      {
-         locationURL = getBundleStorageLocation(input);
-      }
-      else
-      {
-         locationURL = getLocationURL(location);
-      }
-
-      // Get the root file
-      VirtualFile root;
-      try
-      {
-         root = VFS.getRoot(locationURL);
-      }
-      catch (IOException e)
-      {
-         throw new BundleException("Invalid bundle location=" + locationURL, e);
-      }
-
-      return install(root, location, false);
-   }
-
-   private URL getBundleStorageLocation(InputStream input) throws BundleException
-   {
-      try
-      {
-         BundleStoragePlugin plugin = getPlugin(BundleStoragePlugin.class);
-         String path = plugin.getStorageDir(getSystemBundle()).getCanonicalPath();
-
-         // [TODO] do properly
-         File file = new File(path + "/bundle-" + System.currentTimeMillis() + ".jar");
-         FileOutputStream fos = new FileOutputStream(file);
-         VFSUtils.copyStream(input, fos);
-         fos.close();
-
-         URL locationURL = file.toURI().toURL();
-         return locationURL;
-      }
-      catch (IOException ex)
-      {
-         throw new BundleException("Cannot store bundle from input stream", ex);
-      }
-   }
-
-   /**
-    * Install a bundle from a virtual file.
-    *  
-    * @param root the virtual file that point to the bundle
-    * 
-    * @return the bundle state
-    * @throws BundleException for any error
-    */
-   public AbstractBundleState installBundle(VirtualFile root) throws BundleException
-   {
-      return install(root, root.toString(), false);
-   }
-
-   /*
-    * Installs a bundle from the given virtual file.
-    */
-   private AbstractBundleState install(VirtualFile root, String location, boolean autoStart) throws BundleException
-   {
-      if (location == null)
-         throw new IllegalArgumentException("Null location");
-
-      Deployment dep;
-      try
-      {
-         BundleInfo info = BundleInfo.createBundleInfo(root, location);
-         dep = DeploymentFactory.createDeployment(info);
-         dep.setAutoStart(autoStart);
-      }
-      catch (RuntimeException ex)
-      {
-         throw new BundleException("Cannot install bundle: " + root, ex);
-      }
-
-      return installBundle(dep);
-   }
-
-   /**
-    * Install a bundle from a deployment. 
-    *  
-    * @param dep the deployment that represents the bundle
-    * 
-    * @return the bundle state
-    * @throws BundleException for any error
-    */
-   public AbstractBundleState installBundle(Deployment dep) throws BundleException
-   {
-      // Create the deployment and deploy it
-      try
-      {
-         VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(dep.getRoot());
-         MutableAttachments att = (MutableAttachments)deployment.getPredeterminedManagedObjects();
-         att.addAttachment(Deployment.class, dep);
-
-         // In case of update the OSGiBundleState is attached
-         AbstractBundleState bundleState = dep.getAttachment(AbstractBundleState.class);
-         if (bundleState != null)
-            att.addAttachment(AbstractBundleState.class, bundleState);
-
-         deployerClient.deploy(deployment);
-         try
-         {
-            MainDeployerStructure deployerStructure = (MainDeployerStructure)deployerClient;
-            DeploymentUnit unit = deployerStructure.getDeploymentUnit(deployment.getName());
-            bundleState = unit.getAttachment(AbstractBundleState.class);
-            if (bundleState == null)
-               throw new IllegalStateException("Unable to determine bundle state for " + deployment.getName());
-
-            return bundleState;
-         }
-         catch (Exception e)
-         {
-            deployerClient.undeploy(deployment);
-            throw e;
-         }
-      }
-      catch (IncompleteDeploymentException ex)
-      {
-         String errorMessage = getIncompleteDeploymentInfo(dep, ex);
-         throw new BundleException(errorMessage);
-      }
-      catch (Exception ex)
-      {
-         throw new BundleException("Error installing bundle from: " + dep, ex);
-      }
-   }
-
-   private String getIncompleteDeploymentInfo(Deployment dep, IncompleteDeploymentException ex)
-   {
-      IncompleteDeployments deployments = ex.getIncompleteDeployments();
-
-      StringWriter stringWriter = new StringWriter();
-      PrintWriter printWriter = new PrintWriter(stringWriter);
-      printWriter.println("Error installing bundle from: " + dep);
-
-      // Contexts in error 
-      Collection<Throwable> contextsError = deployments.getContextsInError().values();
-      if (contextsError.size() > 0)
-      {
-         printWriter.println("\nContext Errors:");
-         for (Throwable th : contextsError)
-         {
-            printWriter.println("\n");
-            th.printStackTrace(printWriter);
-         }
-      }
-
-      // Deployments in error 
-      Collection<Throwable> deploymentsInError = deployments.getDeploymentsInError().values();
-      if (deploymentsInError.size() > 0)
-      {
-         printWriter.println("\nDeployment Errors:");
-         for (Throwable th : deploymentsInError)
-         {
-            printWriter.println("\n");
-            th.printStackTrace(printWriter);
-         }
-      }
-
-      // Missing Dependencies 
-      Collection<Set<MissingDependency>> missingDependencies = deployments.getContextsMissingDependencies().values();
-      if (missingDependencies.size() > 0)
-      {
-         printWriter.println("\nMissing Dependencies:");
-         for (Set<MissingDependency> missDeps : missingDependencies)
-         {
-            for (MissingDependency missDep : missDeps)
-            {
-               printWriter.println("\n  " + missDep);
-            }
-         }
-      }
-
-      // Missing Deployers 
-      Collection<String> missingDeployers = deployments.getDeploymentsMissingDeployer();
-      if (missingDeployers.size() > 0)
-      {
-         printWriter.println("\nMissing Deployers:");
-         for (String missDep : missingDeployers)
-         {
-            printWriter.println("\n  " + missDep);
-         }
-      }
-
-      String errorMessage = stringWriter.toString();
-      return errorMessage;
-   }
-
-   /**
-    * Updates a bundle from an InputStream. 
-    */
-   public void updateBundle(AbstractDeployedBundleState bundleState, InputStream in) throws BundleException
-   {
-      // If the specified InputStream is null, the Framework must create the InputStream from which to read the updated bundle by interpreting, 
-      // in an implementation dependent manner, this bundle's Bundle-UpdateLocation Manifest header, if present, or this bundle's original location.
-      URL updateURL = bundleState.getOSGiMetaData().getBundleUpdateLocation();
-      if (updateURL == null)
-      {
-         // This updates the bundle from its original location 
-         VirtualFile root = bundleState.getRoot();
-         updateURL = URLHelper.toURL(root);
-      }
-      if (in == null)
-      {
-         try
-         {
-            in = updateURL.openStream();
-         }
-         catch (IOException ex)
-         {
-            throw new BundleException("Cannot obtain update input stream for: " + bundleState, ex);
-         }
-      }
-
-      // If this bundle's state is ACTIVE, it must be stopped before the update and started after the update successfully completes. 
-      boolean activeBeforeUpdate = (bundleState.getState() == Bundle.ACTIVE);
-
-      // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown. 
-      if (bundleState.getState() == Bundle.UNINSTALLED)
-         throw new IllegalStateException("Bundle already uninstalled: " + this);
-
-      // If this bundle has exported any packages that are imported by another bundle, these packages must not be updated. 
-      // Instead, the previous package version must remain exported until the PackageAdmin.refreshPackages method has been 
-      // has been called or the Framework is relaunched. 
-
-      // If this bundle's state is ACTIVE, STARTING  or STOPPING, this bundle is stopped as described in the Bundle.stop method. 
-      // If Bundle.stop throws an exception, the exception is rethrown terminating the update.
-      if (bundleState.getState() == Bundle.ACTIVE || bundleState.getState() == Bundle.STARTING || bundleState.getState() == Bundle.STOPPING)
-      {
-         stopBundle(bundleState);
-      }
-
-      // The updated version of this bundle is read from the input stream and installed. 
-      // If the Framework is unable to install the updated version of this bundle, the original version of this bundle must be restored 
-      // and a BundleException must be thrown after completion of the remaining steps.
-      String location = (updateURL != null ? updateURL.toExternalForm() : bundleState.getCanonicalName() + "/update");
-      AbstractBundleState updatedBundleState = null;
-      BundleException throwAfterUpdate = null;
-      try
-      {
-         URL storageLocation = getBundleStorageLocation(in);
-         VirtualFile root = VFS.getRoot(storageLocation);
-
-         BundleInfo info = BundleInfo.createBundleInfo(root, location);
-         Deployment dep = DeploymentFactory.createDeployment(info);
-         dep.addAttachment(AbstractBundleState.class, bundleState);
-         dep.setBundleUpdate(true);
-         dep.setAutoStart(false);
-
-         updatedBundleState = installBundle(dep);
-         updatedBundleState.updateLastModified();
-      }
-      catch (Exception ex)
-      {
-         if (ex instanceof BundleException)
-            throwAfterUpdate = (BundleException)ex;
-         else
-            throwAfterUpdate = new BundleException("Cannot install updated bundle from: " + location, ex);
-
-         if (activeBeforeUpdate)
-         {
-            startBundle(bundleState);
-         }
-      }
-
-      // If the updated version of this bundle was successfully installed, a bundle event of type BundleEvent.UPDATED is fired
-      if (updatedBundleState != null)
-      {
-         FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
-         plugin.fireBundleEvent(updatedBundleState, BundleEvent.UPDATED);
-
-         // If this bundle's state was originally ACTIVE, the updated bundle is started as described in the Bundle.start method. 
-         // If Bundle.start throws an exception, a Framework event of type FrameworkEvent.ERROR is fired containing the exception
-         if (activeBeforeUpdate)
-         {
-            if (updatedBundleState.isFragment() == false)
-               startBundle((AbstractDeployedBundleState)updatedBundleState);
-         }
-      }
-
-      // A BundleException must be thrown after completion of the remaining steps
-      if (throwAfterUpdate != null)
-      {
-         throw throwAfterUpdate;
-      }
-   }
-
-   /**
-    * Uninstall a bundle
-    * 
-    * @param bundleState the bundle
-    * @throws BundleException for any error
-    */
-   public void uninstallBundle(AbstractDeployedBundleState bundleState) throws BundleException
-   {
-      long id = bundleState.getBundleId();
-      if (getBundleById(id) == null)
-         throw new BundleException(bundleState + " not installed");
-
-      // If this bundle's state is ACTIVE, STARTING or STOPPING, this bundle is stopped 
-      // as described in the Bundle.stop method.
-      int state = bundleState.getState();
-      if (state == Bundle.ACTIVE || state == Bundle.STARTING || state == Bundle.STOPPING)
-      {
-         try
-         {
-            if (bundleState.isFragment() == false)
-               stopBundle((AbstractDeployedBundleState)bundleState);
-         }
-         catch (Exception ex)
-         {
-            // If Bundle.stop throws an exception, a Framework event of type FrameworkEvent.ERROR is
-            // fired containing the exception
-            fireError(bundleState, "Error stopping bundle: " + bundleState, ex);
-         }
-      }
-
-      DeploymentException depEx = null;
-      for (DeploymentUnit unit : bundleState.getDeploymentUnits())
-      {
-         try
-         {
-            deployerClient.undeploy(unit.getName());
-            bundleState.updateLastModified();
-         }
-         catch (DeploymentException ex)
-         {
-            log.error("Cannot undeploy: " + unit.getName(), depEx = ex);
-         }
-      }
-
-      // Rethrow deployment exception 
-      if (depEx != null)
-      {
-         Throwable cause = depEx.getCause();
-         if (cause instanceof BundleException)
-            throw (BundleException)cause;
-
-         throw new BundleException("Unable to uninstall " + bundleState, cause);
-      }
-   }
-
-   /**
-    * Add a deployment to the manager, which creates the bundle state.
-    * 
-    * Note, the bundle state is not yet added to the manager.
-    */
-   public AbstractBundleState addDeployment(DeploymentUnit unit)
-   {
-      if (unit == null)
-         throw new IllegalArgumentException("Null unit");
-
-      // In case of Bundle.update() the OSGiBundleState is attached
-      AbstractBundleState absBundle = unit.getAttachment(AbstractBundleState.class);
-      if (absBundle != null)
-      {
-         // Add the DeploymentUnit to the OSGiBundleState
-         OSGiBundleState depBundle = (OSGiBundleState)absBundle;
-         depBundle.addDeploymentUnit(unit);
-      }
-      else
-      {
-         OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
-         ParameterizedAttribute fragmentHost = osgiMetaData.getFragmentHost();
-         if (fragmentHost != null)
-         {
-            // Create a new OSGiFragmentState
-            OSGiFragmentState fragmentState = new OSGiFragmentState(this, unit);
-            absBundle = fragmentState;
-         }
-         else
-         {
-            // Create a new OSGiBundleState
-            AbstractDeployedBundleState bundleState = new OSGiBundleState(this, unit);
-            absBundle = bundleState;
-         }
-      }
-
-      // Attach the abstract bundle state
-      unit.addAttachment(AbstractBundleState.class, absBundle);
-      
-      if (absBundle.isFragment())
-         unit.addAttachment(OSGiFragmentState.class, (OSGiFragmentState)absBundle);
-      else
-         unit.addAttachment(OSGiBundleState.class, (OSGiBundleState)absBundle);
-      
-      return absBundle;
-   }
-
-   /**
-    * Add a bundle to the manager.
-    * 
-    * Note, the bundle must be metadata complete when it is added to the manager.
-    * An extender might pickup the INSTALLED event and use PackageAdmin to examine the 
-    * exported packages for example.
-    * 
-    * @param bundleState the bundle state
-    * @throws IllegalArgumentException for a null bundle state
-    */
-   public void addBundle(AbstractBundleState bundleState)
-   {
-      if (bundleState == null)
-         throw new IllegalArgumentException("Null bundle state");
-
-      // Do nothing if this is a bundle update
-      if (bundleState instanceof OSGiBundleState)
-      {
-         DeploymentUnit unit = ((AbstractDeployedBundleState)bundleState).getDeploymentUnit();
-         if (unit.getAttachment(ClassLoadingMetaData.class) == null)
-            throw new IllegalStateException("Cannot obtain ClassLoadingMetaData");
-            
-         Deployment dep = unit.getAttachment(Deployment.class);
-         if (dep != null && dep.isBundleUpdate())
-            return;
-      }
-
-      validateBundle(bundleState);
-      
-      allBundles.add(bundleState);
-      
-      bundleState.changeState(Bundle.INSTALLED, true);
-
-      // Add the bundle to the resolver
-      // Note, plugins are not registered when the system bundle is added 
-      ResolverPlugin bundleResolver = getOptionalPlugin(ResolverPlugin.class);
-      if (bundleResolver != null)
-         bundleResolver.addBundle(bundleState);
-
-      log.debug("Added: " + bundleState);
-   }
-
-   /**
-    * Validate the bundle
-    * 
-    * @param bundleState the bundle state
-    */
-   private void validateBundle(AbstractBundleState bundleState)
-   {
-      OSGiMetaData osgiMetaData = bundleState.getOSGiMetaData();
-      if (osgiMetaData == null)
-         return;
-
-      OSGiBundleValidator validator;
-      
-      // Delegate to the validator for the appropriate revision
-      if (osgiMetaData.getBundleManifestVersion() > 1)
-         validator = new OSGiBundleValidatorR4(this);
-      else
-         validator = new OSGiBundleValidatorR3(this);
-
-      validator.validateBundle(bundleState);
-   }
-
-   /**
-    * Remove a bundle
-    * 
-    * @param bundleState the bundle state
-    * @throws IllegalArgumentException for a null bundle state
-    */
-   public void removeBundle(AbstractBundleState bundleState)
-   {
-      if (bundleState == null)
-         throw new IllegalArgumentException("Null bundle state");
-
-      bundleState.uninstallInternal();
-
-      // Remove the bundle from the resolver
-      ResolverPlugin bundleResolver = getOptionalPlugin(ResolverPlugin.class);
-      if (bundleResolver != null)
-         bundleResolver.removeBundle(bundleState);
-
-      allBundles.remove(bundleState);
-      log.debug("Removed " + bundleState.getCanonicalName());
-   }
-
-   /**
-    * Get the system bundle
-    * 
-    * @return the system bundle
-    */
-   public OSGiSystemState getSystemBundle()
-   {
-      return systemBundle;
-   }
-
-   /**
-    * Get the system bundle context
-    * 
-    * @return the system bundle context
-    */
-   public BundleContext getSystemContext()
-   {
-      return systemBundle.getBundleContext();
-   }
-
-   /**
-    * Get a deployment
-    * 
-    * @param id the id of the bundle
-    * @return the deployment or null if there is no bundle with that id
-    */
-   public DeploymentUnit getDeployment(long id)
-   {
-      if (id == 0)
-         throw new IllegalArgumentException("Cannot get deployment from system bundle");
-
-      AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)getBundleById(id);
-      if (bundleState == null)
-         return null;
-
-      return bundleState.getDeploymentUnit();
-   }
-
-   /**
-    * Get a bundle by id
-    * 
-    * @param id the id of the bundle
-    * @return the bundle or null if there is no bundle with that id
-    */
-   public AbstractBundleState getBundleById(long id)
-   {
-      AbstractBundleState result = null;
-      for (AbstractBundleState aux : allBundles)
-      {
-         if (id == aux.getBundleId())
-         {
-            result = aux;
-            break;
-         }
-      }
-      return result;
-   }
-
-   /**
-    * Get a bundle by symbolic name and version
-    *
-    * @param symbolicName the symbolic name of the bundle
-    * @param version the version of the bundle
-    * @return the bundle or null if there is no bundle with that id
-    */
-   public AbstractBundleState getBundle(String symbolicName, Version version)
-   {
-      AbstractBundleState result = null;
-      for (AbstractBundleState aux : allBundles)
-      {
-         String auxName = aux.getSymbolicName();
-         Version auxVersion = aux.getVersion();
-         if (auxName.equals(symbolicName) && auxVersion.equals(version))
-         {
-            result = aux;
-            break;
-         }
-      }
-      return result;
-   }
-
-   /**
-    * Get the underlying bundle state for a bundle
-    * 
-    * @param bundle the bundle
-    * @return the bundle state
-    * @throws IllegalArgumentException if it is an unrecognised bundle
-    */
-   public AbstractBundleState getBundleState(Bundle bundle)
-   {
-      if (bundle instanceof OSGiBundleWrapper)
-         bundle = ((OSGiBundleWrapper)bundle).getBundleState();
-
-      if (bundle instanceof AbstractBundleState == false)
-         throw new IllegalArgumentException("Cannot obtain bunde state from: " + bundle);
-
-      return (AbstractBundleState)bundle;
-   }
-
-   /**
-    * Get a bundle by location
-    * 
-    * @param location the location of the bundle
-    * @return the bundle or null if there is no bundle with that location
-    */
-   public AbstractBundleState getBundleByLocation(String location)
-   {
-      if (location == null)
-         throw new IllegalArgumentException("Null location");
-
-      AbstractBundleState result = null;
-
-      for (AbstractBundleState aux : allBundles)
-      {
-         String auxLocation = aux.getLocation();
-         if (location.equals(auxLocation))
-         {
-            result = aux;
-            break;
-         }
-
-         // Fallback to the deployment name
-         else if (aux instanceof AbstractDeployedBundleState)
-         {
-            DeploymentUnit unit = ((AbstractDeployedBundleState)aux).getDeploymentUnit();
-            if (location.equals(unit.getName()))
-            {
-               result = aux;
-               break;
-            }
-         }
-      }
-      return result;
-   }
-
-   /**
-    * Get all the bundles
-    * 
-    * @return the bundles
-    */
-   public Collection<AbstractBundleState> getBundles()
-   {
-      List<AbstractBundleState> bundles = new ArrayList<AbstractBundleState>();
-      for (AbstractBundleState aux : allBundles)
-      {
-         bundles.add(aux);
-      }
-      return Collections.unmodifiableList(bundles);
-   }
-
-   /**
-    * Get the bundles with the given state
-    * 
-    * @param state the bundle state
-    * @return the bundles
-    */
-   public Collection<AbstractBundleState> getBundles(int state)
-   {
-      List<AbstractBundleState> bundles = new ArrayList<AbstractBundleState>();
-      for (AbstractBundleState aux : allBundles)
-      {
-         if (aux.getState() == state)
-            bundles.add(aux);
-      }
-      return Collections.unmodifiableList(bundles);
-   }
-
-   /**
-    * Start a bundle.
-    * 
-    * Stating a bundle is done in an attempt to move the bundle's DeploymentUnit to state INSTALLED.
-    * A failure to resolve the bundle is fatal, the bundle should remain in state INSTALLED.
-    * A failure in BundleActivator.start() is a normal condition not handled by the deployment layer.
-    * 
-    * @see OSGiBundleActivatorDeployer
-    * @see OSGiBundleState#startInternal()
-    */
-   public void startBundle(AbstractDeployedBundleState bundleState) throws BundleException
-   {
-      // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown. 
-      if (bundleState.getState() == Bundle.UNINSTALLED)
-         throw new IllegalStateException("Bundle already uninstalled: " + this);
-
-      // [TODO] If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation 
-      // to complete before continuing. If this does not occur in a reasonable time, a BundleException is thrown to indicate this bundle was 
-      // unable to be started.
-
-      // If this bundle's state is ACTIVE then this method returns immediately. 
-      if (bundleState.getState() == Bundle.ACTIVE)
-         return;
-
-      // [TODO] If the START_TRANSIENT option is not set then set this bundle's autostart setting to Started with declared activation  
-      // if the START_ACTIVATION_POLICY option is set or Started with eager activation if not set. When the Framework is restarted 
-      // and this bundle's autostart setting is not Stopped, this bundle must be automatically started.
-
-      // If this bundle's state is not RESOLVED, an attempt is made to resolve this bundle. If the Framework cannot resolve this bundle, 
-      // a BundleException is thrown.
-      if (bundleState.getState() != Bundle.RESOLVED)
-      {
-         // Resolve all INSTALLED bundles through the PackageAdmin
-         PackageAdmin packageAdmin = getPlugin(PackageAdminPlugin.class);
-         packageAdmin.resolveBundles(null);
-
-         if (bundleState.getState() != Bundle.RESOLVED)
-            throw new BundleException("Cannot resolve bundle: " + bundleState);
-      }
-
-      // [TODO] If the START_ACTIVATION_POLICY option is set and this bundle's declared activation policy is lazy then:
-      //    * If this bundle's state is STARTING then this method returns immediately.
-      //    * This bundle's state is set to STARTING.
-      //    * A bundle event of type BundleEvent.LAZY_ACTIVATION is fired.
-      //    * This method returns immediately and the remaining steps will be followed when this bundle's activation is later triggered.
-
-      try
-      {
-         DeploymentUnit unit = bundleState.getDeploymentUnit();
-         deployerClient.change(unit.getName(), DeploymentStages.INSTALLED);
-         deployerClient.checkComplete(unit.getName());
-
-         // The potential BundleException is attached by the OSGiBundleActivatorDeployer
-         BundleException startEx = unit.removeAttachment(BundleException.class);
-         if (startEx != null)
-         {
-            // Reset the deployment unit to stage classloader
-            deployerClient.change(unit.getName(), DeploymentStages.CLASSLOADER);
-            deployerClient.checkComplete(unit.getName());
-
-            // Rethrow the attached BundleException
-            throw startEx;
-         }
-      }
-      catch (DeploymentException ex)
-      {
-         Throwable cause = ex.getCause();
-         if (cause instanceof BundleException)
-            throw (BundleException)cause;
-
-         throw new BundleException("Error starting " + bundleState, (cause != null ? cause : ex));
-      }
-   }
-
-   /**
-    * Stop a bundle
-    * 
-    * Stopping a bundle is done in an attempt to move the bundle's DeploymentUnit to state CLASSLOADER.
-    * 
-    * @see OSGiBundleActivatorDeployer
-    * @see OSGiBundleState#stopInternal()
-    */
-   public void stopBundle(AbstractDeployedBundleState bundleState) throws BundleException
-   {
-      // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown. 
-      if (bundleState.getState() == Bundle.UNINSTALLED)
-         throw new IllegalStateException("Bundle already uninstalled: " + this);
-
-      // [TODO] If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation 
-      // to complete before continuing. If this does not occur in a reasonable time, a BundleException is thrown to indicate this bundle 
-      // was unable to be stopped.
-
-      // [TODO] If the STOP_TRANSIENT option is not set then then set this bundle's persistent autostart setting to to Stopped. 
-      // When the Framework is restarted and this bundle's autostart setting is Stopped, this bundle must not be automatically started. 
-
-      // If this bundle's state is not STARTING or ACTIVE then this method returns immediately
-      if (bundleState.getState() != Bundle.STARTING && bundleState.getState() != Bundle.ACTIVE)
-         return;
-
-      try
-      {
-         DeploymentUnit unit = bundleState.getDeploymentUnit();
-         deployerClient.change(unit.getName(), DeploymentStages.CLASSLOADER);
-         deployerClient.checkComplete(unit.getName());
-
-         // The potential BundleException is attached by the OSGiBundleActivatorDeployer
-         BundleException stopEx = unit.removeAttachment(BundleException.class);
-         if (stopEx != null)
-         {
-            // Rethrow the attached BundleException
-            throw stopEx;
-         }
-      }
-      catch (DeploymentException ex)
-      {
-         Throwable cause = ex.getCause();
-         if (cause instanceof BundleException)
-            throw (BundleException)cause;
-
-         throw new BundleException("Error stopping " + bundleState, (cause != null ? cause : ex));
-      }
-   }
-
-   /**
-    * Load class from a bundle.
-    * If it cannot be loaded, return null.
-    *
-    * @param bundle the bundle to load from
-    * @param clazz the class
-    * @return class or null
-    */
-   Class<?> loadClassFailsafe(Bundle bundle, String clazz)
-   {
-      try
-      {
-         return bundle.loadClass(clazz);
-      }
-      catch (ClassNotFoundException e)
-      {
-         return null;
-      }
-   }
-
-   /**
-    * Get the executor.
-    * 
-    * @return the executor.
-    */
-   Executor getExecutor()
-   {
-      return executor;
-   }
-
-   /**
-    * Initialize this Framework. 
-    * 
-    * After calling this method, this Framework must:
-    * - Be in the Bundle.STARTING state.
-    * - Have a valid Bundle Context.
-    * - Be at start level 0.
-    * - Have event handling enabled.
-    * - Have reified Bundle objects for all installed bundles.
-    * - Have registered any framework services. For example, PackageAdmin, ConditionalPermissionAdmin, StartLevel.
-    * 
-    * This Framework will not actually be started until start is called.
-    * 
-    * This method does nothing if called when this Framework is in the Bundle.STARTING, Bundle.ACTIVE or Bundle.STOPPING states. 
-    */
-   public void initFramework()
-   {
-      // Log INFO about this implementation
-      String implTitle = getClass().getPackage().getImplementationTitle();
-      String implVersion = getClass().getPackage().getImplementationVersion();
-      log.info(implTitle + " - " + implVersion);
-
-      int state = systemBundle.getState();
-
-      // This method does nothing if called when this Framework is in the STARTING, ACTIVE or STOPPING state
-      if (state == Bundle.STARTING || state == Bundle.ACTIVE || state == Bundle.STOPPING)
-         return;
-
-      // Put into the STARTING state
-      systemBundle.changeState(Bundle.STARTING);
-
-      // Create the system bundle context
-      systemBundle.createBundleContext();
-
-      // [TODO] Be at start level 0
-
-      // Have event handling enabled
-      FrameworkEventsPlugin eventsPlugin = getPlugin(FrameworkEventsPlugin.class);
-      eventsPlugin.setActive(true);
-
-      // Have registered any framework services.
-      for (Plugin plugin : plugins.values())
-      {
-         if (plugin instanceof ServicePlugin)
-         {
-            ServicePlugin servicePlugin = (ServicePlugin)plugin;
-            servicePlugin.startService();
-         }
-      }
-
-      // Cleanup the storage area
-      String storageClean = getProperty(Constants.FRAMEWORK_STORAGE_CLEAN);
-      BundleStoragePlugin storagePlugin = getOptionalPlugin(BundleStoragePlugin.class);
-      if (storagePlugin != null)
-         storagePlugin.cleanStorage(storageClean);
-   }
-
-   /**
-    * Start the framework
-    * 
-    * @throws BundleException for any error
-    */
-   public void startFramework() throws BundleException
-   {
-      // If this Framework is not in the STARTING state, initialize this Framework
-      if (systemBundle.getState() != Bundle.STARTING)
-         initFramework();
-
-      // All installed bundles must be started
-      AutoInstallPlugin autoInstall = getOptionalPlugin(AutoInstallPlugin.class);
-      if (autoInstall != null)
-      {
-         autoInstall.installBundles();
-         autoInstall.startBundles();
-      }
-
-      // Add the system bundle to the resolver
-      ResolverPlugin bundleResolver = getOptionalPlugin(ResolverPlugin.class);
-      if (bundleResolver != null)
-         bundleResolver.addBundle(systemBundle);
-
-      // This Framework's state is set to ACTIVE
-      systemBundle.changeState(Bundle.ACTIVE);
-
-      // A framework event of type STARTED is fired
-      FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
-      plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.STARTED, null);
-   }
-
-   /**
-    * Stop this Framework.
-    * 
-    * The method returns immediately to the caller after initiating the following steps to be taken on another thread.
-    * 
-    * 1. This Framework's state is set to Bundle.STOPPING.
-    * 2. All installed bundles must be stopped without changing each bundle's persistent autostart setting. 
-    * 3. Unregister all services registered by this Framework.
-    * 4. Event handling is disabled.
-    * 5. This Framework's state is set to Bundle.RESOLVED.
-    * 6. All resources held by this Framework are released. This includes threads, bundle class loaders, open files, etc.
-    * 7. Notify all threads that are waiting at waitForStop that the stop operation has completed.
-    * 
-    * After being stopped, this Framework may be discarded, initialized or started. 
-    */
-   public void stopFramework()
-   {
-      int beforeCount = stopMonitor.get();
-      Runnable stopcmd = new Runnable()
-      {
-         public void run()
-         {
-            synchronized (stopMonitor)
-            {
-               // Start the stop process
-               stopMonitor.addAndGet(1);
-
-               // This Framework's state is set to Bundle.STOPPING
-               systemBundle.changeState(Bundle.STOPPING);
-
-               // If this Framework implements the optional Start Level Service Specification, 
-               // then the start level of this Framework is moved to start level zero (0), as described in the Start Level Service Specification. 
-
-               // All installed bundles must be stopped without changing each bundle's persistent autostart setting
-               for (AbstractBundleState bundleState : getBundles())
-               {
-                  if (bundleState != systemBundle)
-                  {
-                     try
-                     {
-                        // [TODO] don't change the  persistent state
-                        bundleState.stop();
-                     }
-                     catch (Exception ex)
-                     {
-                        // Any exceptions that occur during bundle stopping must be wrapped in a BundleException and then 
-                        // published as a framework event of type FrameworkEvent.ERROR
-                        fireError(bundleState, "stopping bundle", ex);
-                     }
-                  }
-               }
-
-               // Stop registered service plugins
-               List<Plugin> reverseServicePlugins = new ArrayList<Plugin>(plugins.values());
-               Collections.reverse(reverseServicePlugins);
-               for (Plugin plugin : reverseServicePlugins)
-               {
-                  if (plugin instanceof ServicePlugin)
-                  {
-                     ServicePlugin servicePlugin = (ServicePlugin)plugin;
-                     servicePlugin.stopService();
-                  }
-               }
-
-               // Event handling is disabled
-               FrameworkEventsPlugin eventsPlugin = getPlugin(FrameworkEventsPlugin.class);
-               eventsPlugin.setActive(false);
-
-               // This Framework's state is set to Bundle.RESOLVED
-               systemBundle.changeState(Bundle.RESOLVED);
-
-               // All resources held by this Framework are released
-               systemBundle.destroyBundleContext();
-
-               // Notify all threads that are waiting at waitForStop that the stop operation has completed
-               stopMonitor.notifyAll();
-            }
-         }
-      };
-      executor.execute(stopcmd);
-
-      // Wait for the stop thread
-      while (stopMonitor.get() == beforeCount)
-      {
-         try
-         {
-            Thread.sleep(100);
-         }
-         catch (InterruptedException ex)
-         {
-            // ignore
-         }
-      }
-   }
-
-   /**
-    * Wait until this Framework has completely stopped. 
-    * 
-    * The stop and update methods on a Framework performs an asynchronous stop of the Framework. 
-    * This method can be used to wait until the asynchronous stop of this Framework has completed. 
-    * This method will only wait if called when this Framework is in the Bundle.STARTING, Bundle.ACTIVE, or Bundle.STOPPING states. 
-    * Otherwise it will return immediately.
-    * 
-    * A Framework Event is returned to indicate why this Framework has stopped.
-    */
-   public FrameworkEvent waitForStop(long timeout) throws InterruptedException
-   {
-      int state = systemBundle.getState();
-
-      // Only wait when this Framework is in Bundle.STARTING, Bundle.ACTIVE, or Bundle.STOPPING state
-      if (state != Bundle.STARTING && state != Bundle.ACTIVE && state != Bundle.STOPPING)
-         return new FrameworkEvent(FrameworkEvent.STOPPED, systemBundle, null);
-
-      long timeoutTime = System.currentTimeMillis() + timeout;
-      synchronized (stopMonitor)
-      {
-         while (state != Bundle.RESOLVED && System.currentTimeMillis() < timeoutTime)
-         {
-            stopMonitor.wait(timeout);
-            state = systemBundle.getState();
-         }
-      }
-
-      if (System.currentTimeMillis() > timeoutTime)
-         return new FrameworkEvent(FrameworkEvent.WAIT_TIMEDOUT, systemBundle, null);
-
-      return new FrameworkEvent(FrameworkEvent.STOPPED, systemBundle, null);
-   }
-
-   /**
-    * Stop the framework
-    */
-   public void restartFramework()
-   {
-      AbstractBundleState systemBundle = getSystemBundle();
-      if (systemBundle.getState() != Bundle.ACTIVE)
-         return;
-
-      for (AbstractBundleState bundleState : getBundles())
-      {
-         if (bundleState != systemBundle && bundleState.getState() == Bundle.ACTIVE)
-         {
-            try
-            {
-               // [TODO] don't change the  persistent state
-               bundleState.stop();
-            }
-            catch (Throwable t)
-            {
-               fireWarning(bundleState, "stopping bundle", t);
-            }
-            try
-            {
-               bundleState.start();
-            }
-            catch (Throwable t)
-            {
-               fireError(bundleState, "starting bundle", t);
-            }
-         }
-      }
-   }
-
-   private URL getLocationURL(String location) throws BundleException
-   {
-      // Try location as URL
-      URL url = null;
-      try
-      {
-         url = new URL(location);
-      }
-      catch (MalformedURLException e)
-      {
-         // ignore
-      }
-
-      // Try location as File
-      if (url == null)
-      {
-         try
-         {
-            File file = new File(location);
-            if (file.exists())
-               url = file.toURI().toURL();
-         }
-         catch (MalformedURLException e)
-         {
-            // ignore
-         }
-      }
-
-      if (url == null)
-         throw new BundleException("Unable to handle location=" + location);
-
-      return url;
-   }
-
-   /**
-    * Fire a framework error
-    * 
-    * @param bundle the bundle
-    * @param context the msg context
-    * @param t the throwable
-    */
-   void fireError(Bundle bundle, String context, Throwable t)
-   {
-      FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
-      if (t instanceof BundleException)
-         plugin.fireFrameworkEvent(bundle, FrameworkEvent.ERROR, t);
-      else if (bundle != null)
-         plugin.fireFrameworkEvent(bundle, FrameworkEvent.ERROR, new BundleException("Error " + context + " bundle: " + bundle, t));
-      else
-         plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.ERROR, new BundleException("Error " + context, t));
-   }
-
-   /**
-    * Fire a framework error
-    * 
-    * @param bundle the bundle
-    * @param context the msg context
-    * @param t the throwable
-    */
-   void fireWarning(Bundle bundle, String context, Throwable t)
-   {
-      FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
-      if (t instanceof BundleException)
-         plugin.fireFrameworkEvent(bundle, FrameworkEvent.WARNING, t);
-      else if (bundle != null)
-         plugin.fireFrameworkEvent(bundle, FrameworkEvent.WARNING, new BundleException("Error " + context + " bundle: " + bundle, t));
-      else
-         plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.WARNING, new BundleException("Error " + context, t));
-   }
-}

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java (from rev 101762, projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2010-03-03 09:56:16 UTC (rev 101766)
@@ -0,0 +1,1563 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.bundle;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.IncompleteDeploymentException;
+import org.jboss.deployers.client.spi.IncompleteDeployments;
+import org.jboss.deployers.client.spi.MissingDependency;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.kernel.Kernel;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.deployment.deployer.Deployment;
+import org.jboss.osgi.deployment.deployer.DeploymentFactory;
+import org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
+import org.jboss.osgi.framework.plugins.AutoInstallPlugin;
+import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
+import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
+import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
+import org.jboss.osgi.framework.plugins.Plugin;
+import org.jboss.osgi.framework.plugins.ResolverPlugin;
+import org.jboss.osgi.framework.plugins.ServicePlugin;
+import org.jboss.osgi.framework.util.URLHelper;
+import org.jboss.osgi.spi.util.BundleInfo;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.util.platform.Java;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.Version;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * OSGiBundleManager.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler at jboss.com
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
+ * @version $Revision: 1.1 $
+ */
+public class OSGiBundleManager
+{
+   /** The log */
+   private static final Logger log = Logger.getLogger(OSGiBundleManager.class);
+
+   /** The bundle manager's bean name: OSGiBundleManager */
+   public static final String BEAN_BUNDLE_MANAGER = "OSGiBundleManager";
+   /** The framework execution environment */
+   private static String OSGi_FRAMEWORK_EXECUTIONENVIRONMENT;
+   /** The framework language */
+   private static String OSGi_FRAMEWORK_LANGUAGE = Locale.getDefault().getISO3Language(); // REVIEW correct?
+   /** The os name */
+   private static String OSGi_FRAMEWORK_OS_NAME;
+   /** The os version */
+   private static String OSGi_FRAMEWORK_OS_VERSION;
+   /** The os version */
+   private static String OSGi_FRAMEWORK_PROCESSOR;
+   /** The framework vendor */
+   private static String OSGi_FRAMEWORK_VENDOR = "jboss.org";
+   /** The framework version. This is the version of the org.osgi.framework package in r4v42 */
+   private static String OSGi_FRAMEWORK_VERSION = "1.5";
+   /** The bundles by id */
+   private List<AbstractBundleState> allBundles = new CopyOnWriteArrayList<AbstractBundleState>();
+   /** The kernel */
+   private Kernel kernel;
+   /** The main deployer */
+   private DeployerClient deployerClient;
+   /** The executor */
+   private Executor executor;
+   /** The system bundle */
+   private OSGiSystemState systemBundle;
+   /** The registered manager plugins */
+   private Map<Class<?>, Plugin> plugins = Collections.synchronizedMap(new LinkedHashMap<Class<?>, Plugin>());
+   /** The frame work properties */
+   private Map<String, Object> properties = new ConcurrentHashMap<String, Object>();
+   /** The framework stop monitor*/
+   private AtomicInteger stopMonitor = new AtomicInteger(0);
+
+   static
+   {
+      AccessController.doPrivileged(new PrivilegedAction<Object>()
+      {
+         public Object run()
+         {
+            List<String> execEnvironments = new ArrayList<String>();
+            if (Java.isCompatible(Java.VERSION_1_5))
+               execEnvironments.add("J2SE-1.5");
+            if (Java.isCompatible(Java.VERSION_1_6))
+               execEnvironments.add("JavaSE-1.6");
+
+            String envlist = execEnvironments.toString();
+            envlist = envlist.substring(1, envlist.length() - 1);
+            OSGi_FRAMEWORK_EXECUTIONENVIRONMENT = envlist;
+
+            OSGi_FRAMEWORK_OS_NAME = System.getProperty("os.name");
+            OSGi_FRAMEWORK_OS_VERSION = System.getProperty("os.version");
+            OSGi_FRAMEWORK_PROCESSOR = System.getProperty("os.arch");
+
+            System.setProperty("org.osgi.vendor.framework", "org.jboss.osgi.plugins.framework");
+            return null;
+         }
+      });
+   }
+
+   /**
+    * Create a new OSGiBundleManager.
+    * 
+    * @param kernel the kernel
+    * @param deployerClient the deployer client
+    * @param registry the deployment registry
+    * @throws IllegalArgumentException for a null parameter
+    */
+   public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient)
+   {
+      this(kernel, deployerClient, null);
+   }
+
+   /**
+    * Create a new OSGiBundleManager.
+    * 
+    * @param kernel the kernel
+    * @param deployerClient the deployer client
+    * @param registry the deployment registry
+    * @param executor the executor
+    * @throws IllegalArgumentException for a null parameter
+    */
+   public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient, Executor executor)
+   {
+      if (kernel == null)
+         throw new IllegalArgumentException("Null kernel");
+      if (deployerClient == null)
+         throw new IllegalArgumentException("Null deployerClient");
+      if (deployerClient instanceof MainDeployerStructure == false)
+         throw new IllegalArgumentException("Deployer client does not implement " + MainDeployerStructure.class.getName());
+
+      this.kernel = kernel;
+      this.deployerClient = deployerClient;
+
+      // TODO thread factory
+      if (executor == null)
+         executor = Executors.newFixedThreadPool(10);
+
+      this.executor = executor;
+   }
+
+   public void start()
+   {
+      // Create the system Bundle
+      systemBundle = new OSGiSystemState(this);
+      addBundle(systemBundle);
+   }
+
+   public void stop()
+   {
+      // nothing to do
+   }
+
+   /**
+    * Get the kernel
+    *
+    * @return the kernel
+    */
+   public Kernel getKernel()
+   {
+      return kernel;
+   }
+
+   /**
+    * Get the deployerClient.
+    *
+    * @return the deployerClient.
+    */
+   public DeployerClient getDeployerClient()
+   {
+      return deployerClient;
+   }
+
+   /**
+    * Set the framework properties
+    *
+    * @param properties the properties
+    */
+   public void setProperties(Map<String, Object> props)
+   {
+      properties.putAll(props);
+
+      // Init default framework properties
+      if (getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT) == null)
+         setProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, OSGi_FRAMEWORK_EXECUTIONENVIRONMENT);
+      if (getProperty(Constants.FRAMEWORK_LANGUAGE) == null)
+         setProperty(Constants.FRAMEWORK_LANGUAGE, OSGi_FRAMEWORK_LANGUAGE);
+      if (getProperty(Constants.FRAMEWORK_OS_NAME) == null)
+         setProperty(Constants.FRAMEWORK_OS_NAME, OSGi_FRAMEWORK_OS_NAME);
+      if (getProperty(Constants.FRAMEWORK_OS_VERSION) == null)
+         setProperty(Constants.FRAMEWORK_OS_VERSION, OSGi_FRAMEWORK_OS_VERSION);
+      if (getProperty(Constants.FRAMEWORK_PROCESSOR) == null)
+         setProperty(Constants.FRAMEWORK_PROCESSOR, OSGi_FRAMEWORK_PROCESSOR);
+      if (getProperty(Constants.FRAMEWORK_VENDOR) == null)
+         setProperty(Constants.FRAMEWORK_VENDOR, OSGi_FRAMEWORK_VENDOR);
+      if (getProperty(Constants.FRAMEWORK_VERSION) == null)
+         setProperty(Constants.FRAMEWORK_VERSION, OSGi_FRAMEWORK_VERSION);
+   }
+
+   /**
+    * Get a property
+    *
+    * @param key the property key
+    * @return the property
+    * @throws SecurityException if the caller doesn't have the relevant property permission
+    */
+   public String getProperty(String key)
+   {
+      Object value = properties.get(key);
+      if (value == null)
+         value = System.getProperty(key);
+
+      if (value instanceof String == false)
+         return null;
+
+      return (String)value;
+   }
+
+   /**
+    * Set a property. This is used at the frame work init state.
+    * 
+    * @param key the prperty key
+    * @param value the property value
+    */
+   public void setProperty(String key, String value)
+   {
+      properties.put(key, value);
+   }
+
+   /**
+    * Get a plugin that is registered with the bundle manager.
+    * 
+    * @param <T> the pluging type
+    * @param clazz the plugin type
+    * @return the plugin
+    * @throws IllegalStateException if the requested plugin class is not registered
+    */
+   @SuppressWarnings("unchecked")
+   public <T extends Plugin> T getPlugin(Class<T> clazz)
+   {
+      T plugin = (T)plugins.get(clazz);
+      if (plugin == null)
+         throw new IllegalStateException("Cannot obtain plugin for: " + clazz.getName());
+
+      return plugin;
+   }
+
+   /**
+    * Get an optional plugin that is registered with the bundle manager.
+    * 
+    * @param <T> the pluging type
+    * @param clazz the plugin type
+    * @return The plugin instance or null if the requested plugin class is not registered
+    */
+   @SuppressWarnings("unchecked")
+   public <T extends Plugin> T getOptionalPlugin(Class<T> clazz)
+   {
+      return (T)plugins.get(clazz);
+   }
+
+   /**
+    * Add a plugin
+    * 
+    * @param plugin the plugin
+    */
+   public void addPlugin(Plugin plugin)
+   {
+      Class<?> key = getPluginKey(plugin);
+      log.debug("Add plugin: " + key.getName());
+      plugins.put(key, plugin);
+
+      // In case a service plugin gets added after the framework is started
+      if (isFrameworkActive() == true && plugin instanceof ServicePlugin)
+      {
+         ServicePlugin servicePlugin = (ServicePlugin)plugin;
+         servicePlugin.startService();
+      }
+   }
+
+   /**
+    * Get the key for a given plugin
+    *
+    * @param plugin the plugin
+    * @return the class
+    */
+   private Class<?> getPluginKey(Plugin plugin)
+   {
+      if (plugin == null)
+         throw new IllegalArgumentException("Null plugin");
+
+      Class<?> clazz = plugin.getClass();
+      Class<?> key = getPluginKey(plugin, clazz);
+
+      // If the plugin could not be added by Interface, use the clazz directly
+      return (key != null ? key : clazz);
+   }
+
+   /**
+    * Get the plugin key by scanning the interfaces for the given clazz.
+    *
+    * @param plugin the plugin
+    * @param clazz the class
+    * @return The first interface that extends Plugin.
+    */
+   private Class<?> getPluginKey(Plugin plugin, Class<?> clazz)
+   {
+      // Scan the interfaces on the class
+      for (Class<?> interf : clazz.getInterfaces())
+      {
+         if (interf == Plugin.class || interf == ServicePlugin.class)
+            continue;
+
+         if (Plugin.class.isAssignableFrom(interf))
+         {
+            return interf;
+         }
+      }
+
+      // Interface not found, try the plugin's superclass 
+      Class<?> superclass = clazz.getSuperclass();
+      if (Plugin.class.isAssignableFrom(superclass))
+         return getPluginKey(plugin, superclass);
+
+      return null;
+   }
+
+   /**
+    * Remove a plugin
+    * 
+    * @param plugin the plugin to remove
+    */
+   public void removePlugin(Plugin plugin)
+   {
+      Class<?> key = getPluginKey(plugin);
+      log.debug("Remove plugin: " + key.getName());
+      plugins.remove(key);
+   }
+
+   /**
+    * Are we active
+    * @return true when the system is active
+    */
+   public boolean isFrameworkActive()
+   {
+      // We are active if the system bundle is ACTIVE
+      AbstractBundleState bundleState = getSystemBundle();
+      return bundleState.getState() == Bundle.ACTIVE;
+   }
+
+   /**
+    * Install a bundle from an URL.
+    * 
+    * @param url the url of the bundle
+    * @return the bundle state
+    * @throws BundleException for any error
+    */
+   public AbstractBundleState installBundle(URL url) throws BundleException
+   {
+      if (url == null)
+         throw new BundleException("Null url");
+
+      return installBundle(url.toExternalForm(), null);
+   }
+
+   /**
+    * Install a bundle from an input stream.
+    * 
+    * @param location the bundle's location identifier
+    * @param input an optional input stream to read the bundle content from
+    * @return the bundle state
+    * @throws BundleException for any error
+    */
+   public AbstractBundleState installBundle(String location, InputStream input) throws BundleException
+   {
+      if (location == null)
+         throw new BundleException("Null location");
+
+      URL locationURL;
+
+      // Get the location URL
+      if (input != null)
+      {
+         locationURL = getBundleStorageLocation(input);
+      }
+      else
+      {
+         locationURL = getLocationURL(location);
+      }
+
+      // Get the root file
+      VirtualFile root;
+      try
+      {
+         root = VFS.getRoot(locationURL);
+      }
+      catch (IOException e)
+      {
+         throw new BundleException("Invalid bundle location=" + locationURL, e);
+      }
+
+      return install(root, location, false);
+   }
+
+   private URL getBundleStorageLocation(InputStream input) throws BundleException
+   {
+      try
+      {
+         BundleStoragePlugin plugin = getPlugin(BundleStoragePlugin.class);
+         String path = plugin.getStorageDir(getSystemBundle()).getCanonicalPath();
+
+         // [TODO] do properly
+         File file = new File(path + "/bundle-" + System.currentTimeMillis() + ".jar");
+         FileOutputStream fos = new FileOutputStream(file);
+         VFSUtils.copyStream(input, fos);
+         fos.close();
+
+         URL locationURL = file.toURI().toURL();
+         return locationURL;
+      }
+      catch (IOException ex)
+      {
+         throw new BundleException("Cannot store bundle from input stream", ex);
+      }
+   }
+
+   /**
+    * Install a bundle from a virtual file.
+    *  
+    * @param root the virtual file that point to the bundle
+    * 
+    * @return the bundle state
+    * @throws BundleException for any error
+    */
+   public AbstractBundleState installBundle(VirtualFile root) throws BundleException
+   {
+      return install(root, root.toString(), false);
+   }
+
+   /*
+    * Installs a bundle from the given virtual file.
+    */
+   private AbstractBundleState install(VirtualFile root, String location, boolean autoStart) throws BundleException
+   {
+      if (location == null)
+         throw new IllegalArgumentException("Null location");
+
+      Deployment dep;
+      try
+      {
+         BundleInfo info = BundleInfo.createBundleInfo(AbstractVFS.adapt(root), location);
+         dep = DeploymentFactory.createDeployment(info);
+         dep.setAutoStart(autoStart);
+      }
+      catch (RuntimeException ex)
+      {
+         throw new BundleException("Cannot install bundle: " + root, ex);
+      }
+
+      return installBundle(dep);
+   }
+
+   /**
+    * Install a bundle from a deployment. 
+    *  
+    * @param dep the deployment that represents the bundle
+    * 
+    * @return the bundle state
+    * @throws BundleException for any error
+    */
+   public AbstractBundleState installBundle(Deployment dep) throws BundleException
+   {
+      // Create the deployment and deploy it
+      try
+      {
+         VirtualFile root = (VirtualFile)AbstractVFS.adapt(dep.getRoot());
+         VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(root);
+         MutableAttachments att = (MutableAttachments)deployment.getPredeterminedManagedObjects();
+         att.addAttachment(Deployment.class, dep);
+
+         // In case of update the OSGiBundleState is attached
+         AbstractBundleState bundleState = dep.getAttachment(AbstractBundleState.class);
+         if (bundleState != null)
+            att.addAttachment(AbstractBundleState.class, bundleState);
+
+         deployerClient.deploy(deployment);
+         try
+         {
+            MainDeployerStructure deployerStructure = (MainDeployerStructure)deployerClient;
+            DeploymentUnit unit = deployerStructure.getDeploymentUnit(deployment.getName());
+            bundleState = unit.getAttachment(AbstractBundleState.class);
+            if (bundleState == null)
+               throw new IllegalStateException("Unable to determine bundle state for " + deployment.getName());
+
+            return bundleState;
+         }
+         catch (Exception e)
+         {
+            deployerClient.undeploy(deployment);
+            throw e;
+         }
+      }
+      catch (IncompleteDeploymentException ex)
+      {
+         String errorMessage = getIncompleteDeploymentInfo(dep, ex);
+         throw new BundleException(errorMessage);
+      }
+      catch (Exception ex)
+      {
+         throw new BundleException("Error installing bundle from: " + dep, ex);
+      }
+   }
+
+   private String getIncompleteDeploymentInfo(Deployment dep, IncompleteDeploymentException ex)
+   {
+      IncompleteDeployments deployments = ex.getIncompleteDeployments();
+
+      StringWriter stringWriter = new StringWriter();
+      PrintWriter printWriter = new PrintWriter(stringWriter);
+      printWriter.println("Error installing bundle from: " + dep);
+
+      // Contexts in error 
+      Collection<Throwable> contextsError = deployments.getContextsInError().values();
+      if (contextsError.size() > 0)
+      {
+         printWriter.println("\nContext Errors:");
+         for (Throwable th : contextsError)
+         {
+            printWriter.println("\n");
+            th.printStackTrace(printWriter);
+         }
+      }
+
+      // Deployments in error 
+      Collection<Throwable> deploymentsInError = deployments.getDeploymentsInError().values();
+      if (deploymentsInError.size() > 0)
+      {
+         printWriter.println("\nDeployment Errors:");
+         for (Throwable th : deploymentsInError)
+         {
+            printWriter.println("\n");
+            th.printStackTrace(printWriter);
+         }
+      }
+
+      // Missing Dependencies 
+      Collection<Set<MissingDependency>> missingDependencies = deployments.getContextsMissingDependencies().values();
+      if (missingDependencies.size() > 0)
+      {
+         printWriter.println("\nMissing Dependencies:");
+         for (Set<MissingDependency> missDeps : missingDependencies)
+         {
+            for (MissingDependency missDep : missDeps)
+            {
+               printWriter.println("\n  " + missDep);
+            }
+         }
+      }
+
+      // Missing Deployers 
+      Collection<String> missingDeployers = deployments.getDeploymentsMissingDeployer();
+      if (missingDeployers.size() > 0)
+      {
+         printWriter.println("\nMissing Deployers:");
+         for (String missDep : missingDeployers)
+         {
+            printWriter.println("\n  " + missDep);
+         }
+      }
+
+      String errorMessage = stringWriter.toString();
+      return errorMessage;
+   }
+
+   /**
+    * Updates a bundle from an InputStream. 
+    */
+   public void updateBundle(AbstractDeployedBundleState bundleState, InputStream in) throws BundleException
+   {
+      // If the specified InputStream is null, the Framework must create the InputStream from which to read the updated bundle by interpreting, 
+      // in an implementation dependent manner, this bundle's Bundle-UpdateLocation Manifest header, if present, or this bundle's original location.
+      URL updateURL = bundleState.getOSGiMetaData().getBundleUpdateLocation();
+      if (updateURL == null)
+      {
+         // This updates the bundle from its original location 
+         VirtualFile root = bundleState.getRoot();
+         updateURL = URLHelper.toURL(root);
+      }
+      if (in == null)
+      {
+         try
+         {
+            in = updateURL.openStream();
+         }
+         catch (IOException ex)
+         {
+            throw new BundleException("Cannot obtain update input stream for: " + bundleState, ex);
+         }
+      }
+
+      // If this bundle's state is ACTIVE, it must be stopped before the update and started after the update successfully completes. 
+      boolean activeBeforeUpdate = (bundleState.getState() == Bundle.ACTIVE);
+
+      // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown. 
+      if (bundleState.getState() == Bundle.UNINSTALLED)
+         throw new IllegalStateException("Bundle already uninstalled: " + this);
+
+      // If this bundle has exported any packages that are imported by another bundle, these packages must not be updated. 
+      // Instead, the previous package version must remain exported until the PackageAdmin.refreshPackages method has been 
+      // has been called or the Framework is relaunched. 
+
+      // If this bundle's state is ACTIVE, STARTING  or STOPPING, this bundle is stopped as described in the Bundle.stop method. 
+      // If Bundle.stop throws an exception, the exception is rethrown terminating the update.
+      if (bundleState.getState() == Bundle.ACTIVE || bundleState.getState() == Bundle.STARTING || bundleState.getState() == Bundle.STOPPING)
+      {
+         stopBundle(bundleState);
+      }
+
+      // The updated version of this bundle is read from the input stream and installed. 
+      // If the Framework is unable to install the updated version of this bundle, the original version of this bundle must be restored 
+      // and a BundleException must be thrown after completion of the remaining steps.
+      String location = (updateURL != null ? updateURL.toExternalForm() : bundleState.getCanonicalName() + "/update");
+      AbstractBundleState updatedBundleState = null;
+      BundleException throwAfterUpdate = null;
+      try
+      {
+         URL storageLocation = getBundleStorageLocation(in);
+         VirtualFile root = VFS.getRoot(storageLocation);
+
+         BundleInfo info = BundleInfo.createBundleInfo(AbstractVFS.adapt(root), location);
+         Deployment dep = DeploymentFactory.createDeployment(info);
+         dep.addAttachment(AbstractBundleState.class, bundleState);
+         dep.setBundleUpdate(true);
+         dep.setAutoStart(false);
+
+         updatedBundleState = installBundle(dep);
+         updatedBundleState.updateLastModified();
+      }
+      catch (Exception ex)
+      {
+         if (ex instanceof BundleException)
+            throwAfterUpdate = (BundleException)ex;
+         else
+            throwAfterUpdate = new BundleException("Cannot install updated bundle from: " + location, ex);
+
+         if (activeBeforeUpdate)
+         {
+            startBundle(bundleState);
+         }
+      }
+
+      // If the updated version of this bundle was successfully installed, a bundle event of type BundleEvent.UPDATED is fired
+      if (updatedBundleState != null)
+      {
+         FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+         plugin.fireBundleEvent(updatedBundleState, BundleEvent.UPDATED);
+
+         // If this bundle's state was originally ACTIVE, the updated bundle is started as described in the Bundle.start method. 
+         // If Bundle.start throws an exception, a Framework event of type FrameworkEvent.ERROR is fired containing the exception
+         if (activeBeforeUpdate)
+         {
+            if (updatedBundleState.isFragment() == false)
+               startBundle((AbstractDeployedBundleState)updatedBundleState);
+         }
+      }
+
+      // A BundleException must be thrown after completion of the remaining steps
+      if (throwAfterUpdate != null)
+      {
+         throw throwAfterUpdate;
+      }
+   }
+
+   /**
+    * Uninstall a bundle
+    * 
+    * @param bundleState the bundle
+    * @throws BundleException for any error
+    */
+   public void uninstallBundle(AbstractDeployedBundleState bundleState) throws BundleException
+   {
+      long id = bundleState.getBundleId();
+      if (getBundleById(id) == null)
+         throw new BundleException(bundleState + " not installed");
+
+      // If this bundle's state is ACTIVE, STARTING or STOPPING, this bundle is stopped 
+      // as described in the Bundle.stop method.
+      int state = bundleState.getState();
+      if (state == Bundle.ACTIVE || state == Bundle.STARTING || state == Bundle.STOPPING)
+      {
+         try
+         {
+            if (bundleState.isFragment() == false)
+               stopBundle((AbstractDeployedBundleState)bundleState);
+         }
+         catch (Exception ex)
+         {
+            // If Bundle.stop throws an exception, a Framework event of type FrameworkEvent.ERROR is
+            // fired containing the exception
+            fireError(bundleState, "Error stopping bundle: " + bundleState, ex);
+         }
+      }
+
+      DeploymentException depEx = null;
+      for (DeploymentUnit unit : bundleState.getDeploymentUnits())
+      {
+         try
+         {
+            deployerClient.undeploy(unit.getName());
+            bundleState.updateLastModified();
+         }
+         catch (DeploymentException ex)
+         {
+            log.error("Cannot undeploy: " + unit.getName(), depEx = ex);
+         }
+      }
+
+      // Rethrow deployment exception 
+      if (depEx != null)
+      {
+         Throwable cause = depEx.getCause();
+         if (cause instanceof BundleException)
+            throw (BundleException)cause;
+
+         throw new BundleException("Unable to uninstall " + bundleState, cause);
+      }
+   }
+
+   /**
+    * Add a deployment to the manager, which creates the bundle state.
+    * 
+    * Note, the bundle state is not yet added to the manager.
+    */
+   public AbstractBundleState addDeployment(DeploymentUnit unit)
+   {
+      if (unit == null)
+         throw new IllegalArgumentException("Null unit");
+
+      // In case of Bundle.update() the OSGiBundleState is attached
+      AbstractBundleState absBundle = unit.getAttachment(AbstractBundleState.class);
+      if (absBundle != null)
+      {
+         // Add the DeploymentUnit to the OSGiBundleState
+         OSGiBundleState depBundle = (OSGiBundleState)absBundle;
+         depBundle.addDeploymentUnit(unit);
+      }
+      else
+      {
+         OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
+         ParameterizedAttribute fragmentHost = osgiMetaData.getFragmentHost();
+         if (fragmentHost != null)
+         {
+            // Create a new OSGiFragmentState
+            OSGiFragmentState fragmentState = new OSGiFragmentState(this, unit);
+            absBundle = fragmentState;
+         }
+         else
+         {
+            // Create a new OSGiBundleState
+            AbstractDeployedBundleState bundleState = new OSGiBundleState(this, unit);
+            absBundle = bundleState;
+         }
+      }
+
+      // Attach the abstract bundle state
+      unit.addAttachment(AbstractBundleState.class, absBundle);
+      
+      if (absBundle.isFragment())
+         unit.addAttachment(OSGiFragmentState.class, (OSGiFragmentState)absBundle);
+      else
+         unit.addAttachment(OSGiBundleState.class, (OSGiBundleState)absBundle);
+      
+      return absBundle;
+   }
+
+   /**
+    * Add a bundle to the manager.
+    * 
+    * Note, the bundle must be metadata complete when it is added to the manager.
+    * An extender might pickup the INSTALLED event and use PackageAdmin to examine the 
+    * exported packages for example.
+    * 
+    * @param bundleState the bundle state
+    * @throws IllegalArgumentException for a null bundle state
+    */
+   public void addBundle(AbstractBundleState bundleState)
+   {
+      if (bundleState == null)
+         throw new IllegalArgumentException("Null bundle state");
+
+      // Do nothing if this is a bundle update
+      if (bundleState instanceof OSGiBundleState)
+      {
+         DeploymentUnit unit = ((AbstractDeployedBundleState)bundleState).getDeploymentUnit();
+         if (unit.getAttachment(ClassLoadingMetaData.class) == null)
+            throw new IllegalStateException("Cannot obtain ClassLoadingMetaData");
+            
+         Deployment dep = unit.getAttachment(Deployment.class);
+         if (dep != null && dep.isBundleUpdate())
+            return;
+      }
+
+      validateBundle(bundleState);
+      
+      allBundles.add(bundleState);
+      
+      bundleState.changeState(Bundle.INSTALLED, true);
+
+      // Add the bundle to the resolver
+      // Note, plugins are not registered when the system bundle is added 
+      ResolverPlugin bundleResolver = getOptionalPlugin(ResolverPlugin.class);
+      if (bundleResolver != null)
+         bundleResolver.addBundle(bundleState);
+
+      log.debug("Added: " + bundleState);
+   }
+
+   /**
+    * Validate the bundle
+    * 
+    * @param bundleState the bundle state
+    */
+   private void validateBundle(AbstractBundleState bundleState)
+   {
+      OSGiMetaData osgiMetaData = bundleState.getOSGiMetaData();
+      if (osgiMetaData == null)
+         return;
+
+      OSGiBundleValidator validator;
+      
+      // Delegate to the validator for the appropriate revision
+      if (osgiMetaData.getBundleManifestVersion() > 1)
+         validator = new OSGiBundleValidatorR4(this);
+      else
+         validator = new OSGiBundleValidatorR3(this);
+
+      validator.validateBundle(bundleState);
+   }
+
+   /**
+    * Remove a bundle
+    * 
+    * @param bundleState the bundle state
+    * @throws IllegalArgumentException for a null bundle state
+    */
+   public void removeBundle(AbstractBundleState bundleState)
+   {
+      if (bundleState == null)
+         throw new IllegalArgumentException("Null bundle state");
+
+      bundleState.uninstallInternal();
+
+      // Remove the bundle from the resolver
+      ResolverPlugin bundleResolver = getOptionalPlugin(ResolverPlugin.class);
+      if (bundleResolver != null)
+         bundleResolver.removeBundle(bundleState);
+
+      allBundles.remove(bundleState);
+      log.debug("Removed " + bundleState.getCanonicalName());
+   }
+
+   /**
+    * Get the system bundle
+    * 
+    * @return the system bundle
+    */
+   public OSGiSystemState getSystemBundle()
+   {
+      return systemBundle;
+   }
+
+   /**
+    * Get the system bundle context
+    * 
+    * @return the system bundle context
+    */
+   public BundleContext getSystemContext()
+   {
+      return systemBundle.getBundleContext();
+   }
+
+   /**
+    * Get a deployment
+    * 
+    * @param id the id of the bundle
+    * @return the deployment or null if there is no bundle with that id
+    */
+   public DeploymentUnit getDeployment(long id)
+   {
+      if (id == 0)
+         throw new IllegalArgumentException("Cannot get deployment from system bundle");
+
+      AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)getBundleById(id);
+      if (bundleState == null)
+         return null;
+
+      return bundleState.getDeploymentUnit();
+   }
+
+   /**
+    * Get a bundle by id
+    * 
+    * @param id the id of the bundle
+    * @return the bundle or null if there is no bundle with that id
+    */
+   public AbstractBundleState getBundleById(long id)
+   {
+      AbstractBundleState result = null;
+      for (AbstractBundleState aux : allBundles)
+      {
+         if (id == aux.getBundleId())
+         {
+            result = aux;
+            break;
+         }
+      }
+      return result;
+   }
+
+   /**
+    * Get a bundle by symbolic name and version
+    *
+    * @param symbolicName the symbolic name of the bundle
+    * @param version the version of the bundle
+    * @return the bundle or null if there is no bundle with that id
+    */
+   public AbstractBundleState getBundle(String symbolicName, Version version)
+   {
+      AbstractBundleState result = null;
+      for (AbstractBundleState aux : allBundles)
+      {
+         String auxName = aux.getSymbolicName();
+         Version auxVersion = aux.getVersion();
+         if (auxName.equals(symbolicName) && auxVersion.equals(version))
+         {
+            result = aux;
+            break;
+         }
+      }
+      return result;
+   }
+
+   /**
+    * Get the underlying bundle state for a bundle
+    * 
+    * @param bundle the bundle
+    * @return the bundle state
+    * @throws IllegalArgumentException if it is an unrecognised bundle
+    */
+   public AbstractBundleState getBundleState(Bundle bundle)
+   {
+      if (bundle instanceof OSGiBundleWrapper)
+         bundle = ((OSGiBundleWrapper)bundle).getBundleState();
+
+      if (bundle instanceof AbstractBundleState == false)
+         throw new IllegalArgumentException("Cannot obtain bunde state from: " + bundle);
+
+      return (AbstractBundleState)bundle;
+   }
+
+   /**
+    * Get a bundle by location
+    * 
+    * @param location the location of the bundle
+    * @return the bundle or null if there is no bundle with that location
+    */
+   public AbstractBundleState getBundleByLocation(String location)
+   {
+      if (location == null)
+         throw new IllegalArgumentException("Null location");
+
+      AbstractBundleState result = null;
+
+      for (AbstractBundleState aux : allBundles)
+      {
+         String auxLocation = aux.getLocation();
+         if (location.equals(auxLocation))
+         {
+            result = aux;
+            break;
+         }
+
+         // Fallback to the deployment name
+         else if (aux instanceof AbstractDeployedBundleState)
+         {
+            DeploymentUnit unit = ((AbstractDeployedBundleState)aux).getDeploymentUnit();
+            if (location.equals(unit.getName()))
+            {
+               result = aux;
+               break;
+            }
+         }
+      }
+      return result;
+   }
+
+   /**
+    * Get all the bundles
+    * 
+    * @return the bundles
+    */
+   public Collection<AbstractBundleState> getBundles()
+   {
+      List<AbstractBundleState> bundles = new ArrayList<AbstractBundleState>();
+      for (AbstractBundleState aux : allBundles)
+      {
+         bundles.add(aux);
+      }
+      return Collections.unmodifiableList(bundles);
+   }
+
+   /**
+    * Get the bundles with the given state
+    * 
+    * @param state the bundle state
+    * @return the bundles
+    */
+   public Collection<AbstractBundleState> getBundles(int state)
+   {
+      List<AbstractBundleState> bundles = new ArrayList<AbstractBundleState>();
+      for (AbstractBundleState aux : allBundles)
+      {
+         if (aux.getState() == state)
+            bundles.add(aux);
+      }
+      return Collections.unmodifiableList(bundles);
+   }
+
+   /**
+    * Start a bundle.
+    * 
+    * Stating a bundle is done in an attempt to move the bundle's DeploymentUnit to state INSTALLED.
+    * A failure to resolve the bundle is fatal, the bundle should remain in state INSTALLED.
+    * A failure in BundleActivator.start() is a normal condition not handled by the deployment layer.
+    * 
+    * @see OSGiBundleActivatorDeployer
+    * @see OSGiBundleState#startInternal()
+    */
+   public void startBundle(AbstractDeployedBundleState bundleState) throws BundleException
+   {
+      // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown. 
+      if (bundleState.getState() == Bundle.UNINSTALLED)
+         throw new IllegalStateException("Bundle already uninstalled: " + this);
+
+      // [TODO] If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation 
+      // to complete before continuing. If this does not occur in a reasonable time, a BundleException is thrown to indicate this bundle was 
+      // unable to be started.
+
+      // If this bundle's state is ACTIVE then this method returns immediately. 
+      if (bundleState.getState() == Bundle.ACTIVE)
+         return;
+
+      // [TODO] If the START_TRANSIENT option is not set then set this bundle's autostart setting to Started with declared activation  
+      // if the START_ACTIVATION_POLICY option is set or Started with eager activation if not set. When the Framework is restarted 
+      // and this bundle's autostart setting is not Stopped, this bundle must be automatically started.
+
+      // If this bundle's state is not RESOLVED, an attempt is made to resolve this bundle. If the Framework cannot resolve this bundle, 
+      // a BundleException is thrown.
+      if (bundleState.getState() != Bundle.RESOLVED)
+      {
+         // Resolve all INSTALLED bundles through the PackageAdmin
+         PackageAdmin packageAdmin = getPlugin(PackageAdminPlugin.class);
+         packageAdmin.resolveBundles(null);
+
+         if (bundleState.getState() != Bundle.RESOLVED)
+            throw new BundleException("Cannot resolve bundle: " + bundleState);
+      }
+
+      // [TODO] If the START_ACTIVATION_POLICY option is set and this bundle's declared activation policy is lazy then:
+      //    * If this bundle's state is STARTING then this method returns immediately.
+      //    * This bundle's state is set to STARTING.
+      //    * A bundle event of type BundleEvent.LAZY_ACTIVATION is fired.
+      //    * This method returns immediately and the remaining steps will be followed when this bundle's activation is later triggered.
+
+      try
+      {
+         DeploymentUnit unit = bundleState.getDeploymentUnit();
+         deployerClient.change(unit.getName(), DeploymentStages.INSTALLED);
+         deployerClient.checkComplete(unit.getName());
+
+         // The potential BundleException is attached by the OSGiBundleActivatorDeployer
+         BundleException startEx = unit.removeAttachment(BundleException.class);
+         if (startEx != null)
+         {
+            // Reset the deployment unit to stage classloader
+            deployerClient.change(unit.getName(), DeploymentStages.CLASSLOADER);
+            deployerClient.checkComplete(unit.getName());
+
+            // Rethrow the attached BundleException
+            throw startEx;
+         }
+      }
+      catch (DeploymentException ex)
+      {
+         Throwable cause = ex.getCause();
+         if (cause instanceof BundleException)
+            throw (BundleException)cause;
+
+         throw new BundleException("Error starting " + bundleState, (cause != null ? cause : ex));
+      }
+   }
+
+   /**
+    * Stop a bundle
+    * 
+    * Stopping a bundle is done in an attempt to move the bundle's DeploymentUnit to state CLASSLOADER.
+    * 
+    * @see OSGiBundleActivatorDeployer
+    * @see OSGiBundleState#stopInternal()
+    */
+   public void stopBundle(AbstractDeployedBundleState bundleState) throws BundleException
+   {
+      // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown. 
+      if (bundleState.getState() == Bundle.UNINSTALLED)
+         throw new IllegalStateException("Bundle already uninstalled: " + this);
+
+      // [TODO] If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation 
+      // to complete before continuing. If this does not occur in a reasonable time, a BundleException is thrown to indicate this bundle 
+      // was unable to be stopped.
+
+      // [TODO] If the STOP_TRANSIENT option is not set then then set this bundle's persistent autostart setting to to Stopped. 
+      // When the Framework is restarted and this bundle's autostart setting is Stopped, this bundle must not be automatically started. 
+
+      // If this bundle's state is not STARTING or ACTIVE then this method returns immediately
+      if (bundleState.getState() != Bundle.STARTING && bundleState.getState() != Bundle.ACTIVE)
+         return;
+
+      try
+      {
+         DeploymentUnit unit = bundleState.getDeploymentUnit();
+         deployerClient.change(unit.getName(), DeploymentStages.CLASSLOADER);
+         deployerClient.checkComplete(unit.getName());
+
+         // The potential BundleException is attached by the OSGiBundleActivatorDeployer
+         BundleException stopEx = unit.removeAttachment(BundleException.class);
+         if (stopEx != null)
+         {
+            // Rethrow the attached BundleException
+            throw stopEx;
+         }
+      }
+      catch (DeploymentException ex)
+      {
+         Throwable cause = ex.getCause();
+         if (cause instanceof BundleException)
+            throw (BundleException)cause;
+
+         throw new BundleException("Error stopping " + bundleState, (cause != null ? cause : ex));
+      }
+   }
+
+   /**
+    * Load class from a bundle.
+    * If it cannot be loaded, return null.
+    *
+    * @param bundle the bundle to load from
+    * @param clazz the class
+    * @return class or null
+    */
+   Class<?> loadClassFailsafe(Bundle bundle, String clazz)
+   {
+      try
+      {
+         return bundle.loadClass(clazz);
+      }
+      catch (ClassNotFoundException e)
+      {
+         return null;
+      }
+   }
+
+   /**
+    * Get the executor.
+    * 
+    * @return the executor.
+    */
+   Executor getExecutor()
+   {
+      return executor;
+   }
+
+   /**
+    * Initialize this Framework. 
+    * 
+    * After calling this method, this Framework must:
+    * - Be in the Bundle.STARTING state.
+    * - Have a valid Bundle Context.
+    * - Be at start level 0.
+    * - Have event handling enabled.
+    * - Have reified Bundle objects for all installed bundles.
+    * - Have registered any framework services. For example, PackageAdmin, ConditionalPermissionAdmin, StartLevel.
+    * 
+    * This Framework will not actually be started until start is called.
+    * 
+    * This method does nothing if called when this Framework is in the Bundle.STARTING, Bundle.ACTIVE or Bundle.STOPPING states. 
+    */
+   public void initFramework()
+   {
+      // Log INFO about this implementation
+      String implTitle = getClass().getPackage().getImplementationTitle();
+      String implVersion = getClass().getPackage().getImplementationVersion();
+      log.info(implTitle + " - " + implVersion);
+
+      int state = systemBundle.getState();
+
+      // This method does nothing if called when this Framework is in the STARTING, ACTIVE or STOPPING state
+      if (state == Bundle.STARTING || state == Bundle.ACTIVE || state == Bundle.STOPPING)
+         return;
+
+      // Put into the STARTING state
+      systemBundle.changeState(Bundle.STARTING);
+
+      // Create the system bundle context
+      systemBundle.createBundleContext();
+
+      // [TODO] Be at start level 0
+
+      // Have event handling enabled
+      FrameworkEventsPlugin eventsPlugin = getPlugin(FrameworkEventsPlugin.class);
+      eventsPlugin.setActive(true);
+
+      // Have registered any framework services.
+      for (Plugin plugin : plugins.values())
+      {
+         if (plugin instanceof ServicePlugin)
+         {
+            ServicePlugin servicePlugin = (ServicePlugin)plugin;
+            servicePlugin.startService();
+         }
+      }
+
+      // Cleanup the storage area
+      String storageClean = getProperty(Constants.FRAMEWORK_STORAGE_CLEAN);
+      BundleStoragePlugin storagePlugin = getOptionalPlugin(BundleStoragePlugin.class);
+      if (storagePlugin != null)
+         storagePlugin.cleanStorage(storageClean);
+   }
+
+   /**
+    * Start the framework
+    * 
+    * @throws BundleException for any error
+    */
+   public void startFramework() throws BundleException
+   {
+      // If this Framework is not in the STARTING state, initialize this Framework
+      if (systemBundle.getState() != Bundle.STARTING)
+         initFramework();
+
+      // All installed bundles must be started
+      AutoInstallPlugin autoInstall = getOptionalPlugin(AutoInstallPlugin.class);
+      if (autoInstall != null)
+      {
+         autoInstall.installBundles();
+         autoInstall.startBundles();
+      }
+
+      // Add the system bundle to the resolver
+      ResolverPlugin bundleResolver = getOptionalPlugin(ResolverPlugin.class);
+      if (bundleResolver != null)
+         bundleResolver.addBundle(systemBundle);
+
+      // This Framework's state is set to ACTIVE
+      systemBundle.changeState(Bundle.ACTIVE);
+
+      // A framework event of type STARTED is fired
+      FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+      plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.STARTED, null);
+   }
+
+   /**
+    * Stop this Framework.
+    * 
+    * The method returns immediately to the caller after initiating the following steps to be taken on another thread.
+    * 
+    * 1. This Framework's state is set to Bundle.STOPPING.
+    * 2. All installed bundles must be stopped without changing each bundle's persistent autostart setting. 
+    * 3. Unregister all services registered by this Framework.
+    * 4. Event handling is disabled.
+    * 5. This Framework's state is set to Bundle.RESOLVED.
+    * 6. All resources held by this Framework are released. This includes threads, bundle class loaders, open files, etc.
+    * 7. Notify all threads that are waiting at waitForStop that the stop operation has completed.
+    * 
+    * After being stopped, this Framework may be discarded, initialized or started. 
+    */
+   public void stopFramework()
+   {
+      int beforeCount = stopMonitor.get();
+      Runnable stopcmd = new Runnable()
+      {
+         public void run()
+         {
+            synchronized (stopMonitor)
+            {
+               // Start the stop process
+               stopMonitor.addAndGet(1);
+
+               // This Framework's state is set to Bundle.STOPPING
+               systemBundle.changeState(Bundle.STOPPING);
+
+               // If this Framework implements the optional Start Level Service Specification, 
+               // then the start level of this Framework is moved to start level zero (0), as described in the Start Level Service Specification. 
+
+               // All installed bundles must be stopped without changing each bundle's persistent autostart setting
+               for (AbstractBundleState bundleState : getBundles())
+               {
+                  if (bundleState != systemBundle)
+                  {
+                     try
+                     {
+                        // [TODO] don't change the  persistent state
+                        bundleState.stop();
+                     }
+                     catch (Exception ex)
+                     {
+                        // Any exceptions that occur during bundle stopping must be wrapped in a BundleException and then 
+                        // published as a framework event of type FrameworkEvent.ERROR
+                        fireError(bundleState, "stopping bundle", ex);
+                     }
+                  }
+               }
+
+               // Stop registered service plugins
+               List<Plugin> reverseServicePlugins = new ArrayList<Plugin>(plugins.values());
+               Collections.reverse(reverseServicePlugins);
+               for (Plugin plugin : reverseServicePlugins)
+               {
+                  if (plugin instanceof ServicePlugin)
+                  {
+                     ServicePlugin servicePlugin = (ServicePlugin)plugin;
+                     servicePlugin.stopService();
+                  }
+               }
+
+               // Event handling is disabled
+               FrameworkEventsPlugin eventsPlugin = getPlugin(FrameworkEventsPlugin.class);
+               eventsPlugin.setActive(false);
+
+               // This Framework's state is set to Bundle.RESOLVED
+               systemBundle.changeState(Bundle.RESOLVED);
+
+               // All resources held by this Framework are released
+               systemBundle.destroyBundleContext();
+
+               // Notify all threads that are waiting at waitForStop that the stop operation has completed
+               stopMonitor.notifyAll();
+            }
+         }
+      };
+      executor.execute(stopcmd);
+
+      // Wait for the stop thread
+      while (stopMonitor.get() == beforeCount)
+      {
+         try
+         {
+            Thread.sleep(100);
+         }
+         catch (InterruptedException ex)
+         {
+            // ignore
+         }
+      }
+   }
+
+   /**
+    * Wait until this Framework has completely stopped. 
+    * 
+    * The stop and update methods on a Framework performs an asynchronous stop of the Framework. 
+    * This method can be used to wait until the asynchronous stop of this Framework has completed. 
+    * This method will only wait if called when this Framework is in the Bundle.STARTING, Bundle.ACTIVE, or Bundle.STOPPING states. 
+    * Otherwise it will return immediately.
+    * 
+    * A Framework Event is returned to indicate why this Framework has stopped.
+    */
+   public FrameworkEvent waitForStop(long timeout) throws InterruptedException
+   {
+      int state = systemBundle.getState();
+
+      // Only wait when this Framework is in Bundle.STARTING, Bundle.ACTIVE, or Bundle.STOPPING state
+      if (state != Bundle.STARTING && state != Bundle.ACTIVE && state != Bundle.STOPPING)
+         return new FrameworkEvent(FrameworkEvent.STOPPED, systemBundle, null);
+
+      long timeoutTime = System.currentTimeMillis() + timeout;
+      synchronized (stopMonitor)
+      {
+         while (state != Bundle.RESOLVED && System.currentTimeMillis() < timeoutTime)
+         {
+            stopMonitor.wait(timeout);
+            state = systemBundle.getState();
+         }
+      }
+
+      if (System.currentTimeMillis() > timeoutTime)
+         return new FrameworkEvent(FrameworkEvent.WAIT_TIMEDOUT, systemBundle, null);
+
+      return new FrameworkEvent(FrameworkEvent.STOPPED, systemBundle, null);
+   }
+
+   /**
+    * Stop the framework
+    */
+   public void restartFramework()
+   {
+      AbstractBundleState systemBundle = getSystemBundle();
+      if (systemBundle.getState() != Bundle.ACTIVE)
+         return;
+
+      for (AbstractBundleState bundleState : getBundles())
+      {
+         if (bundleState != systemBundle && bundleState.getState() == Bundle.ACTIVE)
+         {
+            try
+            {
+               // [TODO] don't change the  persistent state
+               bundleState.stop();
+            }
+            catch (Throwable t)
+            {
+               fireWarning(bundleState, "stopping bundle", t);
+            }
+            try
+            {
+               bundleState.start();
+            }
+            catch (Throwable t)
+            {
+               fireError(bundleState, "starting bundle", t);
+            }
+         }
+      }
+   }
+
+   private URL getLocationURL(String location) throws BundleException
+   {
+      // Try location as URL
+      URL url = null;
+      try
+      {
+         url = new URL(location);
+      }
+      catch (MalformedURLException e)
+      {
+         // ignore
+      }
+
+      // Try location as File
+      if (url == null)
+      {
+         try
+         {
+            File file = new File(location);
+            if (file.exists())
+               url = file.toURI().toURL();
+         }
+         catch (MalformedURLException e)
+         {
+            // ignore
+         }
+      }
+
+      if (url == null)
+         throw new BundleException("Unable to handle location=" + location);
+
+      return url;
+   }
+
+   /**
+    * Fire a framework error
+    * 
+    * @param bundle the bundle
+    * @param context the msg context
+    * @param t the throwable
+    */
+   void fireError(Bundle bundle, String context, Throwable t)
+   {
+      FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+      if (t instanceof BundleException)
+         plugin.fireFrameworkEvent(bundle, FrameworkEvent.ERROR, t);
+      else if (bundle != null)
+         plugin.fireFrameworkEvent(bundle, FrameworkEvent.ERROR, new BundleException("Error " + context + " bundle: " + bundle, t));
+      else
+         plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.ERROR, new BundleException("Error " + context, t));
+   }
+
+   /**
+    * Fire a framework error
+    * 
+    * @param bundle the bundle
+    * @param context the msg context
+    * @param t the throwable
+    */
+   void fireWarning(Bundle bundle, String context, Throwable t)
+   {
+      FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+      if (t instanceof BundleException)
+         plugin.fireFrameworkEvent(bundle, FrameworkEvent.WARNING, t);
+      else if (bundle != null)
+         plugin.fireFrameworkEvent(bundle, FrameworkEvent.WARNING, new BundleException("Error " + context + " bundle: " + bundle, t));
+      else
+         plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.WARNING, new BundleException("Error " + context, t));
+   }
+}

Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java	2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java	2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,113 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.service.internal;
-
-//$Id$
-
-import java.net.URL;
-import java.util.Properties;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.deployment.deployer.DeployerService;
-import org.jboss.osgi.deployment.deployer.Deployment;
-import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
-import org.jboss.osgi.deployment.internal.DeploymentRegistryServiceImpl;
-import org.jboss.osgi.deployment.internal.SystemDeployerService;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.plugins.DeployerServicePlugin;
-import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
-import org.jboss.osgi.spi.util.BundleInfo;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-/**
- * A plugin that manages bundle deployments.
- * 
- * @author thomas.diesler at jboss.com
- * @since 19-Oct-2009
- */
-public class DeployerServiceImpl extends AbstractServicePlugin implements DeployerServicePlugin
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(DeployerServiceImpl.class);
-
-   private DeployerService delegate;
-
-   public DeployerServiceImpl(OSGiBundleManager bundleManager)
-   {
-      super(bundleManager);
-   }
-
-   public void startService()
-   {
-      BundleContext context = getSystemContext();
-      delegate = new SystemDeployerService(context);
-
-      DeploymentRegistryService registry = new DeploymentRegistryServiceImpl(context);
-      context.registerService(DeploymentRegistryService.class.getName(), registry, null);
-
-      Properties props = new Properties();
-      props.put("provider", "system");
-      context.registerService(DeployerService.class.getName(), this, props);
-   }
-
-   public void stopService()
-   {
-      // do nothing
-   }
-
-   public Deployment createDeployment(URL url) throws BundleException
-   {
-      return delegate.createDeployment(url);
-   }
-
-   public Deployment createDeployment(VirtualFile file) throws BundleException
-   {
-      return delegate.createDeployment(file);
-   }
-
-   public Deployment createDeployment(BundleInfo info) throws BundleException
-   {
-      return delegate.createDeployment(info);
-   }
-
-   public void deploy(Deployment[] bundleDeps) throws BundleException
-   {
-      delegate.deploy(bundleDeps);
-   }
-
-   public void deploy(URL url) throws BundleException
-   {
-      delegate.deploy(url);
-   }
-
-   public void undeploy(Deployment[] bundleDeps) throws BundleException
-   {
-      delegate.undeploy(bundleDeps);
-   }
-
-   public void undeploy(URL url) throws BundleException
-   {
-      delegate.undeploy(url);
-   }
-}
\ No newline at end of file

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java (from rev 101762, projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java	2010-03-03 09:56:16 UTC (rev 101766)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.framework.service.internal;
+
+//$Id$
+
+import java.net.URL;
+import java.util.Properties;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.deployment.deployer.Deployment;
+import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
+import org.jboss.osgi.deployment.internal.DeploymentRegistryServiceImpl;
+import org.jboss.osgi.deployment.internal.SystemDeployerService;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.plugins.DeployerServicePlugin;
+import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
+import org.jboss.osgi.spi.util.BundleInfo;
+import org.jboss.osgi.vfs.VirtualFile;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * A plugin that manages bundle deployments.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 19-Oct-2009
+ */
+public class DeployerServiceImpl extends AbstractServicePlugin implements DeployerServicePlugin
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(DeployerServiceImpl.class);
+
+   private DeployerService delegate;
+
+   public DeployerServiceImpl(OSGiBundleManager bundleManager)
+   {
+      super(bundleManager);
+   }
+
+   public void startService()
+   {
+      BundleContext context = getSystemContext();
+      delegate = new SystemDeployerService(context);
+
+      DeploymentRegistryService registry = new DeploymentRegistryServiceImpl(context);
+      context.registerService(DeploymentRegistryService.class.getName(), registry, null);
+
+      Properties props = new Properties();
+      props.put("provider", "system");
+      context.registerService(DeployerService.class.getName(), this, props);
+   }
+
+   public void stopService()
+   {
+      // do nothing
+   }
+
+   public Deployment createDeployment(URL url) throws BundleException
+   {
+      return delegate.createDeployment(url);
+   }
+
+   public Deployment createDeployment(VirtualFile file) throws BundleException
+   {
+      return delegate.createDeployment(file);
+   }
+
+   public Deployment createDeployment(BundleInfo info) throws BundleException
+   {
+      return delegate.createDeployment(info);
+   }
+
+   public void deploy(Deployment[] bundleDeps) throws BundleException
+   {
+      delegate.deploy(bundleDeps);
+   }
+
+   public void undeploy(Deployment[] bundleDeps) throws BundleException
+   {
+      delegate.undeploy(bundleDeps);
+   }
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java	2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java	2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,104 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.service.internal;
-
-//$Id$
-
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.logging.Logger;
-import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptorService;
-import org.jboss.osgi.deployment.interceptor.InvocationContext;
-import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
-import org.jboss.osgi.deployment.internal.InvocationContextImpl;
-import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.plugins.LifecycleInterceptorServicePlugin;
-import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
-import org.jboss.osgi.framework.util.DeploymentUnitAttachments;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * A plugin that manages bundle lifecycle interceptors.
- * 
- * @author thomas.diesler at jboss.com
- * @since 19-Oct-2009
- */
-public class LifecycleInterceptorServiceImpl extends AbstractServicePlugin implements LifecycleInterceptorServicePlugin
-{
-   // Provide logging
-   final Logger log = Logger.getLogger(LifecycleInterceptorServiceImpl.class);
-
-   private AbstractLifecycleInterceptorService delegate;
-   private ServiceRegistration registration;
-
-   public LifecycleInterceptorServiceImpl(final OSGiBundleManager bundleManager)
-   {
-      super(bundleManager);
-   }
-
-   public void startService()
-   {
-      BundleContext sysContext = getSystemContext();
-      delegate = new AbstractLifecycleInterceptorService(sysContext)
-      {
-         @Override
-         protected InvocationContext getInvocationContext(Bundle bundle)
-         {
-            long bundleId = bundle.getBundleId();
-            AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)getBundleManager().getBundleById(bundleId);
-            if (bundleState == null)
-               throw new IllegalStateException("Cannot obtain bundleState for: " + bundle);
-
-            VFSDeploymentUnit unit = (VFSDeploymentUnit)bundleState.getDeploymentUnit();
-            InvocationContext inv = unit.getAttachment(InvocationContext.class);
-            if (inv == null)
-            {
-               BundleContext context = bundleState.getBundleManager().getSystemContext();
-               DeploymentUnitAttachments att = new DeploymentUnitAttachments(unit);
-               inv = new InvocationContextImpl(context, bundle, unit.getRoot(), att);
-               unit.addAttachment(InvocationContext.class, inv);
-            }
-            return inv;
-         }
-      };
-
-      registration = sysContext.registerService(LifecycleInterceptorService.class.getName(), delegate, null);
-   }
-
-   public void stopService()
-   {
-      if (registration != null)
-      {
-         registration.unregister();
-         registration = null;
-         delegate = null;
-      }
-   }
-
-   public void handleStateChange(int state, Bundle bundle)
-   {
-      if (delegate != null)
-         delegate.handleStateChange(state, bundle);
-   }
-}
\ No newline at end of file

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java (from rev 101762, projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java	2010-03-03 09:56:16 UTC (rev 101766)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.framework.service.internal;
+
+//$Id$
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptorService;
+import org.jboss.osgi.deployment.interceptor.InvocationContext;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
+import org.jboss.osgi.deployment.internal.InvocationContextImpl;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.plugins.LifecycleInterceptorServicePlugin;
+import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
+import org.jboss.osgi.framework.util.DeploymentUnitAttachments;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * A plugin that manages bundle lifecycle interceptors.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 19-Oct-2009
+ */
+public class LifecycleInterceptorServiceImpl extends AbstractServicePlugin implements LifecycleInterceptorServicePlugin
+{
+   // Provide logging
+   final Logger log = Logger.getLogger(LifecycleInterceptorServiceImpl.class);
+
+   private AbstractLifecycleInterceptorService delegate;
+   private ServiceRegistration registration;
+
+   public LifecycleInterceptorServiceImpl(final OSGiBundleManager bundleManager)
+   {
+      super(bundleManager);
+   }
+
+   public void startService()
+   {
+      BundleContext sysContext = getSystemContext();
+      delegate = new AbstractLifecycleInterceptorService(sysContext)
+      {
+         @Override
+         protected InvocationContext getInvocationContext(Bundle bundle)
+         {
+            long bundleId = bundle.getBundleId();
+            AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)getBundleManager().getBundleById(bundleId);
+            if (bundleState == null)
+               throw new IllegalStateException("Cannot obtain bundleState for: " + bundle);
+
+            VFSDeploymentUnit unit = (VFSDeploymentUnit)bundleState.getDeploymentUnit();
+            InvocationContext inv = unit.getAttachment(InvocationContext.class);
+            if (inv == null)
+            {
+               BundleContext context = bundleState.getBundleManager().getSystemContext();
+               DeploymentUnitAttachments att = new DeploymentUnitAttachments(unit);
+               inv = new InvocationContextImpl(context, bundle, AbstractVFS.adapt(unit.getRoot()), att);
+               unit.addAttachment(InvocationContext.class, inv);
+            }
+            return inv;
+         }
+      };
+
+      registration = sysContext.registerService(LifecycleInterceptorService.class.getName(), delegate, null);
+   }
+
+   public void stopService()
+   {
+      if (registration != null)
+      {
+         registration.unregister();
+         registration = null;
+         delegate = null;
+      }
+   }
+
+   public void handleStateChange(int state, Bundle bundle)
+   {
+      if (delegate != null)
+         delegate.handleStateChange(state, bundle);
+   }
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java	2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java	2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,109 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.service.internal;
-
-//$Id$
-
-import java.util.Set;
-
-import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor;
-import org.jboss.osgi.deployment.interceptor.InvocationContext;
-import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
-import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Bundle;
-
-/**
- * The lifecycle interceptor that verifies that deployments ending in '.war'
- * have a WEB-INF/web.xml descriptor.
- * 
- * @author thomas.diesler at jboss.com
- * @since 20-Oct-2009
- */
-public class WebXMLVerifierInterceptor extends AbstractServicePlugin implements LifecycleInterceptor
-{
-   private LifecycleInterceptor delegate;
-
-   public WebXMLVerifierInterceptor(OSGiBundleManager bundleManager)
-   {
-      super(bundleManager);
-      
-      delegate = new AbstractLifecycleInterceptor()
-      {
-         public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
-         {
-            if (state == Bundle.STARTING)
-            {
-               try
-               {
-                  VirtualFile root = context.getRoot();
-                  VirtualFile webXML = root.getChild("/WEB-INF/web.xml");
-                  String contextPath = (String)context.getBundle().getHeaders().get("Web-ContextPath");
-                  boolean isWebApp = contextPath != null || root.getName().endsWith(".war");
-                  if (isWebApp == true && webXML == null)
-                     throw new LifecycleInterceptorException("Cannot obtain web.xml from: " + root.toURL());
-               }
-               catch (RuntimeException rte)
-               {
-                  throw rte;
-               }
-               catch (Exception ex)
-               {
-                  throw new LifecycleInterceptorException("Cannot check for web.xml", ex);
-               }
-            }
-         }
-      };
-   }
-
-   public void startService()
-   {
-      getSystemContext().registerService(LifecycleInterceptor.class.getName(), delegate, null);
-   }
-
-   public void stopService()
-   {
-      // do nothing
-   }
-
-   public Set<Class<?>> getInput()
-   {
-      return delegate.getInput();
-   }
-
-   public Set<Class<?>> getOutput()
-   {
-      return delegate.getOutput();
-   }
-
-   public int getRelativeOrder()
-   {
-      return delegate.getRelativeOrder();
-   }
-
-   public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
-   {
-      delegate.invoke(state, context);
-   }
-}
\ No newline at end of file

Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java (from rev 101762, projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java	2010-03-03 09:56:16 UTC (rev 101766)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.framework.service.internal;
+
+//$Id$
+
+import java.util.Set;
+
+import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.InvocationContext;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
+import org.jboss.osgi.vfs.VirtualFile;
+import org.osgi.framework.Bundle;
+
+/**
+ * The lifecycle interceptor that verifies that deployments ending in '.war'
+ * have a WEB-INF/web.xml descriptor.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 20-Oct-2009
+ */
+public class WebXMLVerifierInterceptor extends AbstractServicePlugin implements LifecycleInterceptor
+{
+   private LifecycleInterceptor delegate;
+
+   public WebXMLVerifierInterceptor(OSGiBundleManager bundleManager)
+   {
+      super(bundleManager);
+      
+      delegate = new AbstractLifecycleInterceptor()
+      {
+         public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
+         {
+            if (state == Bundle.STARTING)
+            {
+               try
+               {
+                  VirtualFile root = context.getRoot();
+                  VirtualFile webXML = root.getChild("/WEB-INF/web.xml");
+                  String contextPath = (String)context.getBundle().getHeaders().get("Web-ContextPath");
+                  boolean isWebApp = contextPath != null || root.getName().endsWith(".war");
+                  if (isWebApp == true && webXML == null)
+                     throw new LifecycleInterceptorException("Cannot obtain web.xml from: " + root.toURL());
+               }
+               catch (RuntimeException rte)
+               {
+                  throw rte;
+               }
+               catch (Exception ex)
+               {
+                  throw new LifecycleInterceptorException("Cannot check for web.xml", ex);
+               }
+            }
+         }
+      };
+   }
+
+   public void startService()
+   {
+      getSystemContext().registerService(LifecycleInterceptor.class.getName(), delegate, null);
+   }
+
+   public void stopService()
+   {
+      // do nothing
+   }
+
+   public Set<Class<?>> getInput()
+   {
+      return delegate.getInput();
+   }
+
+   public Set<Class<?>> getOutput()
+   {
+      return delegate.getOutput();
+   }
+
+   public int getRelativeOrder()
+   {
+      return delegate.getRelativeOrder();
+   }
+
+   public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
+   {
+      delegate.invoke(state, context);
+   }
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java	2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java	2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,185 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.vfs;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.plugins.context.AbstractVirtualFileHandler;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-import org.jboss.deployers.vfs.spi.structure.helpers.AbstractStructureDeployer;
-import org.osgi.framework.Bundle;
-
-/**
- * Bundle handler.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-class BundleHandler extends AbstractVirtualFileHandler
-{
-   /** The serialVersionUID */
-   private static final long serialVersionUID = 6650185906199900589L;
-
-   private VirtualFile root; // bundle's root
-   private VirtualFile file;
-   private Bundle bundle;
-
-   private volatile String relativePath;
-   private volatile URI uri;
-   private volatile VirtualFileHandler handler;
-
-   public BundleHandler(VFSContext context, VirtualFile root, VirtualFile file, Bundle bundle) throws IOException
-   {
-      this(context, LazyVirtualFileHandler.create(file.getParent()), root, file, bundle);
-   }
-
-   private BundleHandler(VFSContext context, VirtualFileHandler parent, VirtualFile root, VirtualFile file, Bundle bundle) throws IOException
-   {
-      super(context, parent, file.getName());
-      this.root = root;
-      this.file = file;
-      this.bundle = bundle;
-   }
-
-   protected VirtualFileHandler getHandler() throws IOException
-   {
-      if (handler == null)
-         handler = LazyVirtualFileHandler.create(file);
-
-      return handler;
-   }
-
-   protected String getRelativePath(boolean checkStart, boolean checkEnd)
-   {
-      if (relativePath == null)
-         relativePath = AbstractStructureDeployer.getRelativePath(root, file);
-      
-      StringBuilder path = new StringBuilder(relativePath);
-      if (checkStart && relativePath.startsWith("/") == false)
-         path.insert(0, '/');
-      if (checkEnd && relativePath.endsWith("/") == false)
-         path.append('/');
-
-      return path.toString();
-   }
-
-   protected VirtualFileHandler createChildHandler(VirtualFile child) throws IOException
-   {
-      return new BundleHandler(getVFSContext(), this, root, child, bundle);
-   }
-
-   public URI toURI() throws URISyntaxException
-   {
-      if (uri == null)
-         uri = new URI("bundle", Long.toString(bundle.getBundleId()), getRelativePath(true, false), null);
-
-      return uri;
-   }
-
-   public long getLastModified() throws IOException
-   {
-      return bundle.getLastModified();
-   }
-
-   public InputStream openStream() throws IOException
-   {
-      bundle.getResource(getRelativePath(false, false)); // permission check
-      
-      return file.openStream();
-   }
-
-   public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
-   {
-      bundle.findEntries(getRelativePath(false, false), null, false); // permission check
-
-      List<VirtualFile> children = file.getChildren();
-      if (children != null && children.isEmpty() == false)
-      {
-         List<VirtualFileHandler> handlers = new ArrayList<VirtualFileHandler>(children.size());
-         for (VirtualFile child : children)
-         {
-            handlers.add(createChildHandler(child));
-         }
-         return handlers;
-      }
-      return Collections.emptyList();
-   }
-
-   public VirtualFileHandler getChild(String path) throws IOException
-   {
-      String fullPath = getRelativePath(false, true) + path; 
-      URL entry = bundle.getEntry(fullPath); // permission check
-      if (entry == null)
-         return null;
-
-      VirtualFile child = file.getChild(path); // the child should exist, since entry does
-      return createChildHandler(child);
-   }
-
-   //---------------------------------------------------------
-
-   @Override
-   protected URL toInternalVfsUrl() throws MalformedURLException, URISyntaxException
-   {
-      return toURI().toURL();
-   }
-
-   public long getSize() throws IOException
-   {
-      return file.getSize();
-   }
-
-   public boolean exists() throws IOException
-   {
-      return file.exists();
-   }
-
-   public boolean isLeaf() throws IOException
-   {
-      return file.isLeaf();
-   }
-
-   public boolean isHidden() throws IOException
-   {
-      return file.isHidden();
-   }
-
-   public boolean removeChild(String name) throws IOException
-   {
-      return getHandler().removeChild(name);
-   }
-
-   public boolean isNested() throws IOException
-   {
-      return VFSUtils.isNestedFile(file);
-   }
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java	2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java	2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.vfs;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URL;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.plugins.context.AbstractVFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * Bundle vfs context.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class BundleVFSContext extends AbstractVFSContext
-{
-   private String name;
-   private VirtualFileHandler root;
-
-   public BundleVFSContext(URI rootURI, OSGiBundleManager manager) throws IOException
-   {
-      super(rootURI);
-
-      name = parseName(rootURI);
-
-      AbstractDeployedBundleState bundleState = getBundleState(rootURI, manager);
-      String path = parsePath(rootURI);
-      URL resource = bundleState.getEntry(path); // permission check
-      if (resource == null)
-         throw new IllegalArgumentException("No such resource: " + path + " in bundle: " + bundleState);
-
-      DeploymentUnit unit = bundleState.getDeploymentUnit();
-      if (unit instanceof VFSDeploymentUnit == false)
-         throw new IllegalArgumentException("Cannot handle non VFS deployments: " + unit);
-
-      VFSDeploymentUnit vdu = VFSDeploymentUnit.class.cast(unit);
-      VirtualFile duRoot = vdu.getRoot();
-      VirtualFile duFile = vdu.getFile(path); // should exist, resource != null
-      root = new BundleHandler(this, duRoot, duFile, bundleState);
-   }
-
-   /**
-    * Parse context name from uri.
-    *
-    * @param uri the uri
-    * @return parsed context's name
-    */
-   protected String parseName(URI uri)
-   {
-      return uri.getHost();
-   }
-
-   /**
-    * Parse resource path from uri.
-    *
-    * @param uri the uri
-    * @return parsed resource path
-    */
-   protected String parsePath(URI uri)
-   {
-      String path = uri.getPath();
-      if (path == null)
-         path = "";
-
-      return path;
-   }
-
-   /**
-    * Get bundle state.
-    *
-    * @param uri the uri
-    * @param manager the osgi manager
-    * @return bundle state or exception if no such bundle exists
-    */
-   protected AbstractDeployedBundleState getBundleState(URI uri, OSGiBundleManager manager)
-   {
-      String host = uri.getHost();
-      long id = Long.parseLong(host);
-      if (id == 0)
-         throw new IllegalArgumentException("Cannot handle system bundle, it's too abstract.");
-
-      AbstractBundleState abs = manager.getBundleById(id);
-      if (abs == null)
-         throw new IllegalArgumentException("No such bundle: " + id);
-
-      return OSGiBundleState.class.cast(abs); // should be able to cast, as it's not system
-   }
-
-   public String getName()
-   {
-      return name;
-   }
-
-   public VirtualFileHandler getRoot() throws IOException
-   {
-      return root;
-   }
-}

Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContextFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContextFactory.java	2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContextFactory.java	2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,102 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.vfs;
-
-import java.net.URL;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.io.IOException;
-
-import org.jboss.virtual.plugins.context.AbstractContextFactory;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VFSContextFactoryLocator;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-
-/**
- * Bundle vfs context factory.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class BundleVFSContextFactory extends AbstractContextFactory
-{
-   static
-   {
-      init();
-   }
-
-   private static final String HANDLER_PKGS = "java.protocol.handler.pkgs";
-   private OSGiBundleManager manager;
-
-   public BundleVFSContextFactory(OSGiBundleManager manager)
-   {
-      super("bundle");
-      if (manager == null)
-         throw new IllegalArgumentException("Null manager");
-      this.manager = manager;
-   }
-
-   public static void init()
-   {
-      String pkg = BundleVFSContextFactory.class.getPackage().getName();
-      String pkgs = System.getProperty(HANDLER_PKGS);
-
-      if (pkgs == null || pkgs.trim().length() == 0)
-      {
-         pkgs = pkg;
-         System.setProperty(HANDLER_PKGS, pkgs);
-      }
-      else if (pkgs.contains(pkg) == false)
-      {
-         pkgs += ("|" + pkg);
-         System.setProperty(HANDLER_PKGS, pkgs);
-      }
-   }
-
-   public void start()
-   {
-      VFSContextFactoryLocator.registerFactory(this);
-   }
-
-   public void stop()
-   {
-      VFSContextFactoryLocator.unregisterFactory(this);
-   }
-
-   public VFSContext getVFS(URL rootURL) throws IOException
-   {
-      try
-      {
-         return getVFS(rootURL.toURI());
-      }
-      catch (URISyntaxException e)
-      {
-         IOException ioe = new IOException();
-         ioe.initCause(e);
-         throw ioe;
-      }
-   }
-
-   public VFSContext getVFS(URI rootURI) throws IOException
-   {
-      return new BundleVFSContext(rootURI, manager);
-   }
-}

Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/LazyVirtualFileHandler.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/LazyVirtualFileHandler.java	2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/LazyVirtualFileHandler.java	2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,105 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.vfs;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * Create a lazy VirtualFileHandler based off VirtualFile
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-class LazyVirtualFileHandler
-{
-   private static final Method getHandler;
-
-   static
-   {
-      try
-      {
-         PrivilegedExceptionAction<Method> action = new PrivilegedExceptionAction<Method>()
-         {
-            public Method run() throws Exception
-            {
-               Method method = VirtualFile.class.getDeclaredMethod("getHandler");
-               method.setAccessible(true);
-               return method;
-            }
-         };
-         getHandler = AccessController.doPrivileged(action);
-
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   /**
-    * Create a VFH proxy, delaying the actual reflect hack.
-    *
-    * @param file the VFH owner
-    * @return VFH proxy
-    * @throws IOException for any error
-    */
-   static VirtualFileHandler create(VirtualFile file) throws IOException
-   {
-      if (file == null)
-         return null;
-
-      ClassLoader cl = LazyVirtualFileHandler.class.getClassLoader();
-      Object proxy = Proxy.newProxyInstance(cl, new Class<?>[]{VirtualFileHandler.class}, new ProxyHandler(file));
-      return VirtualFileHandler.class.cast(proxy);
-   }
-   
-   private static class ProxyHandler implements InvocationHandler
-   {
-      private VirtualFile file;
-      private volatile VirtualFileHandler handler;
-
-      private ProxyHandler(VirtualFile file)
-      {
-         this.file = file;
-      }
-
-      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
-      {
-         return method.invoke(getHandler(), args);
-      }
-
-      private VirtualFileHandler getHandler() throws Exception
-      {
-         if (handler == null)
-            handler = (VirtualFileHandler)getHandler.invoke(file);
-
-         return handler;
-      }
-   }
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java	2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java	2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,233 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.osgi.bundle;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import junit.framework.Test;
-
-import org.jboss.osgi.framework.vfs.BundleVFSContextFactory;
-import org.jboss.test.osgi.FrameworkTest;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-import org.jboss.virtual.VirtualFileVisitor;
-import org.jboss.virtual.VisitorAttributes;
-import org.osgi.framework.Bundle;
-
-/**
- * BundleVFSUnitTestCase.
- *
- * TODO test security
- * TODO test fragments
- * @author <a href="ales.justin at jboss.org">Ales Justin</a>
- */
-public class BundleVFSUnitTestCase extends FrameworkTest
-{
-   private BundleVFSContextFactory factory;
-
-   public static Test suite()
-   {
-      return suite(BundleVFSUnitTestCase.class);
-   }
-
-   public BundleVFSUnitTestCase(String name)
-   {
-      super(name);
-   }
-
-   @Override
-   protected void setUp() throws Exception
-   {
-      super.setUp();
-
-      factory = new BundleVFSContextFactory(getBundleManager());
-      factory.start();
-   }
-
-   @Override
-   protected void tearDown() throws Exception
-   {
-      factory.stop();
-      factory = null;
-
-      super.tearDown();
-   }
-
-   public void testBasicOps() throws Exception
-   {
-      Bundle bundle = addBundle("/bundles/entries/", "entries-simple");
-      try
-      {
-         URI uri = createURI(bundle, null);
-         assertBundleByURI(uri, 0, true, "root.xml");
-
-         uri = createURI(bundle, "root.xml");
-         assertBundleByURI(uri, 0, false, null);         
-
-         uri = createURI(bundle, "META-INF");
-         assertBundleByURI(uri, -1, true, "MANIFEST.MF");
-
-         uri = createURI(bundle, "META-INF/MANIFEST.MF");
-         assertBundleByURI(uri, 0, false, null);
-      }
-      finally
-      {
-         uninstall(bundle);
-      }
-   }
-
-   public void testBasicNavigation() throws Exception
-   {
-      Bundle bundle = addBundle("/bundles/entries/", "entries-simple");
-      try
-      {
-         URI uri = createURI(bundle, null);
-         VirtualFile root = VFS.getRoot(uri);
-         assertNotNull(root);
-
-         VirtualFile metainf = root.getChild("META-INF");
-         assertBundleByFile(metainf, -1, true, "MANIFEST.MF");
-         List<VirtualFile> children = metainf.getChildren();
-         assertTrue(children != null && children.size() == 1);
-         assertEquals(root, metainf.getParent());
-
-         VirtualFile manifest = metainf.getChild("MANIFEST.MF");
-         assertBundleByFile(manifest, 0, false, null);
-      }
-      finally
-      {
-         uninstall(bundle);
-      }
-   }
-
-   public void testVisitor() throws Exception
-   {
-      Bundle bundle = addBundle("/bundles/entries/", "entries-simple");
-      try
-      {
-         URI uri = createURI(bundle, null);
-         VirtualFile root = VFS.getRoot(uri);
-         assertNotNull(root);
-
-         List<VirtualFile> children = root.getChildren(new VirtualFileFilter()
-         {
-            public boolean accepts(VirtualFile file)
-            {
-               return file.getPathName().contains("META-INF");
-            }
-         });
-         assertTrue(children != null && children.size() == 1);
-
-         children = root.getChildrenRecursively(new VirtualFileFilter()
-         {
-            public boolean accepts(VirtualFile file)
-            {
-               return file.getPathName().contains("META-INF");
-            }
-         });
-         assertTrue(children != null && children.size() == 2);
-
-         final AtomicInteger counter = new AtomicInteger(0);
-         root.visit(new VirtualFileVisitor()
-         {
-            public VisitorAttributes getAttributes()
-            {
-               return VisitorAttributes.RECURSE_LEAVES_ONLY;
-            }
-
-            public void visit(VirtualFile file)
-            {
-               if (file.getName().equals("entry2.xml")) counter.incrementAndGet();
-            }
-         });
-         assertEquals(2, counter.get());
-      }
-      finally
-      {
-         uninstall(bundle);
-      }
-   }
-
-   protected URI createURI(Bundle bundle, String path) throws Exception
-   {
-      if (path == null)
-         path = "";
-      if (path != null && path.startsWith("/") == false)
-         path = "/" + path;
-      
-      return new URI("bundle", Long.toString(bundle.getBundleId()), path, null);
-   }
-
-   protected void assertBundleByURI(URI uri, int available, boolean hasChildren, String path) throws Exception
-   {
-      VFS vfs = VFS.getVFS(uri);
-      assertNotNull(vfs);
-      VirtualFile file = vfs.getRoot();
-      assertNotNull(file);
-
-      URI bURI = file.toURI();
-      assertEquals(uri, bURI);
-      URL url = uri.toURL();
-      assertEquals(url, file.toURL());
-
-      assertBundleByFile(file, available, hasChildren, path);
-
-      // check url
-      file = VFS.getRoot(url);
-      assertBundleByFile(file, available, hasChildren, path);
-   }
-
-   protected void assertBundleByFile(VirtualFile file, int available, boolean hasChildren, String path) throws IOException
-   {
-      long lastModified = file.getLastModified();
-      assertTrue(lastModified >= 0);
-
-      InputStream is = file.openStream();
-      try
-      {
-         assertTrue(is.available() > available);
-      }
-      finally
-      {
-         is.close();
-      }
-
-      List<VirtualFile> children = file.getChildren();
-      assertEquals(hasChildren, children != null && children.isEmpty() == false);
-
-      String cp = path;
-      if (cp == null)
-         cp = "rubbish"; // :-)
-
-      VirtualFile child = file.getChild(cp);
-      assertEquals(path != null, child != null);
-
-      if (child != null)
-         assertEquals(file, child.getParent());
-   }
-}
\ No newline at end of file

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml	2010-03-03 09:42:26 UTC (rev 101765)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml	2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,30 +1,25 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-  <!-- ====================================================================== -->
-  <!--                                                                        -->
-  <!--  JBoss, the OpenSource J2EE webOS                                      -->
-  <!--                                                                        -->
-  <!--  Distributable under LGPL license.                                     -->
-  <!--  See terms of license at http://www.gnu.org.                           -->
-  <!--                                                                        -->
-  <!-- ====================================================================== -->
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
 
-  <!-- $Id$ -->
+<!-- $Id$ -->
 
-  <!-- 
-     Set these VM properties in your IDE debugger
-     
-     -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target}
-     -Dlog4j.configuration=log4j-console.xml
-  -->
+<!-- Set these VM properties in your IDE debugger -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target} -Dlog4j.configuration=log4j-console.xml -->
 
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
 
-  <name>JBossOSGi Core Framework</name>
+  <name>JBossOSGi Framework</name>
   <groupId>org.jboss.osgi.runtime</groupId>
-  <artifactId>jboss-osgi-framework</artifactId>
-  <packaging>bundle</packaging>
+  <artifactId>jboss-osgi-framework-parent</artifactId>
+  <packaging>pom</packaging>
 
   <version>1.0.0.Alpha4-SNAPSHOT</version>
 
@@ -40,7 +35,7 @@
     <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/framework/trunk</developerConnection>
     <url>http://fisheye.jboss.com/qsearch/JBossOSGi</url>
   </scm>
-  
+
   <!-- Properties -->
   <properties>
     <version.apache.felix.configadmin>1.0.10</version.apache.felix.configadmin>
@@ -69,389 +64,216 @@
     <version.osgi>4.2.0</version.osgi>
   </properties>
 
-  <dependencies>
-    <dependency>
-      <groupId>biz.aQute</groupId>
-      <artifactId>bnd</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.cl</groupId>
-      <artifactId>jboss-classloader</artifactId>
-      <version>${version.jboss.classloading}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.cl</groupId>
-      <artifactId>jboss-classloading</artifactId>
-      <version>${version.jboss.classloading}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.cl</groupId>
-      <artifactId>jboss-classloading-vfs</artifactId>
-      <version>${version.jboss.classloading}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.deployers</groupId>
-      <artifactId>jboss-deployers-client</artifactId>
-      <version>${version.jboss.deployers}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.deployers</groupId>
-      <artifactId>jboss-deployers-client-spi</artifactId>
-      <version>${version.jboss.deployers}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.deployers</groupId>
-      <artifactId>jboss-deployers-core</artifactId>
-      <version>${version.jboss.deployers}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.deployers</groupId>
-      <artifactId>jboss-deployers-core-spi</artifactId>
-      <version>${version.jboss.deployers}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.deployers</groupId>
-      <artifactId>jboss-deployers-impl</artifactId>
-      <version>${version.jboss.deployers}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.deployers</groupId>
-      <artifactId>jboss-deployers-structure-spi</artifactId>
-      <version>${version.jboss.deployers}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.deployers</groupId>
-      <artifactId>jboss-deployers-vfs-spi</artifactId>
-      <version>${version.jboss.deployers}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.deployers</groupId>
-      <artifactId>jboss-deployers-vfs</artifactId>
-      <version>${version.jboss.deployers}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.deployers</groupId>
-      <artifactId>jboss-deployers-jmx</artifactId>
-      <version>${version.jboss.deployers}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.kernel</groupId>
-      <artifactId>jboss-kernel</artifactId>
-      <version>${version.jboss.kernel}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.kernel</groupId>
-      <artifactId>jboss-jmx-aop-mc-int</artifactId>
-      <version>${version.jboss.kernel}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.kernel</groupId>
-      <artifactId>jboss-jmx-mc-int</artifactId>
-      <version>${version.jboss.kernel}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.kernel</groupId>
-      <artifactId>jboss-dependency</artifactId>
-      <version>${version.jboss.kernel}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.logging</groupId>
-      <artifactId>jboss-logging-spi</artifactId>
-      <version>${version.jboss.logging}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss</groupId>
-      <artifactId>jboss-mdr</artifactId>
-      <version>${version.jboss.mdr}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi</groupId>
-      <artifactId>jboss-osgi-spi</artifactId>
-      <version>${version.jboss.osgi.spi}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi.runtime</groupId>
-      <artifactId>jboss-osgi-deployers</artifactId>
-      <version>${version.jboss.osgi.deployers}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi.runtime</groupId>
-      <artifactId>jboss-osgi-deployment</artifactId>
-      <version>${version.jboss.osgi.deployment}</version>
-    </dependency>
+  <!-- Modules -->
+  <modules>
+    <module>core</module>
+  </modules>
+  
+  <!-- Dependency Management -->
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.jboss.cl</groupId>
+        <artifactId>jboss-classloader</artifactId>
+        <version>${version.jboss.classloading}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.cl</groupId>
+        <artifactId>jboss-classloading</artifactId>
+        <version>${version.jboss.classloading}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.cl</groupId>
+        <artifactId>jboss-classloading-vfs</artifactId>
+        <version>${version.jboss.classloading}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-client</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-client-spi</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-core</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-core-spi</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-impl</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-structure-spi</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-vfs-spi</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-vfs</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.deployers</groupId>
+        <artifactId>jboss-deployers-jmx</artifactId>
+        <version>${version.jboss.deployers}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.kernel</groupId>
+        <artifactId>jboss-kernel</artifactId>
+        <version>${version.jboss.kernel}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.kernel</groupId>
+        <artifactId>jboss-jmx-aop-mc-int</artifactId>
+        <version>${version.jboss.kernel}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.kernel</groupId>
+        <artifactId>jboss-jmx-mc-int</artifactId>
+        <version>${version.jboss.kernel}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.kernel</groupId>
+        <artifactId>jboss-dependency</artifactId>
+        <version>${version.jboss.kernel}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.logging</groupId>
+        <artifactId>jboss-logging-spi</artifactId>
+        <version>${version.jboss.logging}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss</groupId>
+        <artifactId>jboss-mdr</artifactId>
+        <version>${version.jboss.mdr}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi</groupId>
+        <artifactId>jboss-osgi-spi</artifactId>
+        <version>${version.jboss.osgi.spi}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi.runtime</groupId>
+        <artifactId>jboss-osgi-deployers</artifactId>
+        <version>${version.jboss.osgi.deployers}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi.runtime</groupId>
+        <artifactId>jboss-osgi-deployment</artifactId>
+        <version>${version.jboss.osgi.deployment}</version>
+      </dependency>
 
-    <!-- OSGi Dependencies -->
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>${version.osgi}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.compendium</artifactId>
-      <version>${version.osgi}</version>
-    </dependency>
+      <!-- OSGi Dependencies -->
+      <dependency>
+        <groupId>org.osgi</groupId>
+        <artifactId>org.osgi.core</artifactId>
+        <version>${version.osgi}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.osgi</groupId>
+        <artifactId>org.osgi.compendium</artifactId>
+        <version>${version.osgi}</version>
+      </dependency>
 
-    <!-- Test bundles dependencies -->
-    <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.configadmin</artifactId>
-      <version>${version.apache.felix.configadmin}</version>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.felix</groupId>
-          <artifactId>org.osgi.core</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.apache.felix</groupId>
-          <artifactId>org.osgi.compendium</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.log</artifactId>
-      <version>${version.apache.felix.log}</version>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.felix</groupId>
-          <artifactId>org.osgi.core</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.apache.felix</groupId>
-          <artifactId>org.osgi.compendium</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.metatype</artifactId>
-      <version>${version.apache.felix.metatype}</version>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.felix</groupId>
-          <artifactId>org.osgi.core</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.apache.felix</groupId>
-          <artifactId>org.osgi.compendium</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi.bundles</groupId>
-      <artifactId>jboss-osgi-apache-xerces</artifactId>
-      <version>${version.jboss.osgi.apache.xerces}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi.bundles</groupId>
-      <artifactId>jboss-osgi-common</artifactId>
-      <version>${version.jboss.osgi.common}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi.bundles</groupId>
-      <artifactId>jboss-osgi-common-core</artifactId>
-      <version>${version.jboss.osgi.common.core}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi.bundles</groupId>
-      <artifactId>jboss-osgi-husky</artifactId>
-      <version>${version.jboss.osgi.husky}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi.bundles</groupId>
-      <artifactId>jboss-osgi-jaxb</artifactId>
-      <version>${version.jboss.osgi.jaxb}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi.jmx</groupId>
-      <artifactId>jboss-osgi-jmx</artifactId>
-      <version>${version.jboss.osgi.jmx}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi.jndi</groupId>
-      <artifactId>jboss-osgi-jndi</artifactId>
-      <version>${version.jboss.osgi.jndi}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi.bundles</groupId>
-      <artifactId>jboss-osgi-reflect</artifactId>
-      <version>${version.jboss.osgi.reflect}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi.bundles</groupId>
-      <artifactId>jboss-osgi-xml-binding</artifactId>
-      <version>${version.jboss.osgi.xml.binding}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.ops4j.pax.web</groupId>
-      <artifactId>pax-web-jetty-bundle</artifactId>
-      <version>${version.ops4j.pax.web}</version>
-      <scope>test</scope>
-    </dependency>
-
-    <!-- Test Dependencies -->
-    <dependency>
-      <groupId>org.jboss.test</groupId>
-      <artifactId>jboss-test</artifactId>
-      <version>${version.jboss.test}</version>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>org.jboss</groupId>
-          <artifactId>jboss-common-core</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.jboss.logging</groupId>
-          <artifactId>jboss-logging-spi</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.osgi</groupId>
-      <artifactId>jboss-osgi-testing</artifactId>
-      <version>${version.jboss.osgi.testing}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jboss.logging</groupId>
-      <artifactId>jboss-logging-log4j</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-assembly-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>bundles</id>
-            <phase>test-compile</phase>
-            <goals>
-              <goal>directory-single</goal>
-            </goals>
-            <configuration>
-              <finalName>test-libs</finalName>
-              <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
-              <appendAssemblyId>false</appendAssemblyId>
-              <descriptors>
-                <descriptor>scripts/assembly-bundles.xml</descriptor>
-              </descriptors>
-            </configuration>
-          </execution>
-          <execution>
-            <id>all</id>
-            <phase>package</phase>
-            <goals>
-              <goal>single</goal>
-            </goals>
-            <configuration>
-              <descriptors>
-                <descriptor>scripts/assembly-all.xml</descriptor>
-              </descriptors>
-              <archive>
-                <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
-              </archive>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <artifactId>maven-antrun-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>build-test-jars</id>
-            <phase>test-compile</phase>
-            <goals>
-              <goal>run</goal>
-            </goals>
-            <configuration>
-              <tasks>
-                <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
-                <property name="tests.output.dir" value="${project.build.directory}" />
-                <ant antfile="scripts/antrun-test-jars.xml" />
-              </tasks>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <artifactId>maven-idea-plugin</artifactId>
-        <configuration>
-          <downloadSources>true</downloadSources>
-        </configuration>
-      </plugin>
-      <plugin>
+      <!-- Test bundles dependencies -->
+      <dependency>
         <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Bundle-SymbolicName>org.jboss.osgi.framework</Bundle-SymbolicName>
-            <Bundle-Name>JBossOSGi Framework</Bundle-Name>
-            <Bundle-Version>${version}</Bundle-Version>
-            <Export-Package>
-              org.osgi.framework;version="1.5",
-              org.osgi.framework.launch;version="1.0",
-              org.osgi.framework.hooks.service;version="1.0",
-              org.osgi.service.packageadmin;version="1.2",
-              org.osgi.service.startlevel;version="1.1",
-              org.osgi.util.tracker;version="1.4"
-             </Export-Package>
-          </instructions>
-        </configuration>
-      </plugin>
-      <plugin>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <argLine>-Xmx512m</argLine>
-          <systemProperties>
-            <property>
-              <name>log4j.output.dir</name>
-              <value>${project.build.directory}</value>
-            </property>
-            <property>
-              <name>org.jboss.osgi.framework.launch.bootstrapPath</name>
-              <value>bootstrap/jboss-osgi-bootstrap.xml</value>
-            </property>
-            <property>
-              <name>org.jboss.osgi.husky.Invoker</name>
-              <value>org.jboss.osgi.husky.internal.AbstractInvoker</value>
-            </property>
-            <property>
-              <name>test.archive.directory</name>
-              <value>${project.build.directory}/test-libs</value>
-            </property>
-          </systemProperties>
-          <excludes>
-            <!-- excludes listed here need to have a jira issue associated 
-            <exclude>org/jboss/test/osgi/service/ServiceMixUnitTestCase.class</exclude>
-            -->
-          </excludes>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
+        <artifactId>org.apache.felix.configadmin</artifactId>
+        <version>${version.apache.felix.configadmin}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>org.apache.felix.log</artifactId>
+        <version>${version.apache.felix.log}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>org.apache.felix.metatype</artifactId>
+        <version>${version.apache.felix.metatype}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi.bundles</groupId>
+        <artifactId>jboss-osgi-apache-xerces</artifactId>
+        <version>${version.jboss.osgi.apache.xerces}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi.bundles</groupId>
+        <artifactId>jboss-osgi-common</artifactId>
+        <version>${version.jboss.osgi.common}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi.bundles</groupId>
+        <artifactId>jboss-osgi-common-core</artifactId>
+        <version>${version.jboss.osgi.common.core}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi.bundles</groupId>
+        <artifactId>jboss-osgi-husky</artifactId>
+        <version>${version.jboss.osgi.husky}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi.bundles</groupId>
+        <artifactId>jboss-osgi-jaxb</artifactId>
+        <version>${version.jboss.osgi.jaxb}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi.jmx</groupId>
+        <artifactId>jboss-osgi-jmx</artifactId>
+        <version>${version.jboss.osgi.jmx}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi.jndi</groupId>
+        <artifactId>jboss-osgi-jndi</artifactId>
+        <version>${version.jboss.osgi.jndi}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi.bundles</groupId>
+        <artifactId>jboss-osgi-reflect</artifactId>
+        <version>${version.jboss.osgi.reflect}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi.bundles</groupId>
+        <artifactId>jboss-osgi-xml-binding</artifactId>
+        <version>${version.jboss.osgi.xml.binding}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.ops4j.pax.web</groupId>
+        <artifactId>pax-web-jetty-bundle</artifactId>
+        <version>${version.ops4j.pax.web}</version>
+      </dependency>
 
+      <!-- Test Dependencies -->
+      <dependency>
+        <groupId>org.jboss.test</groupId>
+        <artifactId>jboss-test</artifactId>
+        <version>${version.jboss.test}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi</groupId>
+        <artifactId>jboss-osgi-testing</artifactId>
+        <version>${version.jboss.osgi.testing}</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
   <profiles>
-  
-    <!--
-      Name: distro
-      Desc: Build the distribution
-    -->
+
+    <!-- Name: distro Desc: Build the distribution -->
     <profile>
       <id>distro</id>
       <build>
@@ -465,7 +287,7 @@
         </plugins>
       </build>
     </profile>
-    
+
   </profiles>
 
 </project>




More information about the jboss-cvs-commits mailing list