Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package io.dropwizard.jdbi;
 
import static com.codahale.metrics.MetricRegistry.name;
public class DBIFactory {
    private static final Logger LOGGER = (Logger) LoggerFactory.getLogger(DBI.class);
    private static final String RAW_SQL = name(DBI.class"raw-sql");
    private static class SanerNamingStrategy extends DelegatingStatementNameStrategy {
        private SanerNamingStrategy() {
            super(.,
                  .,
                  .,
                  .,
                  new StatementNameStrategy() {
                      @Override
                      public String getStatementName(StatementContext statementContext) {
                          return ;
                      }
                  });
        }
    }
    public DBI build(Environment environment,
                     DataSourceFactory configuration,
                     String namethrows ClassNotFoundException {
        final ManagedDataSource dataSource = configuration.build(environment.metrics(), name);
        return build(environmentconfigurationdataSourcename);
    }
    public DBI build(Environment environment,
                     DataSourceFactory configuration,
                     ManagedDataSource dataSource,
                     String name) {
        final String validationQuery = configuration.getValidationQuery();
        final DBI dbi = new DBI(dataSource);
        environment.lifecycle().manage(dataSource);
        environment.healthChecks().register(namenew DBIHealthCheck(dbivalidationQuery));
        dbi.setSQLLog(new LogbackLog(.));
        dbi.setTimingCollector(new InstrumentedTimingCollector(environment.metrics(),
                                                               new SanerNamingStrategy()));
        if (configuration.isAutoCommentsEnabled()) {
        }
        dbi.registerArgumentFactory(new OptionalArgumentFactory(configuration.getDriverClass()));
        dbi.registerMapper(new JodaDateTimeMapper());
        return dbi;
    }
New to GrepCode? Check out our FAQ X