Package com.mckoi.database.jdbcserver
Class DefaultLocalBootable
java.lang.Object
com.mckoi.database.jdbcserver.DefaultLocalBootable
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionBoots the local database with the given configuration.boolean
checkExists
(DBConfig config) Attempts to test if the database exists or not.Creates a new LocalDatabaseInterface that is connected to the database currently running in this VM.Creates and boots a local database with the given configuration.boolean
isBooted()
Returns true if a database has successfully been booted in this JVM.
-
Constructor Details
-
DefaultLocalBootable
public DefaultLocalBootable()
-
-
Method Details
-
create
public DatabaseInterface create(String username, String password, DBConfig config) throws SQLException Creates and boots a local database with the given configuration. This is implemented from LocalBootable.- Specified by:
create
in interfaceLocalBootable
- Parameters:
config
- the configuration variables.- Throws:
SQLException
-
boot
Boots the local database with the given configuration. This is implemented from LocalBootable.- Specified by:
boot
in interfaceLocalBootable
- Parameters:
config
- the configuration variables.- Throws:
SQLException
-
checkExists
Attempts to test if the database exists or not. Returns true if the database exists.- Specified by:
checkExists
in interfaceLocalBootable
- Parameters:
config
- the configuration variables.- Throws:
SQLException
-
isBooted
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 interfaceLocalBootable
- Throws:
SQLException
-
connectToJVM
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 interfaceLocalBootable
- Throws:
SQLException
-