Skip to content

Commit

Permalink
Modify KuduModule to use AbstractConfigurationAwareModule
Browse files Browse the repository at this point in the history
Subsequent commit will add kerberos config support to the kudumodule
  • Loading branch information
grantatspothero authored and hashhar committed Feb 24, 2022
1 parent 2af2b37 commit ab182c7
Showing 1 changed file with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
*/
package io.trino.plugin.kudu;

import com.google.inject.AbstractModule;
import com.google.inject.Binder;
import com.google.inject.Provides;
import com.google.inject.Scopes;
import com.google.inject.multibindings.Multibinder;
import com.google.inject.multibindings.ProvidesIntoSet;
import io.airlift.configuration.AbstractConfigurationAwareModule;
import io.trino.plugin.base.classloader.ClassLoaderSafeNodePartitioningProvider;
import io.trino.plugin.base.classloader.ForClassLoaderSafe;
import io.trino.plugin.kudu.procedures.RangePartitionProcedures;
Expand All @@ -39,7 +40,7 @@
import static java.util.Objects.requireNonNull;

public class KuduModule
extends AbstractModule
extends AbstractConfigurationAwareModule
{
private final TypeManager typeManager;

Expand All @@ -49,25 +50,25 @@ public KuduModule(TypeManager typeManager)
}

@Override
protected void configure()
protected void setup(Binder binder)
{
bind(TypeManager.class).toInstance(typeManager);
binder.bind(TypeManager.class).toInstance(typeManager);

bind(KuduConnector.class).in(Scopes.SINGLETON);
bind(KuduMetadata.class).in(Scopes.SINGLETON);
bind(KuduTableProperties.class).in(Scopes.SINGLETON);
bind(ConnectorSplitManager.class).to(KuduSplitManager.class).in(Scopes.SINGLETON);
bind(ConnectorPageSourceProvider.class).to(KuduPageSourceProvider.class)
binder.bind(KuduConnector.class).in(Scopes.SINGLETON);
binder.bind(KuduMetadata.class).in(Scopes.SINGLETON);
binder.bind(KuduTableProperties.class).in(Scopes.SINGLETON);
binder.bind(ConnectorSplitManager.class).to(KuduSplitManager.class).in(Scopes.SINGLETON);
binder.bind(ConnectorPageSourceProvider.class).to(KuduPageSourceProvider.class)
.in(Scopes.SINGLETON);
bind(ConnectorPageSinkProvider.class).to(KuduPageSinkProvider.class).in(Scopes.SINGLETON);
bind(KuduSessionProperties.class).in(Scopes.SINGLETON);
bind(ConnectorNodePartitioningProvider.class).annotatedWith(ForClassLoaderSafe.class).to(KuduNodePartitioningProvider.class).in(Scopes.SINGLETON);
bind(ConnectorNodePartitioningProvider.class).to(ClassLoaderSafeNodePartitioningProvider.class).in(Scopes.SINGLETON);
bind(KuduRecordSetProvider.class).in(Scopes.SINGLETON);
configBinder(binder()).bindConfig(KuduClientConfig.class);
binder.bind(ConnectorPageSinkProvider.class).to(KuduPageSinkProvider.class).in(Scopes.SINGLETON);
binder.bind(KuduSessionProperties.class).in(Scopes.SINGLETON);
binder.bind(ConnectorNodePartitioningProvider.class).annotatedWith(ForClassLoaderSafe.class).to(KuduNodePartitioningProvider.class).in(Scopes.SINGLETON);
binder.bind(ConnectorNodePartitioningProvider.class).to(ClassLoaderSafeNodePartitioningProvider.class).in(Scopes.SINGLETON);
binder.bind(KuduRecordSetProvider.class).in(Scopes.SINGLETON);
configBinder(binder).bindConfig(KuduClientConfig.class);

bind(RangePartitionProcedures.class).in(Scopes.SINGLETON);
Multibinder.newSetBinder(binder(), Procedure.class);
binder.bind(RangePartitionProcedures.class).in(Scopes.SINGLETON);
Multibinder.newSetBinder(binder, Procedure.class);
}

@ProvidesIntoSet
Expand Down

0 comments on commit ab182c7

Please sign in to comment.