use of org.killbill.billing.util.config.definition.RedisCacheConfig in project killbill by killbill.
the class KillBillShiroWebModule method configureShiroWeb.
@Override
protected void configureShiroWeb() {
final RedisCacheConfig redisCacheConfig = new ConfigurationObjectFactory(new ConfigSource() {
@Override
public String getString(final String propertyName) {
return configSource.getString(propertyName);
}
}).build(RedisCacheConfig.class);
// Magic provider to configure the cache manager
if (redisCacheConfig.isRedisCachingEnabled()) {
bind(CacheManager.class).toProvider(RedisShiroManagerProvider.class).asEagerSingleton();
} else {
bind(CacheManager.class).toProvider(EhcacheShiroManagerProvider.class).asEagerSingleton();
}
final SecurityConfig securityConfig = new ConfigurationObjectFactory(configSource).build(SecurityConfig.class);
final Collection<Realm> realms = defaultSecurityManager.getRealms() != null ? defaultSecurityManager.getRealms() : // Mainly for testing
ImmutableSet.<Realm>of(new IniRealm(securityConfig.getShiroResourcePath()));
for (final Realm realm : realms) {
bindRealm().toInstance(realm);
}
configureShiroForRBAC();
configureShiroForTenants();
expose(new TypeLiteral<Set<Realm>>() {
});
}
use of org.killbill.billing.util.config.definition.RedisCacheConfig in project killbill by killbill.
the class CacheModule method configure.
@Override
protected void configure() {
final CacheConfig cacheConfig = new ConfigurationObjectFactory(skifeConfigSource).build(CacheConfig.class);
bind(CacheConfig.class).toInstance(cacheConfig);
final EhCacheConfig ehCacheConfig = new ConfigurationObjectFactory(skifeConfigSource).build(EhCacheConfig.class);
bind(EhCacheConfig.class).toInstance(ehCacheConfig);
final RedisCacheConfig redisCacheConfig = new ConfigurationObjectFactory(skifeConfigSource).build(RedisCacheConfig.class);
bind(RedisCacheConfig.class).toInstance(redisCacheConfig);
if (redisCacheConfig.isRedisCachingEnabled()) {
bind(RedissonClient.class).annotatedWith(Names.named(REDIS_CACHE_CLIENT)).toProvider(RedissonCacheClientProvider.class).asEagerSingleton();
bind(CacheManager.class).toProvider(Redis107CacheManagerProvider.class).asEagerSingleton();
} else {
bind(RedissonClient.class).annotatedWith(Names.named(REDIS_CACHE_CLIENT)).toProvider(Providers.<RedissonClient>of(null));
bind(CacheManager.class).toProvider(Eh107CacheManagerProvider.class).asEagerSingleton();
}
// Kill Bill generic cache dispatcher
bind(CacheControllerDispatcher.class).toProvider(CacheControllerDispatcherProvider.class).asEagerSingleton();
final Multibinder<BaseCacheLoader> resultSetMapperSetBinder = Multibinder.newSetBinder(binder(), BaseCacheLoader.class);
resultSetMapperSetBinder.addBinding().to(ImmutableAccountCacheLoader.class).asEagerSingleton();
resultSetMapperSetBinder.addBinding().to(AccountBCDCacheLoader.class).asEagerSingleton();
resultSetMapperSetBinder.addBinding().to(RecordIdCacheLoader.class).asEagerSingleton();
resultSetMapperSetBinder.addBinding().to(AccountRecordIdCacheLoader.class).asEagerSingleton();
resultSetMapperSetBinder.addBinding().to(TenantRecordIdCacheLoader.class).asEagerSingleton();
resultSetMapperSetBinder.addBinding().to(ObjectIdCacheLoader.class).asEagerSingleton();
resultSetMapperSetBinder.addBinding().to(TenantCatalogCacheLoader.class).asEagerSingleton();
resultSetMapperSetBinder.addBinding().to(TenantConfigCacheLoader.class).asEagerSingleton();
resultSetMapperSetBinder.addBinding().to(TenantOverdueConfigCacheLoader.class).asEagerSingleton();
resultSetMapperSetBinder.addBinding().to(TenantKVCacheLoader.class).asEagerSingleton();
resultSetMapperSetBinder.addBinding().to(TenantCacheLoader.class).asEagerSingleton();
resultSetMapperSetBinder.addBinding().to(OverriddenPlanCacheLoader.class).asEagerSingleton();
resultSetMapperSetBinder.addBinding().to(TenantStateMachineConfigCacheLoader.class).asEagerSingleton();
resultSetMapperSetBinder.addBinding().to(AccountIdFromBundleIdCacheLoader.class).asEagerSingleton();
resultSetMapperSetBinder.addBinding().to(BundleIdFromSubscriptionIdCacheLoader.class).asEagerSingleton();
}
use of org.killbill.billing.util.config.definition.RedisCacheConfig in project killbill by killbill.
the class KillBillShiroModule method bindSecurityManager.
@Override
protected void bindSecurityManager(final AnnotatedBindingBuilder<? super SecurityManager> bind) {
// super.bindSecurityManager(bind);
bind.toInstance(defaultSecurityManager);
final RedisCacheConfig redisCacheConfig = new ConfigurationObjectFactory(new ConfigSource() {
@Override
public String getString(final String propertyName) {
return configSource.getString(propertyName);
}
}).build(RedisCacheConfig.class);
// Magic provider to configure the cache manager
if (redisCacheConfig.isRedisCachingEnabled()) {
bind(CacheManager.class).toProvider(RedisShiroManagerProvider.class).asEagerSingleton();
} else {
bind(CacheManager.class).toProvider(EhcacheShiroManagerProvider.class).asEagerSingleton();
}
}
Aggregations