[jboss-osgi-commits] JBoss-OSGI SVN: r92791 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src: main/java/org/jboss/osgi/plugins/facade/bundle and 77 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Tue Aug 25 09:15:12 EDT 2009


Author: adrian at jboss.org
Date: 2009-08-25 09:15:04 -0400 (Tue, 25 Aug 2009)
New Revision: 92791

Added:
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleCapability.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleRequirement.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageCapability.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageRequirement.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/ClassLoaderTestSuite.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/support/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/support/a/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/support/a/A.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/support/b/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/support/b/B.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/test/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/test/ExportImportPackageUnitTestCase.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/test/RequireBundleUnitTestCase.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributeimportpackageA/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributeimportpackageA/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributeimportpackageA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributeimportpackagefails/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributeimportpackagefails/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributeimportpackagefails/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributerequirebundleA/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributerequirebundleA/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributerequirebundleA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributerequirebundlefails/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributerequirebundlefails/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributerequirebundlefails/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleA/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleA/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleA2/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleA2/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleA2/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleattributeimportpackageA/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleattributeimportpackageA/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleattributeimportpackageA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundlenameimportpackageA/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundlenameimportpackageA/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundlenameimportpackageA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundlenameimportpackagefails/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundlenameimportpackagefails/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundlenameimportpackagefails/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleversionimportpackageA/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleversionimportpackageA/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleversionimportpackageA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleversionimportpackagefails/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleversionimportpackagefails/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleversionimportpackagefails/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/noreexportrequirebundleA/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/noreexportrequirebundleA/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/noreexportrequirebundleA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/notbundleA/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/notbundleA/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/notbundleA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalimportpackageA/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalimportpackageA/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalimportpackageA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalimportpackagefails/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalimportpackagefails/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalimportpackagefails/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalrequirebundleA/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalrequirebundleA/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalrequirebundleA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalrequirebundlefails/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalrequirebundlefails/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalrequirebundlefails/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/reexportrequirebundleA/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/reexportrequirebundleA/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/reexportrequirebundleA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/reexportrequirebundleB/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/reexportrequirebundleB/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/reexportrequirebundleB/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simpleimportpackageA/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simpleimportpackageA/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simpleimportpackageA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simpleimportpackagefails/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simpleimportpackagefails/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simpleimportpackagefails/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simplerequirebundleA/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simplerequirebundleA/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simplerequirebundleA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simplerequirebundlefails/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simplerequirebundlefails/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simplerequirebundlefails/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionimportpackageA/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionimportpackageA/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionimportpackageA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionimportpackagefails/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionimportpackagefails/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionimportpackagefails/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionrequirebundleA/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionrequirebundleA/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionrequirebundleA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionrequirebundlefails/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionrequirebundlefails/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionrequirebundlefails/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/not-singleton/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/not-singleton/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/not-singleton/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/singleton1/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/singleton1/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/singleton1/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/singleton2/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/singleton2/META-INF/
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/singleton2/META-INF/MANIFEST.MF
Removed:
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/log4j.xml
Modified:
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiManifestParsingDeployer.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoadingDeployer.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractParameterizedAttribute.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/spi/metadata/OSGiMetaData.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/spi/metadata/ParameterizedAttribute.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestSuite.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleUnitTestCase.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java
   projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml
Log:
[JBOSGI-5] - Updates to better handle classloading metadata and a few other changes

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiManifestParsingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiManifestParsingDeployer.java	2009-08-25 13:08:45 UTC (rev 92790)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiManifestParsingDeployer.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -22,10 +22,12 @@
 package org.jboss.osgi.plugins.deployers.bundle;
 
 import java.util.jar.Manifest;
+import java.util.jar.Attributes.Name;
 
 import org.jboss.deployers.vfs.spi.deployer.ManifestDeployer;
 import org.jboss.osgi.plugins.metadata.AbstractOSGiMetaData;
 import org.jboss.osgi.spi.metadata.OSGiMetaData;
+import org.osgi.framework.Constants;
 
 /**
  * OSGiManifestParsingDeployer.<p>
@@ -50,9 +52,9 @@
    protected OSGiMetaData createMetaData(Manifest manifest) throws Exception
    {
       // To be a true OSGi bundle it must have a bundle symbolic name in the manfiest
+      if (manifest.getMainAttributes().get(new Name(Constants.BUNDLE_SYMBOLICNAME)) == null)
+         return null;
       OSGiMetaData result = new AbstractOSGiMetaData(manifest);
-      if (result.getBundleSymbolicName() == null)
-         return null;
       return result;
    }
 }

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java	2009-08-25 13:08:45 UTC (rev 92790)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -24,7 +24,6 @@
 import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.Dictionary;
@@ -40,12 +39,6 @@
 import java.util.jar.Manifest;
 import java.util.jar.Attributes.Name;
 
-import org.jboss.classloading.spi.dependency.RequirementDependencyItem;
-import org.jboss.classloading.spi.metadata.Requirement;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.DependencyInfo;
-import org.jboss.dependency.spi.DependencyItem;
 import org.jboss.deployers.client.spi.DeployerClient;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.DeploymentStages;
@@ -127,6 +120,7 @@
    private Map<Class<?>, AbstractPlugin> plugins = new HashMap<Class<?>, AbstractPlugin>();
    
    /** The frame work properties */
+   @SuppressWarnings("unused") // [TODO] ????
    private Map<String, Object> properties = new HashMap<String, Object>();
    
    static
@@ -196,6 +190,8 @@
 
    /**
     * Set the framework properties
+    * 
+    * @param properties the properties
     */
    public void setProperties(Map<String, Object> properties)
    {
@@ -204,6 +200,10 @@
 
    /**
     * 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")
@@ -218,6 +218,8 @@
 
    /**
     * 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")
@@ -228,6 +230,8 @@
    
    /**
     * Add a plugin
+    * 
+    * @param plugin the plugin
     */
    public void addPlugin(AbstractPlugin plugin)
    {
@@ -243,7 +247,9 @@
    }
    
    /**
-    * Add a plugin
+    * Remove a plugin
+    * 
+    * @param plugin the plugin to remove
     */
    public void removePlugin(AbstractPlugin plugin)
    {
@@ -399,8 +405,9 @@
             manifest = new Manifest();
          // [TODO] populate some bundle information
          Attributes attributes = manifest.getMainAttributes();
+         String name = generateName(unit);
          attributes.put(new Name(Constants.BUNDLE_NAME), unit.getName());
-         attributes.put(new Name(Constants.BUNDLE_SYMBOLICNAME), unit.getName());
+         attributes.put(new Name(Constants.BUNDLE_SYMBOLICNAME), name);
          osgiMetaData = new AbstractOSGiMetaData(manifest);
       }
       else
@@ -414,6 +421,28 @@
    }
    
    /**
+    * Generate a name for the deployment unit
+    * 
+    * todo some better solution
+    * @param unit the deployment unit
+    * @return the name
+    */
+   protected String generateName(DeploymentUnit unit)
+   {
+      StringBuilder result = new StringBuilder();
+      String name = unit.getName();
+      for (int i = 0; i < name.length(); ++i)
+      {
+         char c = name.charAt(i);
+         if (Character.isJavaIdentifierPart(c))
+            result.append(c);
+         else
+            result.append('_');
+      }
+      return result.toString();
+   }
+   
+   /**
     * Add a bundle
     * 
     * @param bundleState the bundle state
@@ -423,6 +452,20 @@
    {
       if (bundleState == null)
          throw new IllegalArgumentException("Null bundle state");
+
+      // todo more validation
+      OSGiMetaData metaData = bundleState.getOSGiMetaData();
+      if (metaData.isSingleton())
+      {
+         String symbolicName = metaData.getBundleSymbolicName();
+         for (OSGiBundleState bundle : getBundles())
+         {
+            OSGiMetaData other = bundle.getOSGiMetaData();
+            if (other.isSingleton() && symbolicName.equals(other.getBundleSymbolicName()))
+               throw new IllegalStateException("Cannot install singleton " + bundleState + " another singleton is already installed: " + bundle);
+         }
+      }
+      
       bundleState.setBundleManager(this);
       bundlesById.put(bundleState.getBundleId(), bundleState);
       log.debug("Added " + bundleState.getCanonicalName() + " id=" + bundleState.getBundleId());
@@ -550,36 +593,9 @@
    {
       try
       {
-         DeploymentUnit unit = bundleState.getDeploymentUnit();
-         deployerClient.change(unit.getName(), DeploymentStages.INSTALLED);
-         
-         ControllerContext context = unit.getAttachment(ControllerContext.class);
-         if (context == null)
-            throw new IllegalStateException("Cannot obtain controller context");
-         
-         // check actually changed state
-         ControllerState actualState = context.getState();
-         if (actualState != ControllerState.INSTALLED)
-         {
-            ArrayList<Requirement> unresolved = new ArrayList<Requirement>();
-            DependencyInfo depInfo = context.getDependencyInfo();
-            for (DependencyItem iDependOn : depInfo.getIDependOn(RequirementDependencyItem.class))
-            {
-               if (iDependOn.isResolved() == false)
-               {
-                  RequirementDependencyItem rdi = (RequirementDependencyItem)iDependOn;
-                  unresolved.add(rdi.getRequirement());
-               }
-            }
-            if (unresolved.size() > 0)
-            {
-               throw new BundleException("Cannot start bundle " + bundleState + ", because of unresolved dependencies\n  " + unresolved);
-            }
-            else
-            {
-               throw new BundleException("Cannot start bundle: " + bundleState);
-            }
-         }
+         String name = bundleState.getDeploymentUnit().getName();
+         deployerClient.change(name, DeploymentStages.INSTALLED);
+         deployerClient.checkComplete(name);
       }
       catch (DeploymentException e)
       {
@@ -810,7 +826,7 @@
       // [TODO] Have event handling enabled
 
       // Cleanup the storage area
-      String storageClean = (String)getProperty(Constants.FRAMEWORK_STORAGE_CLEAN);
+      String storageClean = getProperty(Constants.FRAMEWORK_STORAGE_CLEAN);
       BundleStoragePlugin storagePlugin = getOptionalPlugin(BundleStoragePlugin.class);
       if (storagePlugin != null)
          storagePlugin.cleanStorage(storageClean);
@@ -818,6 +834,8 @@
 
    /**
     * Start the framework
+    * 
+    * @throws BundleException for any error
     */
    public void startFramework() throws BundleException
    {
@@ -873,8 +891,6 @@
    
    /**
     * Stop the framework
-    * 
-    * @param systemBundle the system bundle
     */
    public void restartFramework()
    {

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java	2009-08-25 13:08:45 UTC (rev 92790)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -277,7 +277,7 @@
       {
          VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
          VirtualFile root = vfsDeploymentUnit.getRoot();
-         return root.getName();
+         return root.getPathName();
       }
 
       return null;

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleCapability.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleCapability.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleCapability.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,159 @@
+/*
+* 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.plugins.facade.classloading;
+
+import java.util.Map;
+
+import org.jboss.classloading.plugins.metadata.ModuleCapability;
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.classloading.spi.metadata.Requirement;
+import org.jboss.osgi.spi.metadata.OSGiMetaData;
+import org.jboss.osgi.spi.metadata.Parameter;
+import org.jboss.osgi.spi.metadata.ParameterizedAttribute;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
+
+/**
+ * OSGiBundleCapability.
+ * 
+ * todo BundlePermission/PROVIDE
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class OSGiBundleCapability extends ModuleCapability
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 2366716668262831380L;
+
+   /** The metadata */
+   private OSGiMetaData metadata;
+
+   /**
+    * Create a new OSGiBundleCapability
+    * 
+    * @param metadata the osgi metadata
+    * @return the capability
+    * @throws IllegalArgumentException for a null metadata
+    */
+   public static OSGiBundleCapability create(OSGiMetaData metadata)
+   {
+      if (metadata == null)
+         throw new IllegalArgumentException("Null metadata");
+
+      String name = metadata.getBundleSymbolicName();
+      Version version = metadata.getBundleVersion();
+
+      return new OSGiBundleCapability(name, version, metadata);
+   }
+   
+   /**
+    * Create a new OSGiBundleCapability.
+    * 
+    * @param name the name
+    * @param version the version pass null of the default version
+    * @param metadata the metadata
+    * @throws IllegalArgumentException for a null name or requireBundle
+    */
+   public OSGiBundleCapability(String name, Version version, OSGiMetaData metadata)
+   {
+      super(name, version);
+      if (metadata == null)
+         throw new IllegalArgumentException("Null metadata");
+      this.metadata = metadata;
+   }
+   
+   /**
+    * Get the metadata.
+    * 
+    * @return the metadata.
+    */
+   public OSGiMetaData getMetaData()
+   {
+      return metadata;
+   }
+
+   @Override
+   public boolean resolves(Module module, Requirement requirement)
+   {
+      if (super.resolves(module, requirement) == false)
+         return false;
+      if (requirement instanceof OSGiBundleRequirement == false)
+         return true;
+      
+      // Review its not clear to me from the spec whether attribute matching 
+      // beyond the version should work for require-bundle?
+      OSGiBundleRequirement bundleRequirement = (OSGiBundleRequirement) requirement;
+      OSGiMetaData metaData = getMetaData();
+      ParameterizedAttribute ourParameters = metaData.getBundleParameters();
+      ParameterizedAttribute otherParameters = bundleRequirement.getRequireBundle();
+      if (otherParameters != null)
+      {
+         Map<String, Parameter> params = otherParameters.getParameters();
+         if (params != null && params.isEmpty() == false)
+         {
+            for (String name : params.keySet())
+            {
+               // todo we shouldn't mix attributes and directives in the metadata
+               if (Constants.VISIBILITY_DIRECTIVE.equals(name) == false
+                && Constants.RESOLUTION_DIRECTIVE.equals(name) == false
+                && Constants.BUNDLE_VERSION_ATTRIBUTE.equals(name) == false)
+               {
+                  if (ourParameters == null)
+                     return false;
+                  String ourValue = ourParameters.getParameterValue(name, String.class);
+                  if (ourValue == null)
+                     return false;
+                  if (ourValue.equals(otherParameters.getParameterValue(name, String.class)) == false)
+                     return false;
+               }
+            }
+         }
+      }
+      return true;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (obj == this)
+         return true;
+      if (obj == null || obj instanceof OSGiBundleCapability == false)
+         return false;
+      if (super.equals(obj) ==false)
+         return false;
+      OSGiBundleCapability other = (OSGiBundleCapability) obj;
+      return getMetaData().equals(other.getMetaData());
+   }
+
+   @Override
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      ParameterizedAttribute parameters = metadata.getBundleParameters();
+      if (parameters != null)
+      {
+         Map<String, Parameter> params = parameters.getParameters();
+         if (params != null && params.isEmpty() == false)
+            buffer.append(" parameters=").append(params);
+      }
+   }
+}

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoadingDeployer.java	2009-08-25 13:08:45 UTC (rev 92790)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoadingDeployer.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -24,91 +24,92 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.jboss.classloading.plugins.metadata.ModuleCapability;
-import org.jboss.classloading.plugins.metadata.PackageCapability;
-import org.jboss.classloading.plugins.metadata.PackageRequirement;
-import org.jboss.classloading.spi.metadata.Capability;
+import org.jboss.classloading.spi.metadata.CapabilitiesMetaData;
 import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.classloading.spi.metadata.RequirementsMetaData;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.DeploymentStages;
 import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.osgi.plugins.facade.api.SystemPackagesPlugin;
 import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
+import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
 import org.jboss.osgi.spi.metadata.OSGiMetaData;
 import org.jboss.osgi.spi.metadata.PackageAttribute;
-import org.jboss.osgi.spi.metadata.Parameter;
-import org.osgi.framework.Constants;
+import org.jboss.osgi.spi.metadata.ParameterizedAttribute;
 
 /**
- * OSGiBundleClassLoadingDeployer.
- * <p>
+ * OSGiBundleClassLoadingDeployer.<p>
  * 
  * This deployer maps osgi metadata into our classloading metadata.
  * 
- * [TODO] versions and attributes [TODO] require-bundle, dynamic-imports, etc.
- * 
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision: 1.1 $
  */
 public class OSGiBundleClassLoadingDeployer extends AbstractSimpleRealDeployer<OSGiMetaData>
 {
-   /** The bundle manager */
-   private OSGiBundleManager bundleManager;
-   
    /**
     * Create a new OSGiBundleClassLoadingDeployer.
-    * 
-    * @param bundleManager the bundleManager
-    * @throws IllegalArgumentException for a null bundle manager
     */
-   public OSGiBundleClassLoadingDeployer(OSGiBundleManager bundleManager)
+   public OSGiBundleClassLoadingDeployer()
    {
       super(OSGiMetaData.class);
-      this.bundleManager = bundleManager;
-      
-      if (bundleManager == null)
-         throw new IllegalArgumentException("Null bundle manager");
-      
       setTopLevelOnly(true);
       setOutput(ClassLoadingMetaData.class);
       setStage(DeploymentStages.POST_PARSE);
    }
 
    @Override
-   public void deploy(DeploymentUnit unit, OSGiMetaData metadata) throws DeploymentException
+   public void deploy(DeploymentUnit unit, OSGiMetaData deployment) throws DeploymentException
    {
       if (unit.isAttachmentPresent(ClassLoadingMetaData.class))
          return;
 
+      OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
+      if (bundleState == null)
+         throw new IllegalStateException("No bundle state");
+      OSGiBundleManager bundleManager = bundleState.getBundleManager();
+      
       ClassLoadingMetaData classLoadingMetaData = new ClassLoadingMetaData();
-      classLoadingMetaData.setName(metadata.getBundleSymbolicName());
-      classLoadingMetaData.setVersion(metadata.getBundleVersion());
+      classLoadingMetaData.setName(deployment.getBundleSymbolicName());
+      classLoadingMetaData.setVersion(deployment.getBundleVersion());
 
-      Capability capability = new ModuleCapability(metadata.getBundleSymbolicName(), metadata.getBundleVersion());
-      classLoadingMetaData.getCapabilities().addCapability(capability);
-
+      CapabilitiesMetaData capabilities = classLoadingMetaData.getCapabilities();
+      RequirementsMetaData requirements = classLoadingMetaData.getRequirements();
+      
+      OSGiBundleCapability capability = OSGiBundleCapability.create(deployment);
+      capabilities.addCapability(capability);
+      
+      List<ParameterizedAttribute> requireBundles = deployment.getRequireBundles();
+      if (requireBundles != null && requireBundles.isEmpty() == false)
+      {
+         for (ParameterizedAttribute requireBundle : requireBundles)
+         {
+            OSGiBundleRequirement requirement = OSGiBundleRequirement.create(requireBundle);
+            requirements.addRequirement(requirement);
+         }
+      }
+      
       ArrayList<String> exportedNames = new ArrayList<String>();
       
-      List<PackageAttribute> exported = metadata.getExportPackages();
-      if (exported != null)
+      List<PackageAttribute> exported = deployment.getExportPackages();
+      if (exported != null && exported.isEmpty() == false)
       {
          for (PackageAttribute packageAttribute : exported)
          {
-            String packageName = packageAttribute.getPackageInfo().getName();
-            capability = new PackageCapability(packageName);
-            classLoadingMetaData.getCapabilities().addCapability(capability);
-            exportedNames.add(packageName);
+            OSGiPackageCapability packageCapability = OSGiPackageCapability.create(deployment, packageAttribute); 
+            capabilities.addCapability(packageCapability);
+            exportedNames.add(packageCapability.getName());
          }
       }
-
-      List<PackageAttribute> imported = metadata.getImportPackages();
-      if (imported != null)
+      
+      List<PackageAttribute> imported = deployment.getImportPackages();
+      if (imported != null && imported.isEmpty() == false)
       {
          SystemPackagesPlugin syspackPlugin = bundleManager.getPlugin(SystemPackagesPlugin.class);
          for (PackageAttribute packageAttribute : imported)
          {
-            String packageName = packageAttribute.getPackageInfo().getName();
+            String packageName = packageAttribute.getAttribute();
             
             // [TODO] Import package requirements should probably resolve against export capabilities
             boolean isExportPackage = exportedNames.contains(packageName);
@@ -119,20 +120,14 @@
             // [TODO] add exported package requirements
             if (isSystemPackage == false && isExportPackage == false)
             {
-               // [TODO] add version ranges
-               PackageRequirement requirement = new PackageRequirement(packageName);
-
-               Parameter resolution = packageAttribute.getParameter(Constants.RESOLUTION_DIRECTIVE);
-               if (resolution != null && Constants.RESOLUTION_OPTIONAL.equals(resolution.getValue()))
-                  requirement.setOptional(true);
-               
-               // [TODO] add optional package requirements
-               if (requirement.isOptional() == false)
-                  classLoadingMetaData.getRequirements().addRequirement(requirement);
+               OSGiPackageRequirement requirement = OSGiPackageRequirement.create(packageAttribute); 
+               requirements.addRequirement(requirement);
             }
          }
       }
-
+      
+      // [TODO] dynamic imports
+      
       unit.addAttachment(ClassLoadingMetaData.class, classLoadingMetaData);
    }
 }

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleRequirement.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleRequirement.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleRequirement.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,125 @@
+/*
+* 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.plugins.facade.classloading;
+
+import java.util.Map;
+
+import org.jboss.classloading.plugins.metadata.ModuleRequirement;
+import org.jboss.classloading.spi.version.VersionRange;
+import org.jboss.osgi.plugins.metadata.AbstractVersionRange;
+import org.jboss.osgi.spi.metadata.Parameter;
+import org.jboss.osgi.spi.metadata.ParameterizedAttribute;
+import org.osgi.framework.Constants;
+
+/**
+ * OSGiBundleRequirement.
+ * 
+ * todo BundlePermission/REQUIRE
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class OSGiBundleRequirement extends ModuleRequirement
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 4264597072894634275L;
+   
+   /** The attributes */
+   private ParameterizedAttribute requireBundle;
+
+   /**
+    * Create a new OSGiBundleRequirement.
+    * 
+    * @param requireBundle the require bundle metadata
+    * @return the requirement
+    * @throws IllegalArgumentException for a null requireBundle
+    */
+   public static OSGiBundleRequirement create(ParameterizedAttribute requireBundle)
+   {
+      if (requireBundle == null)
+         throw new IllegalArgumentException("Null require bundle");
+
+      String name = requireBundle.getAttribute();
+      
+      AbstractVersionRange range = null;
+      String version = requireBundle.getParameterValue(Constants.BUNDLE_VERSION_ATTRIBUTE, String.class);
+      if (version != null)
+         range = (AbstractVersionRange) AbstractVersionRange.valueOf(version);
+
+      return new OSGiBundleRequirement(name, range, requireBundle);
+   }
+   
+   /**
+    * Create a new OSGiBundleRequirement.
+    * 
+    * @param name the name
+    * @param versionRange the version range - pass null for all versions
+    * @param requireBundle the require bundle metadata
+    * @throws IllegalArgumentException for a null name or requireBundle
+    */
+   public OSGiBundleRequirement(String name, VersionRange versionRange, ParameterizedAttribute requireBundle)
+   {
+      super(name, versionRange);
+      if (requireBundle == null)
+         throw new IllegalArgumentException("Null requireBundle");
+      this.requireBundle = requireBundle;
+
+      String visibility = requireBundle.getParameterValue(Constants.VISIBILITY_DIRECTIVE, String.class);
+      if (Constants.VISIBILITY_REEXPORT.equals(visibility))
+         setReExport(true);
+
+      String resolution = requireBundle.getParameterValue(Constants.RESOLUTION_DIRECTIVE, String.class);
+      if (Constants.RESOLUTION_OPTIONAL.equals(resolution))
+         setOptional(true);
+   }
+   
+   /**
+    * Get the requireBundle metadata.
+    * 
+    * @return the requireBundle.
+    */
+   public ParameterizedAttribute getRequireBundle()
+   {
+      return requireBundle;
+   }
+   
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (obj == this)
+         return true;
+      if (obj == null || obj instanceof OSGiBundleRequirement == false)
+         return false;
+      if (super.equals(obj) ==false)
+         return false;
+      OSGiBundleRequirement other = (OSGiBundleRequirement) obj;
+      return getRequireBundle().equals(other.getRequireBundle());
+   }
+
+   @Override
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      Map<String, Parameter> parameters = requireBundle.getParameters();
+      if (parameters != null && parameters.isEmpty() == false)
+         buffer.append(" parameters=").append(parameters);
+   }
+}

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageCapability.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageCapability.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageCapability.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,219 @@
+/*
+* 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.plugins.facade.classloading;
+
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.jboss.classloading.plugins.metadata.PackageCapability;
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.classloading.spi.metadata.Requirement;
+import org.jboss.classloading.spi.version.VersionRange;
+import org.jboss.osgi.plugins.metadata.AbstractVersionRange;
+import org.jboss.osgi.spi.metadata.OSGiMetaData;
+import org.jboss.osgi.spi.metadata.PackageAttribute;
+import org.jboss.osgi.spi.metadata.Parameter;
+import org.jboss.osgi.spi.metadata.ParameterizedAttribute;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
+
+/**
+ * OSGiPackageCapability.
+ * 
+ * todo PackagePermission/EXPORT
+ * todo uses
+ * todo include/exclude
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class OSGiPackageCapability extends PackageCapability
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 6047222760667029014L;
+
+   /** The metadata */
+   private OSGiMetaData metadata;
+
+   /** The export package */
+   private PackageAttribute exportPackage;
+   
+   /** The mandatory attributes */
+   private String[] mandatoryAttributes;
+
+   /**
+    * Create a new OSGiPackageCapability.
+    * 
+    * @param metadata the osgi metadata
+    * @param exportPackage the export package metadata
+    * @return the capability
+    * @throws IllegalArgumentException for null metadata
+    */
+   public static OSGiPackageCapability create(OSGiMetaData metadata, PackageAttribute exportPackage)
+   {
+      if (metadata == null)
+         throw new IllegalArgumentException("Null metadata");
+
+      String name = exportPackage.getAttribute();
+      String versionString = exportPackage.getParameterValue(Constants.VERSION_ATTRIBUTE, String.class);
+      String oldVersionString = exportPackage.getParameterValue(Constants.PACKAGE_SPECIFICATION_VERSION, String.class);
+      if (oldVersionString != null)
+      {
+         if (versionString != null && versionString.equals(oldVersionString) == false)
+            throw new IllegalStateException(Constants.VERSION_ATTRIBUTE + " of " + versionString + " does not match " + Constants.PACKAGE_SPECIFICATION_VERSION + " of " + oldVersionString);
+         if (versionString == null)
+            versionString = oldVersionString;
+      }
+      Version version = Version.parseVersion(versionString);
+
+      return new OSGiPackageCapability(name, version, metadata, exportPackage);
+   }
+   
+   /**
+    * Create a new OSGiPackageCapability.
+    * 
+    * @param name the name
+    * @param version the version pass null of the default version
+    * @param metadata the metadata
+    * @param exportPackage the export information
+    * @throws IllegalArgumentException for a null name metadata or exportPackage
+    */
+   public OSGiPackageCapability(String name, Version version, OSGiMetaData metadata, PackageAttribute exportPackage)
+   {
+      super(name, version);
+      if (metadata == null)
+         throw new IllegalArgumentException("Null metadata");
+      this.metadata = metadata;
+      this.exportPackage = exportPackage;
+
+      String mandatory = exportPackage.getParameterValue(Constants.MANDATORY_DIRECTIVE, String.class);
+      if (mandatory != null)
+      {
+         StringTokenizer tokens = new StringTokenizer(mandatory, ",");
+         mandatoryAttributes = new String[tokens.countTokens()];
+         int i = 0;
+         while (tokens.hasMoreTokens())
+            mandatoryAttributes[i++] = tokens.nextToken();
+      }
+
+      if (exportPackage.getParameter(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE) != null)
+         throw new IllegalStateException("You cannot specify " + Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE + " on an Export-Package");
+      if (exportPackage.getParameter(Constants.BUNDLE_VERSION_ATTRIBUTE) != null)
+         throw new IllegalStateException("You cannot specify " + Constants.BUNDLE_VERSION_ATTRIBUTE + " on an Export-Package");
+   }
+   
+   /**
+    * Get the metadata.
+    * 
+    * @return the metadata.
+    */
+   public OSGiMetaData getMetaData()
+   {
+      return metadata;
+   }
+
+   @Override
+   public boolean resolves(Module module, Requirement requirement)
+   {
+      if (super.resolves(module, requirement) == false)
+         return false;
+      if (requirement instanceof OSGiPackageRequirement == false)
+         return true;
+      
+      OSGiPackageRequirement packageRequirement = (OSGiPackageRequirement) requirement;
+      OSGiMetaData metaData = getMetaData();
+      PackageAttribute ourParameters = exportPackage;
+      PackageAttribute otherParameters = packageRequirement.getRequirePackage();
+      // Check all the manadatory attributes are present
+      if (mandatoryAttributes != null)
+      {
+         if (otherParameters == null)
+            return false;
+         
+         for (String mand : mandatoryAttributes)
+         {
+            if (otherParameters.getParameter(mand) == null)
+               return false;
+         }
+      }
+      if (otherParameters != null)
+      {
+         Map<String, Parameter> params = otherParameters.getParameters();
+         if (params != null && params.isEmpty() == false)
+         {
+            for (String name : params.keySet())
+            {
+               // todo we shouldn't mix attributes and directives in the metadata
+               if (Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE.equals(name))
+               {
+                  String otherValue = otherParameters.getParameterValue(name, String.class);
+                  return otherValue.equals(metaData.getBundleSymbolicName());
+               }
+               else if (Constants.BUNDLE_VERSION_ATTRIBUTE.equals(name))
+               {
+                  String otherValue = otherParameters.getParameterValue(name, String.class);
+                  VersionRange range = (VersionRange) AbstractVersionRange.valueOf(otherValue);
+                  return range.isInRange(metaData.getBundleVersion());
+               }
+               if (Constants.RESOLUTION_DIRECTIVE.equals(name) == false
+                && Constants.PACKAGE_SPECIFICATION_VERSION.equals(name) == false
+                && Constants.VERSION_ATTRIBUTE.equals(name) == false)
+               {
+                  if (ourParameters == null)
+                     return false;
+                  String ourValue = ourParameters.getParameterValue(name, String.class);
+                  if (ourValue == null)
+                     return false;
+                  if (ourValue.equals(otherParameters.getParameterValue(name, String.class)) == false)
+                     return false;
+               }
+            }
+         }
+      }
+      return true;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (obj == this)
+         return true;
+      if (obj == null || obj instanceof OSGiPackageCapability == false)
+         return false;
+      if (super.equals(obj) ==false)
+         return false;
+      OSGiPackageCapability other = (OSGiPackageCapability) obj;
+      return getMetaData().equals(other.getMetaData());
+   }
+
+   @Override
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      ParameterizedAttribute parameters = metadata.getBundleParameters();
+      if (parameters != null)
+      {
+         Map<String, Parameter> params = parameters.getParameters();
+         if (params != null && params.isEmpty() == false)
+            buffer.append(" parameters=").append(params);
+      }
+   }
+}

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageRequirement.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageRequirement.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageRequirement.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,132 @@
+/*
+* 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.plugins.facade.classloading;
+
+import java.util.Map;
+
+import org.jboss.classloading.plugins.metadata.PackageRequirement;
+import org.jboss.classloading.spi.version.VersionRange;
+import org.jboss.osgi.plugins.metadata.AbstractVersionRange;
+import org.jboss.osgi.spi.metadata.PackageAttribute;
+import org.jboss.osgi.spi.metadata.Parameter;
+import org.osgi.framework.Constants;
+
+/**
+ * OSGiPackageRequirement.
+ *
+ * todo PackagePermission/IMPORT
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class OSGiPackageRequirement extends PackageRequirement
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 5109907232396093061L;
+
+   /** The attributes */
+   private PackageAttribute requirePackage;
+
+   /**
+    * Create a new OSGiPackageRequirement.
+    * 
+    * @param requirePackage the require package metadata
+    * @return the requirement
+    * @throws IllegalArgumentException for a null requirePackage
+    */
+   public static OSGiPackageRequirement create(PackageAttribute requirePackage)
+   {
+      if (requirePackage == null)
+         throw new IllegalArgumentException("Null require package");
+
+      String name = requirePackage.getAttribute();
+      
+      AbstractVersionRange range = null;
+      String version = requirePackage.getParameterValue(Constants.VERSION_ATTRIBUTE, String.class);
+      if (version != null)
+      {
+         range = (AbstractVersionRange) AbstractVersionRange.valueOf(version);
+         String old = requirePackage.getParameterValue(Constants.PACKAGE_SPECIFICATION_VERSION, String.class);
+         if (old != null && old.equals(version) == false)
+            throw new IllegalStateException(Constants.VERSION_ATTRIBUTE + " of " + version + " does not match " + Constants.PACKAGE_SPECIFICATION_VERSION + " of " + old);
+      }
+      else
+      {
+         version = requirePackage.getParameterValue(Constants.PACKAGE_SPECIFICATION_VERSION, String.class);
+         if (version != null)
+            range = (AbstractVersionRange) AbstractVersionRange.valueOf(version);
+      }
+
+      return new OSGiPackageRequirement(name, range, requirePackage);
+   }
+   
+   /**
+    * Create a new OSGiPackageRequirement.
+    * 
+    * @param name the name
+    * @param versionRange the version range - pass null for all versions
+    * @param requirePackage the require package metadata
+    * @throws IllegalArgumentException for a null name or requirePackage
+    */
+   public OSGiPackageRequirement(String name, VersionRange versionRange, PackageAttribute requirePackage)
+   {
+      super(name, versionRange);
+      if (requirePackage == null)
+         throw new IllegalArgumentException("Null requirePackage");
+      this.requirePackage = requirePackage;
+
+      String resolution = requirePackage.getParameterValue(Constants.RESOLUTION_DIRECTIVE, String.class);
+      if (Constants.RESOLUTION_OPTIONAL.equals(resolution))
+         setOptional(true);
+   }
+   
+   /**
+    * Get the requirePackage metadata.
+    * 
+    * @return the requirePackage.
+    */
+   public PackageAttribute getRequirePackage()
+   {
+      return requirePackage;
+   }
+   
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (obj == this)
+         return true;
+      if (obj == null || obj instanceof OSGiPackageRequirement == false)
+         return false;
+      if (super.equals(obj) ==false)
+         return false;
+      OSGiPackageRequirement other = (OSGiPackageRequirement) obj;
+      return getRequirePackage().equals(other.getRequirePackage());
+   }
+
+   @Override
+   protected void toString(StringBuffer buffer)
+   {
+      super.toString(buffer);
+      Map<String, Parameter> parameters = requirePackage.getParameters();
+      if (parameters != null && parameters.isEmpty() == false)
+         buffer.append(" parameters=").append(parameters);
+   }
+}

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java	2009-08-25 13:08:45 UTC (rev 92790)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -92,7 +92,6 @@
       }
    }
    
-   @Override
    public List<String> getSystemPackages()
    {
       return Collections.unmodifiableList(allPackages);

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java	2009-08-25 13:08:45 UTC (rev 92790)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -61,11 +61,16 @@
 import java.util.jar.Manifest;
 import java.util.jar.Attributes.Name;
 
+import org.jboss.classloading.spi.version.VersionComparatorRegistry;
 import org.jboss.deployers.vfs.spi.deployer.helpers.AbstractManifestMetaData;
+import org.jboss.osgi.plugins.metadata.AbstractVersionRange.OSGiVersionToOSGiVersionComparator;
+import org.jboss.osgi.plugins.metadata.AbstractVersionRange.OSGiVersionToStringComparator;
+import org.jboss.osgi.plugins.metadata.AbstractVersionRange.OSGiVersionToVersionComparator;
 import org.jboss.osgi.spi.metadata.ActivationPolicyMetaData;
 import org.jboss.osgi.spi.metadata.OSGiMetaData;
 import org.jboss.osgi.spi.metadata.PackageAttribute;
 import org.jboss.osgi.spi.metadata.ParameterizedAttribute;
+import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
 
 /**
@@ -77,8 +82,18 @@
 {
    private static final long serialVersionUID = 1L;
 
+   static
+   {
+      VersionComparatorRegistry registry = VersionComparatorRegistry.getInstance();
+      registry.registerVersionComparator(Version.class, Version.class, new OSGiVersionToOSGiVersionComparator());
+      registry.registerVersionComparator(Version.class, org.jboss.classloading.spi.version.Version.class, new OSGiVersionToVersionComparator());
+      registry.registerVersionComparator(Version.class, String.class, new OSGiVersionToStringComparator());
+   }
+
    protected transient Map<String, Object> cachedAttributes = new HashMap<String, Object>();
 
+   protected transient ParameterizedAttribute parameters;
+   
    public AbstractOSGiMetaData()
    {
    }
@@ -156,9 +171,17 @@
 
    public String getBundleSymbolicName()
    {
-      return get(BUNDLE_SYMBOLICNAME, STRING_VC);
+      ParameterizedAttribute parameters = parseSymbolicName();
+      if (parameters == null)
+         return null;
+      return parameters.getAttribute();
    }
 
+   public ParameterizedAttribute getBundleParameters()
+   {
+      return parseSymbolicName();
+   }
+   
    public URL getBundleUpdateLocation()
    {
       return get(BUNDLE_UPDATELOCATION, URL_VC);
@@ -194,6 +217,34 @@
       return get(REQUIRE_BUNDLE, QNAME_ATTRIB_LIST_VC);
    }
 
+   public boolean isSingleton()
+   {
+      parseSymbolicName();
+      if (parameters == null)
+         return false;
+      return "true".equals(parameters.getParameterValue(Constants.SINGLETON_DIRECTIVE, String.class));
+   }
+
+   public String getFragmentAttachment()
+   {
+      parseSymbolicName();
+      if (parameters == null)
+         return null;
+      return parameters.getParameterValue(Constants.FRAGMENT_ATTACHMENT_DIRECTIVE, String.class);
+   }
+
+   protected ParameterizedAttribute parseSymbolicName()
+   {
+      if (parameters == null)
+      {
+         List<ParameterizedAttribute> parsed = get(BUNDLE_SYMBOLICNAME, QNAME_ATTRIB_LIST_VC);
+         if (parsed == null || parsed.size() != 1)
+            return null;
+         parameters = parsed.get(0);
+      }
+      return parameters;
+   }
+
    protected <T> T get(String key, ValueCreator<T> creator)
    {
       return get(key, creator, null);

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractParameterizedAttribute.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractParameterizedAttribute.java	2009-08-25 13:08:45 UTC (rev 92790)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractParameterizedAttribute.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -54,6 +54,27 @@
       return parameters.get(name);
    }
 
+   /**
+    * Get a parameter
+    * 
+    * @param <T> the expected type
+    * @param name the name of the parameter
+    * @param type the expected type
+    * @return the parmaeter value
+    */
+   public <T> T getParameterValue(String name, Class<T> type)
+   {
+      Parameter parameter = getParameter(name);
+      if (parameter == null)
+         return null;
+      if (parameter.isCollection())
+         throw new IllegalArgumentException("Duplicate " + name + " parameter.");
+      Object value = parameter.getValue();
+      if (value == null)
+         return null;
+      return type.cast(value);
+   }
+
    protected void toString(JBossStringBuilder buffer)
    {
       super.toString(buffer);

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java	2009-08-25 13:08:45 UTC (rev 92790)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractVersionRange.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -25,7 +25,6 @@
 import java.util.StringTokenizer;
 
 import org.jboss.classloading.spi.version.VersionComparator;
-import org.jboss.classloading.spi.version.VersionComparatorRegistry;
 import org.jboss.osgi.spi.metadata.VersionRange;
 import org.osgi.framework.Version;
 
@@ -46,14 +45,6 @@
 {
    /** The serialVersionUID */
    private static final long serialVersionUID = -178825219621278882L;
-
-   static
-   {
-      VersionComparatorRegistry registry = VersionComparatorRegistry.getInstance();
-      registry.registerVersionComparator(Version.class, Version.class, new OSGiVersionToOSGiVersionComparator());
-      registry.registerVersionComparator(Version.class, org.jboss.classloading.spi.version.Version.class, new OSGiVersionToVersionComparator());
-      registry.registerVersionComparator(Version.class, String.class, new OSGiVersionToStringComparator());
-   }
    
    /**
     * Get the version range from a string
@@ -166,7 +157,7 @@
    /**
     * OSGiVersionToOSGiVersionComparator.
     */
-   private static class OSGiVersionToOSGiVersionComparator implements VersionComparator<Version, Version>
+   public static class OSGiVersionToOSGiVersionComparator implements VersionComparator<Version, Version>
    {
       public int compare(Version t, Version u)
       {
@@ -177,7 +168,7 @@
    /**
     * OSGiVersionToVersionComparator.
     */
-   private static class OSGiVersionToVersionComparator implements VersionComparator<Version, org.jboss.classloading.spi.version.Version>
+   public static class OSGiVersionToVersionComparator implements VersionComparator<Version, org.jboss.classloading.spi.version.Version>
    {
       public int compare(Version t, org.jboss.classloading.spi.version.Version u)
       {
@@ -202,7 +193,7 @@
    /**
     * VersionToStringComparator.
     */
-   private static class OSGiVersionToStringComparator implements VersionComparator<Version, String>
+   public static class OSGiVersionToStringComparator implements VersionComparator<Version, String>
    {
       public int compare(Version t, String u)
       {

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/spi/metadata/OSGiMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/spi/metadata/OSGiMetaData.java	2009-08-25 13:08:45 UTC (rev 92790)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/spi/metadata/OSGiMetaData.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -128,6 +128,13 @@
    String getBundleSymbolicName();
 
    /**
+    * Get the bundle parameters
+    * 
+    * @return the bundle parameters
+    */
+   ParameterizedAttribute getBundleParameters();
+
+   /**
     * Get the update url.
     *
     * @return URL of an update bundle location
@@ -175,4 +182,19 @@
     * @return required exports from anoter bundle
     */
    List<ParameterizedAttribute> getRequireBundles();
+   
+   /**
+    * Whether the bundle is a singleton
+    * 
+    * @return true when it is a singleton
+    */
+   boolean isSingleton();
+   
+   /**
+    * Get the fragment attrachment
+    * 
+    * todo fragments
+    * @return the fragment attachment
+    */
+   String getFragmentAttachment();
 }

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/spi/metadata/ParameterizedAttribute.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/spi/metadata/ParameterizedAttribute.java	2009-08-25 13:08:45 UTC (rev 92790)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/spi/metadata/ParameterizedAttribute.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -27,6 +27,7 @@
  * Attribute with parameters.
  *
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
  */
 public interface ParameterizedAttribute extends AttributeAware
 {
@@ -45,4 +46,14 @@
     * @return parameter value
     */
    Parameter getParameter(String name);
+
+   /**
+    * Get a parameter value
+    * 
+    * @param <T> the expected type
+    * @param name the name of the parameter
+    * @param type the expected type
+    * @return the parmaeter value
+    */
+   <T> T getParameterValue(String name, Class<T> type);
 }

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestSuite.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestSuite.java	2009-08-25 13:08:45 UTC (rev 92790)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestSuite.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -27,6 +27,7 @@
 
 import org.jboss.test.bundle.metadata.MetaDataTestSuite;
 import org.jboss.test.osgi.bundle.BundleTestSuite;
+import org.jboss.test.osgi.classloader.ClassLoaderTestSuite;
 import org.jboss.test.osgi.filter.FilterTestSuite;
 import org.jboss.test.osgi.service.ServiceTestSuite;
 import org.jboss.test.osgi.smoke.SmokeTestSuite;
@@ -53,6 +54,7 @@
       suite.addTest(FilterTestSuite.suite());
       suite.addTest(BundleTestSuite.suite());
       suite.addTest(ServiceTestSuite.suite());
+      suite.addTest(ClassLoaderTestSuite.suite());
 
       return suite;
    }

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleUnitTestCase.java	2009-08-25 13:08:45 UTC (rev 92790)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/bundle/test/BundleUnitTestCase.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -30,6 +30,7 @@
 import org.jboss.test.osgi.OSGiTestCase;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
 
 /**
@@ -158,6 +159,46 @@
       // TODO testUninstall
    }
    
+   public void testSingleton() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundle1", "/bundles/singleton/singleton1");
+      try
+      {
+         Bundle bundle2 = assembleBundle("bundle2", "/bundles/singleton/singleton2");
+         uninstall(bundle2);
+         fail("Should not be here!");
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(BundleException.class, t);
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testNotSingleton() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundle1", "/bundles/singleton/singleton1");
+      try
+      {
+         Bundle bundle2 = assembleBundle("not-singleton", "/bundles/singleton/not-singleton");
+         try
+         {
+            assertEquals(bundle1.getSymbolicName(), bundle2.getSymbolicName());
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
    @SuppressWarnings("unchecked")
    public void testGetHeaders() throws Exception
    {

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/ClassLoaderTestSuite.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/ClassLoaderTestSuite.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/ClassLoaderTestSuite.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,53 @@
+/*
+* 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.classloader;
+
+import org.jboss.test.osgi.classloader.test.ExportImportPackageUnitTestCase;
+import org.jboss.test.osgi.classloader.test.RequireBundleUnitTestCase;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * BundleTestSuite.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassLoaderTestSuite extends TestSuite
+{
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("ClassLoader Tests");
+
+      suite.addTest(RequireBundleUnitTestCase.suite());
+      suite.addTest(ExportImportPackageUnitTestCase.suite());
+
+      return suite;
+   }
+}

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/support/a/A.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/support/a/A.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/support/a/A.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,32 @@
+/*
+* 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.classloader.support.a;
+
+/**
+ * A.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class A
+{
+}

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/support/b/B.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/support/b/B.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/support/b/B.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,32 @@
+/*
+* 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.classloader.support.b;
+
+/**
+ * B.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class B
+{
+}

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/test/ExportImportPackageUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/test/ExportImportPackageUnitTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/test/ExportImportPackageUnitTestCase.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,428 @@
+/*
+* 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.classloader.test;
+
+import junit.framework.Test;
+
+import org.jboss.deployers.client.spi.IncompleteDeploymentException;
+import org.jboss.test.osgi.OSGiTestCase;
+import org.jboss.test.osgi.classloader.support.a.A;
+import org.jboss.test.osgi.classloader.support.b.B;
+import org.osgi.framework.Bundle;
+
+/**
+ * ExportImportUnitTestCase.
+ *
+ * TODO test security
+ * TODO test mandatory attributes
+ * TODO test include/exclude
+ * TODO test uses
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ExportImportPackageUnitTestCase extends OSGiTestCase
+{
+   public ExportImportPackageUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(ExportImportPackageUnitTestCase.class);
+   }
+   
+   public void testSimpleImportPackage() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("simpleimportpackageA", "/bundles/classloader/simpleimportpackageA", B.class);
+         try
+         {
+            bundle2.start();
+            assertLoadClass(bundle2, A.class, bundle1);
+            assertLoadClass(bundle2, B.class, bundle2);
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testSimpleImportPackageFails() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("simpleimportpackagefails", "/bundles/classloader/simpleimportpackagefails", B.class);
+         try
+         {
+            bundle2.start();
+            fail("Should not be here!");
+         }
+         catch (Throwable t)
+         {
+            checkDeepThrowable(IncompleteDeploymentException.class, t);
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testVersionImportPackage() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("versionimportpackageA", "/bundles/classloader/versionimportpackageA", B.class);
+         try
+         {
+            bundle2.start();
+            assertLoadClass(bundle2, A.class, bundle1);
+            assertLoadClass(bundle2, B.class, bundle2);
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testVersionImportPackageFails() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("versionimportpackagefails", "/bundles/classloader/versionimportpackagefails", B.class);
+         try
+         {
+            bundle2.start();
+            fail("Should not be here!");
+         }
+         catch (Throwable t)
+         {
+            checkDeepThrowable(IncompleteDeploymentException.class, t);
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testOptionalImportPackage() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("optionalimportpackageA", "/bundles/classloader/optionalimportpackageA", B.class);
+         try
+         {
+            bundle2.start();
+            assertLoadClass(bundle2, A.class, bundle1);
+            assertLoadClass(bundle2, B.class, bundle2);
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testOptionalImportPackageFails() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("optionalimportpackagefails", "/bundles/classloader/optionalimportpackagefails", B.class);
+         try
+         {
+            bundle2.start();
+            assertLoadClassFail(bundle2, A.class);
+            assertLoadClass(bundle2, B.class);
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testBundleNameImportPackage() throws Exception
+   {
+      Bundle bundle0 = assembleBundle("notbundleA", "/bundles/classloader/notbundleA", A.class);
+      try
+      {
+         bundle0.start();
+         assertLoadClass(bundle0, A.class);
+         Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+         try
+         {
+            bundle1.start();
+            assertLoadClass(bundle1, A.class);
+            Bundle bundle2 = assembleBundle("bundlenameimportpackageA", "/bundles/classloader/bundlenameimportpackageA", B.class);
+            try
+            {
+               bundle2.start();
+               // todo FIXME assertLoadClass(bundle2, A.class, bundle1);
+               assertLoadClass(bundle2, B.class, bundle2);
+            }
+            finally
+            {
+               uninstall(bundle2);
+            }
+         }
+         finally
+         {
+            uninstall(bundle1);
+         }
+      }
+      finally
+      {
+         uninstall(bundle0);
+      }
+   }
+   
+   public void testBundleNameImportPackageFails() throws Exception
+   {
+      Bundle bundle0 = assembleBundle("notbundleA", "/bundles/classloader/notbundleA", A.class);
+      try
+      {
+         bundle0.start();
+         assertLoadClass(bundle0, A.class);
+         Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+         try
+         {
+            bundle1.start();
+            assertLoadClass(bundle1, A.class);
+            Bundle bundle2 = assembleBundle("bundlenameimportpackagefails", "/bundles/classloader/bundlenameimportpackagefails", B.class);
+            try
+            {
+               bundle2.start();
+               fail("Should not be here!");
+            }
+            catch (Throwable t)
+            {
+               checkDeepThrowable(IncompleteDeploymentException.class, t);
+            }
+            finally
+            {
+               uninstall(bundle2);
+            }
+         }
+         finally
+         {
+            uninstall(bundle1);
+         }
+      }
+      finally
+      {
+         uninstall(bundle0);
+      }
+   }
+   
+   public void testBundleVersionImportPackage() throws Exception
+   {
+      Bundle bundle0 = assembleBundle("bundleA2", "/bundles/classloader/bundleA2", A.class);
+      try
+      {
+         bundle0.start();
+         assertLoadClass(bundle0, A.class);
+         Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+         try
+         {
+            bundle1.start();
+            assertLoadClass(bundle1, A.class);
+            Bundle bundle2 = assembleBundle("bundleversionimportpackageA", "/bundles/classloader/bundleversionimportpackageA", B.class);
+            try
+            {
+               bundle2.start();
+               assertLoadClass(bundle2, A.class, bundle1);
+               assertLoadClass(bundle2, B.class, bundle2);
+            }
+            finally
+            {
+               uninstall(bundle2);
+            }
+         }
+         finally
+         {
+            uninstall(bundle1);
+         }
+      }
+      finally
+      {
+         uninstall(bundle0);
+      }
+   }
+   
+   public void testBundleVersionImportPackageFails() throws Exception
+   {
+      Bundle bundle0 = assembleBundle("bundleA2", "/bundles/classloader/bundleA2", A.class);
+      try
+      {
+         bundle0.start();
+         assertLoadClass(bundle0, A.class);
+         Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+         try
+         {
+            bundle1.start();
+            assertLoadClass(bundle1, A.class);
+            Bundle bundle2 = assembleBundle("bundleversionimportpackagefails", "/bundles/classloader/bundleversionimportpackagefails", B.class);
+            try
+            {
+               bundle2.start();
+               fail("Should not be here!");
+            }
+            catch (Throwable t)
+            {
+               checkDeepThrowable(IncompleteDeploymentException.class, t);
+            }
+            finally
+            {
+               uninstall(bundle2);
+            }
+         }
+         finally
+         {
+            uninstall(bundle1);
+         }
+      }
+      finally
+      {
+         uninstall(bundle0);
+      }
+   }
+   
+   public void testAttributeImportPackage() throws Exception
+   {
+      Bundle bundle0 = assembleBundle("bundleA2", "/bundles/classloader/bundleA2", A.class);
+      try
+      {
+         bundle0.start();
+         assertLoadClass(bundle0, A.class);
+         Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+         try
+         {
+            bundle1.start();
+            assertLoadClass(bundle1, A.class);
+            Bundle bundle2 = assembleBundle("attributeimportpackageA", "/bundles/classloader/attributeimportpackageA", B.class);
+            try
+            {
+               bundle2.start();
+               assertLoadClass(bundle2, A.class, bundle1);
+               assertLoadClass(bundle2, B.class, bundle2);
+            }
+            finally
+            {
+               uninstall(bundle2);
+            }
+         }
+         finally
+         {
+            uninstall(bundle1);
+         }
+      }
+      finally
+      {
+         uninstall(bundle0);
+      }
+   }
+   
+   public void testAttributeImportPackageFails() throws Exception
+   {
+      Bundle bundle0 = assembleBundle("bundleA2", "/bundles/classloader/bundleA2", A.class);
+      try
+      {
+         bundle0.start();
+         assertLoadClass(bundle0, A.class);
+         Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+         try
+         {
+            bundle1.start();
+            assertLoadClass(bundle1, A.class);
+            Bundle bundle2 = assembleBundle("attributeimportpackagefails", "/bundles/classloader/attributeimportpackagefails", B.class);
+            try
+            {
+               bundle2.start();
+               fail("Should not be here!");
+            }
+            catch (Throwable t)
+            {
+               checkDeepThrowable(IncompleteDeploymentException.class, t);
+            }
+            finally
+            {
+               uninstall(bundle2);
+            }
+         }
+         finally
+         {
+            uninstall(bundle1);
+         }
+      }
+      finally
+      {
+         uninstall(bundle0);
+      }
+   }
+}

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/test/RequireBundleUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/test/RequireBundleUnitTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/classloader/test/RequireBundleUnitTestCase.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,329 @@
+/*
+* 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.classloader.test;
+
+import junit.framework.Test;
+
+import org.jboss.deployers.client.spi.IncompleteDeploymentException;
+import org.jboss.test.osgi.OSGiTestCase;
+import org.jboss.test.osgi.classloader.support.a.A;
+import org.jboss.test.osgi.classloader.support.b.B;
+import org.osgi.framework.Bundle;
+
+/**
+ * RequireBundleUnitTestCase.
+ *
+ * TODO test security
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class RequireBundleUnitTestCase extends OSGiTestCase
+{
+   public RequireBundleUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(RequireBundleUnitTestCase.class);
+   }
+   
+   public void testSimpleRequireBundle() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("simplerequirebundleA", "/bundles/classloader/simplerequirebundleA", B.class);
+         try
+         {
+            bundle2.start();
+            assertLoadClass(bundle2, A.class, bundle1);
+            assertLoadClass(bundle2, B.class, bundle2);
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testSimpleRequireBundleFails() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("simplerequirebundlefails", "/bundles/classloader/simplerequirebundlefails", B.class);
+         try
+         {
+            bundle2.start();
+            fail("Should not be here!");
+         }
+         catch (Throwable t)
+         {
+            checkDeepThrowable(IncompleteDeploymentException.class, t);
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testVersionRequireBundle() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("versionrequirebundleA", "/bundles/classloader/versionrequirebundleA", B.class);
+         try
+         {
+            bundle2.start();
+            assertLoadClass(bundle2, A.class, bundle1);
+            assertLoadClass(bundle2, B.class, bundle2);
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testVersionRequireBundleFails() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("versionrequirebundlefails", "/bundles/classloader/versionrequirebundlefails", B.class);
+         try
+         {
+            bundle2.start();
+            fail("Should not be here!");
+         }
+         catch (Throwable t)
+         {
+            checkDeepThrowable(IncompleteDeploymentException.class, t);
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testOptionalRequireBundle() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("optionalrequirebundleA", "/bundles/classloader/optionalrequirebundleA", B.class);
+         try
+         {
+            bundle2.start();
+            assertLoadClass(bundle2, A.class, bundle1);
+            assertLoadClass(bundle2, B.class, bundle2);
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testOptionalRequireBundleFails() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("optionalrequirebundlefails", "/bundles/classloader/optionalrequirebundlefails", B.class);
+         try
+         {
+            bundle2.start();
+            assertLoadClassFail(bundle2, A.class);
+            assertLoadClass(bundle2, B.class);
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testReExportRequireBundle() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("reexportrequirebundleA", "/bundles/classloader/reexportrequirebundleA", B.class);
+         try
+         {
+            bundle2.start();
+            assertLoadClass(bundle2, A.class, bundle1);
+            assertLoadClass(bundle2, B.class, bundle2);
+            Bundle bundle3 = assembleBundle("reexportrequirebundleB", "/bundles/classloader/reexportrequirebundleB");
+            try
+            {
+               assertLoadClass(bundle3, A.class, bundle1);
+               assertLoadClass(bundle3, B.class, bundle2);
+            }
+            finally
+            {
+               uninstall(bundle3);
+            }
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testNoReExportRequireBundle() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("noreexportrequirebundleA", "/bundles/classloader/noreexportrequirebundleA", B.class);
+         try
+         {
+            bundle2.start();
+            assertLoadClass(bundle2, A.class, bundle1);
+            assertLoadClass(bundle2, B.class, bundle2);
+            Bundle bundle3 = assembleBundle("reexportrequirebundleB", "/bundles/classloader/reexportrequirebundleB");
+            try
+            {
+               assertLoadClassFail(bundle3, A.class);
+               assertLoadClass(bundle3, B.class, bundle2);
+            }
+            finally
+            {
+               uninstall(bundle3);
+            }
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testAttributeRequireBundle() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("attributerequirebundleA", "/bundles/classloader/attributerequirebundleA", B.class);
+         try
+         {
+            bundle2.start();
+            assertLoadClass(bundle2, A.class, bundle1);
+            assertLoadClass(bundle2, B.class, bundle2);
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+   
+   public void testAttributeRequireBundleFails() throws Exception
+   {
+      Bundle bundle1 = assembleBundle("bundleA", "/bundles/classloader/bundleA", A.class);
+      try
+      {
+         bundle1.start();
+         assertLoadClass(bundle1, A.class);
+         Bundle bundle2 = assembleBundle("attributerequirebundlefails", "/bundles/classloader/attributerequirebundlefails", B.class);
+         try
+         {
+            bundle2.start();
+            fail("Should not be here!");
+         }
+         catch (Throwable t)
+         {
+            checkDeepThrowable(IncompleteDeploymentException.class, t);
+         }
+         finally
+         {
+            uninstall(bundle2);
+         }
+      }
+      finally
+      {
+         uninstall(bundle1);
+      }
+   }
+}

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java	2009-08-25 13:08:45 UTC (rev 92790)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/integration/simple/SimpleLogServiceTestCase.java	2009-08-25 13:15:04 UTC (rev 92791)
@@ -23,7 +23,7 @@
 
 //$Id$
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -31,7 +31,6 @@
 import org.jboss.osgi.spi.testing.OSGiTest;
 import org.jboss.osgi.spi.util.ServiceLoader;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml	2009-08-25 13:08:45 UTC (rev 92790)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bootstrap/bootstrap.xml	2009-08-25 13:15:04 UTC (rev 92791)
@@ -87,9 +87,7 @@
   <bean name="OSGiBundleStateDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleStateDeployer">
     <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
   </bean>
-  <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.plugins.facade.classloading.OSGiBundleClassLoadingDeployer" >
-    <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
-  </bean>
+  <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.plugins.facade.classloading.OSGiBundleClassLoadingDeployer"/>
   <bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleActivatorDeployer" />
 
   <!--

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributeimportpackageA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributeimportpackageA/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributeimportpackageA/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Import-Package: org.jboss.test.osgi.classloader.support.a;test=x

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributeimportpackagefails/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributeimportpackagefails/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributeimportpackagefails/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Import-Package: org.jboss.test.osgi.classloader.support.a;test=y

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributerequirebundleA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributerequirebundleA/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributerequirebundleA/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Require-Bundle: org.jboss.test.osgi.classloader.bundleA;test=x

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributerequirebundlefails/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributerequirebundlefails/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/attributerequirebundlefails/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Require-Bundle: org.jboss.test.osgi.classloader.bundleA;doesnotexist=true;test=y

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleA/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleA/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleA
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleA;test=x
+Bundle-Version: 1.0.0
+Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0;test=x

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleA2/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleA2/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleA2/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleA
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleA
+Bundle-Version: 2.0.0
+Export-Package: org.jboss.test.osgi.classloader.support.a

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleattributeimportpackageA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleattributeimportpackageA/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleattributeimportpackageA/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Import-Package: org.jboss.test.osgi.classloader.support.a;bundle-version="[0.0.0,1.0.0]"

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundlenameimportpackageA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundlenameimportpackageA/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundlenameimportpackageA/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Import-Package: org.jboss.test.osgi.classloader.support.a;bundle-symbolic-name=org.jboss.test.osgi.classloader.bundleA

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundlenameimportpackagefails/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundlenameimportpackagefails/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundlenameimportpackagefails/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Import-Package: org.jboss.test.osgi.classloader.support.a;bundle-symbolic-name=doesnotexist

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleversionimportpackageA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleversionimportpackageA/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleversionimportpackageA/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Import-Package: org.jboss.test.osgi.classloader.support.a;bundle-version="[0.0.0,1.0.0]"

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleversionimportpackagefails/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleversionimportpackagefails/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/bundleversionimportpackagefails/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Import-Package: org.jboss.test.osgi.classloader.support.a;bundle-version="[0.0.0,1.0.0)"

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/noreexportrequirebundleA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/noreexportrequirebundleA/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/noreexportrequirebundleA/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Require-Bundle: org.jboss.test.osgi.classloader.bundleA
+Export-Package: org.jboss.test.osgi.classloader.support.b

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/notbundleA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/notbundleA/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/notbundleA/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: NotBundleA
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.notbundleA
+Bundle-Version: 1.0.0
+Export-Package: org.jboss.test.osgi.classloader.support.a

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalimportpackageA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalimportpackageA/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalimportpackageA/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Import-Package: org.jboss.test.osgi.classloader.support.a;resolution:=optional

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalimportpackagefails/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalimportpackagefails/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalimportpackagefails/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Import-Package: doesnotexist;resolution:=optional

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalrequirebundleA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalrequirebundleA/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalrequirebundleA/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Require-Bundle: org.jboss.test.osgi.classloader.bundleA;resolution:=optional

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalrequirebundlefails/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalrequirebundlefails/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/optionalrequirebundlefails/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Require-Bundle: doesnotexist;resolution:=optional

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/reexportrequirebundleA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/reexportrequirebundleA/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/reexportrequirebundleA/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Require-Bundle: org.jboss.test.osgi.classloader.bundleA;visibility:=reexport
+Export-Package: org.jboss.test.osgi.classloader.support.b

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/reexportrequirebundleB/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/reexportrequirebundleB/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/reexportrequirebundleB/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleC
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleC
+Require-Bundle: org.jboss.test.osgi.classloader.bundleB

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simpleimportpackageA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simpleimportpackageA/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simpleimportpackageA/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Import-Package: org.jboss.test.osgi.classloader.support.a

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simpleimportpackagefails/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simpleimportpackagefails/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simpleimportpackagefails/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Import-Package: doesnotexist

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simplerequirebundleA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simplerequirebundleA/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simplerequirebundleA/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Require-Bundle: org.jboss.test.osgi.classloader.bundleA

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simplerequirebundlefails/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simplerequirebundlefails/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/simplerequirebundlefails/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Require-Bundle: doesnotexist

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionimportpackageA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionimportpackageA/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionimportpackageA/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Import-Package: org.jboss.test.osgi.classloader.support.a;version="[0.0.0,1.0.0]"

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionimportpackagefails/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionimportpackagefails/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionimportpackagefails/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Import-Package: org.jboss.test.osgi.classloader.support.a;version="[0.0.0,1.0.0)"

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionrequirebundleA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionrequirebundleA/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionrequirebundleA/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Require-Bundle: org.jboss.test.osgi.classloader.bundleA;bundle-version="[0.0.0,1.0.0]"

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionrequirebundlefails/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionrequirebundlefails/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/classloader/versionrequirebundlefails/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: BundleB
+Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
+Require-Bundle: org.jboss.test.osgi.classloader.bundleA;bundle-version="[0.0.0,1.0.0)"

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/not-singleton/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/not-singleton/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/not-singleton/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: NotSingleton
+Bundle-SymbolicName: org.jboss.test.osgi.singleton
+Bundle-Version: 2.0.0

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/singleton1/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/singleton1/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/singleton1/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: Singleton1
+Bundle-SymbolicName: org.jboss.test.osgi.singleton;singleton=true

Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/singleton2/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/singleton2/META-INF/MANIFEST.MF	                        (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/bundles/singleton/singleton2/META-INF/MANIFEST.MF	2009-08-25 13:15:04 UTC (rev 92791)
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Implementation-Title: JBoss OSGi tests
+Implementation-Version: test
+Implementation-Vendor: jboss.org
+Bundle-Name: Singleton2
+Bundle-SymbolicName: org.jboss.test.osgi.singleton;singleton=true

Deleted: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/log4j.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/log4j.xml	2009-08-25 13:08:45 UTC (rev 92790)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/resources/log4j.xml	2009-08-25 13:15:04 UTC (rev 92791)
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
-
-  <!-- ================================= -->
-  <!-- Preserve messages in a local file -->
-  <!-- ================================= -->
-
-  <appender name="FILE" class="org.apache.log4j.FileAppender">
-    <param name="File" value="${log4j.output.dir}/test.log"/>
-    <param name="Append" value="false"/>
-    <layout class="org.apache.log4j.PatternLayout">
-      <!-- The default pattern: Date Priority [Category] Message\n -->
-      <param name="ConversionPattern" value="%d %-5p [%c:%L] %m%n"/>
-    </layout>
-  </appender>
-  
-  <!-- ============================== -->
-  <!-- Append messages to the console -->
-  <!-- ============================== -->
-
-  <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
-    <param name="Target" value="System.out" />
-    <param name="Threshold" value="INFO" />
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n" />
-    </layout>
-  </appender>
-
-  <!-- ================ -->
-  <!-- Limit categories -->
-  <!-- ================ -->
-
-  <!-- Show jboss deployer traces 
-  <category name="org.jboss.deployers">
-    <priority value="TRACE" />
-  </category>
-  -->
-
-  <!-- ======================= -->
-  <!-- Setup the Root category -->
-  <!-- ======================= -->
-
-  <root>
-    <!--appender-ref ref="CONSOLE"/-->
-    <appender-ref ref="FILE"/>
-  </root>
-
-</log4j:configuration>



More information about the jboss-osgi-commits mailing list