Java 类org.jooq.ConnectionProvider 实例源码

项目:vertx-zero    文件:JooqInfix.java   
private static void initInternal(final Vertx vertx,
                                 final String name) {
    vertxRef = vertx;
    Fn.pool(CONFIGS, name,
            () -> Infix.init(Plugins.Infix.JOOQ,
                    (config) -> {
                        // Initialized client
                        final Configuration configuration = new DefaultConfiguration();
                        configuration.set(SQLDialect.MYSQL_8_0);
                        final ConnectionProvider provider =
                                new DefaultConnectionProvider(HikariCpPool.getConnection(
                                        config.getJsonObject("provider")
                                ));
                        // Initialized default configuration
                        configuration.set(provider);
                        return configuration;
                    }, JooqInfix.class));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JooqAutoConfiguration.java   
public DslContextConfiguration(JooqProperties properties,
        ConnectionProvider connectionProvider,
        ObjectProvider<TransactionProvider> transactionProviderProvider,
        ObjectProvider<RecordMapperProvider> recordMapperProviderProvider,
        ObjectProvider<Settings> settingsProvider,
        ObjectProvider<RecordListenerProvider[]> recordListenerProvidersProvider,
        ExecuteListenerProvider[] executeListenerProviders,
        ObjectProvider<VisitListenerProvider[]> visitListenerProvidersProvider) {
    this.properties = properties;
    this.connectionProvider = connectionProvider;
    this.transactionProvider = transactionProviderProvider.getIfAvailable();
    this.recordMapperProvider = recordMapperProviderProvider.getIfAvailable();
    this.settings = settingsProvider.getIfAvailable();
    this.recordListenerProviders = recordListenerProvidersProvider
            .getIfAvailable();
    this.executeListenerProviders = executeListenerProviders;
    this.visitListenerProviders = visitListenerProvidersProvider.getIfAvailable();
}
项目:sociallink    文件:Application.java   
@Override
protected void configure() {
    bind(credentials).to(TwitterCredentials[].class);
    bind(alignments).to(DataSource.class);
    bind(sparqlLocation).named("SPARQLEndpoint").to(String.class);
    bind(ngramsEndpoint).named("NgramsEndpoint").to(String.class);
    bind(wikimachineEndpoint).named("WikimachineEndpoint").to(String.class);
    bind(lsaFilename).named("lsaFilename").to(String.class);
    bind(scaler).to(Scaler.class);
    bind(modelEndpoint).to(ModelEndpoint.class);
    bindFactory(TwitterFactory.class).to(Twitter[].class);
    bindFactory(ConnectionFactory.class).to(ConnectionProvider.class).in(Singleton.class);
    bind(AlignmentsService.class).to(AlignmentsService.class);
    bind(TwitterService.class).to(TwitterService.class);
    bind(KBAccessService.class).to(KBAccessService.class).in(Singleton.class);
    bind(WikimachineService.class).to(WikimachineService.class).in(Singleton.class);
    bind(AnnotationService.class).to(AnnotationService.class).in(Singleton.class);
    bind(MLService.class).to(MLService.class).in(Singleton.class);
    bind(ResourcesService.class).to(ResourcesService.class).in(Singleton.class);
    bind(NGramsService.class).to(NGramsService.class).in(Singleton.class);
    bind(OnlineAlignmentsService.class).to(OnlineAlignmentsService.class).in(Singleton.class);
}
项目:spring-boot-concourse    文件:JooqAutoConfiguration.java   
public DslContextConfiguration(JooqProperties properties,
        ConnectionProvider connectionProvider,
        ObjectProvider<TransactionProvider> transactionProviderProvider,
        ObjectProvider<RecordMapperProvider> recordMapperProviderProvider,
        ObjectProvider<Settings> settingsProvider,
        ObjectProvider<RecordListenerProvider[]> recordListenerProvidersProvider,
        ExecuteListenerProvider[] executeListenerProviders,
        ObjectProvider<VisitListenerProvider[]> visitListenerProvidersProvider) {
    this.properties = properties;
    this.connectionProvider = connectionProvider;
    this.transactionProvider = transactionProviderProvider.getIfAvailable();
    this.recordMapperProvider = recordMapperProviderProvider.getIfAvailable();
    this.settings = settingsProvider.getIfAvailable();
    this.recordListenerProviders = recordListenerProvidersProvider
            .getIfAvailable();
    this.executeListenerProviders = executeListenerProviders;
    this.visitListenerProviders = visitListenerProvidersProvider.getIfAvailable();
}
项目:droptools    文件:JooqBinder.java   
@Override
protected void configure() {
    // bind default Configuration to DSLContext
    bindFactory(new DSLContextFactory(configurationMap.values().stream().findFirst().orElse(null)))
            .to(DSLContext.class)
            .in(RequestScoped.class);

    // bind multiple instances of Configuration and ConnectionProvider for Named DSLContext(s)
    for (final Configuration configuration : configurationMap.values()) {

        bind(configuration).to(Configuration.class);

        bind(configuration.connectionProvider())
                .to(ConnectionProvider.class);
    }

    // bind a ValueFactoryProvider for Named DSLContext(s)
    bind(new DSLContextValueFactoryProvider(configurationMap))
            .to(ValueFactoryProvider.class);
}
项目:jooby    文件:jOOQ.java   
@Override
public void configure(final Env env, final Config conf, final Binder binder) {
  Key<DataSource> dskey = Key.get(DataSource.class, Names.named(name));
  HikariDataSource ds = (HikariDataSource) env.get(dskey)
      .orElseThrow(() -> new NoSuchElementException("DataSource missing: " + dskey));
  Configuration jooqconf = new DefaultConfiguration();
  ConnectionProvider dscp = new DataSourceConnectionProvider(ds);
  jooqconf.set(JDBCUtils.dialect(ds.getDataSourceProperties().getProperty("url")));
  jooqconf.set(dscp);
  jooqconf.set(new DefaultTransactionProvider(dscp));

  if (callback != null) {
    callback.accept(jooqconf, conf);
  }

  ServiceKey serviceKey = env.serviceKey();
  serviceKey.generate(Configuration.class, name, k -> binder.bind(k).toInstance(jooqconf));

  Provider<DSLContext> dsl = () -> DSL.using(jooqconf);
  serviceKey.generate(DSLContext.class, name, k -> binder.bind(k).toProvider(dsl));
}
项目:sunshine-security    文件:DSLConfig.java   
@Bean
public DSLContext getDSLContext() {
    HikariDataSource hikariDataSource = new HikariDataSource();
    hikariDataSource.setJdbcUrl(environment.getProperty("spring.datasource.url"));
    hikariDataSource.setUsername(environment.getProperty("spring.datasource.username"));
    hikariDataSource.setPassword(environment.getProperty("spring.datasource.password"));
    ConnectionProvider connectionProvider = new DataSourceConnectionProvider(hikariDataSource);
    org.jooq.Configuration configuration = new DefaultConfiguration().set(connectionProvider).set(SQLDialect.MYSQL);
    return DSL.using(configuration);
}
项目:droptools    文件:JooqFactory.java   
public Configuration build(Environment environment, PooledDataSourceFactory factory, String name) throws ClassNotFoundException {
    final Settings settings = buildSettings();
    final ManagedDataSource dataSource = factory.build(environment.metrics(), name);
    final SQLDialect dialect = determineDialect(factory, dataSource);
    final ConnectionProvider connectionProvider = new DataSourceConnectionProvider(dataSource);
    final Configuration config = new DefaultConfiguration()
            .set(settings)
            .set(dialect)
            .set(connectionProvider);

    environment.lifecycle().manage(dataSource);

    return config;
}
项目:jpa-samples-demo    文件:DSLContextProvider.java   
@Produces
@ApplicationScoped
public ConnectionProvider produceConnectionProvider() {
    JooqConnectionProvider.log.info("Producing a connection provider");
    return new DataSourceConnectionProvider(ds);
}
项目:jpa-samples-demo    文件:JooqConnectionProvider.java   
@Produces
@ApplicationScoped
public ConnectionProvider produceConnectionProvider() {
    log.info("Producing a connection provider");
    return new DataSourceConnectionProvider(ds);
}
项目:sociallink    文件:ConnectionFactory.java   
@Override
public ConnectionProvider provide() {
    return provider;
}
项目:sociallink    文件:ConnectionFactory.java   
@Override
public void dispose(ConnectionProvider instance) {
}
项目:cloud-cattle    文件:Configuration.java   
public ConnectionProvider getConnectionProvider() {
    return connectionProvider;
}
项目:cloud-cattle    文件:Configuration.java   
public void setConnectionProvider(ConnectionProvider connectionProvider) {
    this.connectionProvider = connectionProvider;
}
项目:dstack    文件:Configuration.java   
public ConnectionProvider getConnectionProvider() {
    return connectionProvider;
}
项目:dstack    文件:Configuration.java   
public void setConnectionProvider(ConnectionProvider connectionProvider) {
    this.connectionProvider = connectionProvider;
}