use of io.prestosql.spi.filesystem.HetuFileSystemClientFactory in project hetu-core by openlookeng.
the class PluginManager method installPlugin.
public void installPlugin(Plugin plugin) {
for (BlockEncoding blockEncoding : plugin.getBlockEncodings()) {
log.info("Registering block encoding %s", blockEncoding.getName());
metadataManager.getFunctionAndTypeManager().addBlockEncoding(blockEncoding);
}
for (Type type : plugin.getTypes()) {
log.info("Registering type %s", type.getTypeSignature());
metadataManager.getFunctionAndTypeManager().addType(type);
}
for (ParametricType parametricType : plugin.getParametricTypes()) {
log.info("Registering parametric type %s", parametricType.getName());
metadataManager.getFunctionAndTypeManager().addParametricType(parametricType);
}
for (ConnectorFactory connectorFactory : plugin.getConnectorFactories()) {
log.info("Registering connector %s", connectorFactory.getName());
connectorManager.addConnectorFactory(connectorFactory);
ConnectorCache.addCatalogConfig(plugin, connectorFactory.getName());
}
for (SessionPropertyConfigurationManagerFactory sessionConfigFactory : plugin.getSessionPropertyConfigurationManagerFactories()) {
log.info("Registering session property configuration manager %s", sessionConfigFactory.getName());
sessionPropertyDefaults.addConfigurationManagerFactory(sessionConfigFactory);
}
for (FunctionNamespaceManagerFactory functionNamespaceManagerFactory : plugin.getFunctionNamespaceManagerFactories()) {
log.info("Registering function namespace manager %s", functionNamespaceManagerFactory.getName());
metadataManager.getFunctionAndTypeManager().addFunctionNamespaceFactory(functionNamespaceManagerFactory);
}
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 (GroupProviderFactory groupProviderFactory : plugin.getGroupProviderFactories()) {
log.info("Registering group provider %s", groupProviderFactory.getName());
groupProviderManager.addGroupProviderFactory(groupProviderFactory);
}
// Install StateStorePlugin
for (StateStoreBootstrapper bootstrapper : plugin.getStateStoreBootstrappers()) {
log.info("Registering state store bootstrapper");
stateStoreLauncher.addStateStoreBootstrapper(bootstrapper);
}
for (StateStoreFactory stateStoreFactory : plugin.getStateStoreFactories()) {
log.info("Registering state store %s", stateStoreFactory.getName());
localStateStoreProvider.addStateStoreFactory(stateStoreFactory);
}
for (SeedStoreFactory seedStoreFactory : plugin.getSeedStoreFactories()) {
log.info("Registering seed store %s", seedStoreFactory.getName());
seedStoreManager.addSeedStoreFactory(seedStoreFactory);
}
for (CubeProvider cubeProvider : plugin.getCubeProviders()) {
log.info("Registering cube provider %s", cubeProvider.getName());
cubeManager.addCubeProvider(cubeProvider);
}
for (HetuFileSystemClientFactory fileSystemClientFactory : plugin.getFileSystemClientFactory()) {
log.info("Registering file system provider %s", fileSystemClientFactory.getName());
fileSystemClientManager.addFileSystemClientFactories(fileSystemClientFactory);
}
for (HetuMetaStoreFactory hetuMetaStoreFactory : plugin.getHetuMetaStoreFactories()) {
log.info("Registering hetu metastore %s", hetuMetaStoreFactory.getName());
hetuMetaStoreManager.addHetuMetaStoreFactory(hetuMetaStoreFactory);
}
for (IndexFactory indexFactory : plugin.getIndexFactories()) {
log.info("Loading index factory");
heuristicIndexerManager.loadIndexFactories(indexFactory);
}
installFunctionsPlugin(plugin);
}
use of io.prestosql.spi.filesystem.HetuFileSystemClientFactory in project hetu-core by openlookeng.
the class TestHetuFileSystemClientFactory method testCreateHdfsFS.
/**
* Test creating HetuHdfsFileSystemClient
*
* @throws IOException
*/
@Test
public void testCreateHdfsFS() throws IOException {
HetuFileSystemClientFactory factory = new HdfsFileSystemClientFactory();
Properties properties = new Properties();
properties.setProperty("fs.client.type", "hdfs");
properties.setProperty("hdfs.config.resources", getResourcePath("docker_config/core-site.xml") + "," + getResourcePath("docker_config/hdfs-site.xml"));
properties.setProperty("hdfs.authentication.type", "KERBEROS");
properties.setProperty("hdfs.krb5.conf.path", getResourcePath("docker_config/docker_krb5.conf"));
properties.setProperty("hdfs.krb5.keytab.path", getResourcePath("docker_config/user.keytab"));
properties.setProperty("hdfs.krb5.principal", "user@HADOOP.COM");
try (HetuFileSystemClient fs = factory.getFileSystemClient((properties), Paths.get("/"))) {
assertSame(fs.getClass(), HetuHdfsFileSystemClient.class);
}
}
use of io.prestosql.spi.filesystem.HetuFileSystemClientFactory in project hetu-core by openlookeng.
the class FileSystemClientManager method getFileSystemClient.
/**
* Get a file system client with a user-defined properties object
*
* @param properties properties used to construct the file system client
* @param root Workspace root of the filesystem client. It will only be allowed to access filesystem within this directory.
* @return a {@link HetuFileSystemClient}
* @throws IOException exception thrown during constructing the client
*/
public HetuFileSystemClient getFileSystemClient(Properties properties, Path root) throws IOException {
String type = checkProperty(properties, FS_CLIENT_TYPE);
checkState(fileSystemFactories.containsKey(type), "Factory for file system type %s not found", type);
HetuFileSystemClientFactory factory = fileSystemFactories.get(type);
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(factory.getClass().getClassLoader())) {
return factory.getFileSystemClient(properties, root);
}
}
use of io.prestosql.spi.filesystem.HetuFileSystemClientFactory in project hetu-core by openlookeng.
the class TestHetuFileSystemClientFactory method testCreateLocalFS.
/**
* Test creating HetuLocalFileSystemClient
*
* @throws IOException
*/
@Test
public void testCreateLocalFS() throws IOException {
HetuFileSystemClientFactory factory = new LocalFileSystemClientFactory();
Properties properties = new Properties();
properties.setProperty("fs.client.type", "local");
try (HetuFileSystemClient fs = factory.getFileSystemClient(properties, Paths.get("/"))) {
assertSame(fs.getClass(), HetuLocalFileSystemClient.class);
}
}
use of io.prestosql.spi.filesystem.HetuFileSystemClientFactory in project hetu-core by openlookeng.
the class FileSystemClientManager method getFileSystemClient.
/**
* Get a file system client with pre-defined profile in filesystem config folder
*
* @param name name of the filesystem profile defined in the filesystem config folder,
* or the default profile name (same as {@link FileSystemClientManager#getFileSystemClient(Path)} if provide default name)
* @param root Workspace root of the filesystem client. It will only be allowed to access filesystem within this directory.
* @return a {@link HetuFileSystemClient}
* @throws IOException exception thrown during constructing the client
*/
public HetuFileSystemClient getFileSystemClient(String name, Path root) throws IOException {
if (!availableFileSystemConfigs.containsKey(name)) {
throw new IllegalArgumentException(String.format("Profile %s is not available. Please check the name provided.", name));
}
Properties fsConfig = availableFileSystemConfigs.get(name);
String type = fsConfig.getProperty(FS_CLIENT_TYPE);
HetuFileSystemClientFactory factory = fileSystemFactories.get(type);
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(factory.getClass().getClassLoader())) {
return factory.getFileSystemClient(fsConfig, root);
}
}
Aggregations