bass.db.embedded
Class DerbyInit

java.lang.Object
  extended by java.lang.Thread
      extended by bass.db.embedded.DerbyInit
All Implemented Interfaces:
java.lang.Runnable

public class DerbyInit
extends java.lang.Thread

Initialization Class for the embedded java DB, checks if DB is initialized or not, if not the DB is created, the tables are added and filled

Version:
0.1
Author:
Thomas Klein

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private static java.lang.String path
           
private  StartupScreen ss
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DerbyInit(StartupScreen ss)
           
 
Method Summary
private  boolean checkForCompleteDB(int nrOfBands, int nrOfFriends)
           
private  void createTables()
          creates the tables "bands" & "bandfriends" and the index "ipx_bandname" on the embedded db
private  void fillTables()
          fills the tables "bands" & "bandfriends" with the data from insertBandData.sql & insertBandFriendData.sql
private  void initDatabase()
           
static boolean isDBInstalled()
          checks if the embedded db is already installed
static void main(java.lang.String[] args)
          Deprecated. testing purposes only
 void run()
           
private  void setDBSystemDir()
          sets the directory for the embedded DB
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

path

private static java.lang.String path

ss

private StartupScreen ss
Constructor Detail

DerbyInit

public DerbyInit(StartupScreen ss)
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

main

public static void main(java.lang.String[] args)
Deprecated. testing purposes only

Parameters:
args -

setDBSystemDir

private void setDBSystemDir()
sets the directory for the embedded DB


isDBInstalled

public static boolean isDBInstalled()
checks if the embedded db is already installed

Returns:
true if installed, else false

initDatabase

private void initDatabase()

createTables

private void createTables()
creates the tables "bands" & "bandfriends" and the index "ipx_bandname" on the embedded db


fillTables

private void fillTables()
fills the tables "bands" & "bandfriends" with the data from insertBandData.sql & insertBandFriendData.sql


checkForCompleteDB

private boolean checkForCompleteDB(int nrOfBands,
                                   int nrOfFriends)