KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > aspectwerkz > compiler > VerifierClassLoader


1 /**************************************************************************************
2  * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
3  * http://aspectwerkz.codehaus.org *
4  * ---------------------------------------------------------------------------------- *
5  * The software in this package is published under the terms of the LGPL license *
6  * a copy of which has been included with this distribution in the license.txt file. *
7  **************************************************************************************/

8 package org.codehaus.aspectwerkz.compiler;
9
10 import java.net.URL JavaDoc;
11 import java.net.URLClassLoader JavaDoc;
12
13 /**
14  * VerifierClassLoader does not follow parent delegation model. <p/>It allow to run the -verify option of offline mode
15  * on aspectwerkz itself.
16  *
17  * @author <a HREF="mailto:alex@gnilux.com">Alexandre Vasseur </a>
18  */

19 public class VerifierClassLoader extends URLClassLoader JavaDoc {
20     public VerifierClassLoader(URL JavaDoc[] urls, ClassLoader JavaDoc parent) {
21         super(urls, parent);
22     }
23
24     protected synchronized Class JavaDoc loadClass(String JavaDoc name, boolean resolve) throws ClassNotFoundException JavaDoc {
25         // First, check if the class has already been loaded
26
Class JavaDoc c = findLoadedClass(name);
27         if (c == null) {
28             try {
29                 // try to load the class localy
30
c = findClass(name);
31             } catch (ClassNotFoundException JavaDoc e) {
32                 // delegate to parent
33
c = getParent().loadClass(name);
34             }
35         }
36         if (resolve) {
37             resolveClass(c);
38         }
39         return c;
40     }
41 }
Popular Tags