KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > aspectwerkz > compiler > VerifierClassLoader


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.aspectwerkz.compiler;
5
6 import java.net.URL JavaDoc;
7 import java.net.URLClassLoader JavaDoc;
8
9 /**
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 JavaDoc {
16   public VerifierClassLoader(URL JavaDoc[] urls, ClassLoader JavaDoc parent) {
17     super(urls, parent);
18   }
19
20   protected synchronized Class JavaDoc loadClass(String JavaDoc name, boolean resolve) throws ClassNotFoundException JavaDoc {
21     // First, check if the class has already been loaded
22
Class JavaDoc c = findLoadedClass(name);
23     if (c == null) {
24       try {
25         // try to load the class localy
26
c = findClass(name);
27       } catch (ClassNotFoundException JavaDoc e) {
28         // delegate to parent
29
c = getParent().loadClass(name);
30       }
31     }
32     if (resolve) {
33       resolveClass(c);
34     }
35     return c;
36   }
37 }
Popular Tags