| 1 23 24 package com.rift.coad; 26 27 import java.net.MalformedURLException ; 29 import java.rmi.server.RMIClassLoader ; 30 import java.rmi.server.RMIClassLoaderSpi ; 31 32 37 public class RemoteClassLoaderSpi extends RMIClassLoaderSpi { 38 39 private RMIClassLoaderSpi delegate = 41 RMIClassLoader.getDefaultProviderInstance(); 42 43 46 public RemoteClassLoaderSpi() { 47 } 48 49 50 60 public Class loadProxyClass (String codebase, String [] interfaces, 61 ClassLoader defaultLoader) throws MalformedURLException , 62 ClassNotFoundException { 63 return delegate.loadProxyClass(codebase,interfaces, 65 Thread.currentThread().getContextClassLoader()); 66 } 67 68 69 80 public Class loadClass(String codebase, String name, 81 ClassLoader defaultLoader) throws MalformedURLException , 82 ClassNotFoundException { 83 return delegate.loadClass(codebase,name, 85 Thread.currentThread().getContextClassLoader()); 86 } 87 88 89 97 public ClassLoader getClassLoader(String codebase) throws 98 MalformedURLException { 99 return delegate.getClassLoader(codebase); 100 } 101 102 103 109 public String getClassAnnotation(Class cl) { 110 String annotation = null; 111 try { 112 annotation = delegate.getClassAnnotation(cl); 113 } catch (Throwable ex) { 114 annotation = System.getProperty("java.rmi.server.codebase"); 115 } 116 return annotation; 117 } 118 } 119 | Popular Tags |