throw new RuntimeException("Cannot instantiate extension '" + className + "'", e);
} catch (IllegalAccessException e) {
throw new RuntimeException("Extension '" + className + "' or constructor are inaccessible", e);
}
ConcordionExtension extension;
try {
extension = (ConcordionExtension) extensionObject;
} catch (ClassCastException e) {
try {
ConcordionExtensionFactory factory = (ConcordionExtensionFactory) extensionObject;
extension = factory.createExtension();
} catch (ClassCastException e1) {
String message = String.format("Extension class '%s' must implement '%s' or '%s'", className,
ConcordionExtension.class.getName(), ConcordionExtensionFactory.class.getName());
throw new RuntimeException(message);
}
}
extension.addTo(this);
}