[jboss-cvs] JBossAS SVN: r93466 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins: resolver and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Sep 14 08:07:40 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-09-14 08:07:40 -0400 (Mon, 14 Sep 2009)
New Revision: 93466

Modified:
   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/OSGiBundleClassLoadingDeployer.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/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java
Log:
Restore signature on Capability.resolve()

Modified: 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	2009-09-14 12:07:23 UTC (rev 93465)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleCapability.java	2009-09-14 12:07:40 UTC (rev 93466)
@@ -93,9 +93,9 @@
    }
 
    @Override
-   public boolean resolves(Module capModule, Module reqModule, Requirement requirement)
+   public boolean resolves(Module reqModule, Requirement requirement)
    {
-      if (super.resolves(capModule, reqModule, requirement) == false)
+      if (super.resolves(reqModule, requirement) == false)
          return false;
       if (requirement instanceof OSGiBundleRequirement == false)
          return true;

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-09-14 12:07:23 UTC (rev 93465)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiBundleClassLoadingDeployer.java	2009-09-14 12:07:40 UTC (rev 93466)
@@ -132,7 +132,7 @@
             boolean isSystemPackage = syspackPlugin.isSystemPackage(packageName);
             if (isSystemPackage == false)
             {
-               OSGiPackageRequirement requirement = OSGiPackageRequirement.create(packageAttribute); 
+               OSGiPackageRequirement requirement = OSGiPackageRequirement.create(bundleState, packageAttribute); 
                requirements.addRequirement(requirement);
             }
          }

Modified: 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	2009-09-14 12:07:23 UTC (rev 93465)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageCapability.java	2009-09-14 12:07:40 UTC (rev 93466)
@@ -29,6 +29,7 @@
 import org.jboss.classloading.spi.dependency.Module;
 import org.jboss.classloading.spi.metadata.Requirement;
 import org.jboss.classloading.spi.version.VersionRange;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
 import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
 import org.jboss.osgi.plugins.metadata.AbstractVersionRange;
@@ -130,9 +131,9 @@
    }
 
    @Override
-   public boolean resolves(Module capModule, Module reqModule, Requirement requirement)
+   public boolean resolves(Module reqModule, Requirement requirement)
    {
-      if (super.resolves(capModule, reqModule, requirement) == false)
+      if (super.resolves(reqModule, requirement) == false)
          return false;
       if (requirement instanceof OSGiPackageRequirement == false)
          return true;
@@ -147,12 +148,25 @@
       if (bundleCapability == null)
          return false;
 
+      Module capModule = getModule();
       Module otherCapModule = bundleCapability.getExportingModule();
       PackageCapability otherCapability = bundleCapability.getPackageCapability();
       boolean isMatch = (otherCapModule == capModule && otherCapability == this);
       return isMatch;
    }
 
+   /**
+    * Get the Module associated with this capability
+    */
+   public Module getModule()
+   {
+      DeploymentUnit unit = bundleState.getDeploymentUnit();
+      Module module = unit.getAttachment(Module.class);
+      if (module == null)
+         throw new IllegalStateException("Cannot obtain module from: " + bundleState);
+      return module;
+   }
+
    @SuppressWarnings("deprecation")
    public boolean match(OSGiPackageRequirement packageRequirement)
    {

Modified: 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	2009-09-14 12:07:23 UTC (rev 93465)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageRequirement.java	2009-09-14 12:07:40 UTC (rev 93466)
@@ -25,7 +25,10 @@
 import java.util.Map;
 
 import org.jboss.classloading.plugins.metadata.PackageRequirement;
+import org.jboss.classloading.spi.dependency.Module;
 import org.jboss.classloading.spi.version.VersionRange;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
 import org.jboss.osgi.plugins.metadata.AbstractVersionRange;
 import org.jboss.osgi.spi.metadata.PackageAttribute;
 import org.jboss.osgi.spi.metadata.Parameter;
@@ -44,6 +47,9 @@
    /** The serialVersionUID */
    private static final long serialVersionUID = 5109907232396093061L;
 
+   /** The bundle state */
+   private OSGiBundleState bundleState;
+
    /** The attributes */
    private PackageAttribute requirePackage;
 
@@ -55,8 +61,10 @@
     * @throws IllegalArgumentException for a null requirePackage
     */
    @SuppressWarnings("deprecation")
-   public static OSGiPackageRequirement create(PackageAttribute requirePackage)
+   public static OSGiPackageRequirement create(OSGiBundleState bundleState, PackageAttribute requirePackage)
    {
+      if (bundleState == null)
+         throw new IllegalArgumentException("Null bundle");
       if (requirePackage == null)
          throw new IllegalArgumentException("Null require package");
 
@@ -79,7 +87,7 @@
             range = (AbstractVersionRange)AbstractVersionRange.valueOf(versionString);
       }
 
-      return new OSGiPackageRequirement(name, range, requirePackage);
+      return new OSGiPackageRequirement(bundleState, name, range, requirePackage);
    }
 
    /**
@@ -90,9 +98,11 @@
     * @param requirePackage the require package metadata
     * @throws IllegalArgumentException for a null name or requirePackage
     */
-   public OSGiPackageRequirement(String name, VersionRange versionRange, PackageAttribute requirePackage)
+   public OSGiPackageRequirement(OSGiBundleState bundleState, String name, VersionRange versionRange, PackageAttribute requirePackage)
    {
       super(name, versionRange);
+      this.bundleState = bundleState;
+
       if (requirePackage != null)
       {
          this.requirePackage = requirePackage;
@@ -112,6 +122,18 @@
       return requirePackage;
    }
 
+   /**
+    * Get the Module associated with this requirement
+    */
+   public Module getModule()
+   {
+      DeploymentUnit unit = bundleState.getDeploymentUnit();
+      Module module = unit.getAttachment(Module.class);
+      if (module == null)
+         throw new IllegalStateException("Cannot obtain module from: " + bundleState);
+      return module;
+   }
+   
    @Override
    public boolean equals(Object obj)
    {

Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java	2009-09-14 12:07:23 UTC (rev 93465)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java	2009-09-14 12:07:40 UTC (rev 93466)
@@ -407,7 +407,7 @@
                   Object version = otherPackage.getVersion();
                   VersionRange versionRange = new VersionRange(version, true, version, true);
 
-                  OSGiPackageRequirement newPackageRequirement = new OSGiPackageRequirement(packageName, versionRange, null);
+                  OSGiPackageRequirement newPackageRequirement = new OSGiPackageRequirement(bundle, packageName, versionRange, null);
                   BundleRequirement newBundleRequirement = new BundleRequirement(bundle, newPackageRequirement);
                   newBundleRequirement.setWire(otherCapability);
                   bundleRequirements.add(newBundleRequirement);




More information about the jboss-cvs-commits mailing list