com.sparsity.sparksee.gdb
Class Database

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

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

Database class.

All the data of the Database is stored into a persistent file which just can be created or open through a Sparksee instance.

Also, all the manipulation of a Database must be done by means of a Session which can be initiated from a Database instance.

Multiple Databases do not share the memory, that is there is no negotiation among them. In those cases, memory must be prefixed for each Database. To do that, use the SPARKSEEConfig.

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

Method Summary
 void close()
          Closes the Database instance.
 void disableRollback()
          Disables the rollback mechanism.
 void enableRollback()
          Enables the rollback mechanism.
 void fixCurrentCacheMaxSize()
          Sets the cache maximum size to the current cache size in use.
 java.lang.String getAlias()
          Gets the alias of the Database.
 int getCacheMaxSize()
          Gets the cache maximum size (in MB).
 java.lang.String getPath()
          Gets the path of the Database.
 void getStatistics(DatabaseStatistics stats)
          Gets Database statistics.
 boolean isClosed()
          Gets if Database instance has been closed or not.
 Session newSession()
          Creates a new Session.
 void setCacheMaxSize(int megaBytes)
          Sets the cache maximum size (in MB).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

disableRollback

public void disableRollback()
Disables the rollback mechanism.


fixCurrentCacheMaxSize

public void fixCurrentCacheMaxSize()
Sets the cache maximum size to the current cache size in use.


getAlias

public java.lang.String getAlias()
Gets the alias of the Database.

Returns:
The alias of the Database.

getPath

public java.lang.String getPath()
Gets the path of the Database.

Returns:
The path of the Database.

enableRollback

public void enableRollback()
Enables the rollback mechanism.


newSession

public Session newSession()
Creates a new Session.


getCacheMaxSize

public int getCacheMaxSize()
Gets the cache maximum size (in MB).

Returns:
Returns the current cache max size.

isClosed

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

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

setCacheMaxSize

public void setCacheMaxSize(int megaBytes)
Sets the cache maximum size (in MB).

0 means unlimited which is all the physical memory of the computer minus a small margin.

Parameters:
megaBytes - [in] The new cache max size.

close

public void close()
Closes the Database instance.

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

Specified by:
close in interface java.io.Closeable

getStatistics

public void getStatistics(DatabaseStatistics stats)
Gets Database statistics.

Parameters:
stats - [out] The DatabaseStatistics instance.