Search in sources :

Example 1 with JacksonModule

use of org.apache.druid.jackson.JacksonModule in project druid by druid-io.

the class MetricsModuleTest method createInjector.

private static Injector createInjector(Properties properties) {
    return Guice.createInjector(new JacksonModule(), new LifecycleModule(), binder -> {
        binder.bind(Validator.class).toInstance(Validation.buildDefaultValidatorFactory().getValidator());
        binder.bindScope(LazySingleton.class, Scopes.SINGLETON);
        binder.bind(ServiceEmitter.class).toInstance(new NoopServiceEmitter());
        binder.bind(Properties.class).toInstance(properties);
    }, new MetricsModule());
}
Also used : ServiceEmitter(org.apache.druid.java.util.emitter.service.ServiceEmitter) Properties(java.util.Properties) JacksonModule(org.apache.druid.jackson.JacksonModule) Validator(javax.validation.Validator) LifecycleModule(org.apache.druid.guice.LifecycleModule)

Example 2 with JacksonModule

use of org.apache.druid.jackson.JacksonModule in project druid by druid-io.

the class GuiceInjectors method makeDefaultStartupModules.

public static Collection<Module> makeDefaultStartupModules() {
    return ImmutableList.of(new DruidGuiceExtensions(), new JacksonModule(), new PropertiesModule(Arrays.asList("common.runtime.properties", "runtime.properties")), new RuntimeInfoModule(), new ConfigModule(), new NullHandlingModule(), new ExpressionProcessingModule(), binder -> {
        binder.bind(DruidSecondaryModule.class);
        JsonConfigProvider.bind(binder, "druid.extensions", ExtensionsConfig.class);
        JsonConfigProvider.bind(binder, "druid.modules", ModulesConfig.class);
    });
}
Also used : ExpressionProcessingModule(org.apache.druid.math.expr.ExpressionProcessingModule) JacksonModule(org.apache.druid.jackson.JacksonModule)

Example 3 with JacksonModule

use of org.apache.druid.jackson.JacksonModule in project druid by druid-io.

the class QueryableModuleTest method makeInjector.

private Injector makeInjector(Properties properties) {
    Injector injector = Guice.createInjector(ImmutableList.of(new DruidGuiceExtensions(), new JacksonModule(), new ConfigModule(), new QueryRunnerFactoryModule(), new DruidProcessingConfigModule(), new BrokerProcessingModule(), new LifecycleModule(), binder -> {
        binder.bind(Properties.class).toInstance(properties);
    }, new QueryableModule()));
    ObjectMapper mapper = injector.getInstance(Key.get(ObjectMapper.class, Json.class));
    mapper.registerModules(new QueryableModule().getJacksonModules());
    mapper.setInjectableValues(new InjectableValues.Std().addValue(ServiceEmitter.class, new NoopServiceEmitter()));
    return injector;
}
Also used : RequestLoggerProvider(org.apache.druid.server.log.RequestLoggerProvider) InjectableValues(com.fasterxml.jackson.databind.InjectableValues) Properties(java.util.Properties) EmittingRequestLogger(org.apache.druid.server.log.EmittingRequestLogger) NoopRequestLogger(org.apache.druid.server.log.NoopRequestLogger) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Key(com.google.inject.Key) RequestLogger(org.apache.druid.server.log.RequestLogger) Test(org.junit.Test) Json(org.apache.druid.guice.annotations.Json) Injector(com.google.inject.Injector) EmittingRequestLoggerProvider(org.apache.druid.server.log.EmittingRequestLoggerProvider) ImmutableList(org.apache.curator.shaded.com.google.common.collect.ImmutableList) NoopRequestLoggerProvider(org.apache.druid.server.log.NoopRequestLoggerProvider) ServiceEmitter(org.apache.druid.java.util.emitter.service.ServiceEmitter) Guice(com.google.inject.Guice) JacksonModule(org.apache.druid.jackson.JacksonModule) Assert(org.junit.Assert) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) ServiceEmitter(org.apache.druid.java.util.emitter.service.ServiceEmitter) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) Json(org.apache.druid.guice.annotations.Json) JacksonModule(org.apache.druid.jackson.JacksonModule) Injector(com.google.inject.Injector) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 4 with JacksonModule

use of org.apache.druid.jackson.JacksonModule in project druid by druid-io.

the class SqlModuleTest method makeInjectorWithProperties.

private Injector makeInjectorWithProperties(final Properties props) {
    return Guice.createInjector(ImmutableList.of(new DruidGuiceExtensions(), new LifecycleModule(), new ServerModule(), new JacksonModule(), (Module) binder -> {
        binder.bind(Validator.class).toInstance(Validation.buildDefaultValidatorFactory().getValidator());
        binder.bind(JsonConfigurator.class).in(LazySingleton.class);
        binder.bind(Properties.class).toInstance(props);
        binder.bind(ExprMacroTable.class).toInstance(ExprMacroTable.nil());
        binder.bind(AuthorizerMapper.class).toInstance(CalciteTests.TEST_AUTHORIZER_MAPPER);
        binder.bind(Escalator.class).toInstance(new NoopEscalator());
        binder.bind(ServiceEmitter.class).toInstance(serviceEmitter);
        binder.bind(RequestLogger.class).toInstance(new NoopRequestLogger());
        binder.bind(new TypeLiteral<Supplier<DefaultQueryConfig>>() {
        }).toInstance(Suppliers.ofInstance(new DefaultQueryConfig(null)));
        binder.bind(FilteredServerInventoryView.class).toInstance(inventoryView);
        binder.bind(TimelineServerView.class).toInstance(timelineServerView);
        binder.bind(DruidLeaderClient.class).annotatedWith(Coordinator.class).toInstance(druidLeaderClient);
        binder.bind(DruidLeaderClient.class).annotatedWith(IndexingService.class).toInstance(druidLeaderClient);
        binder.bind(DruidNodeDiscoveryProvider.class).toInstance(druidNodeDiscoveryProvider);
        binder.bind(GenericQueryMetricsFactory.class).toInstance(genericQueryMetricsFactory);
        binder.bind(QuerySegmentWalker.class).toInstance(querySegmentWalker);
        binder.bind(QueryToolChestWarehouse.class).toInstance(queryToolChestWarehouse);
        binder.bind(LookupExtractorFactoryContainerProvider.class).toInstance(lookupExtractorFactoryContainerProvider);
        binder.bind(JoinableFactory.class).toInstance(joinableFactory);
        binder.bind(SegmentLoader.class).toInstance(segmentLoader);
        binder.bind(QuerySchedulerProvider.class).in(LazySingleton.class);
        binder.bind(QueryScheduler.class).toProvider(QuerySchedulerProvider.class).in(LazySingleton.class);
    }, new SqlModule(props), new TestViewManagerModule()));
}
Also used : ServiceEmitter(org.apache.druid.java.util.emitter.service.ServiceEmitter) DruidGuiceExtensions(org.apache.druid.guice.DruidGuiceExtensions) Properties(java.util.Properties) ExprMacroTable(org.apache.druid.math.expr.ExprMacroTable) JoinableFactory(org.apache.druid.segment.join.JoinableFactory) ServerModule(org.apache.druid.guice.ServerModule) QuerySegmentWalker(org.apache.druid.query.QuerySegmentWalker) NoopEscalator(org.apache.druid.server.security.NoopEscalator) Escalator(org.apache.druid.server.security.Escalator) NoopEscalator(org.apache.druid.server.security.NoopEscalator) TypeLiteral(com.google.inject.TypeLiteral) QuerySchedulerProvider(org.apache.druid.server.QuerySchedulerProvider) IndexingService(org.apache.druid.client.indexing.IndexingService) RequestLogger(org.apache.druid.server.log.RequestLogger) NoopRequestLogger(org.apache.druid.server.log.NoopRequestLogger) JsonConfigurator(org.apache.druid.guice.JsonConfigurator) LookupExtractorFactoryContainerProvider(org.apache.druid.query.lookup.LookupExtractorFactoryContainerProvider) AuthorizerMapper(org.apache.druid.server.security.AuthorizerMapper) DefaultQueryConfig(org.apache.druid.query.DefaultQueryConfig) TimelineServerView(org.apache.druid.client.TimelineServerView) QueryToolChestWarehouse(org.apache.druid.query.QueryToolChestWarehouse) LifecycleModule(org.apache.druid.guice.LifecycleModule) FilteredServerInventoryView(org.apache.druid.client.FilteredServerInventoryView) NoopRequestLogger(org.apache.druid.server.log.NoopRequestLogger) GenericQueryMetricsFactory(org.apache.druid.query.GenericQueryMetricsFactory) Coordinator(org.apache.druid.client.coordinator.Coordinator) JacksonModule(org.apache.druid.jackson.JacksonModule) SegmentLoader(org.apache.druid.segment.loading.SegmentLoader) DruidNodeDiscoveryProvider(org.apache.druid.discovery.DruidNodeDiscoveryProvider) Module(com.google.inject.Module) LifecycleModule(org.apache.druid.guice.LifecycleModule) JacksonModule(org.apache.druid.jackson.JacksonModule) DruidModule(org.apache.druid.initialization.DruidModule) ServerModule(org.apache.druid.guice.ServerModule) Validator(javax.validation.Validator)

Aggregations

JacksonModule (org.apache.druid.jackson.JacksonModule)4 Properties (java.util.Properties)3 ServiceEmitter (org.apache.druid.java.util.emitter.service.ServiceEmitter)3 Validator (javax.validation.Validator)2 LifecycleModule (org.apache.druid.guice.LifecycleModule)2 NoopRequestLogger (org.apache.druid.server.log.NoopRequestLogger)2 RequestLogger (org.apache.druid.server.log.RequestLogger)2 InjectableValues (com.fasterxml.jackson.databind.InjectableValues)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Guice (com.google.inject.Guice)1 Injector (com.google.inject.Injector)1 Key (com.google.inject.Key)1 Module (com.google.inject.Module)1 TypeLiteral (com.google.inject.TypeLiteral)1 ImmutableList (org.apache.curator.shaded.com.google.common.collect.ImmutableList)1 FilteredServerInventoryView (org.apache.druid.client.FilteredServerInventoryView)1 TimelineServerView (org.apache.druid.client.TimelineServerView)1 Coordinator (org.apache.druid.client.coordinator.Coordinator)1 IndexingService (org.apache.druid.client.indexing.IndexingService)1 DruidNodeDiscoveryProvider (org.apache.druid.discovery.DruidNodeDiscoveryProvider)1