games.strategy.engine.lobby.server.userDB
Class Database

java.lang.Object
  extended by games.strategy.engine.lobby.server.userDB.Database

public class Database
extends java.lang.Object

Utility to get connections to the database.

The database is embedded within the jvm.

Getting a connection will cause the database (and the neccessary tables) to be created if it does not already exist.

The database will be shutdown on System.exit through a shutdown hook.

Getting a connection will also schedule backups at regular intervals.

Author:
sgb

Constructor Summary
Database()
           
 
Method Summary
static void backup()
           
static java.io.File getBackupDir()
           
static java.sql.Connection getConnection()
           
static void main(java.lang.String[] args)
          Restore the database.
static void restoreFromBackup(java.io.File backupDir)
          This must be the first db call made.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Database

public Database()
Method Detail

getConnection

public static java.sql.Connection getConnection()

restoreFromBackup

public static void restoreFromBackup(java.io.File backupDir)
                              throws java.sql.SQLException
This must be the first db call made. Run Database as a main method to run the backup.

Parameters:
backupDir -
Throws:
java.sql.SQLException

backup

public static void backup()

getBackupDir

public static java.io.File getBackupDir()

main

public static void main(java.lang.String[] args)
Restore the database.