Java Code Examples for org.jdbi.v3.core.Jdbi#onDemand()

The following examples show how to use org.jdbi.v3.core.Jdbi#onDemand() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IronTestApplication.java    From irontest with Apache License 2.0 6 votes vote down vote up
private void createSampleResources(IronTestConfiguration configuration, Environment environment) {
    final JdbiFactory jdbiFactory = new JdbiFactory();
    final Jdbi jdbi = jdbiFactory.build(environment, configuration.getSampleDatabase(), "sampleDatabase");

    //  create DAO objects
    final ArticleDAO articleDAO = jdbi.onDemand(ArticleDAO.class);

    //  create database tables
    articleDAO.createTableIfNotExists();

    //  register APIs
    environment.jersey().register(new ArticleResource(articleDAO));

    //  register SOAP web services
    jaxWsBundle.publishEndpoint(new EndpointBuilder("/article", new ArticleSOAP(articleDAO)));
}
 
Example 2
Source File: FetchPlayerInfoModule.java    From triplea with GNU General Public License v3.0 5 votes vote down vote up
static FetchPlayerInfoModule build(
    final Jdbi jdbi, final Chatters chatters, final GameListing gameListing) {
  return new FetchPlayerInfoModule(
      PlayerApiKeyDaoWrapper.build(jdbi),
      jdbi.onDemand(PlayerInfoForModeratorDao.class),
      jdbi.onDemand(PlayerHistoryDao.class),
      chatters,
      gameListing);
}
 
Example 3
Source File: UserBanService.java    From triplea with GNU General Public License v3.0 5 votes vote down vote up
@Builder
public UserBanService(
    final Jdbi jdbi,
    final Chatters chatters,
    final WebSocketMessagingBus chatMessagingBus,
    final WebSocketMessagingBus gameMessagingBus) {
  moderatorAuditHistoryDao = jdbi.onDemand(ModeratorAuditHistoryDao.class);
  userBanDao = jdbi.onDemand(UserBanDao.class);
  publicIdSupplier = () -> UUID.randomUUID().toString();
  this.chatters = chatters;
  this.apiKeyDaoWrapper = PlayerApiKeyDaoWrapper.build(jdbi);
  this.chatMessagingBus = chatMessagingBus;
  this.gameMessagingBus = gameMessagingBus;
}
 
Example 4
Source File: SessionBannedCheck.java    From triplea with GNU General Public License v3.0 4 votes vote down vote up
public static SessionBannedCheck build(final Jdbi jdbi) {
  return new SessionBannedCheck(jdbi.onDemand(UserBanDao.class));
}
 
Example 5
Source File: ChatUploadModule.java    From triplea with GNU General Public License v3.0 4 votes vote down vote up
static ChatUploadModule build(final Jdbi jdbi, final GameListing gameListing) {
  return new ChatUploadModule(
      jdbi.onDemand(LobbyGameDao.class), gameListing::isValidApiKeyAndGameId);
}
 
Example 6
Source File: NameIsAvailableValidation.java    From triplea with GNU General Public License v3.0 4 votes vote down vote up
public static NameIsAvailableValidation build(final Jdbi jdbi) {
  return new NameIsAvailableValidation(jdbi.onDemand(UserJdbiDao.class));
}
 
Example 7
Source File: BannedPlayerFilter.java    From triplea with GNU General Public License v3.0 4 votes vote down vote up
public static BannedPlayerFilter newBannedPlayerFilter(final Jdbi jdbi) {
  return new BannedPlayerFilter(jdbi.onDemand(UserBanDao.class), Clock.systemUTC());
}
 
Example 8
Source File: TempPasswordPersistence.java    From triplea with GNU General Public License v3.0 4 votes vote down vote up
static TempPasswordPersistence newInstance(final Jdbi jdbi) {
  return new TempPasswordPersistence(
      jdbi.onDemand(TempPasswordDao.class),
      Sha512Hasher::hashPasswordWithSalt,
      PasswordBCrypter::hashPassword);
}
 
Example 9
Source File: BadWordsService.java    From triplea with GNU General Public License v3.0 4 votes vote down vote up
public static BadWordsService build(final Jdbi jdbi) {
  return new BadWordsService(
      jdbi.onDemand(BadWordsDao.class), jdbi.onDemand(ModeratorAuditHistoryDao.class));
}
 
Example 10
Source File: ModeratorAuditHistoryService.java    From triplea with GNU General Public License v3.0 4 votes vote down vote up
public static ModeratorAuditHistoryService build(final Jdbi jdbi) {
  return new ModeratorAuditHistoryService(jdbi.onDemand(ModeratorAuditHistoryDao.class));
}
 
Example 11
Source File: FetchGameChatHistoryModule.java    From triplea with GNU General Public License v3.0 4 votes vote down vote up
static FetchGameChatHistoryModule build(final Jdbi jdbi) {
  return new FetchGameChatHistoryModule(jdbi.onDemand(GameChatHistoryDao.class));
}
 
Example 12
Source File: JdbiConfiguration.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
public CarMakerDao carMakerDao(Jdbi jdbi) {        
    return jdbi.onDemand(CarMakerDao.class);       
}
 
Example 13
Source File: JdbiConfiguration.java    From tutorials with MIT License 4 votes vote down vote up
@Bean
public CarModelDao carModelDao(Jdbi jdbi) {
    return jdbi.onDemand(CarModelDao.class);
}