String className = (String) props.get(extension);
if (className == null || !ClassUtils.isClassOnPath(className, this.getClass()))
{
throw new ConfigurationException(
CoreMessages.configurationBuilderNoMatching(createConfigResourcesString()));
}
ConfigResource[] constructorArg = new ConfigResource[configs.size()];
System.arraycopy(configs.toArray(), 0, constructorArg, 0, configs.size());
ConfigurationBuilder cb = (ConfigurationBuilder) ClassUtils.instanciateClass(className, new Object[] {constructorArg});
if (domainContext != null && cb instanceof DomainMuleContextAwareConfigurationBuilder)
{
((DomainMuleContextAwareConfigurationBuilder) cb).setDomainContext(domainContext);
}
else if (domainContext != null)
{
throw new MuleRuntimeException(CoreMessages.createStaticMessage(String.format("ConfigurationBuilder %s does not support domain context", cb.getClass().getCanonicalName())));
}
cb.configure(muleContext);
}
}
catch (ConfigurationException e)
{
throw e;
}
catch (Exception e)
{
throw new ConfigurationException(e);
}
}