use of org.mule.runtime.core.api.config.bootstrap.PropertiesBootstrapServiceDiscoverer in project mule by mulesoft.
the class ArtifactBootstrapServiceDiscovererConfigurationBuilder method doConfigure.
@Override
protected void doConfigure(MuleContext muleContext) throws Exception {
final PropertiesBootstrapServiceDiscoverer propertiesBootstrapServiceDiscoverer = new PropertiesBootstrapServiceDiscoverer(this.getClass().getClassLoader());
List<BootstrapService> bootstrapServices = new LinkedList<>();
bootstrapServices.addAll(propertiesBootstrapServiceDiscoverer.discover());
for (ArtifactPlugin artifactPlugin : artifactPlugins) {
final Enumeration<URL> resources = artifactPlugin.getArtifactClassLoader().findResources(BOOTSTRAP_PROPERTIES);
while (resources.hasMoreElements()) {
final URL localResource = resources.nextElement();
final Properties properties = PropertiesUtils.loadProperties(localResource);
final BootstrapService pluginBootstrapService = new PropertiesBootstrapService(artifactPlugin.getArtifactClassLoader().getClassLoader(), properties);
bootstrapServices.add(pluginBootstrapService);
}
}
muleContext.setBootstrapServiceDiscoverer(() -> bootstrapServices);
}
use of org.mule.runtime.core.api.config.bootstrap.PropertiesBootstrapServiceDiscoverer in project mule by mulesoft.
the class TestBootstrapServiceDiscovererConfigurationBuilder method doConfigure.
@Override
protected void doConfigure(MuleContext muleContext) throws Exception {
final PropertiesBootstrapServiceDiscoverer propertiesBootstrapServiceDiscoverer = new PropertiesBootstrapServiceDiscoverer(containerClassLoader);
List<BootstrapService> bootstrapServices = new LinkedList<>();
bootstrapServices.addAll(propertiesBootstrapServiceDiscoverer.discover());
// Uses Object instead of ArtifactClassLoader because that class was originally loaded from a different class loader
for (Object pluginClassLoader : pluginClassLoaders) {
List<BootstrapService> pluginBootstrapServices = getArtifactBootstrapService(pluginClassLoader);
bootstrapServices.addAll(pluginBootstrapServices);
}
List<BootstrapService> appBootstrapServices = getArtifactBootstrapService(executionClassLoader);
bootstrapServices.addAll(appBootstrapServices);
muleContext.setBootstrapServiceDiscoverer(() -> bootstrapServices);
}
Aggregations