Search in sources :

Example 6 with FactoryModuleBuilder

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));
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder)

Example 7 with FactoryModuleBuilder

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);
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder) TimeService(org.forgerock.util.time.TimeService) AuditorFactory(org.forgerock.openam.audit.servlet.AuditorFactory)

Example 8 with FactoryModuleBuilder

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);
}
Also used : FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder) ConsoleConfigHandler(org.forgerock.openam.sm.config.ConsoleConfigHandler) SmsRequestHandler(org.forgerock.openam.core.rest.sms.SmsRequestHandler) Handler(org.forgerock.http.Handler) CrestAuthorizationModule(org.forgerock.authz.filter.crest.api.CrestAuthorizationModule) SmsGlobalSingletonProviderFactory(org.forgerock.openam.core.rest.sms.SmsGlobalSingletonProviderFactory) SmsRequestHandlerFactory(org.forgerock.openam.core.rest.sms.SmsRequestHandlerFactory) SmsCollectionProviderFactory(org.forgerock.openam.core.rest.sms.SmsCollectionProviderFactory) DebugRecorder(org.forgerock.openam.core.rest.record.DebugRecorder) DefaultDebugRecorder(org.forgerock.openam.core.rest.record.DefaultDebugRecorder) RouteMatcher(org.forgerock.services.routing.RouteMatcher) Component(org.forgerock.openam.audit.AuditConstants.Component) MatchingResourcePath(org.forgerock.openam.forgerockrest.utils.MatchingResourcePath) SmsSingletonProviderFactory(org.forgerock.openam.core.rest.sms.SmsSingletonProviderFactory) AbstractHttpAccessAuditFilter(org.forgerock.openam.audit.AbstractHttpAccessAuditFilter)

Example 9 with FactoryModuleBuilder

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());
}
Also used : ConstraintValidator(org.forgerock.openam.entitlement.constraints.ConstraintValidator) FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder) ApplicationServiceFactory(org.forgerock.openam.entitlement.service.ApplicationServiceFactory) ResourceTypeConfiguration(org.forgerock.openam.entitlement.configuration.ResourceTypeConfiguration) ResourceTypeService(org.forgerock.openam.entitlement.service.ResourceTypeService) SessionCache(org.forgerock.openam.session.SessionCache)

Example 10 with FactoryModuleBuilder

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);
}
Also used : BackendBundleFactory(com.torodb.core.backend.BackendBundleFactory) SqlInterface(com.torodb.backend.SqlInterface) FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder) ReservedIdGenerator(com.torodb.core.d2r.ReservedIdGenerator) SqlHelper(com.torodb.backend.SqlHelper) ReservedIdInfoFactoryImpl(com.torodb.backend.rid.ReservedIdInfoFactoryImpl) DslContextFactoryImpl(com.torodb.backend.DslContextFactoryImpl) ReservedIdInfoFactory(com.torodb.backend.rid.ReservedIdInfoFactory) SnapshotUpdater(com.torodb.core.backend.SnapshotUpdater) SqlInterfaceDelegate(com.torodb.backend.SqlInterfaceDelegate) ReservedIdGeneratorImpl(com.torodb.backend.rid.ReservedIdGeneratorImpl) DslContextFactory(com.torodb.backend.DslContextFactory) BackendConnectionJobFactoryImpl(com.torodb.backend.jobs.BackendConnectionJobFactoryImpl) BackendServiceImpl(com.torodb.backend.BackendServiceImpl)

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