com.mckoi.database.jdbcserver
Class DefaultLocalBootable

java.lang.Object
  extended by com.mckoi.database.jdbcserver.DefaultLocalBootable
All Implemented Interfaces:
LocalBootable

public class DefaultLocalBootable
extends java.lang.Object
implements LocalBootable

A bootable object that filters through to a JDBCDatabaseInterface but is thread-safe and multi-threaded. This is to be used when you have a local JDBC Client accessing a stand-alone database.

Author:
Tobias Downer

Constructor Summary
DefaultLocalBootable()
           
 
Method Summary
 DatabaseInterface boot(DBConfig config)
          Boots the local database with the given configuration.
 boolean checkExists(DBConfig config)
          Attempts to test if the database exists or not.
 DatabaseInterface connectToJVM()
          Creates a new LocalDatabaseInterface that is connected to the database currently running in this VM.
 DatabaseInterface create(java.lang.String username, java.lang.String password, DBConfig config)
          Creates and boots a local database with the given configuration.
 boolean isBooted()
          Returns true if a database has successfully been booted in this JVM.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLocalBootable

public DefaultLocalBootable()
Method Detail

create

public DatabaseInterface create(java.lang.String username,
                                java.lang.String password,
                                DBConfig config)
                         throws java.sql.SQLException
Creates and boots a local database with the given configuration. This is implemented from LocalBootable.

Specified by:
create in interface LocalBootable
Parameters:
config - the configuration variables.
Throws:
java.sql.SQLException

boot

public DatabaseInterface boot(DBConfig config)
                       throws java.sql.SQLException
Boots the local database with the given configuration. This is implemented from LocalBootable.

Specified by:
boot in interface LocalBootable
Parameters:
config - the configuration variables.
Throws:
java.sql.SQLException

checkExists

public boolean checkExists(DBConfig config)
                    throws java.sql.SQLException
Attempts to test if the database exists or not. Returns true if the database exists.

Specified by:
checkExists in interface LocalBootable
Parameters:
config - the configuration variables.
Throws:
java.sql.SQLException

isBooted

public boolean isBooted()
                 throws java.sql.SQLException
Returns true if a database has successfully been booted in this JVM. If a database hasn't been botted then it returns false.

Specified by:
isBooted in interface LocalBootable
Throws:
java.sql.SQLException

connectToJVM

public DatabaseInterface connectToJVM()
                               throws java.sql.SQLException
Creates a new LocalDatabaseInterface that is connected to the database currently running in this VM. Calling this method must guarentee that either 'boot' or 'create' has been called in this VM beforehand.

Specified by:
connectToJVM in interface LocalBootable
Throws:
java.sql.SQLException