Methods Summary |
---|
public void | addResourceAdapter(java.lang.String rarName, java.lang.String moduleDir)Adds the requested resource adapter to the ConnectorClassLoader. A
ConnectorClassLoader is created with the moduleDir as its search path
and this classloader is added to the classloader chain.
try {
//System RARs are placed in classpath and hence would be handled
//by the parent classloader
if(!ResourcesUtil.createInstance().belongToSystemRar(rarName)) {
File file= new File(moduleDir);
EJBClassLoader cl= new EJBClassLoader(parent);
cl.appendURL(file.toURI().toURL());
classLoaderChain.add(cl);
rarModuleClassLoaders.put(rarName, cl);
}
} catch (MalformedURLException ex) {
_logger.log(
Level.SEVERE,
"enterprise_util.connector_malformed_url",
ex);
}
|
public java.lang.String | getClasspath()Returns all the resources of the connector classloaders in the chain,
concatenated to a classpath string.
Notice that this method is called by the setClassPath() method of
org.apache.catalina.loader.WebappLoader, since the ConnectorClassLoader does
not extend off of URLClassLoader.
StringBuffer strBuf = new StringBuffer();
for (int i = 0; i < classLoaderChain.size(); i++) {
EJBClassLoader ecl= (EJBClassLoader) classLoaderChain.get(i);
String eclClasspath = ecl.getClasspath();
if ( eclClasspath != null) {
if (i > 0) strBuf.append(File.pathSeparator);
strBuf.append(eclClasspath);
}
}
return strBuf.toString();
|
public static synchronized com.sun.enterprise.util.ConnectorClassLoader | getInstance()
if (classLoader == null) {
classLoader = new ConnectorClassLoader();
}
return classLoader;
|
public static com.sun.enterprise.util.ConnectorClassLoader | getInstance(java.lang.ClassLoader parent)Initializes this sigleton with the given parent class loader
if not already created.
if (classLoader == null) {
synchronized(ConnectorClassLoader.class) {
classLoader = new ConnectorClassLoader(parent);
}
}
return classLoader;
|
public synchronized java.lang.Class | loadClass(java.lang.String name, boolean resolve)
Class clz = null;
//Use the delegation model to service class requests that could be
//satisfied by parent [common class loader].
if(parent != null) {
try {
clz = parent.loadClass(name);
if (clz != null) {
if(resolve) {
resolveClass(clz);
}
return clz;
}
} catch (ClassNotFoundException e) {
//ignore and try the connector modules classloader
//chain.
}
} else {
return super.loadClass(name,resolve);
}
//Going through the connector module classloader chain to find
// class and return the first match.
for (Iterator iter= classLoaderChain.iterator(); iter.hasNext();) {
EJBClassLoader ccl= (EJBClassLoader) iter.next();
try {
clz= ccl.loadClass(name);
if (clz != null){
if(resolve) {
resolveClass(clz);
}
return clz;
}
} catch (ClassNotFoundException cnfe) {
//ignore this exception and continue with next classloader in
// chain
continue;
}
}
//Can't find requested class in parent and in our classloader chain
throw new ClassNotFoundException(name);
|
public void | removeResourceAdapter(java.lang.String moduleName)Removes the resource adapter's class loader from the classloader linked
list
EJBClassLoader classLoaderToRemove=
(EJBClassLoader) rarModuleClassLoaders.get(moduleName);
if (classLoaderToRemove != null) {
classLoaderChain.remove(classLoaderToRemove);
rarModuleClassLoaders.remove(moduleName);
classLoaderToRemove = null;
_logger.log(
Level.WARNING,
"The Connector module "
+ moduleName
+ " has been removed. Please redeploy all applications that "
+ "are using this connector module's resources");
}
|