org.apache.hivemind
Interface ClassResolver

All Known Implementing Classes:
DefaultClassResolver

public interface ClassResolver

An object which is used to resolve classes and class-path resources. This is needed because, in an application server, different class loaders may be involved in loading different HiveMind modules. For example, the HiveMind library may be on the system claasspath, and modules may include EJBs and WARs, each loaded by a different classloader.

The class loader for the framework needs to be able to see resources in the application, but the application's class loader is a descendent of the framework's class loader. To resolve this, we need a 'hook', an instance that provides access to the application's class loader.

Author:
Howard Lewis Ship

Method Summary
 java.lang.Class checkForClass(java.lang.String type)
          Like findClass(String), but simply returns null if the class does not exist (i.e., if ClassNotFoundException is thrown).
 java.lang.Class findClass(java.lang.String type)
          Forwarded, to the the method Class.forName(String, boolean, ClassLoader), using the resolver's class loader.
 java.lang.ClassLoader getClassLoader()
          Returns a ClassLoader that can see all the classes the resolver can access.
 java.net.URL getResource(java.lang.String name)
          Forwarded, unchanged, to the class loader.
 

Method Detail

getResource

java.net.URL getResource(java.lang.String name)
Forwarded, unchanged, to the class loader. Returns null if the resource is not found.


findClass

java.lang.Class findClass(java.lang.String type)
Forwarded, to the the method Class.forName(String, boolean, ClassLoader), using the resolver's class loader.

Since 1.1, the type may include primitive types and arrays (of primitives or of objects).

Throws:
ApplicationRuntimeException - on any error.

checkForClass

java.lang.Class checkForClass(java.lang.String type)
Like findClass(String), but simply returns null if the class does not exist (i.e., if ClassNotFoundException is thrown). This is used in certain spots when (typically) the exact package for a class is not known.


getClassLoader

java.lang.ClassLoader getClassLoader()
Returns a ClassLoader that can see all the classes the resolver can access.



Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.