public class DatabaseManager extends Object
Constructor and Description |
---|
DatabaseManager() |
Modifier and Type | Method and Description |
---|---|
static void |
closeLog(PrintWriter log) |
static boolean |
databaseExists(DatabaseMaker maker,
String name) |
static boolean |
databaseIsValid(DatabaseMaker maker,
String name) |
static DatabaseMaker |
getDefaultDatabaseMaker() |
static String |
getVersion() |
static Database |
initializeDatabase(DatabaseMaker maker,
String name,
Object initializer)
This is used to initialize a database if it has not yet been initialized.
|
static Database |
initializeDatabase(DatabaseMaker maker,
String name,
Object initializer,
DataProcessor decryptor,
DataProcessor encryptor)
This is used to initialize a database if it has not yet been initialized.
|
static boolean |
logError(String toLog) |
static Database |
openDatabase(DatabaseMaker maker,
String name,
String mode)
Open a Database given the database name.
|
static Database |
openDatabase(DatabaseMaker maker,
String name,
String mode,
Object initializer)
Open a Database given the database name.
|
static Database |
openDatabase(DatabaseMaker maker,
String name,
String mode,
Object initializer,
DataProcessor decryptor,
DataProcessor encryptor)
Open a Database given the database name.
|
static PrintWriter |
openLog() |
static void |
setDefaultDatabaseMaker(DatabaseMaker maker) |
public static String getVersion()
public static PrintWriter openLog() throws IOException
IOException
public static void closeLog(PrintWriter log) throws IOException
IOException
public static boolean logError(String toLog)
public static DatabaseMaker getDefaultDatabaseMaker()
public static void setDefaultDatabaseMaker(DatabaseMaker maker)
public static Database openDatabase(DatabaseMaker maker, String name, String mode, Object initializer, DataProcessor decryptor, DataProcessor encryptor) throws IOException, IllegalArgumentException
name
- A name for the database. Avoid using fully qualified paths and extensions. On
simple OSes like the PalmOS, the database name will be mapped to the appropriate database
on the device. On devices with a file system a ".db" extension will be added (if it is not
already present in the name) and the file will be searched for as a file or resource.mode
- A string that should be "r" or "rw".initializer
- An optional object that can be used to initialize the fields and sorts of the database,
if the database is being opened and created for the first time. If it is null then no initialization
of a new database is done.decryptor
- An optional decryptor used to decode the database if it is encrypted.encryptor
- An optional encryptor used to encoded the database - used only when writing.IOException
- If there is an error opening the file.IllegalArgumentException
public static Database openDatabase(DatabaseMaker maker, String name, String mode) throws IOException, IllegalArgumentException
name
- A name for the database. Avoid using fully qualified paths and extensions. On
simple OSes like the PalmOS, the database name will be mapped to the appropriate database
on the device. On devices with a file system a ".dat" extension will be added (if it is not
already present in the name) and the file will be searched for as a file or resource.mode
- A string that should be "r" or "rw".IOException
- If there is an error opening the file.IllegalArgumentException
public static Database openDatabase(DatabaseMaker maker, String name, String mode, Object initializer) throws IOException, IllegalArgumentException
name
- A name for the database. Avoid using fully qualified paths and extensions. On
simple OSes like the PalmOS, the database name will be mapped to the appropriate database
on the device. On devices with a file system a ".db" extension will be added (if it is not
already present in the name) and the file will be searched for as a file or resource.mode
- A string that should be "r" or "rw".IOException
- If there is an error opening the file.IllegalArgumentException
public static Database initializeDatabase(DatabaseMaker maker, String name, Object initializer, DataProcessor decryptor, DataProcessor encryptor) throws IOException
name
- A name for the database. Avoid using fully qualified paths and extensions. On
simple OSes like the PalmOS, the database name will be mapped to the appropriate database
on the device. On devices with a file system a ".db" extension will be added (if it is not
already present in the name) and the file will be searched for as a file or resource.initializer
- An optional object that can be used to initialize the fields and sorts of the database.decryptor
- An optional decryptor used to decode the database if it is encrypted.encryptor
- An optional encryptor used to encoded the database - used only when writing.IOException
- If the database cannot be created, or is improperly formatted.public static Database initializeDatabase(DatabaseMaker maker, String name, Object initializer) throws IOException
name
- A name for the database. Avoid using fully qualified paths and extensions. On
simple OSes like the PalmOS, the database name will be mapped to the appropriate database
on the device. On devices with a file system a ".dat" extension will be added (if it is not
already present in the name) and the file will be searched for as a file or resource.initializer
- An optional object that can be used to initialize the fields and sorts of the database.IOException
- If the database cannot be created, or is improperly formatted.public static boolean databaseExists(DatabaseMaker maker, String name)
public static boolean databaseIsValid(DatabaseMaker maker, String name)