Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.mx.loading
Class UnifiedClassLoader

    java.lang.Object
      java.lang.ClassLoader
          java.security.SecureClassLoader
              java.net.URLClassLoader
                  org.jboss.mx.loading.RepositoryClassLoader
                      org.jboss.mx.loading.UnifiedClassLoader

All Implemented Interfaces:
  org.jboss.util.loading.Translatable, UnifiedClassLoaderMBean

Direct Known Subclasses:
  UnifiedClassLoader3

public class UnifiedClassLoader
extends RepositoryClassLoader
implements UnifiedClassLoaderMBean, org.jboss.util.loading.Translatable

A ClassLoader which loads classes from a single URL in conjunction with the `LoaderRepository`. Notice that this classloader does not work independently of the repository. A repository reference must be provided via the constructor or the classloader must be explicitly registered to the repository before any attempt to load a class. At this point this is little more than an abstract class maintained as the interface for class loaders as the algorithm of the UnifiedLoaderRepository fails with deadlocks, and several other class loading exceptions in multi- threaded environments.

Version:
  `$Revision: 1.38 $`
Author:
  Marc Fleury, Christoph G. Jung, Scott Stark, Juha Lindfors, Bill Burke

Field Summary
`protected URL` | `origURL` An optional URL from which url may have been copied.
`protected URL` | `url` One URL per ClassLoader in our case

Fields inherited from class org.jboss.mx.loading.RepositoryClassLoader
`loadLock, parent, repository`

Constructor Summary
`UnifiedClassLoader(URL url)` Construct a `UnifiedClassLoader` without registering it to the classloader repository.
`UnifiedClassLoader(URL url, LoaderRepository repository)` Construct a `UnifiedClassLoader` and registers it to the given repository.
`UnifiedClassLoader(URL url, MBeanServer server, ObjectName repositoryName)` UnifiedClassLoader constructor that can be used to register with a particular Loader Repository identified by ObjectName.
`UnifiedClassLoader(URL url, URL origURL)` Construct a `UnifiedClassLoader` without registering it to the classloader repository.
`UnifiedClassLoader(URL url, URL origURL, ClassLoader parent)` Construct a UnifiedClassLoader without registering with the classloader repository.
`UnifiedClassLoader(URL url, URL origURL, LoaderRepository repository)` Construct a `UnifiedClassLoader` and registers it to the given repository.
`UnifiedClassLoader(URL url, URL origURL, MBeanServer server, ObjectName repositoryName)` UnifiedClassLoader constructor that can be used to register with a particular Loader Repository identified by ObjectName.

Method Summary
`ObjectName` | `getObjectName()` Obtain the ObjectName under which the UCL can be registered with the JMX server.
`URL` | `getOrigURL()` Get the original URL associated with the UCL.
`protected PermissionCollection` | `getPermissions(CodeSource cs)` Override the permissions accessor to use the CodeSource based on the original URL if one exists.
`protected ProtectionDomain` | `getProtectionDomain()` Determine the protection domain.
`URL` | `getURL()` Get the URL associated with the UCL.
`void` | `unregister()`

Methods inherited from class org.jboss.mx.loading.RepositoryClassLoader
`acquire, addToClassBlackList, addToResourceBlackList, addURL, attempt, clearBlackLists, clearClassBlackList, clearResourceBlackList, definePackage, equals, findClass, findClassLocally, findResources, findResourcesLocally, getAddedOrder, getAllURLs, getClasspath, getLoaderRepository, getPackage, getPackages, getProtectionDomain, getResource, getResourceLocally, getURLs, hashCode, isClassBlackListed, isResourceBlackListed, loadByteCode, loadByteCode, loadClass, loadClassBefore, loadClassImpl, loadClassLocally, release, removeFromClassBlackList, removeFromResourceBlackList, setAddedOrder, setRepository, toString`

Methods inherited from class java.net.URLClassLoader
`definePackage, findResource, newInstance, newInstance`

Methods inherited from class java.security.SecureClassLoader
`defineClass`

Methods inherited from class java.lang.ClassLoader
`clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getParent, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.jboss.util.loading.Translatable
`getResourceLocally`

Field Detail

### url

    protected URL url

  One URL per ClassLoader in our case

### origURL

    protected URL origURL

  An optional URL from which url may have been copied. It is used to allow the security permissions to be based on a static url namespace.

Constructor Detail

### UnifiedClassLoader

    public UnifiedClassLoader(URL url)

  Construct a `UnifiedClassLoader` without registering it to the classloader repository.

Parameters:
  `url` - the single URL to load classes from.

### UnifiedClassLoader

    public UnifiedClassLoader(URL url,
                              URL origURL)

  Construct a `UnifiedClassLoader` without registering it to the classloader repository.

Parameters:
  `url` - the single URL to load classes from.
  `origURL` - the possibly null original URL from which url may be a local copy or nested jar.

### UnifiedClassLoader

    public UnifiedClassLoader(URL url,
                              URL origURL,
                              ClassLoader parent)

  Construct a UnifiedClassLoader without registering with the classloader repository.

Parameters:
  `url` - the single URL to load classes from.
  `origURL` - the possibly null original URL from which url may be a local copy or nested jar.
  `parent` - the parent class loader to use

### UnifiedClassLoader

    public UnifiedClassLoader(URL url,
                              LoaderRepository repository)

  Construct a `UnifiedClassLoader` and registers it to the given repository.

Parameters:
  `url` - The single URL to load classes from.
  `repository` - the repository this classloader delegates to

### UnifiedClassLoader

    public UnifiedClassLoader(URL url,
                              URL origURL,
                              LoaderRepository repository)

  Construct a `UnifiedClassLoader` and registers it to the given repository.

Parameters:
  `url` - The single URL to load classes from.
  `origURL` - the possibly null original URL from which url may be a local copy or nested jar.
  `repository` - the repository this classloader delegates to be a local copy or nested jar.

### UnifiedClassLoader

    public UnifiedClassLoader(URL url,
                              MBeanServer server,
                              ObjectName repositoryName)
                       throws Exception

  UnifiedClassLoader constructor that can be used to register with a particular Loader Repository identified by ObjectName.

Parameters:
  `url` - an `URL` value
  `server` - a `MBeanServer` value
  `repositoryName` - an `ObjectName` value
Throws:
  `Exception` - if an error occurs

### UnifiedClassLoader

    public UnifiedClassLoader(URL url,
                              URL origURL,
                              MBeanServer server,
                              ObjectName repositoryName)
                       throws Exception

  UnifiedClassLoader constructor that can be used to register with a particular Loader Repository identified by ObjectName.

Parameters:
  `url` - an `URL` value
  `origURL` - the possibly null original URL from which url may be a local copy or nested jar.
  `server` - a `MBeanServer` value
  `repositoryName` - an `ObjectName` value
Throws:
  `Exception` - if an error occurs

Method Detail

### getObjectName

    public ObjectName getObjectName()
                             throws MalformedObjectNameException

  Obtain the ObjectName under which the UCL can be registered with the JMX server. This creates a name of the form "jmx.loading:UCL=hashCode" since we don't currently care that UCL be easily queriable.

  Specified by:
    `getObjectName` in class `RepositoryClassLoader`
  Returns:
    the object name
  Throws:
    `MalformedObjectNameException`

### unregister

    public void unregister()

  Overrides:
    `unregister` in class `RepositoryClassLoader`

### getURL

    public URL getURL()

  Get the URL associated with the UCL.

  Overrides:
    `getURL` in class `RepositoryClassLoader`
  Returns:
    the url

### getOrigURL

    public URL getOrigURL()

  Get the original URL associated with the UCL. This may be null.

### getPermissions

    protected PermissionCollection getPermissions(CodeSource cs)

  Override the permissions accessor to use the CodeSource based on the original URL if one exists. This allows the security policy to be defined in terms of the static URL namespace rather than the local copy or nested URL. This builds a PermissionCollection from: 1. The origURL CodeSource 2. The argument CodeSource 3. The Policy.getPermission(origURL CodeSource) This is necessary because we cannot define the CodeSource the SecureClassLoader uses to register the class under.

  Parameters:
    `cs` - the location and signatures of the codebase.

### getProtectionDomain

    protected ProtectionDomain getProtectionDomain()

  Determine the protection domain. If we are a copy of the original deployment, use the original url as the codebase.

  Returns:
    the protection domain

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.