Class: FileDatabase

jala.db.FileDatabase(name, directory, username, password)

Instances of this class represent a file based in-process database
Important: You need the h2.jar in directory "lib/ext" of your helma installation for this library to work, which you can get at http://www.h2database.com/.

Constructor

new FileDatabase(name, directory, username, password)

Returns a newly created instance of FileDatabase.
Parameters:
Name Type Description
name String The name of the database. This name is used as prefix for all database files
directory helma.File The directory where the database files should be stored in.
username String Optional username (defaults to "sa"). This username is used when creating the database, so the same should be used when creating subsequent instances of jala.db.FileDatabase pointing to the same database
password String Optional password (defaults to "").
Source:
Returns:
A newly created FileDatabase instance

Methods

backup(file)

Creates a backup of this database, using the file passed as argument. The result will be a zipped file containing the database files
Parameters:
Name Type Description
file helma.File The file to write the backup to
Source:
Returns:
True if the database backup was created successfully, false otherwise

getDirectory()

Returns the directory where the database files are stored.
Source:
Returns:
The directory where this database is stored.

getName()

Returns the name of the database. This name is used as prefix for all files of this database in the specified directory
Source:
Returns:
The name of the database

getPassword()

Returns the password of this database
Source:
Returns:
The password of this database

getUsername()

Returns the username of this database
Source:
Returns:
The username of this database

remove()

Deletes all files of this database on disk. Note that this also closes the database before removing it.
Source:
Returns:
True in case the database was removed successfully, false otherwise

restore(backupFile)

Restores this database using a backup on disk.
Parameters:
Name Type Description
backupFile helma.File The backup file to use for restore
Source:
Returns:
True if the database was successfully restored, false otherwise