//
// This file is part of the prose package.
//
// The contents of this file are subject to the Mozilla Public License
// Version 1.1 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
//
// The Original Code is prose.
//
// The Initial Developer of the Original Code is Angela Nicoara. Portions
// created by Angela Nicoara are Copyright (C) 2004 Angela Nicoara.
// All Rights Reserved.
//
// Contributor(s):
// $Id: ProseClassLoader.java,v 1.2 2008/11/18 11:44:47 anicoara Exp $
// =====================================================================
//
package ch.ethz.prose;
import java.net.URLClassLoader;
import java.net.URL;
/**
* ProseClassLoader class.
*
* @author Angela Nicoara
* @author Gerald Linhofer
*/
public class ProseClassLoader extends ClassLoader {
private ClassLoader localClassLoader;
private ClassLoader remoteClassLoader;
private ProseClassLoader() { }
/**
* Use {@link #ProseClassLoader(ClassLoader)}
* to create an instance of this class.
*/
public ProseClassLoader(ClassLoader parent) { }
private void init() {
ClassLoader realClassLoader = this.getClass().getClassLoader();
// if the default class loader is used, getClassLoader() may return null
if( null == realClassLoader )
realClassLoader = ClassLoader.getSystemClassLoader();
if( realClassLoader instanceof URLClassLoader) {
remoteClassLoader = (URLClassLoader) realClassLoader;
localClassLoader = remoteClassLoader;
}
else {
localClassLoader = realClassLoader;
remoteClassLoader = new URLClassLoader(new URL[] {});
}
}
}