[Jboss-cvs] JBossAS SVN: r56372 - branches/MC_VDF_WORK/j2se/src/main/org/jboss/mx/loading
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 28 20:41:17 EDT 2006
Author: scott.stark at jboss.org
Date: 2006-08-28 20:41:15 -0400 (Mon, 28 Aug 2006)
New Revision: 56372
Modified:
branches/MC_VDF_WORK/j2se/src/main/org/jboss/mx/loading/LegacyDomainClassLoader.java
Log:
A DomainClassLoader based on the legacy RepositoryClassLoader. This is for portability of the legacy UCL/ULR.
Modified: branches/MC_VDF_WORK/j2se/src/main/org/jboss/mx/loading/LegacyDomainClassLoader.java
===================================================================
--- branches/MC_VDF_WORK/j2se/src/main/org/jboss/mx/loading/LegacyDomainClassLoader.java 2006-08-29 00:39:06 UTC (rev 56371)
+++ branches/MC_VDF_WORK/j2se/src/main/org/jboss/mx/loading/LegacyDomainClassLoader.java 2006-08-29 00:41:15 UTC (rev 56372)
@@ -41,6 +41,8 @@
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
+import org.jboss.classloading.spi.ClassLoadingDomain;
+import org.jboss.classloading.spi.DomainClassLoader;
import org.jboss.logging.Logger;
import org.jboss.util.loading.Translator;
import org.jboss.util.collection.SoftSet;
@@ -49,25 +51,30 @@
import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
/**
- * A RepositoryClassLoader.
+ * A DomainClassLoader based on the legacy RepositoryClassLoader. This is for
+ * portability of the legacy UCL/ULR.
*
+ * @see LoaderRepositoryDomain
+ *
* @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
* @version $Revision$
*/
-public abstract class RepositoryClassLoader extends URLClassLoader
+public abstract class LegacyDomainClassLoader extends URLClassLoader
+ implements DomainClassLoader
{
// Constants -----------------------------------------------------
/** The log */
- private static final Logger log = Logger.getLogger(RepositoryClassLoader.class);
+ private static final Logger log = Logger.getLogger(LegacyDomainClassLoader.class);
/** The value returned by {@link #getURLs}. */
private static final URL[] EMPTY_URL_ARRAY = {};
// Attributes -----------------------------------------------------
- /** Reference to the repository. */
- protected LoaderRepository repository = null;
+ /** Reference to the jboss5 ClassLoadingDomain */
+ protected LoaderRepositoryDomain domain = null;
/** The location where unregister is called from */
protected Exception unregisterTrace;
@@ -95,12 +102,12 @@
// Constructors --------------------------------------------------
/**
- * Create a new LoaderRepositoryClassLoader
+ * Create a new LoaderDomainClassLoaderImpl
*
* @param urls the urls
* @param parent the parent classloader
*/
- protected RepositoryClassLoader(URL[] urls, ClassLoader parent)
+ protected LegacyDomainClassLoader(URL[] urls, ClassLoader parent)
{
super(urls, parent);
this.parent = parent;
@@ -127,27 +134,18 @@
*/
public abstract ObjectName getObjectName() throws MalformedObjectNameException;
- /**
- * Get the loader repository for this classloader
- */
- public LoaderRepository getLoaderRepository()
+ public ClassLoadingDomain getDomain()
{
- return repository;
+ return domain;
}
-
- /**
- * Set the loader repository
- *
- * @param repository the repository
- */
- public void setRepository(LoaderRepository repository)
+ public void setDomain(ClassLoadingDomain domain)
{
- log.debug("setRepository, repository="+repository+", cl=" + this);
- this.repository = repository;
+ log.debug("setDomain, domain="+domain+", cl=" + this);
+ this.domain = (LoaderRepositoryDomain) domain;
}
/**
- * Get the order this classloader was added to the repository
+ * Get the order this classloader was added to the domain
*
* @return the order
*/
@@ -157,7 +155,7 @@
}
/**
- * Set the order this classloader was added to the repository
+ * Set the order this classloader was added to the domain
*
* @param addedOrder the added order
*/
@@ -236,6 +234,10 @@
resourceCache.put(name, resURL);
return resURL;
}
+ public URL loadResourceLocally(String name)
+ {
+ return getResourceLocally(name);
+ }
/**
* Get the URL associated with the UCL.
@@ -254,17 +256,17 @@
public void unregister()
{
log.debug("Unregistering cl=" + this);
- if (repository != null)
- repository.removeClassLoader(this);
+ if (domain != null)
+ domain.removeClassLoader(this);
clearBlacklists();
resourceCache.clear();
- repository = null;
+ domain = null;
this.unregisterTrace = new Exception();
}
/**
* This method simply invokes the super.getURLs() method to access the
- * list of URLs that make up the RepositoryClassLoader classpath.
+ * list of URLs that make up the DomainClassLoaderImpl classpath.
*
* @return the urls that make up the classpath
*/
@@ -274,16 +276,6 @@
}
/**
- * Return all library URLs associated with this RepositoryClassLoader
- *
- * <p>Do not remove this method without running the WebIntegrationTestSuite
- */
- public URL[] getAllURLs()
- {
- return repository.getURLs();
- }
-
- /**
* Black list a class
*
* @param name the name of the class
@@ -375,7 +367,7 @@
/** The only caller of this method should be the VM initiated
* loadClassInternal() method. This method attempts to acquire the
- * UnifiedLoaderRepository2 lock and then asks the repository to
+ * UnifiedLoaderRepository2 lock and then asks the domain to
* load the class.
*
* <p>Forwards request to {@link LoaderRepository}.
@@ -389,9 +381,9 @@
Class clazz = null;
try
{
- if (repository != null)
+ if (domain != null)
{
- clazz = repository.getCachedClass(name);
+ clazz = domain.loadClass(name, resolve, this);
if (clazz != null)
{
if( log.isTraceEnabled() )
@@ -420,7 +412,7 @@
/** The only caller of this method should be the VM initiated
* loadClassInternal() method. This method attempts to acquire the
- * UnifiedLoaderRepository2 lock and then asks the repository to
+ * UnifiedLoaderRepository2 lock and then asks the domain to
* load the class.
*
* <p>Forwards request to {@link LoaderRepository}.
@@ -458,29 +450,29 @@
*/
public URL getResource(String name)
{
- if (repository != null)
- return repository.getResource(name, this);
+ if (domain != null)
+ return domain.loadResource(name, this);
return null;
}
/** Find all resource URLs for the given name. This overrides the
- * URLClassLoader version to look for resources in the repository.
+ * URLClassLoader version to look for resources in the domain.
*
* @param name the name of the resource
* @return Enumeration<URL>
* @throws java.io.IOException
*/
- public Enumeration findResources(String name) throws IOException
+ public Enumeration<URL> findResources(String name) throws IOException
{
- Vector resURLs = new Vector();
- if( repository == null )
+ Vector<URL> resURLs = new Vector<URL>();
+ if( domain == null )
{
String msg = "Invalid use of destroyed classloader, UCL destroyed at:";
IOException e = new IOException(msg);
e.initCause(this.unregisterTrace);
throw e;
}
- repository.getResources(name, this, resURLs);
+ domain.getResources(name, this, resURLs);
return resURLs.elements();
}
@@ -511,7 +503,7 @@
throw new ClassNotFoundException("Class Not Found(blacklist): " + name);
}
- Translator translator = repository.getTranslator();
+ Translator translator = domain.getTranslator();
if (translator != null)
{
// Obtain the transformed class bytecode
@@ -595,7 +587,7 @@
if( url == null )
throw new IllegalArgumentException("url cannot be null");
- if( repository.addClassLoaderURL(this, url) == true )
+ if( domain.addClassLoaderURL(this, url) == true )
{
log.debug("Added url: "+url+", to ucl: "+this);
// Strip any query parameters
More information about the jboss-cvs-commits
mailing list