[jboss-cvs] JBossAS SVN: r97998 - in projects/jboss-osgi/projects: runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading and 35 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Dec 18 12:45:03 EST 2009


Author: thomas.diesler at jboss.com
Date: 2009-12-18 12:45:01 -0500 (Fri, 18 Dec 2009)
New Revision: 97998

Modified:
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoadingDeployer.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiManifestParsingDeployer.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/OSGiMetaData.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractOSGiMetaData.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/metadata/HeaderValuesTestCase.java
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/attributerequirebundleA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/attributerequirebundlefails/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/bundleA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/bundleclasspath/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/noreexportrequirebundleA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/optionalrequirebundleA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/optionalrequirebundlefails/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/reexportrequirebundleA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/reexportrequirebundleB/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/simplerequirebundleA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/simplerequirebundlefails/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/versionrequirebundleA/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/versionrequirebundlefails/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/entries/entries-simple/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/fail-on-start/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/simple-service/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle1/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle2/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle3/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle4/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/simple/simple-bundle1/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/simple/simple-bundle2/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/singleton/not-singleton/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/singleton/singleton1/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/singleton/singleton2/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/smoke/smoke-assembled/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/smoke/smoke-osgi-manifest/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/META-INF/MANIFEST.MF
   projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java
Log:
Initial support for R3 bundles

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java	2009-12-18 17:45:01 UTC (rev 97998)
@@ -50,7 +50,6 @@
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.BundleListener;
-import org.osgi.framework.Constants;
 import org.osgi.framework.Filter;
 import org.osgi.framework.FrameworkListener;
 import org.osgi.framework.FrameworkUtil;
@@ -103,14 +102,22 @@
    {
       String symbolicName = getOSGiMetaData().getBundleSymbolicName();
       if (symbolicName == null)
-         throw new IllegalStateException("Cannot obtain " + Constants.BUNDLE_SYMBOLICNAME);
+         symbolicName = "anonymous-bundle" + getBundleId();
+      
       return symbolicName;
    }
 
    public Version getVersion()
    {
-      Version version = getOSGiMetaData().getBundleVersion();
-      return version;
+      String versionstr = getOSGiMetaData().getBundleVersion();
+      try
+      {
+         return Version.parseVersion(versionstr);
+      }
+      catch (NumberFormatException ex)
+      {
+         return Version.emptyVersion;
+      }
    }
 
    public int getState()

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java	2009-12-18 17:45:01 UTC (rev 97998)
@@ -25,6 +25,8 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.security.AccessController;
@@ -53,6 +55,9 @@
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.dependency.spi.tracker.ContextTracker;
 import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.IncompleteDeploymentException;
+import org.jboss.deployers.client.spi.IncompleteDeployments;
+import org.jboss.deployers.client.spi.MissingDependency;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.attachments.MutableAttachments;
 import org.jboss.deployers.spi.deployer.DeploymentStage;
@@ -720,17 +725,76 @@
             throw e;
          }
       }
+      catch (IncompleteDeploymentException ex)
+      {
+         String errorMessage = getIncompleteDeploymentInfo(dep, ex);
+         throw new BundleException(errorMessage);
+      }
       catch (Exception ex)
       {
-         Throwable cause = ex;
-         if (ex instanceof DeploymentException)
+         throw new BundleException("Error installing bundle from: " + dep, ex);
+      }
+   }
+
+   private String getIncompleteDeploymentInfo(Deployment dep, IncompleteDeploymentException ex)
+   {
+      IncompleteDeployments deployments = ex.getIncompleteDeployments();
+      
+      StringWriter stringWriter = new StringWriter();
+      PrintWriter printWriter = new PrintWriter(stringWriter);
+      printWriter.println("Error installing bundle from: " + dep);
+      
+      // Contexts in error 
+      Collection<Throwable> contextsError = deployments.getContextsInError().values();
+      if (contextsError.size() > 0)
+      {
+         printWriter.println("\nContext Errors:");
+         for (Throwable th : contextsError)
          {
-            cause = ex.getCause();
-            if (cause instanceof BundleException)
-               throw (BundleException)cause;
+            printWriter.println("\n");
+            th.printStackTrace(printWriter);
          }
-         throw new BundleException("Error installing bundle from: " + dep, (cause != null ? cause : ex));
       }
+
+      // Deployments in error 
+      Collection<Throwable> deploymentsInError = deployments.getDeploymentsInError().values();
+      if (deploymentsInError.size() > 0)
+      {
+         printWriter.println("\nDeployment Errors:");
+         for (Throwable th : deploymentsInError)
+         {
+            printWriter.println("\n");
+            th.printStackTrace(printWriter);
+         }
+      }
+
+      // Missing Dependencies 
+      Collection<Set<MissingDependency>> missingDependencies = deployments.getContextsMissingDependencies().values();
+      if (missingDependencies.size() > 0)
+      {
+         printWriter.println("\nMissing Dependencies:");
+         for (Set<MissingDependency> missDeps : missingDependencies)
+         {
+            for (MissingDependency missDep : missDeps)
+            {
+               printWriter.println("\n  " + missDep);
+            }
+         }
+      }
+
+      // Missing Deployers 
+      Collection<String> missingDeployers = deployments.getDeploymentsMissingDeployer();
+      if (missingDeployers.size() > 0)
+      {
+         printWriter.println("\nMissing Deployers:");
+         for (String missDep : missingDeployers)
+         {
+            printWriter.println("\n  " + missDep);
+         }
+      }
+
+      String errorMessage = stringWriter.toString();
+      return errorMessage;
    }
 
    /**
@@ -974,14 +1038,11 @@
       if (metaData == null)
          return;
 
-      String symbolicName = metaData.getBundleSymbolicName();
-      if (symbolicName == null)
-         throw new IllegalStateException("No bundle symbolic name " + bundleState);
-
       int manifestVersion = metaData.getBundleManifestVersion();
       if (manifestVersion > 2)
          throw new IllegalStateException("Unsupported manifest version " + manifestVersion + " for " + bundleState);
 
+      String symbolicName = bundleState.getSymbolicName();
       for (AbstractBundleState bundle : getBundles())
       {
          OSGiMetaData other = bundle.getOSGiMetaData();

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java	2009-12-18 17:45:01 UTC (rev 97998)
@@ -26,6 +26,7 @@
 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.framework.bundle.OSGiBundleState;
 import org.jboss.osgi.framework.metadata.OSGiMetaData;
 import org.jboss.osgi.framework.metadata.Parameter;
 import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
@@ -45,25 +46,25 @@
    /** The serialVersionUID */
    private static final long serialVersionUID = 2366716668262831380L;
 
-   /** The metadata */
-   private OSGiMetaData metadata;
+   /** The bundle state */
+   private OSGiBundleState bundleState;
 
    /**
     * Create a new OSGiBundleCapability
     * 
-    * @param metadata the osgi metadata
+    * @param bundleState the bundleState
     * @return the capability
     * @throws IllegalArgumentException for a null metadata
     */
-   public static OSGiBundleCapability create(OSGiMetaData metadata)
+   public static OSGiBundleCapability create(OSGiBundleState bundleState)
    {
-      if (metadata == null)
-         throw new IllegalArgumentException("Null metadata");
+      if (bundleState == null)
+         throw new IllegalArgumentException("Null bundleState");
 
-      String name = metadata.getBundleSymbolicName();
-      Version version = metadata.getBundleVersion();
+      String symbolicName = bundleState.getSymbolicName();
+      Version version = bundleState.getVersion();
 
-      return new OSGiBundleCapability(name, version, metadata);
+      return new OSGiBundleCapability(symbolicName, version, bundleState);
    }
    
    /**
@@ -74,12 +75,12 @@
     * @param metadata the metadata
     * @throws IllegalArgumentException for a null name or requireBundle
     */
-   public OSGiBundleCapability(String name, Version version, OSGiMetaData metadata)
+   public OSGiBundleCapability(String name, Version version, OSGiBundleState bundleState)
    {
       super(name, version);
-      if (metadata == null)
-         throw new IllegalArgumentException("Null metadata");
-      this.metadata = metadata;
+      if (bundleState == null)
+         throw new IllegalArgumentException("Null bundleState");
+      this.bundleState = bundleState;
    }
    
    /**
@@ -89,7 +90,7 @@
     */
    public OSGiMetaData getMetaData()
    {
-      return metadata;
+      return bundleState.getOSGiMetaData();
    }
 
    @Override
@@ -146,7 +147,7 @@
    protected void toString(StringBuffer buffer)
    {
       super.toString(buffer);
-      ParameterizedAttribute parameters = metadata.getBundleParameters();
+      ParameterizedAttribute parameters = getMetaData().getBundleParameters();
       if (parameters != null)
       {
          Map<String, Parameter> params = parameters.getAttributes();

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoadingDeployer.java	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoadingDeployer.java	2009-12-18 17:45:01 UTC (rev 97998)
@@ -90,14 +90,14 @@
       OSGiBundleManager bundleManager = bundleState.getBundleManager();
       
       ClassLoadingMetaData classLoadingMetaData = new ClassLoadingMetaData();
-      classLoadingMetaData.setName(osgiMetaData.getBundleSymbolicName());
-      classLoadingMetaData.setVersion(osgiMetaData.getBundleVersion());
+      classLoadingMetaData.setName(bundleState.getSymbolicName());
+      classLoadingMetaData.setVersion(bundleState.getVersion());
       classLoadingMetaData.setDomain(domain != null ? domain.getName() : null);
 
       CapabilitiesMetaData capabilities = classLoadingMetaData.getCapabilities();
       RequirementsMetaData requirements = classLoadingMetaData.getRequirements();
       
-      OSGiBundleCapability capability = OSGiBundleCapability.create(osgiMetaData);
+      OSGiBundleCapability capability = OSGiBundleCapability.create(bundleState);
       capabilities.addCapability(capability);
       
       List<ParameterizedAttribute> requireBundles = osgiMetaData.getRequireBundles();

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiManifestParsingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiManifestParsingDeployer.java	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiManifestParsingDeployer.java	2009-12-18 17:45:01 UTC (rev 97998)
@@ -22,7 +22,6 @@
 package org.jboss.osgi.framework.deployers;
 
 import java.util.jar.Manifest;
-import java.util.jar.Attributes.Name;
 
 import org.jboss.deployers.vfs.spi.deployer.ManifestDeployer;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
@@ -30,35 +29,38 @@
 import org.jboss.osgi.framework.metadata.internal.AbstractOSGiMetaData;
 import org.jboss.osgi.spi.OSGiConstants;
 import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Constants;
 
 /**
  * OSGiManifestParsingDeployer.<p>
  * 
- * This deployer attaches OSGiMetaData to the deployment if it is a real OSGi bundle.
+ * This deployer attaches OSGiMetaData to the deployment.
  * 
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler at jboss.com
  * @version $Revision: 1.1 $
  */
 public class OSGiManifestParsingDeployer extends ManifestDeployer<OSGiMetaData>
 {
-   /**
-    * Create a new OSGiManifestParsingDeployer.
-    */
    public OSGiManifestParsingDeployer()
    {
       super(OSGiMetaData.class);
       setTopLevelOnly(true);
    }
-   
+
    @Override
    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;
-
-      return new AbstractOSGiMetaData(manifest);
+      AbstractOSGiMetaData metaData = new AbstractOSGiMetaData(manifest);
+      
+      // At least one of these manifest headers must be there
+      // Note, in R3 and R4 there is no common mandatory header
+      String bundleName = metaData.getBundleName();
+      String bundleVersion = metaData.getBundleVersion();
+      String bundleSymbolicName = metaData.getBundleSymbolicName();
+      if (bundleName == null && bundleVersion == null && bundleSymbolicName == null)
+         metaData = null;
+      
+      return metaData;
    }
 
    @Override
@@ -67,9 +69,11 @@
       super.init(unit, metaData, file);
 
       String symbolicName = metaData.getBundleSymbolicName();
-      log.debug("Bundle-SymbolicName: " + symbolicName + " in " + file);
-
-      // Add a marker that this is an OSGi deployment
-      unit.addAttachment(OSGiConstants.KEY_BUNDLE_SYMBOLIC_NAME, symbolicName);
+      if (symbolicName != null)
+      {
+         // Add a marker that this is an R4 OSGi deployment
+         log.debug("Bundle-SymbolicName: " + symbolicName);
+         unit.addAttachment(OSGiConstants.KEY_BUNDLE_SYMBOLIC_NAME, symbolicName);
+      }
    }
 }

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/OSGiMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/OSGiMetaData.java	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/OSGiMetaData.java	2009-12-18 17:45:01 UTC (rev 97998)
@@ -26,7 +26,6 @@
 import java.util.List;
 
 import org.jboss.deployers.vfs.spi.deployer.ManifestMetaData;
-import org.osgi.framework.Version;
 
 /**
  * OSGi specific manifest meta data.
@@ -143,10 +142,12 @@
 
    /**
     * Get bundle's version.
-    *
+    * 
+    * Note, R3 does not define a specific syntax for Bundle-Version.
+    * 
     * @return version of this bundle
     */
-   Version getBundleVersion();
+   String getBundleVersion();
 
    /**
     * Get dynamic imports.

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractOSGiMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractOSGiMetaData.java	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractOSGiMetaData.java	2009-12-18 17:45:01 UTC (rev 97998)
@@ -30,7 +30,6 @@
 import static org.jboss.osgi.framework.metadata.internal.ValueCreatorUtil.STRING_LIST_VC;
 import static org.jboss.osgi.framework.metadata.internal.ValueCreatorUtil.STRING_VC;
 import static org.jboss.osgi.framework.metadata.internal.ValueCreatorUtil.URL_VC;
-import static org.jboss.osgi.framework.metadata.internal.ValueCreatorUtil.VERSION_VC;
 import static org.osgi.framework.Constants.BUNDLE_ACTIVATOR;
 import static org.osgi.framework.Constants.BUNDLE_CATEGORY;
 import static org.osgi.framework.Constants.BUNDLE_CLASSPATH;
@@ -190,9 +189,9 @@
       return get(BUNDLE_UPDATELOCATION, URL_VC);
    }
 
-   public Version getBundleVersion()
+   public String getBundleVersion()
    {
-      return get(BUNDLE_VERSION, VERSION_VC , Version.emptyVersion);
+      return get(BUNDLE_VERSION, STRING_VC , "0.0.0");
    }
 
    public List<PackageAttribute> getDynamicImports()

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleUnitTestCase.java	2009-12-18 17:45:01 UTC (rev 97998)
@@ -242,6 +242,7 @@
          Dictionary expected = new Hashtable();
          expected.put(Constants.BUNDLE_NAME, "Simple1");
          expected.put(Constants.BUNDLE_SYMBOLICNAME, "org.jboss.test.osgi.simple1");
+         expected.put(Constants.BUNDLE_MANIFESTVERSION, "2");
          expected.put(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
          expected.put(Attributes.Name.IMPLEMENTATION_TITLE.toString(), "JBoss OSGi tests");
          expected.put(Attributes.Name.IMPLEMENTATION_VENDOR.toString(), "jboss.org");

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/metadata/HeaderValuesTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/metadata/HeaderValuesTestCase.java	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/metadata/HeaderValuesTestCase.java	2009-12-18 17:45:01 UTC (rev 97998)
@@ -41,7 +41,6 @@
 import org.jboss.osgi.framework.metadata.internal.AbstractParameter;
 import org.jboss.osgi.framework.metadata.internal.AbstractParameterizedAttribute;
 import org.jboss.osgi.framework.metadata.internal.OSGiParameters;
-import org.osgi.framework.Version;
 
 /**
  * Test OSGi header values.
@@ -79,20 +78,16 @@
       Manifest manifest = getManifest(createName("Simple"));
       OSGiMetaData metaData = new AbstractOSGiMetaData(manifest);
 
-      assertEquals(metaData.getBundleActivator(), "org.jboss.test.osgi.bundle.metadata.BundleActivator");
-      List<String> classpath = Arrays.asList("test.jar", "mc.jar", "seam.jar");
-      assertEquals(metaData.getBundleClassPath(), classpath);
-      assertEquals(metaData.getBundleDescription(), "TestHeadersManifest");
-      assertEquals(metaData.getBundleLocalization(), "OSGI-INF/l10n/bundle");
-      assertEquals(metaData.getBundleManifestVersion(), 2);
-      assertEquals(metaData.getBundleName(), "TestBundle");
-      assertEquals(metaData.getBundleSymbolicName(), "UniqueName");
-      URL url = new URL("file://test.jar");
-      assertEquals(metaData.getBundleUpdateLocation(), url);
-      Version version = new Version("1.2.3.GA");
-      assertEquals(metaData.getBundleVersion(), version);
-      List<String> env = Arrays.asList("ena", "dva", "tri");
-      assertEquals(metaData.getRequiredExecutionEnvironment(), env);
+      assertEquals("org.jboss.test.osgi.bundle.metadata.BundleActivator", metaData.getBundleActivator());
+      assertEquals(Arrays.asList("test.jar", "mc.jar", "seam.jar"), metaData.getBundleClassPath());
+      assertEquals("TestHeadersManifest", metaData.getBundleDescription());
+      assertEquals("OSGI-INF/l10n/bundle", metaData.getBundleLocalization());
+      assertEquals(2, metaData.getBundleManifestVersion());
+      assertEquals("TestBundle", metaData.getBundleName());
+      assertEquals("UniqueName", metaData.getBundleSymbolicName());
+      assertEquals(new URL("file://test.jar"), metaData.getBundleUpdateLocation());
+      assertEquals("1.2.3.GA", metaData.getBundleVersion());
+      assertEquals(Arrays.asList("ena", "dva", "tri"), metaData.getRequiredExecutionEnvironment());
    }
 
    public void testJavaccManifest() throws Exception

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/attributerequirebundleA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/attributerequirebundleA/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/attributerequirebundleA/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,7 +1,4 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: BundleB
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
 Require-Bundle: org.jboss.test.osgi.classloader.bundleA;test=x

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/attributerequirebundlefails/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/attributerequirebundlefails/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/attributerequirebundlefails/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,7 +1,4 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: BundleB
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
 Require-Bundle: org.jboss.test.osgi.classloader.bundleA;doesnotexist=true;test=y

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/bundleA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/bundleA/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/bundleA/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,8 +1,5 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: BundleA
+Bundle-ManifestVersion: 2
 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

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/bundleclasspath/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/bundleclasspath/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/bundleclasspath/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,3 +1,4 @@
+Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-SymbolicName: bundle-classpath
 Bundle-ClassPath: .,WEB-INF/classes

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/noreexportrequirebundleA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/noreexportrequirebundleA/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/noreexportrequirebundleA/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,8 +1,5 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: BundleB
+Bundle-ManifestVersion: 2
 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

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/optionalrequirebundleA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/optionalrequirebundleA/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/optionalrequirebundleA/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,7 +1,4 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: BundleB
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
 Require-Bundle: org.jboss.test.osgi.classloader.bundleA;resolution:=optional

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/optionalrequirebundlefails/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/optionalrequirebundlefails/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/optionalrequirebundlefails/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,7 +1,4 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: BundleB
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
 Require-Bundle: doesnotexist;resolution:=optional

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/reexportrequirebundleA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/reexportrequirebundleA/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/reexportrequirebundleA/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,8 +1,5 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: BundleB
+Bundle-ManifestVersion: 2
 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

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/reexportrequirebundleB/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/reexportrequirebundleB/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/reexportrequirebundleB/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,7 +1,4 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: BundleC
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleC
 Require-Bundle: org.jboss.test.osgi.classloader.bundleB

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/simplerequirebundleA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/simplerequirebundleA/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/simplerequirebundleA/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,7 +1,4 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: BundleB
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
 Require-Bundle: org.jboss.test.osgi.classloader.bundleA

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/simplerequirebundlefails/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/simplerequirebundlefails/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/simplerequirebundlefails/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,7 +1,4 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: BundleB
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
 Require-Bundle: doesnotexist

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/versionrequirebundleA/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/versionrequirebundleA/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/versionrequirebundleA/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,7 +1,4 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: BundleB
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
 Require-Bundle: org.jboss.test.osgi.classloader.bundleA;bundle-version="[0.0.0,1.0.0]"

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/versionrequirebundlefails/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/versionrequirebundlefails/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/classloader/versionrequirebundlefails/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,7 +1,4 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: BundleB
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.classloader.bundleB
 Require-Bundle: org.jboss.test.osgi.classloader.bundleA;bundle-version="[0.0.0,1.0.0)"

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/entries/entries-simple/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/entries/entries-simple/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/entries/entries-simple/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,6 +1,3 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: EntriesSimple
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.entries.simple

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/fail-on-start/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/fail-on-start/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/fail-on-start/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,3 +1,4 @@
+Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-SymbolicName: lifecycle-failstart
 Import-Package: org.jboss.test.osgi.bundle.support.b

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/simple-service/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/simple-service/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/lifecycle/simple-service/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,3 +1,4 @@
+Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-SymbolicName: lifecycle-service
 Export-Package: org.jboss.test.osgi.bundle.support.b

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle1/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle1/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle1/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,7 +1,4 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: Service1
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.service1
 Import-Package: org.jboss.test.osgi.service.support.a

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle2/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle2/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle2/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,7 +1,4 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: Service2
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.service2
 Export-Package: org.jboss.test.osgi.service.support.a

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle3/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle3/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle3/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,7 +1,4 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: Service3
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.service3
 Import-Package: org.jboss.test.osgi.service.support.a,org.jboss.test.osgi.service.support.c

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle4/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle4/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/service/service-bundle4/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,7 +1,4 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: Service4
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.service4
 Import-Package: org.jboss.test.osgi.service.support.a,org.jboss.test.osgi.service.support.c,org.jboss.test.osgi.service.support.d,org.osgi.framework

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/simple/simple-bundle1/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/simple/simple-bundle1/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/simple/simple-bundle1/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -2,5 +2,6 @@
 Implementation-Title: JBoss OSGi tests
 Implementation-Version: test
 Implementation-Vendor: jboss.org
+Bundle-ManifestVersion: 2
 Bundle-Name: Simple1
 Bundle-SymbolicName: org.jboss.test.osgi.simple1

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/simple/simple-bundle2/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/simple/simple-bundle2/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/simple/simple-bundle2/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,6 +1,3 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: Simple2
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.simple2

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/singleton/not-singleton/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/singleton/not-singleton/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/singleton/not-singleton/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,7 +1,4 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: NotSingleton
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.singleton
 Bundle-Version: 2.0.0

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/singleton/singleton1/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/singleton/singleton1/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/singleton/singleton1/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,6 +1,3 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: Singleton1
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.singleton;singleton:=true

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/singleton/singleton2/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/singleton/singleton2/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/singleton/singleton2/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,6 +1,3 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: Singleton2
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.singleton;singleton:=true

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/smoke/smoke-assembled/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/smoke/smoke-assembled/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/smoke/smoke-assembled/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,6 +1,3 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: SmokeAssmbled
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.smoke.assembled

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/smoke/smoke-osgi-manifest/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/smoke/smoke-osgi-manifest/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/smoke/smoke-osgi-manifest/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,6 +1,3 @@
 Manifest-Version: 1.0
-Implementation-Title: JBoss OSGi tests
-Implementation-Version: test
-Implementation-Vendor: jboss.org
-Bundle-Name: Smoke
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: org.jboss.test.osgi.smoke

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle1/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,4 +1,5 @@
 Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: update-bundle1
 Bundle-Version: 1.0.0
 

Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/META-INF/MANIFEST.MF	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bundles/update/update-bundle2/META-INF/MANIFEST.MF	2009-12-18 17:45:01 UTC (rev 97998)
@@ -1,3 +1,4 @@
 Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
 Bundle-SymbolicName: update-bundle2
 Bundle-Version: 1.0.1

Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java	2009-12-18 17:41:46 UTC (rev 97997)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java	2009-12-18 17:45:01 UTC (rev 97998)
@@ -54,7 +54,7 @@
    private URL rootURL;
    private String location;
    private String symbolicName;
-   private String version;
+   private String bundleVersion;
 
    private transient VirtualFile rootFile;
    private transient Manifest manifest;
@@ -67,7 +67,7 @@
       URL url = getRealLocation(location);
       if (url == null)
          throw new IllegalArgumentException("Cannot obtain root url from: " + location);
-      
+
       return new BundleInfo(toVirtualFile(url), url.toExternalForm());
    }
 
@@ -75,7 +75,7 @@
    {
       if (url == null)
          throw new IllegalArgumentException("Null root url");
-      
+
       return new BundleInfo(toVirtualFile(url), url.toExternalForm());
    }
 
@@ -100,9 +100,9 @@
       // Derive the location from the root
       if (location == null)
          location = rootURL.toExternalForm();
-      
+
       this.location = location;
-      
+
       // Initialize the manifest
       try
       {
@@ -113,12 +113,58 @@
          throw new BundleException("Cannot get manifest from: " + rootURL, ex);
       }
 
+      // A bundle manifest must express the version of the OSGi manifest header
+      // syntax in the Bundle-ManifestVersion header. Bundles exploiting this version 
+      // of the Framework specification (or later) must specify this header.
+      // The Framework version 1.3 (or later) bundle manifest version must be ’2’.
+      // Bundle manifests written to previous specifications’ manifest syntax are
+      // taken to have a bundle manifest version of '1', although there is no way to
+      // express this in such manifests. 
+      String manifestVersion = getManifestHeader(Constants.BUNDLE_MANIFESTVERSION);
+      if (manifestVersion == null)
+         manifestVersion = "1";
+
       symbolicName = getManifestHeader(Constants.BUNDLE_SYMBOLICNAME);
-      if (symbolicName == null)
-         throw new IllegalArgumentException("Cannot obtain Bundle-SymbolicName for: " + rootFile);
+      bundleVersion = getManifestHeader(Constants.BUNDLE_VERSION);
+      
+      // R3 Framework
+      if (manifestVersion.equals("1"))
+      {
+         if (symbolicName != null)
+            throw new IllegalArgumentException("Invalid Bundle-ManifestVersion:=1 for " + symbolicName);
 
-      version = getManifestHeader(Constants.BUNDLE_VERSION);
-      version = Version.parseVersion(version).toString();
+         // Generate default symbolic name
+         String name = getManifestHeader(Constants.BUNDLE_NAME);
+         symbolicName = name.replace(' ', '-');
+         
+         // Parse the Bundle-Version string
+         try
+         {
+            bundleVersion = Version.parseVersion(bundleVersion).toString();
+         }
+         catch (NumberFormatException ex)
+         {
+            // Install expected to succeed on invalid Bundle-Version
+            // https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1503
+            bundleVersion = Version.emptyVersion.toString();
+         }
+      }
+      
+      // R4 Framework
+      else if (manifestVersion.equals("2"))
+      {
+         if (symbolicName == null)
+            throw new IllegalArgumentException("Cannot obtain Bundle-SymbolicName for: " + rootFile);
+         
+         // Parse the Bundle-Version string
+         bundleVersion = Version.parseVersion(bundleVersion).toString();
+      }
+      
+      // Unsupported Bundle-ManifestVersion
+      else
+      {
+         throw new IllegalArgumentException("Unsupported Bundle-ManifestVersion: " + manifestVersion);
+      }
    }
 
    /**
@@ -146,7 +192,7 @@
    {
       if (rootFile == null)
          rootFile = toVirtualFile(rootURL);
-      
+
       return rootFile;
    }
 
@@ -171,10 +217,10 @@
     */
    public Version getVersion()
    {
-      return Version.parseVersion(version);
+      return Version.parseVersion(bundleVersion);
    }
 
-   private Manifest getManifest() 
+   private Manifest getManifest()
    {
       if (manifest == null)
       {
@@ -229,7 +275,7 @@
             // ignore
          }
       }
-      
+
       // Try to prefix the location with the test archive directory
       if (url == null)
       {
@@ -237,10 +283,10 @@
          if (location.startsWith(prefix) == false && new File(prefix).exists())
             return getRealLocation(prefix + File.separator + location);
       }
-         
+
       return url;
    }
-   
+
    private static URL toURL(VirtualFile file)
    {
       try
@@ -255,7 +301,7 @@
 
    private String toEqualString()
    {
-      return "[" + symbolicName + "-" + version + ",url=" + rootURL + "]";
+      return "[" + symbolicName + "-" + bundleVersion + ",url=" + rootURL + "]";
    }
 
    @Override




More information about the jboss-cvs-commits mailing list