use of io.trino.plugin.base.TypeDeserializerModule in project trino by trinodb.
the class AccumuloConnectorFactory method create.
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) {
requireNonNull(catalogName, "catalogName is null");
requireNonNull(config, "config is null");
requireNonNull(context, "context is null");
Bootstrap app = new Bootstrap(new JsonModule(), new TypeDeserializerModule(context.getTypeManager()), new AccumuloModule());
Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
return injector.getInstance(AccumuloConnector.class);
}
use of io.trino.plugin.base.TypeDeserializerModule in project trino by trinodb.
the class TestingKinesisConnectorFactory method create.
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) {
requireNonNull(catalogName, "catalogName is null");
requireNonNull(config, "config is null");
try {
Bootstrap app = new Bootstrap(new JsonModule(), new TypeDeserializerModule(context.getTypeManager()), new KinesisModule(), binder -> {
binder.bind(NodeManager.class).toInstance(context.getNodeManager());
binder.bind(KinesisClientProvider.class).toInstance(kinesisClientProvider);
binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, KinesisStreamDescription>>>() {
}).to(KinesisTableDescriptionSupplier.class).in(Scopes.SINGLETON);
});
Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
KinesisConnector connector = injector.getInstance(KinesisConnector.class);
return connector;
} catch (Exception e) {
throwIfUnchecked(e);
throw new RuntimeException(e);
}
}
use of io.trino.plugin.base.TypeDeserializerModule in project trino by trinodb.
the class RedisConnectorFactory method create.
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) {
requireNonNull(catalogName, "catalogName is null");
requireNonNull(config, "config is null");
Bootstrap app = new Bootstrap(new JsonModule(), new TypeDeserializerModule(context.getTypeManager()), new RedisConnectorModule(), binder -> {
binder.bind(NodeManager.class).toInstance(context.getNodeManager());
if (tableDescriptionSupplier.isPresent()) {
binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, RedisTableDescription>>>() {
}).toInstance(tableDescriptionSupplier.get());
} else {
binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, RedisTableDescription>>>() {
}).to(RedisTableDescriptionSupplier.class).in(Scopes.SINGLETON);
}
});
Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
return injector.getInstance(RedisConnector.class);
}
use of io.trino.plugin.base.TypeDeserializerModule in project trino by trinodb.
the class PinotConnectorFactory method create.
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) {
requireNonNull(catalogName, "catalogName is null");
requireNonNull(config, "config is null");
ImmutableList.Builder<Module> modulesBuilder = ImmutableList.<Module>builder().add(new JsonModule()).add(new MBeanModule()).add(new TypeDeserializerModule(context.getTypeManager())).add(new PinotModule(catalogName, context.getNodeManager())).add(new PinotAuthenticationModule());
extension.ifPresent(modulesBuilder::add);
Bootstrap app = new Bootstrap(modulesBuilder.build());
Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
return injector.getInstance(PinotConnector.class);
}
use of io.trino.plugin.base.TypeDeserializerModule in project trino by trinodb.
the class KinesisConnectorFactory method create.
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) {
requireNonNull(catalogName, "catalogName is null");
requireNonNull(config, "config is null");
try {
Bootstrap app = new Bootstrap(new JsonModule(), new TypeDeserializerModule(context.getTypeManager()), new KinesisModule(), binder -> {
binder.bind(NodeManager.class).toInstance(context.getNodeManager());
binder.bind(KinesisClientProvider.class).to(KinesisClientManager.class).in(Scopes.SINGLETON);
binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, KinesisStreamDescription>>>() {
}).to(KinesisTableDescriptionSupplier.class).in(Scopes.SINGLETON);
});
Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
return injector.getInstance(KinesisConnector.class);
} catch (Exception e) {
throwIfUnchecked(e);
throw new RuntimeException(e);
}
}
Aggregations