use of org.mule.runtime.module.extension.internal.runtime.config.DynamicConfigurationProvider in project mule by mulesoft.
the class ExtensionComponent method getMetadataContext.
private MetadataContext getMetadataContext() throws MetadataResolvingException {
CoreEvent fakeEvent = null;
try {
fakeEvent = getInitialiserEvent(muleContext);
Optional<ConfigurationInstance> configuration = getConfiguration(fakeEvent);
if (configuration.isPresent()) {
ConfigurationProvider configurationProvider = findConfigurationProvider().orElseThrow(() -> new MetadataResolvingException("Failed to create the required configuration for Metadata retrieval", INVALID_CONFIGURATION));
if (configurationProvider instanceof DynamicConfigurationProvider) {
throw new MetadataResolvingException("Configuration used for Metadata fetch cannot be dynamic", INVALID_CONFIGURATION);
}
}
String cacheId = configuration.map(ConfigurationInstance::getName).orElseGet(() -> extensionModel.getName() + "|" + componentModel.getName());
return new DefaultMetadataContext(() -> configuration, connectionManager, metadataService.getMetadataCache(cacheId), typeLoader);
} finally {
if (fakeEvent != null) {
((BaseEventContext) fakeEvent.getContext()).success();
}
}
}
Aggregations