01: //
02: // This file is part of the prose package.
03: //
04: // The contents of this file are subject to the Mozilla Public License
05: // Version 1.1 (the "License"); you may not use this file except in
06: // compliance with the License. You may obtain a copy of the License at
07: // http://www.mozilla.org/MPL/
08: //
09: // Software distributed under the License is distributed on an "AS IS" basis,
10: // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11: // for the specific language governing rights and limitations under the
12: // License.
13: //
14: // The Original Code is prose.
15: //
16: // The Initial Developers of the Original Code are Angela Nicoara and Gerald Linhofer.
17: // All Rights Reserved.
18: //
19: // Contributor(s):
20: // $Id$
21: // =====================================================================
22: //
23: // (history at end)
24: //
25:
26: package ch.ethz.prose;
27:
28: import java.net.URLClassLoader;
29: import java.net.URL;
30:
31: /**
32: * ProseClassLoader class.
33: *
34: * @author Angela Nicoara
35: * @author Gerald Linhofer
36: */
37: public class ProseClassLoader extends ClassLoader {
38:
39: private ClassLoader localClassLoader;
40: private ClassLoader remoteClassLoader;
41:
42: private ProseClassLoader() {
43: }
44:
45: /**
46: * Use {@link #ProseClassLoader(ClassLoader)}
47: * to create an instance of this class.
48: */
49: public ProseClassLoader(ClassLoader parent) {
50: }
51:
52: private void init() {
53: ClassLoader realClassLoader = this .getClass().getClassLoader();
54: // if the default class loader is used, getClassLoader() may return null
55: if (null == realClassLoader)
56: realClassLoader = ClassLoader.getSystemClassLoader();
57: if (realClassLoader instanceof URLClassLoader) {
58: remoteClassLoader = (URLClassLoader) realClassLoader;
59: localClassLoader = remoteClassLoader;
60: } else {
61: localClassLoader = realClassLoader;
62: remoteClassLoader = new URLClassLoader(new URL[] {});
63: }
64: }
65:
66: }
67:
68: //======================================================================
69: //
70: //$Log$
71: //
|