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 LoaderRepository

    java.lang.Object
      org.jboss.mx.loading.LoaderRepository

All Implemented Interfaces:
  ClassLoaderRepository, ServerConstants

Direct Known Subclasses:
  BasicLoaderRepository, UnifiedLoaderRepository3

public abstract class LoaderRepository
extends Object
implements ServerConstants, ClassLoaderRepository

Abstract base class of all loader repository implementations

Version:
  $Revision: 1.22 $
Author:
  Juha Lindfors.
See Also:
  `BasicLoaderRepository`

Field Summary
`protected static LoaderRepository` | `instance`
`protected static Vector` | `loaders`
`protected org.jboss.util.loading.Translator` | `translator`

Fields inherited from interface org.jboss.mx.server.ServerConstants
`CLASS_REMOVED, CLASSLOADER, CLASSLOADER_ADDED, CLASSLOADER_REMOVED, DEFAULT_DOMAIN, DEFAULT_LOADER_NAME, DEFAULT_LOADER_REPOSITORY_CLASS, DEFAULT_MBEAN_REGISTRY_CLASS, DEFAULT_MBEAN_SERVER_BUILDER_CLASS, DEFAULT_REQUIRED_MODELMBEAN_CLASS, DEFAULT_SCOPED_REPOSITORY_CLASS, DEFAULT_SCOPED_REPOSITORY_PARSER_CLASS, IMPLEMENTATION_NAME, IMPLEMENTATION_VENDOR, IMPLEMENTATION_VERSION, JMI_DOMAIN, LOADER_REPOSITORY_CLASS_PROPERTY, MBEAN_REGISTRY, MBEAN_REGISTRY_CLASS_PROPERTY, MBEAN_SERVER_BUILDER_CLASS_PROPERTY, MBEAN_SERVER_CONFIGURATION, MBEAN_SERVER_DELEGATE, OPTIMIZE_REFLECTED_DISPATCHER, REQUIRED_MODELMBEAN_CLASS_PROPERTY, SPECIFICATION_NAME, SPECIFICATION_VENDOR, SPECIFICATION_VERSION, UNIFIED_LOADER_REPOSITORY_CLASS`

Constructor Summary
`LoaderRepository()`

Method Summary
`abstract void` | `addClassLoader(ClassLoader cl)` Add a class loader to the repository
`abstract boolean` | `addClassLoaderURL(ClassLoader cl, URL url)` Update the set of URLs known to be associated with a previously added class loader.
`int` | `compare(LoaderRepository lr)` Compare two loader repository, by default we do no special ordering
`Class` | `getCachedClass(String classname)`
`Vector` | `getLoaders()`
`static Class` | `getNativeClassForName(String className)` Return the class of a java native type
`abstract URL` | `getResource(String name, ClassLoader cl)` Find a resource URL for the given name
`abstract void` | `getResources(String name, ClassLoader cl, List urls)` Find all resource URLs for the given name.
`org.jboss.util.loading.Translator` | `getTranslator()`
`URL[]` | `getURLs()`
`abstract Class` | `loadClass(String className)` Loads a class from the repository.
`abstract Class` | `loadClass(String name, boolean resolve, ClassLoader cl)` Load the given class from the repository
`abstract Class` | `loadClassBefore(ClassLoader stop, String className)` Loads a class from the repository, using the classloaders that were registered before the given classloader.
`abstract Class` | `loadClassWithout(ClassLoader loader, String className)` Loads a class from the repository, excluding the given classloader.
`abstract RepositoryClassLoader` | `newClassLoader(URL url, boolean addToRepository)` Create RepositoryClassLoader and optionally add it to the repository
`abstract RepositoryClassLoader` | `newClassLoader(URL url, URL origURL, boolean addToRepository)` Create RepositoryClassLoader and optionally add it to the repository
`abstract void` | `removeClassLoader(ClassLoader cl)` Remove a cladd loader from the repository.
`protected int` | `reverseCompare(LoaderRepository lr)` Allow subclasses to override the ordering
`void` | `setTranslator(org.jboss.util.loading.Translator t)`

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

Field Detail

### loaders

    protected static Vector loaders

### instance

    protected static LoaderRepository instance

### translator

    protected org.jboss.util.loading.Translator translator

Constructor Detail

### LoaderRepository

    public LoaderRepository()

Method Detail

### getLoaders

    public Vector getLoaders()

### getURLs

    public URL[] getURLs()

### getCachedClass

    public Class getCachedClass(String classname)

### getTranslator

    public org.jboss.util.loading.Translator getTranslator()

### setTranslator

    public void setTranslator(org.jboss.util.loading.Translator t)

### compare

    public int compare(LoaderRepository lr)

  Compare two loader repository, by default we do no special ordering

  Parameters:
    `lr` - the loader repository
  Returns:
    -1, 0, 1 depending upon the order

### loadClass

    public abstract Class loadClass(String className)
                             throws ClassNotFoundException

  Loads a class from the repository. This method attempts to load the class using all the classloader registered to the repository.

  Specified by:
    `loadClass` in interface `ClassLoaderRepository`
  Parameters:
    `className` - the class to load
  Returns:
    the found class
  Throws:
    `ClassNotFoundException` - when there is no such class

### loadClassWithout

    public abstract Class loadClassWithout(ClassLoader loader,
                                           String className)
                                    throws ClassNotFoundException

  Loads a class from the repository, excluding the given classloader.

  Specified by:
    `loadClassWithout` in interface `ClassLoaderRepository`
  Parameters:
    `loader` - the classloader to exclude
    `className` - the class to load
  Returns:
    the found class
  Throws:
    `ClassNotFoundException` - when there is no such class

### loadClassBefore

    public abstract Class loadClassBefore(ClassLoader stop,
                                          String className)
                                   throws ClassNotFoundException

  Loads a class from the repository, using the classloaders that were registered before the given classloader.

  Specified by:
    `loadClassBefore` in interface `ClassLoaderRepository`
  Parameters:
    `stop` - consult all the classloaders registered before this one in an attempt to load a class
    `className` - name of the class to load
  Returns:
    loaded class instance
  Throws:
    `ClassNotFoundException` - if none of the consulted classloaders were able to load the requested class

### newClassLoader

    public abstract RepositoryClassLoader newClassLoader(URL url,
                                                         boolean addToRepository)
                                                  throws Exception

  Create RepositoryClassLoader and optionally add it to the repository

  Parameters:
    `url` - the URL to use for class loading
    `addToRepository` - a flag indicating if the CL should be added to the repository
  Returns:
    the UCL instance
  Throws:
    `Exception`

### newClassLoader

    public abstract RepositoryClassLoader newClassLoader(URL url,
                                                         URL origURL,
                                                         boolean addToRepository)
                                                  throws Exception

  Create RepositoryClassLoader and optionally add it to the repository

  Parameters:
    `url` - the URL to use for class loading
    `origURL` - an orignal URL to use as the URL for the CL CodeSource. This is useful when the url is a local copy that is difficult to use for security policy writing.
    `addToRepository` - a flag indicating if the CL should be added to the repository
  Returns:
    the CL instance
  Throws:
    `Exception`

### loadClass

    public abstract Class loadClass(String name,
                                    boolean resolve,
                                    ClassLoader cl)
                             throws ClassNotFoundException

  Load the given class from the repository

  Parameters:
    `name` -
    `resolve` -
    `cl` -
  Returns:
  Throws:
    `ClassNotFoundException`

### getResource

    public abstract URL getResource(String name,
                                    ClassLoader cl)

  Find a resource URL for the given name

  Parameters:
    `name` - the resource name
    `cl` - the requesting class loader
  Returns:
    The resource URL if found, null otherwise

### getResources

    public abstract void getResources(String name,
                                      ClassLoader cl,
                                      List urls)

  Find all resource URLs for the given name. Since this typically entails an exhuastive search of the repository it can be a relatively slow operation.

  Parameters:
    `name` - the resource name
    `cl` - the requesting class loader
    `urls` - a list into which the located resource URLs will be placed

### addClassLoader

    public abstract void addClassLoader(ClassLoader cl)

  Add a class loader to the repository

### addClassLoaderURL

    public abstract boolean addClassLoaderURL(ClassLoader cl,
                                              URL url)

  Update the set of URLs known to be associated with a previously added class loader.

  Parameters:
    `cl` -
    `url` -

### removeClassLoader

    public abstract void removeClassLoader(ClassLoader cl)

  Remove a cladd loader from the repository.

  Parameters:
    `cl` -

### getNativeClassForName

    public static final Class getNativeClassForName(String className)

  Return the class of a java native type

  Returns:
    the class, or null if className is not a native class name

### reverseCompare

    protected int reverseCompare(LoaderRepository lr)

  Allow subclasses to override the ordering

  Parameters:
    `lr` - the loader repository
  Returns:
    -1, 0, 1 depending upon the order

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.