edu.upc.dama.dex.core
Class DEX

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

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

Initial class of the DEX library.

All DEX programs must have one single DEX instance which manages one or more GraphPools. This class allows for the creation of new GraphPools (DEX.create(File,String)), or the management of existing ones (DEX.open(File)). When the DEX instance is closed all its GraphPools are closed too.

Author:
Sparsity Technologies

Nested Class Summary
static class DEX.Config
          DEX core configuration parameters.
static class DEX.SystemStatistics
          Statistics of the system.
 
Constructor Summary
DEX()
          Creates a new instance of DEX.
DEX(DEX.Config cfg)
          Creates a new instance of DEX.
DEX(java.lang.String license)
          Creates a new instance of DEX.
 
Method Summary
 void close()
          Closes all the working GraphPools.
 GraphPool create(java.io.File img)
          Creates a new empty persistent graph database.
 GraphPool create(java.io.File img, java.lang.String alias)
          Creates a new empty persistent graph database.
 GraphPool create(java.lang.String img)
          Creates a new empty persistent graph database.
 GraphPool create(java.lang.String img, java.lang.String alias)
          Creates a new empty persistent graph database.
 java.util.Set getGraphPools()
          Gets all GraphPools of the DEX instance.
static DEX.SystemStatistics getSystemStatistics()
          Gets some statistics of the system DEX.SystemStatistics
static java.lang.String getVersion()
          Gets the version of the DEX software library.
 boolean isOpen()
          Gets if the DEX is open.
 GraphPool open(java.io.File img)
          Opens a persistent graph database.
 GraphPool open(java.lang.String img)
          Opens a persistent graph database.
 GraphPool openReadOnly(java.io.File img)
          Opens a persistent graph database in read only mode.
 GraphPool openReadOnly(java.lang.String img)
          Opens a persistent graph database in read only mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DEX

public DEX(java.lang.String license)
Creates a new instance of DEX.


DEX

public DEX(DEX.Config cfg)
Creates a new instance of DEX. It allows for setting some configuration parameters such as memory buffers size and others.


DEX

public DEX()
Creates a new instance of DEX.

Method Detail

isOpen

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

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

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

close

public void close()
Closes all the working GraphPools.

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

Specified by:
close in interface java.io.Closeable

create

public GraphPool create(java.lang.String img)
                 throws java.io.FileNotFoundException
Creates a new empty persistent graph database.

Parameters:
img - File name to store the persistent graph database.
Returns:
A GraphPool instance.
Throws:
java.io.FileNotFoundException

create

public GraphPool create(java.lang.String img,
                        java.lang.String alias)
                 throws java.io.FileNotFoundException
Creates a new empty persistent graph database.

Parameters:
img - File name to store the persistent graph database.
alias - Alias name for the persistent graph database.
Returns:
A GraphPool instance.
Throws:
java.io.FileNotFoundException

create

public GraphPool create(java.io.File img)
                 throws java.io.FileNotFoundException
Creates a new empty persistent graph database.

Parameters:
img - File to store the persistent graph database.
Returns:
A GraphPool instance.
Throws:
java.io.FileNotFoundException

create

public GraphPool create(java.io.File img,
                        java.lang.String alias)
                 throws java.io.FileNotFoundException
Creates a new empty persistent graph database.

Parameters:
img - File to store the persistent graph database.
alias - Alias name for the persistent graph database.
Returns:
A GraphPool instance.
Throws:
java.io.FileNotFoundException

open

public GraphPool open(java.lang.String img)
               throws java.io.FileNotFoundException
Opens a persistent graph database.

Parameters:
img - File name where the persistent graph database is stored.
Returns:
A GraphPool instance.
Throws:
java.io.FileNotFoundException

openReadOnly

public GraphPool openReadOnly(java.lang.String img)
                       throws java.io.FileNotFoundException
Opens a persistent graph database in read only mode.

Parameters:
img - File name where the persistent graph database is stored.
Returns:
A GraphPool instance.
Throws:
java.io.FileNotFoundException

open

public GraphPool open(java.io.File img)
               throws java.io.FileNotFoundException
Opens a persistent graph database.

Parameters:
img - File name where the persistent graph database is stored.
Returns:
A GraphPool instance.
Throws:
java.io.FileNotFoundException

openReadOnly

public GraphPool openReadOnly(java.io.File img)
                       throws java.io.FileNotFoundException
Opens a persistent graph database in read only mode.

Parameters:
img - File name where the persistent graph database is stored.
Returns:
A GraphPool instance.
Throws:
java.io.FileNotFoundException

getGraphPools

public java.util.Set getGraphPools()
Gets all GraphPools of the DEX instance.

Returns:
A GraphPool set of the DEX instance.

getVersion

public static java.lang.String getVersion()
Gets the version of the DEX software library.

Returns:
Version of the DEX software library.

getSystemStatistics

public static DEX.SystemStatistics getSystemStatistics()
Gets some statistics of the system DEX.SystemStatistics

Returns:
Statistics of the system.