use of org.skife.config.ConfigurationObjectFactory in project killbill by killbill.
the class DefaultTenantModule method installConfig.
private void installConfig() {
final ConfigurationObjectFactory factory = new ConfigurationObjectFactory(skifeConfigSource);
final TenantConfig tenantConfig = factory.build(TenantConfig.class);
bind(TenantConfig.class).toInstance(tenantConfig);
}
use of org.skife.config.ConfigurationObjectFactory in project killbill by killbill.
the class KillBillShiroWebModule method configureShiroForRBAC.
private void configureShiroForRBAC() {
final RbacConfig config = new ConfigurationObjectFactory(configSource).build(RbacConfig.class);
bind(RbacConfig.class).toInstance(config);
// Note: order matters (the first successful match will win, see below)
bindRealm().toProvider(IniRealmProvider.class).asEagerSingleton();
bindRealm().to(KillBillJdbcRealm.class).asEagerSingleton();
if (KillBillShiroModule.isLDAPEnabled()) {
bindRealm().to(KillBillJndiLdapRealm.class).asEagerSingleton();
}
bindListener(new AbstractMatcher<TypeLiteral<?>>() {
@Override
public boolean matches(final TypeLiteral<?> o) {
return Matchers.subclassesOf(WebSecurityManager.class).matches(o.getRawType());
}
}, new DefaultWebSecurityManagerTypeListener(getProvider(ShiroEhCacheInstrumentor.class)));
if (KillBillShiroModule.isRBACEnabled()) {
addFilterChain(JaxrsResource.PREFIX + "/**", Key.get(CorsBasicHttpAuthenticationFilter.class));
}
}
use of org.skife.config.ConfigurationObjectFactory in project killbill by killbill.
the class KillbillServerModule method configurePushNotification.
protected void configurePushNotification() {
final ConfigurationObjectFactory factory = new ConfigurationObjectFactory(skifeConfigSource);
final NotificationConfig notificationConfig = factory.build(NotificationConfig.class);
bind(NotificationConfig.class).annotatedWith(Names.named(STATIC_CONFIG)).toInstance(notificationConfig);
bind(NotificationConfig.class).to(MultiTenantNotificationConfig.class).asEagerSingleton();
bind(PushNotificationListener.class).asEagerSingleton();
bind(PushNotificationRetryService.class).asEagerSingleton();
bind(ServerService.class).to(DefaultServerService.class).asEagerSingleton();
}
use of org.skife.config.ConfigurationObjectFactory in project druid by druid-io.
the class DruidProcessingConfigTest method testDeserialization.
@Test
public void testDeserialization() throws Exception {
ConfigurationObjectFactory factory = Config.createFactory(new Properties());
//with defaults
DruidProcessingConfig config = factory.build(DruidProcessingConfig.class);
Assert.assertEquals(1024 * 1024 * 1024, config.intermediateComputeSizeBytes());
Assert.assertEquals(Integer.MAX_VALUE, config.poolCacheMaxCount());
if (Runtime.getRuntime().availableProcessors() == 1) {
Assert.assertTrue(config.getNumThreads() == 1);
} else {
Assert.assertTrue(config.getNumThreads() < Runtime.getRuntime().availableProcessors());
}
Assert.assertEquals(Math.max(2, config.getNumThreads() / 4), config.getNumMergeBuffers());
Assert.assertEquals(0, config.columnCacheSizeBytes());
Assert.assertFalse(config.isFifo());
Assert.assertEquals(System.getProperty("java.io.tmpdir"), config.getTmpDir());
//with non-defaults
Properties props = new Properties();
props.setProperty("druid.processing.buffer.sizeBytes", "1");
props.setProperty("druid.processing.buffer.poolCacheMaxCount", "1");
props.setProperty("druid.processing.numThreads", "256");
props.setProperty("druid.processing.columnCache.sizeBytes", "1");
props.setProperty("druid.processing.fifo", "true");
props.setProperty("druid.processing.tmpDir", "/test/path");
factory = Config.createFactory(props);
config = factory.buildWithReplacements(DruidProcessingConfig.class, ImmutableMap.of("base_path", "druid.processing"));
Assert.assertEquals(1, config.intermediateComputeSizeBytes());
Assert.assertEquals(1, config.poolCacheMaxCount());
Assert.assertEquals(256, config.getNumThreads());
Assert.assertEquals(64, config.getNumMergeBuffers());
Assert.assertEquals(1, config.columnCacheSizeBytes());
Assert.assertTrue(config.isFifo());
Assert.assertEquals("/test/path", config.getTmpDir());
}
use of org.skife.config.ConfigurationObjectFactory in project killbill by killbill.
the class TestDefaultInvoiceItemFormatter method beforeClass.
@Override
@BeforeClass(groups = "fast")
public void beforeClass() throws Exception {
super.beforeClass();
config = new ConfigurationObjectFactory(skifeConfigSource).build(TranslatorConfig.class);
templateEngine = new MustacheTemplateEngine();
}
Aggregations