public class Sparksee
extends java.lang.Object
implements java.io.Closeable
All Sparksee programs must have one single Sparksee instance to manage one or more Database instances.
This class allows for the creation of new Databases or open an existing one.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
Version
Sparksee version.
|
Constructor and Description |
---|
Sparksee(SparkseeConfig config)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addChecksums(java.lang.String path)
Converts a database WITHOUT checksums into a database WITH checksums.
|
void |
close()
Closes the Sparksee instance.
|
Database |
create(java.lang.String path,
java.lang.String alias)
Creates a new Database instance.
|
Database |
create(java.lang.String path,
java.lang.String alias,
SparkseeConfig config)
Creates a new Database instance.
|
boolean |
decrypt(java.lang.String path)
Converts a database WITH encryption into a database WITHOUT encryption.
|
boolean |
encrypt(java.lang.String path)
Converts a database WITHOUT encryption into an encrypted database.
|
long |
getInMemoryPoolCapacity()
Gets the capacity of the in-memory pool (in Megabytes)
|
boolean |
isClosed()
Gets if Sparksee instance has been closed or not.
|
Database |
open(java.lang.String path,
boolean readOnly)
Opens an existing Database instance.
|
Database |
open(java.lang.String path,
boolean readOnly,
SparkseeConfig config)
Opens an existing Database instance.
|
boolean |
removeChecksums(java.lang.String path)
Converts a database WITH checksums into a database WITHOUT checksums.
|
void |
resizeInMemoryPool(long newCapacity)
Resizes the in memory pool allocator.
|
Database |
restore(java.lang.String path,
java.lang.String backupFile)
Restores a Database from a backup file.
|
Database |
restore(java.lang.String path,
java.lang.String backupFile,
SparkseeConfig config)
Restores a Database from a backup file.
|
Database |
restoreEncryptedBackup(java.lang.String path,
java.lang.String backupFile,
SparkseeConfig config,
java.lang.String keyInHex,
java.lang.String ivInHex)
Restores a Database from an encrypted backup file.
|
Database |
restoreEncryptedBackup(java.lang.String path,
java.lang.String backupFile,
java.lang.String keyInHex,
java.lang.String ivInHex)
Restores a Database from an encrypted backup file.
|
boolean |
verifyChecksums(java.lang.String path)
Verifies the Checksum integrity of the given image file and it's recovery log file.
|
public Sparksee(SparkseeConfig config)
config
- [in/out] Sparksee configuration (may be updated).public Database restoreEncryptedBackup(java.lang.String path, java.lang.String backupFile, SparkseeConfig config, java.lang.String keyInHex, java.lang.String ivInHex) throws java.lang.RuntimeException, java.io.FileNotFoundException
See the Graph class EncryptedBackup method.
path
- [in] Database storage file.backupFile
- [in] The Backup file to be restored.config
- [in] Use a specific configuration instead of the one in this SparkseekeyInHex
- [In] The AES encryption Key of the backup file as an hexadecimal string (8, 16 or 32 bytes).ivInHex
- [In] The AES Initialization Vector of the backup file as an hexadecimal string (16 bytes).java.lang.RuntimeException
- nulljava.io.FileNotFoundException
- If the given file cannot be created, or the exported data file does not exists.public void resizeInMemoryPool(long newCapacity) throws java.lang.RuntimeException
newCapacity
- The new capacity of the in memory pool allocatorjava.lang.RuntimeException
- nullpublic Database create(java.lang.String path, java.lang.String alias, SparkseeConfig config) throws java.lang.RuntimeException, java.io.FileNotFoundException
path
- [in] Database storage file.alias
- [in] Database alias name.config
- [in] Use a specific configuration instead of the one in this Sparkseejava.lang.RuntimeException
- nulljava.io.FileNotFoundException
- If the given file cannot be created.public boolean verifyChecksums(java.lang.String path) throws java.lang.RuntimeException, java.io.FileNotFoundException
The main database file checksums are always checked.
When the recovery log file exists, the recovery log file is also checked for checksum and format errors.
When the checksums of the main file or the recovery file are incorrect, the funcion returns false, in any other error it throws an exception.
Any error found is logged as a WARNING.
sparksee::gdb::FileNotFoundExceptionsparksee::gdb::Error
path
- The path to the image filejava.lang.RuntimeException
- nulljava.io.FileNotFoundException
- nullpublic boolean removeChecksums(java.lang.String path) throws java.lang.RuntimeException, java.io.FileNotFoundException
Any error found is logged. The database (and it's recovery log if present) have checksums. sparksee::gdb::FileNotFoundExceptionsparksee::gdb::Error
path
- The path to the database image filejava.lang.RuntimeException
- nulljava.io.FileNotFoundException
- nullpublic Database restore(java.lang.String path, java.lang.String backupFile) throws java.lang.RuntimeException, java.io.FileNotFoundException
See the Graph class Backup method.
path
- [in] Database storage file.backupFile
- [in] The Backup file to be restored.java.lang.RuntimeException
- nulljava.io.FileNotFoundException
- If the given file cannot be created, or the exported data file does not exists.public boolean addChecksums(java.lang.String path) throws java.lang.RuntimeException, java.io.FileNotFoundException
Any error found is logged. The database (and it's recovery log if present) does NOT have checksums. sparksee::gdb::FileNotFoundExceptionsparksee::gdb::Error
path
- The path to the database image filejava.lang.RuntimeException
- nulljava.io.FileNotFoundException
- nullpublic Database restoreEncryptedBackup(java.lang.String path, java.lang.String backupFile, java.lang.String keyInHex, java.lang.String ivInHex) throws java.lang.RuntimeException, java.io.FileNotFoundException
See the Graph class EncryptedBackup method.
path
- [in] Database storage file.backupFile
- [in] The Backup file to be restored.keyInHex
- [In] The AES encryption Key of the backup file as an hexadecimal string (8, 16 or 32 bytes).ivInHex
- [In] The AES Initialization Vector of the backup file as an hexadecimal string (16 bytes).java.lang.RuntimeException
- nulljava.io.FileNotFoundException
- If the given file cannot be created, or the exported data file does not exists.public boolean decrypt(java.lang.String path) throws java.lang.RuntimeException, java.io.FileNotFoundException
Any error found is logged. The database (and it's recovery log if present) is encrypted. The current encryption had been configured using SparkseeConfig. sparksee::gdb::FileNotFoundExceptionsparksee::gdb::Error
path
- The path to the database image filejava.lang.RuntimeException
- nulljava.io.FileNotFoundException
- nullpublic Database restore(java.lang.String path, java.lang.String backupFile, SparkseeConfig config) throws java.lang.RuntimeException, java.io.FileNotFoundException
See the Graph class Backup method.
path
- [in] Database storage file.backupFile
- [in] The Backup file to be restored.config
- [in] Use a specific configuration instead of the one in this Sparkseejava.lang.RuntimeException
- nulljava.io.FileNotFoundException
- If the given file cannot be created, or the exported data file does not exists.public Database create(java.lang.String path, java.lang.String alias) throws java.lang.RuntimeException, java.io.FileNotFoundException
path
- [in] Database storage file.alias
- [in] Database alias name.java.lang.RuntimeException
- nulljava.io.FileNotFoundException
- If the given file cannot be created.public Database open(java.lang.String path, boolean readOnly) throws java.lang.RuntimeException, java.io.FileNotFoundException
path
- [in] Database storage file.readOnly
- [in] If TRUE, open Database in read-only mode.java.lang.RuntimeException
- nulljava.io.FileNotFoundException
- If the given file does not exist.public boolean isClosed()
close()
public Database open(java.lang.String path, boolean readOnly, SparkseeConfig config) throws java.lang.RuntimeException, java.io.FileNotFoundException
The provided configuration will be used for all the database settings but not for the license, which must already be properly setup in this class.
path
- [in] Database storage file.readOnly
- [in] If TRUE, open Database in read-only mode.config
- [in] Use a specific configuration instead of the one in this Sparkseejava.lang.RuntimeException
- nulljava.io.FileNotFoundException
- If the given file does not exist.public boolean encrypt(java.lang.String path) throws java.lang.RuntimeException, java.io.FileNotFoundException
Any error found is logged. The database (and it's recovery log if present) does is NOT encrypted. The encryption had already been configured using SparkseeConfig. sparksee::gdb::FileNotFoundExceptionsparksee::gdb::Error
path
- The path to the database image filejava.lang.RuntimeException
- nulljava.io.FileNotFoundException
- nullpublic void close()
It must be called to ensure the integrity of all data.
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public long getInMemoryPoolCapacity()