use of io.trino.spi.exchange.ExchangeManagerFactory in project trino by trinodb.
the class PluginManager method installPluginInternal.
private void installPluginInternal(Plugin plugin, Function<CatalogName, ClassLoader> duplicatePluginClassLoaderFactory) {
for (BlockEncoding blockEncoding : plugin.getBlockEncodings()) {
log.info("Registering block encoding %s", blockEncoding.getName());
blockEncodingManager.addBlockEncoding(blockEncoding);
}
for (Type type : plugin.getTypes()) {
log.info("Registering type %s", type.getTypeSignature());
typeRegistry.addType(type);
}
for (ParametricType parametricType : plugin.getParametricTypes()) {
log.info("Registering parametric type %s", parametricType.getName());
typeRegistry.addParametricType(parametricType);
}
for (ConnectorFactory connectorFactory : plugin.getConnectorFactories()) {
log.info("Registering connector %s", connectorFactory.getName());
connectorManager.addConnectorFactory(connectorFactory, duplicatePluginClassLoaderFactory);
}
Set<Class<?>> functions = plugin.getFunctions();
if (!functions.isEmpty()) {
log.info("Registering functions from %s", plugin.getClass().getSimpleName());
InternalFunctionBundleBuilder builder = InternalFunctionBundle.builder();
functions.forEach(builder::functions);
globalFunctionCatalog.addFunctions(builder.build());
}
for (SessionPropertyConfigurationManagerFactory sessionConfigFactory : plugin.getSessionPropertyConfigurationManagerFactories()) {
log.info("Registering session property configuration manager %s", sessionConfigFactory.getName());
sessionPropertyDefaults.addConfigurationManagerFactory(sessionConfigFactory);
}
for (ResourceGroupConfigurationManagerFactory configurationManagerFactory : plugin.getResourceGroupConfigurationManagerFactories()) {
log.info("Registering resource group configuration manager %s", configurationManagerFactory.getName());
resourceGroupManager.addConfigurationManagerFactory(configurationManagerFactory);
}
for (SystemAccessControlFactory accessControlFactory : plugin.getSystemAccessControlFactories()) {
log.info("Registering system access control %s", accessControlFactory.getName());
accessControlManager.addSystemAccessControlFactory(accessControlFactory);
}
passwordAuthenticatorManager.ifPresent(authenticationManager -> {
for (PasswordAuthenticatorFactory authenticatorFactory : plugin.getPasswordAuthenticatorFactories()) {
log.info("Registering password authenticator %s", authenticatorFactory.getName());
authenticationManager.addPasswordAuthenticatorFactory(authenticatorFactory);
}
});
for (CertificateAuthenticatorFactory authenticatorFactory : plugin.getCertificateAuthenticatorFactories()) {
log.info("Registering certificate authenticator %s", authenticatorFactory.getName());
certificateAuthenticatorManager.addCertificateAuthenticatorFactory(authenticatorFactory);
}
headerAuthenticatorManager.ifPresent(authenticationManager -> {
for (HeaderAuthenticatorFactory authenticatorFactory : plugin.getHeaderAuthenticatorFactories()) {
log.info("Registering header authenticator %s", authenticatorFactory.getName());
authenticationManager.addHeaderAuthenticatorFactory(authenticatorFactory);
}
});
for (EventListenerFactory eventListenerFactory : plugin.getEventListenerFactories()) {
log.info("Registering event listener %s", eventListenerFactory.getName());
eventListenerManager.addEventListenerFactory(eventListenerFactory);
}
for (GroupProviderFactory groupProviderFactory : plugin.getGroupProviderFactories()) {
log.info("Registering group provider %s", groupProviderFactory.getName());
groupProviderManager.addGroupProviderFactory(groupProviderFactory);
}
for (ExchangeManagerFactory exchangeManagerFactory : plugin.getExchangeManagerFactories()) {
log.info("Registering exchange manager %s", exchangeManagerFactory.getName());
exchangeManagerRegistry.addExchangeManagerFactory(exchangeManagerFactory);
}
}
use of io.trino.spi.exchange.ExchangeManagerFactory in project trino by trinodb.
the class ExchangeManagerRegistry method loadExchangeManager.
public synchronized void loadExchangeManager(String name, Map<String, String> properties) {
log.info("-- Loading exchange manager %s --", name);
checkState(exchangeManager == null, "exchangeManager is already loaded");
ExchangeManagerFactory factory = exchangeManagerFactories.get(name);
checkArgument(factory != null, "Exchange manager factory '%s' is not registered. Available factories: %s", name, exchangeManagerFactories.keySet());
ExchangeManager exchangeManager;
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(factory.getClass().getClassLoader())) {
exchangeManager = factory.create(properties);
}
handleResolver.setExchangeManagerHandleResolver(factory.getHandleResolver());
log.info("-- Loaded exchange manager %s --", name);
this.exchangeManager = exchangeManager;
}
Aggregations