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);
}