com.sparsity.sparksee.gdb
Class Sparksee

java.lang.Object
  extended by com.sparsity.sparksee.gdb.Sparksee
All Implemented Interfaces:
java.io.Closeable

public class Sparksee
extends java.lang.Object
implements java.io.Closeable

Sparksee class.

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.

Author:
Sparsity Technologies http://www.sparsity-technologies.com

Field Summary
static java.lang.String Version
          Sparksee version.
 
Constructor Summary
Sparksee(SparkseeConfig config)
          Creates a new instance.
 
Method Summary
 void close()
          Closes the Sparksee instance.
 Database create(java.lang.String path, java.lang.String alias)
          Creates a new Database instance.
 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 restore(java.lang.String path, java.lang.String backupFile)
          Restores a Database from a backup file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Version

public static java.lang.String Version
Sparksee version.

Constructor Detail

Sparksee

public Sparksee(SparkseeConfig config)
Creates a new instance.

Parameters:
config - [in] Sparksee configuration.
Method Detail

create

public Database create(java.lang.String path,
                       java.lang.String alias)
                throws java.io.FileNotFoundException,
                       java.lang.RuntimeException
Creates a new Database instance.

Parameters:
path - [in] Database storage file.
alias - [in] Database alias name.
Returns:
A Database instance.
Throws:
java.io.FileNotFoundException - If the given file cannot be created.
java.lang.RuntimeException - null

restore

public Database restore(java.lang.String path,
                        java.lang.String backupFile)
                 throws java.io.FileNotFoundException,
                        java.lang.RuntimeException
Restores a Database from a backup file.

See the Graph class Backup method.

Parameters:
path - [in] Database storage file.
backupFile - [in] The Backup file to be restored.
Returns:
A Database instance.
Throws:
java.io.FileNotFoundException - If the given file cannot be created, or the exported data file does not exists.
java.lang.RuntimeException - null

isClosed

public boolean isClosed()
Gets if Sparksee instance has been closed or not.

Returns:
TRUE if the Sparksee instance has been closed, FALSE otherwise.
See Also:
close()

open

public Database open(java.lang.String path,
                     boolean readOnly)
              throws java.io.FileNotFoundException,
                     java.lang.RuntimeException
Opens an existing Database instance.

Parameters:
path - [in] Database storage file.
readOnly - [in] If TRUE, open Database in read-only mode.
Returns:
A Database instance.
Throws:
java.io.FileNotFoundException - If the given file does not exist.
java.lang.RuntimeException - null

close

public void close()
Closes the Sparksee instance.

It must be called to ensure the integrity of all data.

Specified by:
close in interface java.io.Closeable