|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ClassResolver.java | - | - | - | - |
|
1 |
// Copyright 2004 The Apache Software Foundation
|
|
2 |
//
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
5 |
// You may obtain a copy of the License at
|
|
6 |
//
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8 |
//
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12 |
// See the License for the specific language governing permissions and
|
|
13 |
// limitations under the License.
|
|
14 |
|
|
15 |
package org.apache.hivemind;
|
|
16 |
|
|
17 |
import java.net.URL;
|
|
18 |
|
|
19 |
/**
|
|
20 |
* An object which is used to resolve classes and class-path resources.
|
|
21 |
* This is needed because, in an application server, different class loaders
|
|
22 |
* may be involved in loading different HiveMind modules. For example,
|
|
23 |
* the HiveMind library may be on the system claasspath, and modules
|
|
24 |
* may include EJBs and WARs, each loaded by a different classloader.
|
|
25 |
*
|
|
26 |
* <p>The class loader for the framework needs to be able to see resources in
|
|
27 |
* the application, but the application's class loader is a descendent of the
|
|
28 |
* framework's class loader. To resolve this, we need a 'hook', an instance
|
|
29 |
* that provides access to the application's class loader.
|
|
30 |
*
|
|
31 |
* @author Howard Lewis Ship
|
|
32 |
**/
|
|
33 |
|
|
34 |
public interface ClassResolver |
|
35 |
{ |
|
36 |
/**
|
|
37 |
* Forwarded, unchanged, to the class loader. Returns null if the
|
|
38 |
* resource is not found.
|
|
39 |
*/
|
|
40 |
|
|
41 |
public URL getResource(String name);
|
|
42 |
|
|
43 |
/**
|
|
44 |
* Forwarded, to the the method
|
|
45 |
* <code>Class.forName(String, boolean, ClassLoader)</code>, using
|
|
46 |
* the resolver's class loader.
|
|
47 |
*
|
|
48 |
* @throws ApplicationRuntimeException on any error.
|
|
49 |
*/
|
|
50 |
|
|
51 |
public Class findClass(String name);
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Returns a {@link java.lang.ClassLoader} that can see
|
|
55 |
* all the classes the resolver can access.
|
|
56 |
*/
|
|
57 |
|
|
58 |
public ClassLoader getClassLoader();
|
|
59 |
} |
|