use of com.google.inject.assistedinject.FactoryModuleBuilder in project graylog2-server by Graylog2.
the class Graylog2Module method installWidgetStrategy.
protected void installWidgetStrategy(MapBinder<String, WidgetStrategy.Factory<? extends WidgetStrategy>> widgetStrategyBinder, Class<? extends WidgetStrategy> target, Class<? extends WidgetStrategy.Factory<? extends WidgetStrategy>> targetFactory) {
install(new FactoryModuleBuilder().implement(WidgetStrategy.class, target).build(targetFactory));
widgetStrategyBinder.addBinding(target.getCanonicalName()).to(Key.get(targetFactory));
}
use of com.google.inject.assistedinject.FactoryModuleBuilder in project OpenAM by OpenRock.
the class AuditCoreGuiceModule method configure.
@Override
protected void configure() {
bind(AuditServiceProvider.class).to(AuditServiceProviderImpl.class);
bind(AuditEventPublisher.class).to(AuditEventPublisherImpl.class);
bind(TimeService.class).toInstance(TimeService.SYSTEM);
install(new FactoryModuleBuilder().implement(Auditor.class, Auditor.class).build(AuditorFactory.class));
// Initial binding for a Map of Component to AbstractHttpAccessAuditFilter
// which other Guice modules will populate.
MapBinder.newMapBinder(binder(), AuditConstants.Component.class, AbstractHttpAccessAuditFilter.class);
}
use of com.google.inject.assistedinject.FactoryModuleBuilder in project OpenAM by OpenRock.
the class CoreRestGuiceModule method configure.
@Override
protected void configure() {
install(new FactoryModuleBuilder().implement(SmsRequestHandler.class, SmsRequestHandler.class).build(SmsRequestHandlerFactory.class));
install(new FactoryModuleBuilder().implement(SmsCollectionProvider.class, SmsCollectionProvider.class).build(SmsCollectionProviderFactory.class));
install(new FactoryModuleBuilder().implement(SmsSingletonProvider.class, SmsSingletonProvider.class).build(SmsSingletonProviderFactory.class));
install(new FactoryModuleBuilder().implement(SmsGlobalSingletonProvider.class, SmsGlobalSingletonProvider.class).build(SmsGlobalSingletonProviderFactory.class));
bind(DebugRecorder.class).to(DefaultDebugRecorder.class);
MapBinder<RouteMatcher<Request>, Handler> chfEndpointHandlers = newMapBinder(binder(), new TypeLiteral<RouteMatcher<Request>>() {
}, new TypeLiteral<Handler>() {
});
chfEndpointHandlers.addBinding(requestUriMatcher(EQUALS, "authenticate")).to(Key.get(Handler.class, Names.named("AuthenticateHandler")));
MapBinder<Component, AbstractHttpAccessAuditFilter> httpAccessAuditFilterMapBinder = newMapBinder(binder(), Component.class, AbstractHttpAccessAuditFilter.class);
httpAccessAuditFilterMapBinder.addBinding(AUTHENTICATION).to(AuthenticationAccessAuditFilter.class);
Multibinder<UiRolePredicate> userUiRolePredicates = Multibinder.newSetBinder(binder(), UiRolePredicate.class);
userUiRolePredicates.addBinding().to(SelfServiceUserUiRolePredicate.class);
userUiRolePredicates.addBinding().to(GlobalAdminUiRolePredicate.class);
userUiRolePredicates.addBinding().to(RealmAdminUiRolePredicate.class);
MapBinder<MatchingResourcePath, CrestAuthorizationModule> smsGlobalAuthzModuleBinder = MapBinder.newMapBinder(binder(), MatchingResourcePath.class, CrestAuthorizationModule.class);
smsGlobalAuthzModuleBinder.addBinding(resourcePath("realms")).to(AnyPrivilegeAuthzModule.class);
smsGlobalAuthzModuleBinder.addBinding(resourcePath("authentication/modules/*")).to(PrivilegeWriteAndAnyPrivilegeReadOnlyAuthzModule.class);
smsGlobalAuthzModuleBinder.addBinding(resourcePath("services/scripting")).to(PrivilegeWriteAndAnyPrivilegeReadOnlyAuthzModule.class);
smsGlobalAuthzModuleBinder.addBinding(resourcePath("services/scripting/contexts")).to(PrivilegeWriteAndAnyPrivilegeReadOnlyAuthzModule.class);
}
use of com.google.inject.assistedinject.FactoryModuleBuilder in project OpenAM by OpenRock.
the class CliGuiceModule method configure.
@Override
protected void configure() {
bind(ResourceTypeConfiguration.class).to(ResourceTypeConfigurationImpl.class);
bind(ResourceTypeService.class).to(ResourceTypeServiceImpl.class);
bind(ConstraintValidator.class).to(ConstraintValidatorImpl.class);
install(new FactoryModuleBuilder().implement(ApplicationService.class, ApplicationServiceImpl.class).build(ApplicationServiceFactory.class));
bind(SessionCache.class).toInstance(SessionCache.getInstance());
}
use of com.google.inject.assistedinject.FactoryModuleBuilder in project torodb by torodb.
the class BackendModule method configure.
@Override
protected void configure() {
bind(SqlInterfaceDelegate.class).in(Singleton.class);
bind(SqlInterface.class).to(SqlInterfaceDelegate.class);
expose(SqlInterface.class);
bind(BackendTransactionJobFactory.class).to(BackendConnectionJobFactoryImpl.class).in(Singleton.class);
expose(BackendTransactionJobFactory.class);
bind(ReservedIdInfoFactoryImpl.class).in(Singleton.class);
bind(ReservedIdInfoFactory.class).to(ReservedIdInfoFactoryImpl.class);
bind(ReservedIdGeneratorImpl.class).in(Singleton.class);
bind(ReservedIdGenerator.class).to(ReservedIdGeneratorImpl.class);
expose(ReservedIdGenerator.class);
bind(DslContextFactoryImpl.class).in(Singleton.class);
bind(DslContextFactory.class).to(DslContextFactoryImpl.class);
bind(SnapshotUpdaterImpl.class);
bind(SnapshotUpdater.class).to(SnapshotUpdaterImpl.class);
expose(SnapshotUpdater.class);
install(new FactoryModuleBuilder().implement(BackendBundle.class, BackendBundleImpl.class).build(BackendBundleFactory.class));
expose(BackendBundleFactory.class);
bind(SqlHelper.class).in(Singleton.class);
expose(SqlHelper.class);
bind(BackendServiceImpl.class).in(Singleton.class);
bind(KvMetainfoHandler.class);
}
Aggregations