use of com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorMetadata in project carbondata by apache.
the class CarbondataConnectorFactory method create.
@Override
public Connector create(String connectorId, Map<String, String> config, ConnectorContext context) {
requireNonNull(config, "config is null");
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
Bootstrap app = new Bootstrap(new JsonModule(), new CarbondataModule(connectorId, context.getTypeManager()));
Injector injector = app.strictConfig().doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
LifeCycleManager lifeCycleManager = injector.getInstance(LifeCycleManager.class);
ConnectorMetadata metadata = injector.getInstance(CarbondataMetadata.class);
ConnectorSplitManager splitManager = injector.getInstance(ConnectorSplitManager.class);
ConnectorRecordSetProvider connectorRecordSet = injector.getInstance(ConnectorRecordSetProvider.class);
ConnectorPageSourceProvider connectorPageSource = injector.getInstance(ConnectorPageSourceProvider.class);
return new CarbondataConnector(lifeCycleManager, new ClassLoaderSafeConnectorMetadata(metadata, classLoader), new ClassLoaderSafeConnectorSplitManager(splitManager, classLoader), connectorRecordSet, classLoader, new ClassLoaderSafeConnectorPageSourceProvider(connectorPageSource, classLoader));
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
use of com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorMetadata in project presto by prestodb.
the class HiveConnector method getMetadata.
@Override
public ConnectorMetadata getMetadata(ConnectorTransactionHandle transaction) {
ConnectorMetadata metadata = transactionManager.get(transaction);
checkArgument(metadata != null, "no such transaction: %s", transaction);
return new ClassLoaderSafeConnectorMetadata(metadata, classLoader);
}
Aggregations