@Override public void configure(Binder binder) { binder.bind(CassandraConnectorId.class).toInstance(new CassandraConnectorId(connectorId)); binder.bind(CassandraConnector.class).in(Scopes.SINGLETON); binder.bind(CassandraMetadata.class).in(Scopes.SINGLETON); binder.bind(CassandraSplitManager.class).in(Scopes.SINGLETON); binder.bind(CassandraTokenSplitManager.class).in(Scopes.SINGLETON); binder.bind(CassandraRecordSetProvider.class).in(Scopes.SINGLETON); binder.bind(CassandraPageSinkProvider.class).in(Scopes.SINGLETON); binder.bind(CassandraPartitionManager.class).in(Scopes.SINGLETON); binder.bind(CassandraSessionProperties.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(CassandraClientConfig.class); jsonCodecBinder(binder).bindListJsonCodec(ExtraColumnMetadata.class); }
@Override public void configure(Binder binder) { binder.bind(TypeManager.class).toInstance(typeManager); binder.bind(ExampleConnector.class).in(Scopes.SINGLETON); binder.bind(ExampleConnectorId.class).toInstance(new ExampleConnectorId(connectorId)); binder.bind(ExampleMetadata.class).in(Scopes.SINGLETON); binder.bind(ExampleClient.class).in(Scopes.SINGLETON); binder.bind(ExampleSplitManager.class).in(Scopes.SINGLETON); binder.bind(ExampleRecordSetProvider.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(ExampleConfig.class); jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class); jsonCodecBinder(binder).bindMapJsonCodec(String.class, listJsonCodec(ExampleTable.class)); }
@Override public void configure(Binder binder) { binder.bind(KafkaConnector.class).in(Scopes.SINGLETON); binder.bind(KafkaMetadata.class).in(Scopes.SINGLETON); binder.bind(KafkaSplitManager.class).in(Scopes.SINGLETON); binder.bind(KafkaRecordSetProvider.class).in(Scopes.SINGLETON); binder.bind(KafkaSimpleConsumerManager.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(KafkaConnectorConfig.class); jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class); jsonCodecBinder(binder).bindJsonCodec(KafkaTopicDescription.class); binder.install(new DecoderModule()); }
@Override public void configure(Binder binder) { binder.bind(RedisConnector.class).in(Scopes.SINGLETON); binder.bind(RedisMetadata.class).in(Scopes.SINGLETON); binder.bind(RedisSplitManager.class).in(Scopes.SINGLETON); binder.bind(RedisRecordSetProvider.class).in(Scopes.SINGLETON); binder.bind(RedisJedisManager.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(RedisConnectorConfig.class); jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class); jsonCodecBinder(binder).bindJsonCodec(RedisTableDescription.class); binder.install(new RedisDecoderModule()); }
@Override public void configure(Binder binder) { binder.bind(ElasticsearchConnector.class).in(Scopes.SINGLETON); binder.bind(ElasticsearchMetadata.class).in(Scopes.SINGLETON); binder.bind(ElasticsearchSplitManager.class).in(Scopes.SINGLETON); binder.bind(ElasticsearchRecordSetProvider.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(ElasticsearchConnectorConfig.class); jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class); jsonCodecBinder(binder).bindJsonCodec(ElasticsearchTableDescription.class); binder.install(new DecoderModule()); }
@Override public void configure(Binder binder) { // Add appender to Log4J root logger JulAppender appender = new JulAppender(); //create appender appender.setLayout(new PatternLayout("%d %-5p %c - %m%n")); appender.setThreshold(Level.INFO); appender.activateOptions(); org.apache.log4j.Logger.getRootLogger().addAppender(appender); binder.bind(TypeManager.class).toInstance(typeManager); binder.bind(AccumuloConnector.class).in(Scopes.SINGLETON); binder.bind(AccumuloConnectorId.class).toInstance(new AccumuloConnectorId(connectorId)); binder.bind(AccumuloMetadata.class).in(Scopes.SINGLETON); binder.bind(AccumuloMetadataFactory.class).in(Scopes.SINGLETON); binder.bind(AccumuloClient.class).in(Scopes.SINGLETON); binder.bind(AccumuloSplitManager.class).in(Scopes.SINGLETON); binder.bind(AccumuloRecordSetProvider.class).in(Scopes.SINGLETON); binder.bind(AccumuloPageSinkProvider.class).in(Scopes.SINGLETON); binder.bind(AccumuloHandleResolver.class).in(Scopes.SINGLETON); binder.bind(AccumuloSessionProperties.class).in(Scopes.SINGLETON); binder.bind(AccumuloTableProperties.class).in(Scopes.SINGLETON); binder.bind(ZooKeeperMetadataManager.class).in(Scopes.SINGLETON); binder.bind(AccumuloTableManager.class).in(Scopes.SINGLETON); binder.bind(IndexLookup.class).in(Scopes.SINGLETON); binder.bind(ColumnCardinalityCache.class).in(Scopes.SINGLETON); binder.bind(Connector.class).toProvider(ConnectorProvider.class); configBinder(binder).bindConfig(AccumuloConfig.class); jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class); jsonCodecBinder(binder).bindMapJsonCodec(String.class, JsonCodec.listJsonCodec(AccumuloTable.class)); }
binder.bind(ConnectorNodePartitioningProvider.class).to(HiveNodePartitioningProvider.class).in(Scopes.SINGLETON); jsonCodecBinder(binder).bindJsonCodec(PartitionUpdate.class);
@Override public void configure(Binder binder) { binder.bind(JsonMapper.class); configBinder(binder).bindConfig(FeaturesConfig.class); binder.bind(TypeRegistry.class).in(Scopes.SINGLETON); binder.bind(TypeManager.class).to(TypeRegistry.class).in(Scopes.SINGLETON); jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class); newSetBinder(binder, Type.class); jsonCodecBinder(binder).bindJsonCodec(TaskStatus.class); jsonCodecBinder(binder).bindJsonCodec(TaskInfo.class); jsonCodecBinder(binder).bindJsonCodec(TaskUpdateRequest.class); }
jsonCodecBinder(binder).bindJsonCodec(ViewDefinition.class); binder.bind(LookupJoinOperators.class).in(Scopes.SINGLETON); jsonCodecBinder(binder).bindJsonCodec(TaskStatus.class); jsonCodecBinder(binder).bindJsonCodec(StageInfo.class); jsonCodecBinder(binder).bindJsonCodec(TaskInfo.class); jsonCodecBinder(binder).bindJsonCodec(OperatorStats.class); jsonCodecBinder(binder).bindJsonCodec(ExecutionFailureInfo.class); jaxrsBinder(binder).bind(PagesResponseWriter.class); jsonCodecBinder(binder).bindJsonCodec(MemoryInfo.class); jsonCodecBinder(binder).bindJsonCodec(MemoryPoolAssignmentsRequest.class); jsonCodecBinder(binder).bindJsonCodec(TaskUpdateRequest.class); jsonCodecBinder(binder).bindJsonCodec(ConnectorSplit.class); jsonBinder(binder).addSerializerBinding(Slice.class).to(SliceSerializer.class); jsonBinder(binder).addDeserializerBinding(Slice.class).to(SliceDeserializer.class); jsonCodecBinder(binder).bindJsonCodec(ServerInfo.class); jsonCodecBinder(binder).bindJsonCodec(NodeStatus.class);
jsonCodecBinder(binder).bindJsonCodec(QueryInfo.class); jsonCodecBinder(binder).bindJsonCodec(TaskInfo.class); jsonCodecBinder(binder).bindJsonCodec(QueryResults.class); jaxrsBinder(binder).bind(StatementResource.class); binder.bind(StatementHttpExecutionMBean.class).in(Scopes.SINGLETON);
@Override public void configure(Binder binder) { binder.bind(CassandraConnectorId.class).toInstance(new CassandraConnectorId(connectorId)); binder.bind(CassandraConnector.class).in(Scopes.SINGLETON); binder.bind(CassandraMetadata.class).in(Scopes.SINGLETON); binder.bind(CassandraSplitManager.class).in(Scopes.SINGLETON); binder.bind(CassandraTokenSplitManager.class).in(Scopes.SINGLETON); binder.bind(CassandraRecordSetProvider.class).in(Scopes.SINGLETON); binder.bind(CassandraPageSinkProvider.class).in(Scopes.SINGLETON); binder.bind(CassandraPartitionManager.class).in(Scopes.SINGLETON); binder.bind(CassandraSessionProperties.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(CassandraClientConfig.class); jsonCodecBinder(binder).bindListJsonCodec(ExtraColumnMetadata.class); }
@Override public void configure(Binder binder) { binder.bind(TypeManager.class).toInstance(typeManager); binder.bind(ExampleConnector.class).in(Scopes.SINGLETON); binder.bind(ExampleConnectorId.class).toInstance(new ExampleConnectorId(connectorId)); binder.bind(ExampleMetadata.class).in(Scopes.SINGLETON); binder.bind(ExampleClient.class).in(Scopes.SINGLETON); binder.bind(ExampleSplitManager.class).in(Scopes.SINGLETON); binder.bind(ExampleRecordSetProvider.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(ExampleConfig.class); jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class); jsonCodecBinder(binder).bindMapJsonCodec(String.class, listJsonCodec(ExampleTable.class)); }
@Override public void configure(Binder binder) { binder.bind(TypeManager.class).toInstance(typeManager); binder.bind(ExampleConnector.class).in(Scopes.SINGLETON); binder.bind(ExampleConnectorId.class).toInstance(new ExampleConnectorId(connectorId)); binder.bind(ExampleMetadata.class).in(Scopes.SINGLETON); binder.bind(ExampleClient.class).in(Scopes.SINGLETON); binder.bind(ExampleSplitManager.class).in(Scopes.SINGLETON); binder.bind(ExampleRecordSetProvider.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(ExampleConfig.class); jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class); jsonCodecBinder(binder).bindMapJsonCodec(String.class, listJsonCodec(ExampleTable.class)); }
@Override public void configure(Binder binder) { binder.bind(KafkaConnector.class).in(Scopes.SINGLETON); binder.bind(KafkaMetadata.class).in(Scopes.SINGLETON); binder.bind(KafkaSplitManager.class).in(Scopes.SINGLETON); binder.bind(KafkaRecordSetProvider.class).in(Scopes.SINGLETON); binder.bind(KafkaSimpleConsumerManager.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(KafkaConnectorConfig.class); jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class); jsonCodecBinder(binder).bindJsonCodec(KafkaTopicDescription.class); binder.install(new DecoderModule()); }
@Override public void configure(Binder binder) { jsonCodecBinder(binder).bindJsonCodec(Integer.class); jsonCodecBinder(binder).bindJsonCodec(Integer.class); binder.bind(Dummy.class).in(Scopes.SINGLETON); } });
@Test public void ignoresRepeatedBinding() { Injector injector = Guice.createInjector((Module) binder -> { jsonCodecBinder(binder).bindJsonCodec(Integer.class); jsonCodecBinder(binder).bindJsonCodec(Integer.class); binder.bind(Dummy.class).in(Scopes.SINGLETON); }); assertNotNull(injector.getInstance(Dummy.class).getCodec()); }
@Test public void ignoresRepeatedBinding() { Injector injector = Guice.createInjector((Module) binder -> { jsonCodecBinder(binder).bindJsonCodec(Integer.class); jsonCodecBinder(binder).bindJsonCodec(Integer.class); binder.bind(Dummy.class).in(Scopes.SINGLETON); }); assertNotNull(injector.getInstance(Dummy.class).getCodec()); }
@Override public void configure(Binder binder) { binder.bind(JsonMapper.class); configBinder(binder).bindConfig(FeaturesConfig.class); binder.bind(TypeRegistry.class).in(Scopes.SINGLETON); binder.bind(TypeManager.class).to(TypeRegistry.class).in(Scopes.SINGLETON); jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class); newSetBinder(binder, Type.class); jsonCodecBinder(binder).bindJsonCodec(TaskStatus.class); jsonCodecBinder(binder).bindJsonCodec(TaskInfo.class); jsonCodecBinder(binder).bindJsonCodec(TaskUpdateRequest.class); }
@Override public void configure(Binder binder) { binder.bind(JsonMapper.class); configBinder(binder).bindConfig(FeaturesConfig.class); binder.bind(TypeRegistry.class).in(Scopes.SINGLETON); binder.bind(TypeManager.class).to(TypeRegistry.class).in(Scopes.SINGLETON); jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class); newSetBinder(binder, Type.class); jsonCodecBinder(binder).bindJsonCodec(TaskStatus.class); jsonCodecBinder(binder).bindJsonCodec(TaskInfo.class); jsonCodecBinder(binder).bindJsonCodec(TaskUpdateRequest.class); }
public void configure(Binder binder) { JsonCodecBinder codecBinder = jsonCodecBinder(binder); codecBinder.bindJsonCodec(Person.class); codecBinder.bindListJsonCodec(Person.class); codecBinder.bindMapJsonCodec(String.class, Person.class); } });