[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] Wrapping a Bundle to create a classloader

Hi,
 
I was about to craft my own implementation here, but I figure this has probably been done many times before and bound to be some subtle problems
Can anyone point me at an example.
 
--
...or is it really as simple as:
 
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
import org.osgi.framework.Bundle;
 
public class BundleProxyClassLoader extends ClassLoader {
 
 private Bundle bundle;
 
 public BundleProxyClassLoader(Bundle bundle) {
     this.bundle = bundle;
 }
 
 public URL findResource(String name) {
     return bundle.getResource(name);
 }
 
 public Enumeration findResources(String name) throws IOException {
     return bundle.getResources(name);
 }
 
 public Class findClass(String name) throws ClassNotFoundException {
     return bundle.loadClass(name);
 }
}
 
-Simon
 
     This message may contain privileged and/or confidential information.  If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so.  Thank you.