* @param loader the ClassLoader to use
* @return the XMLClassDescriptor for the given class name
**/
public XMLClassDescriptor resolve(String className, ClassLoader loader) {
XMLClassDescriptor classDesc = null;
if ((className == null) || (className.length() == 0)) {
clearError(); //-- clear previous error flag
setError("Cannot resolve a null or zero-length class name.");
return null;
}
//-- first check mapping loader
if (_mappingLoader != null) {
classDesc = (XMLClassDescriptor)_mappingLoader.getDescriptor(className);
if (classDesc != null)
return classDesc;
}
//-- try and load class to check cache,
Class _class = null;
try {
_class = loadClass(className, loader);
}
catch(ClassNotFoundException cnfe) {
//-- save exception, for future calls with
//-- the same classname
if (_classNotFoundList == null)
_classNotFoundList = new Hashtable();
_classNotFoundList.put(className, cnfe);
}
if (_class != null) {
classDesc = resolve(_class);
}
else clearError(); //-- clear error flag
//-- try to load ClassDescriptor with no class being
//-- present...does this make sense?
if ((classDesc == null) && (_class == null)) {
String dClassName = className+DESCRIPTOR_PREFIX;
try {
Class dClass = loadClass(dClassName, loader);
classDesc = (XMLClassDescriptor) dClass.newInstance();
if (classDesc.getJavaClass() != null) {
associate(classDesc.getJavaClass(), classDesc);
}
}
catch(InstantiationException ie) {
//-- do nothing for now
}