public HibernateDatabaseService(Context context) { this.messageSystem = (MessageSystem) context.getImplementation(MessageSystem.class); address = new Address(); this.messageSystem.addService((DatabaseService) this); this.sessionFactory = createSessionFactory(createConfig()); }
public JdbcDatabaseService(Context context, boolean recreateDb, boolean createInitUsersTable) { this.messageSystem = (MessageSystem) context.getImplementation(MessageSystem.class); address = new Address(); this.messageSystem.addService((DatabaseService) this); String dbUrl = ServerSettings.DB_SERVER_URL + ServerSettings.DB_NAME; if (recreateDb) dbUrl = recreateDb( ServerSettings.DB_SERVER_URL, ServerSettings.DB_LOGIN, ServerSettings.DB_PASSWORD, ServerSettings.DB_NAME); connection = connectTo(dbUrl, ServerSettings.DB_LOGIN, ServerSettings.DB_PASSWORD); if (createInitUsersTable) createInitialTable(connection); }