[jboss-cvs] JBossAS SVN: r104819 - in projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency: policy and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat May 15 01:59:25 EDT 2010
Author: thomas.diesler at jboss.com
Date: 2010-05-15 01:59:25 -0400 (Sat, 15 May 2010)
New Revision: 104819
Modified:
projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/Domain.java
projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/policy/WildcardClassLoaderPolicy.java
Log:
[JBOSGi-143] Add initial tracking of already installed modules
Modified: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/Domain.java
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/Domain.java 2010-05-14 23:01:03 UTC (rev 104818)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/Domain.java 2010-05-15 05:59:25 UTC (rev 104819)
@@ -339,9 +339,6 @@
public Collection<Module> getModules(String name, VersionRange range)
{
- if (name == null)
- throw new IllegalArgumentException("Null name");
-
Collection<Module> result = new HashSet<Module>();
getModulesInternal(name, range, result);
return result;
@@ -350,8 +347,11 @@
/**
* Get the modules matching the name and range
*
- * @param name the name
- * @param range the range
+ * If the given name is null, it matches all names.
+ * If the given range is null, it matches all versions.
+ *
+ * @param name the name or null
+ * @param range the range or null
* @param result the matching modules
*/
void getModulesInternal(String name, VersionRange range, Collection<Module> result)
@@ -362,7 +362,7 @@
for (Module module : modules)
{
List<Capability> capabilities = module.getCapabilitiesRaw();
- if (capabilities != null && capabilities.isEmpty() == false)
+ if (name != null && capabilities != null && capabilities.isEmpty() == false)
{
ModuleRequirement requirement = new ModuleRequirement(name, range);
for (Capability capability : capabilities)
@@ -376,10 +376,11 @@
}
else
{
- if (name.equals(module.getName()) && range.isInRange(module.getVersion()))
+ boolean nameMatch = (name == null || name.equals(module.getName()));
+ boolean versionMatch = range.isInRange(module.getVersion());
+ if (nameMatch && versionMatch)
{
result.add(module);
- return;
}
}
}
Modified: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/policy/WildcardClassLoaderPolicy.java
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/policy/WildcardClassLoaderPolicy.java 2010-05-14 23:01:03 UTC (rev 104818)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/policy/WildcardClassLoaderPolicy.java 2010-05-15 05:59:25 UTC (rev 104819)
@@ -76,9 +76,17 @@
if (module == null)
throw new IllegalArgumentException("Null module");
- // does our module resolve our requirement
- if (module.canResolve(requirement))
- modules.add(module);
+ // Add the modules that can resolve the requirement
+ for (Module aux : domain.getModules(null, null))
+ {
+ // The wildcard policy should not load from this module
+ if (aux == module)
+ continue;
+
+ // Add the module if it can resolve the requirement
+ if (aux.canResolve(requirement))
+ modules.add(aux);
+ }
this.domain = domain;
this.requirement = requirement;
More information about the jboss-cvs-commits
mailing list