com.sparsity.dex.gdb
Class Session

java.lang.Object
  extended by com.sparsity.dex.gdb.Session
All Implemented Interfaces:
java.io.Closeable

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

Session class.

A Session is a stateful period of activity of a user with the Database.

All the manipulation of a Database must be enclosed into a Session. A Session can be initiated from a Database instance and allows for getting a Graph instance which represents the persistent graph (the graph database).

Also, temporary data is associated to the Session, thus when a Session is closed, all the temporary data associated to the Session is removed too. Objects or Values instances or even session attributes are an example of temporary data.

Moreover, a Session is exclusive for a thread, thus if it is shared among threads results may be fatal or unexpected.

Check out the 'Processing' and 'Transactions' sections in the DEX User Manual for details about how Sessions work and the use of transactions.

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

Method Summary
 void begin()
          Begins a transaction.
 void close()
          Closes the Session instance.
 void commit()
          Commits a transaction.
 Graph getGraph()
          Gets the Graph instance.
 boolean isClosed()
          Gets if Session instance has been closed or not.
 Objects newObjects()
          Creates a new Objects instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isClosed

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

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

commit

public void commit()
Commits a transaction.


getGraph

public Graph getGraph()
Gets the Graph instance.

Returns:
The Graph instance.

close

public void close()
Closes the Session instance.

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

Specified by:
close in interface java.io.Closeable

begin

public void begin()
Begins a transaction.


newObjects

public Objects newObjects()
Creates a new Objects instance.

Returns:
The new Objects instance.