[jboss-cvs] JBossAS SVN: r104735 - in projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading: spi/metadata and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed May 12 14:53:42 EDT 2010
Author: alesj
Date: 2010-05-12 14:53:41 -0400 (Wed, 12 May 2010)
New Revision: 104735
Added:
projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/WildcardPackageRequirement.java
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/spi/metadata/ClassLoadingMetaDataFactory.java
Log:
Add wildcard helper method and its impl.
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 17:59:38 UTC (rev 104734)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/DefaultClassLoadingMetaDataFactory.java 2010-05-12 18:53:41 UTC (rev 104735)
@@ -30,6 +30,7 @@
* DefaultClassLoadingMetaDataFactory.
*
* @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 DefaultClassLoadingMetaDataFactory extends ClassLoadingMetaDataFactory
@@ -68,4 +69,11 @@
result.setReExport(reExport);
return result;
}
+
+ public Requirement createWildcardPackage(String name, VersionRange versionRange)
+ {
+ PackageRequirement result = new WildcardPackageRequirement(name, versionRange);
+ result.setDynamic(true);
+ return result;
+ }
}
Copied: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/WildcardPackageRequirement.java (from rev 104077, projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/UsesPackageRequirement.java)
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/WildcardPackageRequirement.java (rev 0)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/plugins/metadata/WildcardPackageRequirement.java 2010-05-12 18:53:41 UTC (rev 104735)
@@ -0,0 +1,70 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.classloading.plugins.metadata;
+
+import org.jboss.classloader.spi.filter.ClassFilter;
+import org.jboss.classloader.spi.filter.RecursivePackageClassFilter;
+import org.jboss.classloading.spi.version.VersionRange;
+
+/**
+ * WildcardPackageRequirement.
+ *
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WildcardPackageRequirement extends PackageRequirement
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * Create a new WildcardPackageRequirement with no version constraint
+ *
+ * @param name the name
+ * @throws IllegalArgumentException for a null name
+ */
+ public WildcardPackageRequirement(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Create a new WildcardPackageRequirement.
+ *
+ * @param name the name
+ * @param versionRange the version range - pass null for all versions
+ * @throws IllegalArgumentException for a null name
+ */
+ public WildcardPackageRequirement(String name, VersionRange versionRange)
+ {
+ super(name, versionRange);
+ }
+
+ /**
+ * Create recursive class filter from package name.
+ *
+ * @return the recursive package filter
+ */
+ public ClassFilter toClassFilter()
+ {
+ return RecursivePackageClassFilter.createRecursivePackageClassFilter(getName());
+ }
+}
\ No newline at end of file
Modified: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaDataFactory.java
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaDataFactory.java 2010-05-12 17:59:38 UTC (rev 104734)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaDataFactory.java 2010-05-12 18:53:41 UTC (rev 104735)
@@ -27,6 +27,7 @@
* ClassLoadingMetaDataFactory.
*
* @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 abstract class ClassLoadingMetaDataFactory
@@ -274,4 +275,29 @@
* @throws IllegalArgumentException for a null name
*/
public abstract Requirement createUsesPackage(String name, VersionRange versionRange, boolean reExport);
+
+ /**
+ * Create a new usespackagerequirement with no version constraint
+ *
+ * @param name the name
+ * @return the package requirement
+ * @throws IllegalArgumentException for a null name
+ */
+ public Requirement createWildcardPackage(String name)
+ {
+ return createWildcardPackage(name, null);
+ }
+
+ /**
+ * Create a new uses package requirement
+ *
+ * @param name the name
+ * @param versionRange the version range
+ * @return the package requirement
+ * @throws IllegalArgumentException for a null name
+ */
+ public Requirement createWildcardPackage(String name, VersionRange versionRange)
+ {
+ throw new IllegalArgumentException("Not yet implemented"); // TODO -- should be abstract method
+ }
}
More information about the jboss-cvs-commits
mailing list