[jboss-cvs] JBossAS SVN: r104739 - 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
Wed May 12 16:17:21 EDT 2010
Author: alesj
Date: 2010-05-12 16:17:21 -0400 (Wed, 12 May 2010)
New Revision: 104739
Modified:
projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/DefaultClassLoadingMetaDataFactory.java
projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/PackageRequirement.java
projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/WildcardPackageRequirement.java
projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/policy/ClassLoaderPolicyModule.java
Log:
Prepare for wildcard handling.
Modified: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/DefaultClassLoadingMetaDataFactory.java
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/DefaultClassLoadingMetaDataFactory.java 2010-05-12 20:09:24 UTC (rev 104738)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/DefaultClassLoadingMetaDataFactory.java 2010-05-12 20:17:21 UTC (rev 104739)
@@ -72,8 +72,6 @@
public Requirement createWildcardPackage(String name, VersionRange versionRange)
{
- PackageRequirement result = new WildcardPackageRequirement(name, versionRange);
- result.setDynamic(true);
- return result;
+ return new WildcardPackageRequirement(name, versionRange);
}
}
Modified: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/PackageRequirement.java
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/PackageRequirement.java 2010-05-12 20:09:24 UTC (rev 104738)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/PackageRequirement.java 2010-05-12 20:17:21 UTC (rev 104739)
@@ -38,6 +38,7 @@
* PackageRequirement.
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
* @version $Revision: 1.1 $
*/
public class PackageRequirement extends AbstractRequirement implements OptionalPackages
@@ -88,7 +89,7 @@
* This methods supports explicit packages, wildcard sub packages (e.g. org.foo.*)
* and the everything wildcard (i.e. '*')
*
- * @return
+ * @return class filter corresponding the package name
*/
public ClassFilter toClassFilter()
{
@@ -97,7 +98,6 @@
if ("*".equals(packageName))
{
filter = EverythingClassFilter.INSTANCE;
-
}
else if (packageName.endsWith(".*"))
{
@@ -111,6 +111,17 @@
return filter;
}
+ /**
+ * Is this package requirement wildcard.
+ * e.g. we check if it ends with '*'
+ *
+ * @return true if wildcard, false otherwise
+ */
+ public boolean isWildcard()
+ {
+ return getName().endsWith("*");
+ }
+
@Override
public boolean isConsistent(Requirement other)
{
Modified: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/WildcardPackageRequirement.java
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/WildcardPackageRequirement.java 2010-05-12 20:09:24 UTC (rev 104738)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/WildcardPackageRequirement.java 2010-05-12 20:17:21 UTC (rev 104739)
@@ -43,7 +43,7 @@
*/
public WildcardPackageRequirement(String name)
{
- super(name);
+ this(name, null);
}
/**
@@ -56,9 +56,18 @@
public WildcardPackageRequirement(String name, VersionRange versionRange)
{
super(name, versionRange);
+ init();
}
/**
+ * Initialise the requirement
+ */
+ protected void init()
+ {
+ setDynamic(true);
+ }
+
+ /**
* Create recursive class filter from package name.
*
* @return the recursive package filter
@@ -67,4 +76,9 @@
{
return RecursivePackageClassFilter.createRecursivePackageClassFilter(getName());
}
+
+ public boolean isWildcard()
+ {
+ return true;
+ }
}
\ No newline at end of file
Modified: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/policy/ClassLoaderPolicyModule.java
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/policy/ClassLoaderPolicyModule.java 2010-05-12 20:09:24 UTC (rev 104738)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/policy/ClassLoaderPolicyModule.java 2010-05-12 20:17:21 UTC (rev 104739)
@@ -27,12 +27,7 @@
import java.util.List;
import org.jboss.classloader.plugins.loader.ClassLoaderToLoaderAdapter;
-import org.jboss.classloader.spi.ClassLoaderPolicy;
-import org.jboss.classloader.spi.ClassLoaderPolicyFactory;
-import org.jboss.classloader.spi.ClassLoaderSystem;
-import org.jboss.classloader.spi.DelegateLoader;
-import org.jboss.classloader.spi.Loader;
-import org.jboss.classloader.spi.ParentPolicy;
+import org.jboss.classloader.spi.*;
import org.jboss.classloader.spi.base.BaseClassLoader;
import org.jboss.classloader.spi.filter.ClassFilter;
import org.jboss.classloader.spi.filter.FilteredDelegateLoader;
@@ -271,6 +266,7 @@
if (requirement instanceof PackageRequirement)
{
PackageRequirement pr = (PackageRequirement)requirement;
+ // TODO -- handle wildcards
return new FilteredDelegateLoader(factory, pr.toClassFilter());
}
else
More information about the jboss-cvs-commits
mailing list