Search in sources :

Example 21 with ConfigurationObjectFactory

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);
}
Also used : TenantConfig(org.killbill.billing.util.config.definition.TenantConfig) ConfigurationObjectFactory(org.skife.config.ConfigurationObjectFactory)

Example 22 with ConfigurationObjectFactory

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));
    }
}
Also used : TypeLiteral(com.google.inject.TypeLiteral) IniRealmProvider(org.killbill.billing.util.glue.IniRealmProvider) KillBillJdbcRealm(org.killbill.billing.util.security.shiro.realm.KillBillJdbcRealm) KillBillJndiLdapRealm(org.killbill.billing.util.security.shiro.realm.KillBillJndiLdapRealm) ConfigurationObjectFactory(org.skife.config.ConfigurationObjectFactory) RbacConfig(org.killbill.billing.util.config.definition.RbacConfig)

Example 23 with ConfigurationObjectFactory

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();
}
Also used : DefaultServerService(org.killbill.billing.server.DefaultServerService) PushNotificationListener(org.killbill.billing.server.notifications.PushNotificationListener) ConfigurationObjectFactory(org.skife.config.ConfigurationObjectFactory) NotificationConfig(org.killbill.billing.util.config.definition.NotificationConfig) MultiTenantNotificationConfig(org.killbill.billing.server.config.MultiTenantNotificationConfig) PushNotificationRetryService(org.killbill.billing.server.notifications.PushNotificationRetryService) MultiTenantNotificationConfig(org.killbill.billing.server.config.MultiTenantNotificationConfig)

Example 24 with ConfigurationObjectFactory

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());
}
Also used : ConfigurationObjectFactory(org.skife.config.ConfigurationObjectFactory) Properties(java.util.Properties) Test(org.junit.Test)

Example 25 with ConfigurationObjectFactory

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();
}
Also used : MustacheTemplateEngine(org.killbill.billing.util.email.templates.MustacheTemplateEngine) ConfigurationObjectFactory(org.skife.config.ConfigurationObjectFactory) TranslatorConfig(org.killbill.billing.util.template.translation.TranslatorConfig) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

ConfigurationObjectFactory (org.skife.config.ConfigurationObjectFactory)26 Properties (java.util.Properties)4 TranslatorConfig (org.killbill.billing.util.template.translation.TranslatorConfig)4 BeforeClass (org.testng.annotations.BeforeClass)3 Test (org.junit.Test)2 OSGIServiceRegistration (org.killbill.billing.osgi.api.OSGIServiceRegistration)2 RbacConfig (org.killbill.billing.util.config.definition.RbacConfig)2 MustacheTemplateEngine (org.killbill.billing.util.email.templates.MustacheTemplateEngine)2 Configuration (com.espertech.esper.client.Configuration)1 EPServiceProvider (com.espertech.esper.client.EPServiceProvider)1 Injector (com.google.inject.Injector)1 TypeLiteral (com.google.inject.TypeLiteral)1 File (java.io.File)1 MBeanServer (javax.management.MBeanServer)1 AuthenticationInfo (org.apache.shiro.authc.AuthenticationInfo)1 UsernamePasswordToken (org.apache.shiro.authc.UsernamePasswordToken)1 AuthorizationInfo (org.apache.shiro.authz.AuthorizationInfo)1 SimplePrincipalCollection (org.apache.shiro.subject.SimplePrincipalCollection)1 JacksonJsonProvider (org.codehaus.jackson.jaxrs.JacksonJsonProvider)1 Duration (org.joda.time.Duration)1