Class logInterface = null;
try {
logInterface = loadClass(LOG_INTERFACE);
logClass = loadClass(logClassName);
if (logClass == null) {
throw new LogConfigurationException
("No suitable Log implementation for " + logClassName);
}
if (!logInterface.isAssignableFrom(logClass)) {
Class interfaces[] = logClass.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
if (LOG_INTERFACE.equals(interfaces[i].getName())) {
throw new LogConfigurationException
("Invalid class loader hierarchy. " +
"You have more than one version of '" +
LOG_INTERFACE + "' visible, which is " +
"not allowed.");
}
}
throw new LogConfigurationException
("Class " + logClassName + " does not implement '" +
LOG_INTERFACE + "'.");
}
} catch (Throwable t) {
throw new LogConfigurationException(t);
}
// Identify the <code>setLogFactory</code> method (if there is one)
try {
logMethod = logClass.getMethod("setLogFactory",
logMethodSignature);
} catch (Throwable t) {
logMethod = null;
}
// Identify the corresponding constructor to be used
try {
logConstructor = logClass.getConstructor(logConstructorSignature);
return (logConstructor);
} catch (Throwable t) {
throw new LogConfigurationException
("No suitable Log constructor " +
logConstructorSignature+ " for " + logClassName, t);
}
}