Search in sources :

Example 76 with FactoryModuleBuilder

use of com.google.inject.assistedinject.FactoryModuleBuilder in project graylog2-server by Graylog2.

the class PluginModule method addSchedulerJob.

protected void addSchedulerJob(String name, Class<? extends Job> jobClass, Class<? extends Job.Factory> factoryClass, Class<? extends JobDefinitionConfig> configClass, Class<? extends JobTriggerData> dataClass) {
    install(new FactoryModuleBuilder().implement(Job.class, jobClass).build(factoryClass));
    jobBinder().addBinding(name).to(factoryClass);
    registerJacksonSubtype(configClass, name);
    // Some jobs might not have a custom data class
    if (dataClass != null) {
        registerJacksonSubtype(dataClass, name);
    }
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder)

Example 77 with FactoryModuleBuilder

use of com.google.inject.assistedinject.FactoryModuleBuilder in project graylog2-server by Graylog2.

the class PluginModule method addNotificationType.

protected void addNotificationType(String name, Class<? extends EventNotificationConfig> notificationClass, Class<? extends EventNotification> handlerClass, Class<? extends EventNotification.Factory> factoryClass) {
    install(new FactoryModuleBuilder().implement(EventNotification.class, handlerClass).build(factoryClass));
    eventNotificationBinder().addBinding(name).to(factoryClass);
    registerJacksonSubtype(notificationClass, name);
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder)

Example 78 with FactoryModuleBuilder

use of com.google.inject.assistedinject.FactoryModuleBuilder in project graylog2-server by Graylog2.

the class PluginModule method addEventStorageHandler.

protected void addEventStorageHandler(String name, Class<? extends EventStorageHandler> handlerClass, Class<? extends EventStorageHandler.Factory> factoryClass, Class<? extends EventStorageHandler.Config> configClass) {
    install(new FactoryModuleBuilder().implement(EventStorageHandler.class, handlerClass).build(factoryClass));
    eventStorageHandlerBinder().addBinding(name).to(factoryClass);
    registerJacksonSubtype(configClass, name);
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder)

Example 79 with FactoryModuleBuilder

use of com.google.inject.assistedinject.FactoryModuleBuilder in project graylog2-server by Graylog2.

the class PluginModule method addEventProcessor.

protected void addEventProcessor(String name, Class<? extends EventProcessor> processorClass, Class<? extends EventProcessor.Factory> factoryClass, Class<? extends EventProcessorConfig> configClass, Class<? extends EventProcessorParameters> parametersClass) {
    install(new FactoryModuleBuilder().implement(EventProcessor.class, processorClass).build(factoryClass));
    eventProcessorBinder().addBinding(name).to(factoryClass);
    registerJacksonSubtype(configClass, name);
    registerJacksonSubtype(parametersClass, name);
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder)

Example 80 with FactoryModuleBuilder

use of com.google.inject.assistedinject.FactoryModuleBuilder in project graylog2-server by Graylog2.

the class Graylog2Module method installAlertCondition.

protected void installAlertCondition(MapBinder<String, AlertCondition.Factory> alertConditionBinder, Class<? extends AlertCondition> alertConditionClass, Class<? extends AlertCondition.Factory> alertConditionFactoryClass) {
    install(new FactoryModuleBuilder().implement(AlertCondition.class, alertConditionClass).build(alertConditionFactoryClass));
    alertConditionBinder.addBinding(alertConditionClass.getCanonicalName()).to(alertConditionFactoryClass);
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder)

Aggregations

FactoryModuleBuilder (com.google.inject.assistedinject.FactoryModuleBuilder)85 AbstractModule (com.google.inject.AbstractModule)20 Injector (com.google.inject.Injector)12 ConfigModule (co.cask.cdap.common.guice.ConfigModule)10 PrivateModule (com.google.inject.PrivateModule)10 DatasetDefinitionRegistry (co.cask.cdap.api.dataset.module.DatasetDefinitionRegistry)8 DefaultDatasetDefinitionRegistry (co.cask.cdap.data2.dataset2.DefaultDatasetDefinitionRegistry)8 InMemoryDatasetFramework (co.cask.cdap.data2.dataset2.InMemoryDatasetFramework)8 TypeLiteral (com.google.inject.TypeLiteral)8 DatasetFramework (co.cask.cdap.data2.dataset2.DatasetFramework)7 DiscoveryRuntimeModule (co.cask.cdap.common.guice.DiscoveryRuntimeModule)6 LocationRuntimeModule (co.cask.cdap.common.guice.LocationRuntimeModule)6 SystemDatasetRuntimeModule (co.cask.cdap.data.runtime.SystemDatasetRuntimeModule)6 DatasetOpExecutor (co.cask.cdap.data2.datafabric.dataset.service.executor.DatasetOpExecutor)6 DatasetDefinitionRegistryFactory (co.cask.cdap.data2.dataset2.DatasetDefinitionRegistryFactory)6 Singleton (com.google.inject.Singleton)6 TransactionManager (org.apache.tephra.TransactionManager)6 DatasetService (co.cask.cdap.data2.datafabric.dataset.service.DatasetService)5 DatasetAdminOpHTTPHandler (co.cask.cdap.data2.datafabric.dataset.service.executor.DatasetAdminOpHTTPHandler)5 CConfiguration (co.cask.cdap.common.conf.CConfiguration)4