com.unister.semweb.drums.api
Class DRUMSInstantiator

java.lang.Object
  extended by com.unister.semweb.drums.api.DRUMSInstantiator

public class DRUMSInstantiator
extends java.lang.Object

This class provides some factory methods to instantiate DRUMS by opening or creating a table.

Author:
Martin Nettling

Constructor Summary
DRUMSInstantiator()
           
 
Method Summary
static
<Data extends AbstractKVStorable>
DRUMS<Data>
createOrOpenTable(AbstractHashFunction hashFunction, DRUMSParameterSet<Data> gp)
          Creates or opens the table.
static
<Data extends AbstractKVStorable>
DRUMS<Data>
createTable(AbstractHashFunction hashFunction, DRUMSParameterSet<Data> gp)
          This method creates a new DRUMS object.
static
<Data extends AbstractKVStorable>
DRUMS<Data>
forceCreateTable(AbstractHashFunction hashFunction, DRUMSParameterSet<Data> gp)
          This method creates a new DRUMS object.
static
<Data extends AbstractKVStorable>
DRUMS<Data>
openTable(DRUMS.AccessMode accessMode, DRUMSParameterSet<Data> gp)
          Opens an existing table.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DRUMSInstantiator

public DRUMSInstantiator()
Method Detail

createTable

public static <Data extends AbstractKVStorable> DRUMS<Data> createTable(AbstractHashFunction hashFunction,
                                                                        DRUMSParameterSet<Data> gp)
                                                          throws java.io.IOException
This method creates a new DRUMS object.
If the directory in DRUMSParameterSet doesn't exist, it will be created.
If the directory in DRUMSParameterSet already exists an IOException will be thrown.

Parameters:
hashFunction - the hash function, decides where to store/search elements
gp - pointer to the DRUMSParameterSet used by the DRUMS to open
Returns:
new DRUMS-object
Throws:
java.io.IOException

forceCreateTable

public static <Data extends AbstractKVStorable> DRUMS<Data> forceCreateTable(AbstractHashFunction hashFunction,
                                                                             DRUMSParameterSet<Data> gp)
                                                               throws java.io.IOException
This method creates a new DRUMS object. The old DRUMS will be overwritten.
If the given directory doesn't exist, it will be created.

Parameters:
hashFunction - the hash function, decides where to store/search elements
gp - pointer to the DRUMSParameterSet used by the DRUMS to open
Returns:
new DRUMS-object
Throws:
java.io.IOException - if an error occurs while writing the configuration file

openTable

public static <Data extends AbstractKVStorable> DRUMS<Data> openTable(DRUMS.AccessMode accessMode,
                                                                      DRUMSParameterSet<Data> gp)
                                                        throws java.io.IOException
Opens an existing table.

Parameters:
accessMode - the AccessMode, how to access the DRUMS
gp - pointer to the DRUMSParameterSet used by the DRUMS to open
Returns:
the table
Throws:
java.io.IOException

createOrOpenTable

public static <Data extends AbstractKVStorable> DRUMS<Data> createOrOpenTable(AbstractHashFunction hashFunction,
                                                                              DRUMSParameterSet<Data> gp)
                                                                throws java.io.IOException
Creates or opens the table. If the directory doesn't exists it will be created.

Parameters:
hashFunction - the hash function, decides where to store/search elements
gp - pointer to the DRUMSParameterSet used by the DRUMS to open
Returns:
a DRUMS instance
Throws:
java.io.IOException
See Also:
#openTable(AccessMode, DRUMSParameterSet), createTable(AbstractHashFunction, DRUMSParameterSet)