Package marauroa.server.db

Examples of marauroa.server.db.DBTransaction


    MDC.put("context", metaData + " ");
    if (TransactionPool.get() == null) {
      logger.warn("Database not initialized, skipping database operation");
      return;
    }
    DBTransaction transaction = TransactionPool.get().beginWork();
    try {
      metaData.getCommand().execute(transaction);
      TransactionPool.get().commit(transaction);
    } catch (IOException e) {
      logger.error(e, e);
View Full Code Here


  /**
   * Tests for perform.
   */
  @Test
  public void testPerform() throws Throwable {
    DBTransaction transaction = TransactionPool.get().beginWork();
    try {
      AccountDAO accountDAO = DAORegister.get().get(AccountDAO.class);
      CharacterDAO characterDAO = DAORegister.get().get(CharacterDAO.class);
      BanAction ban = new BanAction();
      Player player = PlayerTestHelper.createPlayer("bob");
View Full Code Here

  /**
   * Tests for commandCenterPerform.
   */
  @Test
  public void testCommandCenterPerform() throws Throwable {
    DBTransaction transaction = TransactionPool.get().beginWork();
    try {
      AccountDAO accountDAO = DAORegister.get().get(AccountDAO.class);
      CharacterDAO characterDAO = DAORegister.get().get(CharacterDAO.class);
     
      Player player = PlayerTestHelper.createPlayer("bobby");
View Full Code Here

  /**
   * Tests without the valid character
   */
  @Test
  public void testWithoutCharacter() throws Throwable {
    DBTransaction transaction = TransactionPool.get().beginWork();
    try {
      AccountDAO accountDAO = DAORegister.get().get(AccountDAO.class);
     
      Player player = PlayerTestHelper.createPlayer("bobbby");
      Player admin = PlayerTestHelper.createPlayer("admin");
View Full Code Here

  /**
   * Tests for a temporary ban
   */
  @Test
  public void testTemporaryBan() throws Throwable {
    DBTransaction transaction = TransactionPool.get().beginWork();
    try {
      AccountDAO accountDAO = DAORegister.get().get(AccountDAO.class);
      CharacterDAO characterDAO = DAORegister.get().get(CharacterDAO.class);
     
      Player player = PlayerTestHelper.createPlayer("bobby");
View Full Code Here

    cleanDB();
  }

  private void cleanDB() throws SQLException {
    final DBTransaction transaction = TransactionPool.get().beginWork();
    try {
      transaction.execute("DELETE FROM character_stats where name='player';", null);
      transaction.execute("DELETE FROM rpobject WHERE object_id IN (SELECT object_id FROM characters WHERE characters.charname = 'player');", null);
      transaction.execute("DELETE FROM characters WHERE characters.charname = 'player';", null);
      TransactionPool.get().commit(transaction);
    } catch (final SQLException e) {
      TransactionPool.get().rollback(transaction);
      throw e;
    }
View Full Code Here

  void savePlayer(DBTransaction transaction, final Player player) throws SQLException, IOException {
    DAORegister.get().get(CharacterDAO.class).storeCharacter(transaction, player.getName(), player.getName(), player);
  }
   
    private void doUpdate() {
    DBTransaction transaction = TransactionPool.get().beginWork();
    try {
      this.loadAndUpdatePlayers(transaction);
      TransactionPool.get().commit(transaction);
    } catch (Exception e) {
      logger.error(e, e);
View Full Code Here

  /**
   * initializes the database by setting up or updating the database structure and defining
   * the database access objects (DAOs).
   */
  public void initialize() {
    final DBTransaction transaction = TransactionPool.get().beginWork();
    try {

      createTablesUnlessTheyAlreadyExist(transaction);
      updateExistingTables(transaction);

View Full Code Here

   * @param charname name of the player
   * @param fametype type of the hall of fame
   * @return points or 0 in case there is no entry
   */
  public int getHallOfFamePoints(final String charname, final String fametype) {
    DBTransaction transaction = TransactionPool.get().beginWork();
    int res = -1;
    try {
      res = getHallOfFamePoints(transaction, charname, fametype);
      TransactionPool.get().commit(transaction);
    } catch (SQLException e) {
View Full Code Here

   * @param fametype type of the hall of fame
   * @param points points to store
   * @throws SQLException in case of an database error
   */
  public void setHallOfFamePoints(final String charname, final String fametype, final int points) throws SQLException {
    DBTransaction transaction = TransactionPool.get().beginWork();
    try {
      setHallOfFamePoints(transaction, charname, fametype, points);
    } finally {
      TransactionPool.get().commit(transaction);
    }
View Full Code Here

TOP

Related Classes of marauroa.server.db.DBTransaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.