X-Git-Url: http://git.megacz.com/?p=org.ibex.jinetd.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fjinetd%2FTreeClassLoader.java;fp=src%2Forg%2Fibex%2Fjinetd%2FTreeClassLoader.java;h=e9f901feaa6d187896af6a19f8a3cfb626184708;hp=0000000000000000000000000000000000000000;hb=df13dadbee1a679518ccebbf417a11ec17c77aec;hpb=5d36398ed04551d352ed4b185c036c5cd3433282 diff --git a/src/org/ibex/jinetd/TreeClassLoader.java b/src/org/ibex/jinetd/TreeClassLoader.java new file mode 100644 index 0000000..e9f901f --- /dev/null +++ b/src/org/ibex/jinetd/TreeClassLoader.java @@ -0,0 +1,115 @@ +// Copyright 2000-2005 the Contributors, as shown in the revision logs. +// Licensed under the Apache Public Source License 2.0 ("the License"). +// You may not use this file except in compliance with the License. + +package org.ibex.jinetd; +import org.ibex.io.*; +import org.ibex.util.*; +import java.io.*; +import java.util.*; +import java.text.*; +import java.net.*; +import java.util.zip.*; + +public class TreeClassLoader extends URLClassLoader { + + private final File root; + private final File lib; + private Hashtable cache = new Hashtable(); + + public TreeClassLoader(File root, ClassLoader parent) { + super(new URL[] { }, parent); + this.root = root; + this.lib = new File(root.getAbsolutePath() + File.separatorChar + "lib"); + } + + // Classloading ////////////////////////////////////////////////////////////////////////////// + + public URL[] getURLs() { + try { + Vec v = new Vec(); + if (getParent() != null && getParent() instanceof URLClassLoader) { + URL[] parentUrls = ((URLClassLoader)getParent()).getURLs(); + for(int i=0; i