use of org.mule.runtime.core.internal.registry.DefaultRegistryBroker in project mule by mulesoft.
the class DefaultMuleContextBuilder method buildMuleContext.
/**
* {@inheritDoc}
*/
@Override
public MuleContext buildMuleContext() {
logger.debug("Building new DefaultMuleContext instance with MuleContextBuilder: " + this);
DefaultMuleContext muleContext = createDefaultMuleContext();
muleContext.setMuleConfiguration(injectMuleContextIfRequired(getMuleConfiguration(), muleContext));
muleContext.setNotificationManager(injectMuleContextIfRequired(getNotificationManager(), muleContext));
muleContext.setLifecycleManager(injectMuleContextIfRequired(getLifecycleManager(), muleContext));
muleContext.setArtifactType(artifactType);
DefaultRegistryBroker registryBroker = new DefaultRegistryBroker(muleContext, muleContext.getLifecycleInterceptor());
muleContext.setRegistryBroker(registryBroker);
MuleRegistryHelper muleRegistry = new MuleRegistryHelper(registryBroker, muleContext);
muleContext.setMuleRegistry(muleRegistry);
muleContext.setInjector(new RegistryDelegatingInjector(muleRegistry));
muleContext.setExceptionListener(createExceptionListener(muleContext));
muleContext.setExecutionClassLoader(getExecutionClassLoader());
muleContext.setBootstrapServiceDiscoverer(injectMuleContextIfRequired(createBootstrapDiscoverer(), muleContext));
muleContext.setDeploymentProperties(getDeploymentProperties());
muleContext.setListeners(listeners);
getObjectSerializer(muleContext);
if (errorTypeRepository == null) {
errorTypeRepository = createDefaultErrorTypeRepository();
}
muleContext.setErrorTypeRepository(errorTypeRepository);
muleContext.setErrorTypeLocator(createDefaultErrorTypeLocator(errorTypeRepository));
return muleContext;
}
use of org.mule.runtime.core.internal.registry.DefaultRegistryBroker in project mule by mulesoft.
the class ExtensionPluginMetadataGenerator method createExtensionManager.
/**
* Creates a {@link ExtensionManager} needed for generating the metadata for an extension. It would be later discarded due to
* the manager would have references to classes loaded with the launcher class loader instead of the hierarchical class loaders
* created as result of the classification process.
*
* @return an {@link ExtensionManager} that would be used to register the extensions.
*/
private ExtensionManager createExtensionManager() {
DefaultExtensionManager extensionManager = new DefaultExtensionManager();
extensionManager.setMuleContext(new DefaultMuleContext() {
private ErrorTypeRepository errorTypeRepository = createDefaultErrorTypeRepository();
private ErrorTypeLocator errorTypeLocator = createDefaultErrorTypeLocator(errorTypeRepository);
@Override
public MuleRegistry getRegistry() {
return new MuleRegistryHelper(new DefaultRegistryBroker(this, new MuleLifecycleInterceptor()), this);
}
@Override
public ErrorTypeLocator getErrorTypeLocator() {
return errorTypeLocator;
}
@Override
public ErrorTypeRepository getErrorTypeRepository() {
return errorTypeRepository;
}
});
try {
extensionManager.initialise();
} catch (InitialisationException e) {
throw new RuntimeException("Error while initialising the extension manager", e);
}
return extensionManager;
}
Aggregations