use of com.facebook.presto.spi.storage.TempStorageFactory in project presto by prestodb.
the class PluginManager method installPlugin.
public void installPlugin(Plugin plugin) {
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());
metadata.getFunctionAndTypeManager().addType(type);
}
for (ParametricType parametricType : plugin.getParametricTypes()) {
log.info("Registering parametric type %s", parametricType.getName());
metadata.getFunctionAndTypeManager().addParametricType(parametricType);
}
for (ConnectorFactory connectorFactory : plugin.getConnectorFactories()) {
if (disabledConnectors.contains(connectorFactory.getName())) {
log.info("Skipping disabled connector %s", connectorFactory.getName());
continue;
}
log.info("Registering connector %s", connectorFactory.getName());
connectorManager.addConnectorFactory(connectorFactory);
}
for (Class<?> functionClass : plugin.getFunctions()) {
log.info("Registering functions from %s", functionClass.getName());
metadata.registerBuiltInFunctions(extractFunctions(functionClass));
}
for (FunctionNamespaceManagerFactory functionNamespaceManagerFactory : plugin.getFunctionNamespaceManagerFactories()) {
log.info("Registering function namespace manager %s", functionNamespaceManagerFactory.getName());
metadata.getFunctionAndTypeManager().addFunctionNamespaceFactory(functionNamespaceManagerFactory);
}
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);
}
for (PasswordAuthenticatorFactory authenticatorFactory : plugin.getPasswordAuthenticatorFactories()) {
log.info("Registering password authenticator %s", authenticatorFactory.getName());
passwordAuthenticatorManager.addPasswordAuthenticatorFactory(authenticatorFactory);
}
for (EventListenerFactory eventListenerFactory : plugin.getEventListenerFactories()) {
log.info("Registering event listener %s", eventListenerFactory.getName());
eventListenerManager.addEventListenerFactory(eventListenerFactory);
}
for (TempStorageFactory tempStorageFactory : plugin.getTempStorageFactories()) {
log.info("Registering temp storage %s", tempStorageFactory.getName());
tempStorageManager.addTempStorageFactory(tempStorageFactory);
}
for (QueryPrerequisitesFactory queryPrerequisitesFactory : plugin.getQueryPrerequisitesFactories()) {
log.info("Registering query prerequisite factory %s", queryPrerequisitesFactory.getName());
queryPrerequisitesManager.addQueryPrerequisitesFactory(queryPrerequisitesFactory);
}
for (NodeTtlFetcherFactory nodeTtlFetcherFactory : plugin.getNodeTtlFetcherFactories()) {
log.info("Registering Ttl fetcher factory %s", nodeTtlFetcherFactory.getName());
nodeTtlFetcherManager.addNodeTtlFetcherFactory(nodeTtlFetcherFactory);
}
for (ClusterTtlProviderFactory clusterTtlProviderFactory : plugin.getClusterTtlProviderFactories()) {
log.info("Registering Cluster Ttl provider factory %s", clusterTtlProviderFactory.getName());
clusterTtlProviderManager.addClusterTtlProviderFactory(clusterTtlProviderFactory);
}
}
use of com.facebook.presto.spi.storage.TempStorageFactory in project presto by prestodb.
the class TempStorageManager method loadTempStorage.
protected void loadTempStorage(String name, Map<String, String> properties) {
requireNonNull(name, "name is null");
requireNonNull(properties, "properties is null");
log.info("-- Loading temp storage %s --", name);
String tempStorageFactoryName = null;
ImmutableMap.Builder<String, String> tempStorageProperties = ImmutableMap.builder();
for (Map.Entry<String, String> entry : properties.entrySet()) {
if (entry.getKey().equals(TEMP_STORAGE_FACTORY_NAME)) {
tempStorageFactoryName = entry.getValue();
} else {
tempStorageProperties.put(entry.getKey(), entry.getValue());
}
}
checkState(tempStorageFactoryName != null, "Configuration for tempStorage %s does not contain temp-storage-factory.name", name);
TempStorageFactory factory = tempStorageFactories.get(tempStorageFactoryName);
checkState(factory != null, "Temp Storage Factory %s is not registered", tempStorageFactoryName);
TempStorage tempStorage = factory.create(tempStorageProperties.build(), new TempStorageContext(nodeManager));
if (loadedTempStorages.putIfAbsent(name, tempStorage) != null) {
throw new IllegalArgumentException(format("Temp Storage '%s' is already loaded", name));
}
log.info("-- Loaded temp storage %s --", name);
}
Aggregations