Package com.mckoi.database.jdbcserver
Class DefaultLocalBootable
- java.lang.Object
-
- 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
Constructors Constructor Description DefaultLocalBootable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DatabaseInterfaceboot(DBConfig config)Boots the local database with the given configuration.booleancheckExists(DBConfig config)Attempts to test if the database exists or not.DatabaseInterfaceconnectToJVM()Creates a new LocalDatabaseInterface that is connected to the database currently running in this VM.DatabaseInterfacecreate(java.lang.String username, java.lang.String password, DBConfig config)Creates and boots a local database with the given configuration.booleanisBooted()Returns true if a database has successfully been booted in this JVM.
-
-
-
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:
createin interfaceLocalBootable- 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:
bootin interfaceLocalBootable- 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:
checkExistsin interfaceLocalBootable- Parameters:
config- the configuration variables.- Throws:
java.sql.SQLException
-
isBooted
public boolean isBooted() throws java.sql.SQLExceptionReturns true if a database has successfully been booted in this JVM. If a database hasn't been botted then it returns false.- Specified by:
isBootedin interfaceLocalBootable- 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:
connectToJVMin interfaceLocalBootable- Throws:
java.sql.SQLException
-
-