org.hypergraphdb
Class HGEnvironment

java.lang.Object
  extended by org.hypergraphdb.HGEnvironment

public class HGEnvironment
extends java.lang.Object

This class provides some facilities to manage several open HyperGraph databases within a single virtual machine. This is useful when one needs to access a currently open database by its location.

The class essentially implements a static map of currently open databases. The general name HGEnvironment reflects the intent to eventually put JVM-wide operations here.

Author:
Borislav Iordanov

Constructor Summary
HGEnvironment()
           
 
Method Summary
static void configure(java.lang.String location, HGConfiguration config)
           Configure a HyperGraphDB instance before it is actually opened.
static boolean exists(java.lang.String location)
           Return true if there is a HyperGraph database at the given location and false otherwise.
static HyperGraph get(java.lang.String location)
           Retrieve an already opened or open a HyperGraph instance.
static HyperGraph get(java.lang.String location, HGConfiguration config)
          Retrieve the HyperGraphDB instance at the specified location and open it (if not already opened) with the given configuration.
static HGConfiguration getConfiguration(java.lang.String location)
           Retrieve the configuration of a HyperGraphDB instance.
static HyperGraph getExistingOnly(java.lang.String location)
           Same as get, but will return null if there is no database at that location.
static boolean isOpen(java.lang.String location)
           Return true if the database at the given location is already open and false otherwise.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HGEnvironment

public HGEnvironment()
Method Detail

get

public static HyperGraph get(java.lang.String location)

Retrieve an already opened or open a HyperGraph instance. Note that a new database instance will potentially be created via new HyperGraph(location) if it doesn't already exist.

Parameters:
location - The location of the HyperGraph instance.
Returns:
The HyperGraph database instance.

get

public static HyperGraph get(java.lang.String location,
                             HGConfiguration config)

Retrieve the HyperGraphDB instance at the specified location and open it (if not already opened) with the given configuration. If the instance has already been opened, the configuration parameter is ignored.

Parameters:
location - The filesystem path of the database instance.
config - The set of configuration parameters.
Returns:

getExistingOnly

public static HyperGraph getExistingOnly(java.lang.String location)

Same as get, but will return null if there is no database at that location.


exists

public static boolean exists(java.lang.String location)

Return true if there is a HyperGraph database at the given location and false otherwise.


isOpen

public static boolean isOpen(java.lang.String location)

Return true if the database at the given location is already open and false otherwise.


configure

public static void configure(java.lang.String location,
                             HGConfiguration config)

Configure a HyperGraphDB instance before it is actually opened. If the instance at that location is already opened, the new configuration will only take effect if you close and re-open the instance.

Parameters:
location - The filesystem path to the database instance.
config - A HGConfiguration with the desired parameters set.

getConfiguration

public static HGConfiguration getConfiguration(java.lang.String location)

Retrieve the configuration of a HyperGraphDB instance. If no configuration was previously defined, a new one will be created.

Parameters:
location - The filesystem path to the HyperGraphDB instance.