01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.aspectwerkz.compiler;
05:
06: import java.net.URL;
07: import java.net.URLClassLoader;
08:
09: /**
10: * VerifierClassLoader does not follow parent delegation model. <p/>It allow to run the -verify option of offline mode
11: * on aspectwerkz itself.
12: *
13: * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur </a>
14: */
15: public class VerifierClassLoader extends URLClassLoader {
16: public VerifierClassLoader(URL[] urls, ClassLoader parent) {
17: super (urls, parent);
18: }
19:
20: protected synchronized Class loadClass(String name, boolean resolve)
21: throws ClassNotFoundException {
22: // First, check if the class has already been loaded
23: Class c = findLoadedClass(name);
24: if (c == null) {
25: try {
26: // try to load the class localy
27: c = findClass(name);
28: } catch (ClassNotFoundException e) {
29: // delegate to parent
30: c = getParent().loadClass(name);
31: }
32: }
33: if (resolve) {
34: resolveClass(c);
35: }
36: return c;
37: }
38: }
|