1 25 26 package org.objectweb.jonas.server; 27 28 import java.net.MalformedURLException ; 29 import java.net.URLClassLoader ; 30 import java.rmi.server.RMIClassLoader ; 31 import java.rmi.server.RMIClassLoaderSpi ; 32 33 import org.objectweb.carol.util.configuration.CarolDefaultValues; 34 35 40 public class RemoteClassLoaderSpi extends RMIClassLoaderSpi { 41 42 45 private static boolean carolIsInitialized = false; 46 47 50 private static boolean carolIsOptimized = false; 51 52 55 private final RMIClassLoaderSpi defaultProvider = RMIClassLoader.getDefaultProviderInstance(); 56 57 73 public Class loadClass(String codebase, String name, ClassLoader defaultLoader) throws MalformedURLException , 74 ClassNotFoundException { 75 return defaultProvider.loadClass(codebase, name, defaultLoader); 76 } 77 78 100 public Class loadProxyClass(String codebase, String [] interfaces, ClassLoader defaultLoader) 101 throws MalformedURLException , ClassNotFoundException { 102 return defaultProvider.loadProxyClass(codebase, interfaces, defaultLoader); 103 } 104 105 117 public ClassLoader getClassLoader(String codebase) throws MalformedURLException { 118 return defaultProvider.getClassLoader(codebase); 119 } 120 121 132 public String getClassAnnotation(Class cl) { 133 ClassLoader loader = cl.getClassLoader(); 134 135 if (!carolIsInitialized) { 137 String sValue = System.getProperty(CarolDefaultValues.LOCAL_JRMP_PROPERTY, "init"); 138 if (!sValue.equals("init")) { 139 carolIsOptimized = new Boolean (sValue).booleanValue(); 140 carolIsInitialized = true; 141 } 142 143 } 144 145 if (loader instanceof JClassLoader) { 146 return null; 147 } else if ((loader instanceof URLClassLoader ) && (carolIsOptimized)) { 148 return null; 149 } else { 150 return defaultProvider.getClassAnnotation(cl); 151 } 152 } 153 } 154 | Popular Tags |