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 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

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


findClass

public 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.

getClassLoader

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