Search in sources :

Example 1 with DruidAuthenticationModule

use of com.facebook.presto.druid.authentication.DruidAuthenticationModule in project presto by prestodb.

the class DruidConnectorFactory method create.

@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) {
    requireNonNull(config, "config is null");
    try {
        Bootstrap app = new Bootstrap(new JsonModule(), new DruidModule(), new DruidAuthenticationModule(), binder -> {
            binder.bind(TypeManager.class).toInstance(context.getTypeManager());
            binder.bind(FunctionMetadataManager.class).toInstance(context.getFunctionMetadataManager());
            binder.bind(RowExpressionService.class).toInstance(context.getRowExpressionService());
            binder.bind(StandardFunctionResolution.class).toInstance(context.getStandardFunctionResolution());
            binder.bind(DeterminismEvaluator.class).toInstance(context.getRowExpressionService().getDeterminismEvaluator());
        });
        Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
        return injector.getInstance(DruidConnector.class);
    } catch (Exception e) {
        throwIfUnchecked(e);
        throw new RuntimeException(e);
    }
}
Also used : DruidAuthenticationModule(com.facebook.presto.druid.authentication.DruidAuthenticationModule) RowExpressionService(com.facebook.presto.spi.relation.RowExpressionService) DeterminismEvaluator(com.facebook.presto.spi.relation.DeterminismEvaluator) Injector(com.google.inject.Injector) Bootstrap(com.facebook.airlift.bootstrap.Bootstrap) TypeManager(com.facebook.presto.common.type.TypeManager) StandardFunctionResolution(com.facebook.presto.spi.function.StandardFunctionResolution) JsonModule(com.facebook.airlift.json.JsonModule) FunctionMetadataManager(com.facebook.presto.spi.function.FunctionMetadataManager)

Aggregations

Bootstrap (com.facebook.airlift.bootstrap.Bootstrap)1 JsonModule (com.facebook.airlift.json.JsonModule)1 TypeManager (com.facebook.presto.common.type.TypeManager)1 DruidAuthenticationModule (com.facebook.presto.druid.authentication.DruidAuthenticationModule)1 FunctionMetadataManager (com.facebook.presto.spi.function.FunctionMetadataManager)1 StandardFunctionResolution (com.facebook.presto.spi.function.StandardFunctionResolution)1 DeterminismEvaluator (com.facebook.presto.spi.relation.DeterminismEvaluator)1 RowExpressionService (com.facebook.presto.spi.relation.RowExpressionService)1 Injector (com.google.inject.Injector)1