edu.upc.dama.dex.core
Class GraphPool

java.lang.Object
  extended by edu.upc.dama.dex.core.GraphPool
All Implemented Interfaces:
java.io.Closeable

public final class GraphPool
extends java.lang.Object
implements java.io.Closeable

Pool of graphs.

A GraphPool is a pool of Graphs which contains one single and persistent graph database, which is called DbGraph.

GraphPool cannot be instantiated directly. Thus, GraphPool instances are obteined from DEX through DEX.create(File,String) or DEX.open(File) methods.

Multiple GraphPools do not share the memory, that is there is no negotiation among them. In those cases, memory must be prefixed for each GraphPool. To do that, use the DEXConfig utility.

See Also:
DEX
Author:
Sparsity Technologies

Nested Class Summary
 class GraphPool.Statistics
          Statistics of a GraphPool.
 
Method Summary
 void close()
          Closes all the working Graphs.
 void dumpData(Session sess, java.io.File file)
          Dumps the logical content of the GraphPool into a text file.
 void dumpData(Session sess, java.lang.String file)
          Dumps the logical content of the GraphPool into a text file.
 void dumpSchema(Session sess, java.io.Writer writer)
          Dumps the schema of the GraphPool.
 void dumpStorage(Session sess, java.io.File file)
          Dumps the internal content of the GraphPool into a text file.
 void dumpStorage(Session sess, java.lang.String file)
          Dumps the internal content of the GraphPool into a text file.
 void flush()
          Flushes dirty data to disk.
 java.lang.String getAlias()
          Gets the alias name of the persistent graph database.
 DEX getDEX()
          Gets the parent DEX instance.
 java.io.File getFileImage()
          Gets the file of the persistent graph database.
 GraphPool.Statistics getStatistics()
          Gets the current GraphPool.Statistics.
 boolean isOpen()
          Gets if the GraphPool is open.
 Session newSession()
          Gets the Session instance.
 void warmUp()
          Warms up cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isOpen

public boolean isOpen()
Gets if the GraphPool is open.

Only opened GraphPools can execute methods, otherwise they will fail.

Returns:
true if the GraphPool is open, false otherwise.

close

public void close()
Closes all the working Graphs.

It is important to close the GraphPool as soon as possible to free its memory resources.

Specified by:
close in interface java.io.Closeable

getDEX

public DEX getDEX()
Gets the parent DEX instance.

Returns:
The parent DEX instance.

warmUp

public void warmUp()
Warms up cache.


newSession

public Session newSession()
Gets the Session instance.

Returns:
The Session instance.

getAlias

public java.lang.String getAlias()
Gets the alias name of the persistent graph database.

Returns:
The alias name of the persistent graph database.

getFileImage

public java.io.File getFileImage()
Gets the file of the persistent graph database.

Returns:
The file name of the persistent graph database.

dumpStorage

public void dumpStorage(Session sess,
                        java.io.File file)
                 throws java.io.FileNotFoundException
Dumps the internal content of the GraphPool into a text file.

It dumps some statistics of the internal structures such as structure sizes, number of objects, etc.

Parameters:
sess - Session instance to use for the dump.
file - Name of text file to dump all the data.
Throws:
java.io.FileNotFoundException

dumpData

public void dumpData(Session sess,
                     java.io.File file)
              throws java.io.FileNotFoundException
Dumps the logical content of the GraphPool into a text file.

It dumps the DbGraph as a collection of nodes, edges and their attributes.

Parameters:
sess - Session instance to use for the dump.
file - Name of text file to dump all the data.
Throws:
java.io.FileNotFoundException

dumpStorage

public void dumpStorage(Session sess,
                        java.lang.String file)
                 throws java.io.FileNotFoundException
Dumps the internal content of the GraphPool into a text file.

It dumps some statistics of the internal structures such as structure sizes, number of objects, etc.

Parameters:
sess - Session instance to use for the dump.
file - Name of text file to dump all the data.
Throws:
java.io.FileNotFoundException

dumpData

public void dumpData(Session sess,
                     java.lang.String file)
              throws java.io.FileNotFoundException
Dumps the logical content of the GraphPool into a text file.

It dumps the DbGraph as a collection of nodes, edges and their attributes.

Parameters:
sess - Session instance to use for the dump.
file - Name of text file to dump all the data.
Throws:
java.io.FileNotFoundException

dumpSchema

public void dumpSchema(Session sess,
                       java.io.Writer writer)
                throws java.io.IOException
Dumps the schema of the GraphPool.

Parameters:
sess - Session to dump schema
writer - Where to dump the schema of the GraphPool.
Throws:
java.io.IOException - If something bad happens while writting.

flush

public void flush()
Flushes dirty data to disk.


getStatistics

public GraphPool.Statistics getStatistics()
Gets the current GraphPool.Statistics.

Returns:
The current GraphPool.Statistics.
See Also:
GraphPool.Statistics