com.unister.semweb.drums
Class GlobalParameters<Data extends AbstractKVStorable>

java.lang.Object
  extended by com.unister.semweb.drums.GlobalParameters<Data>
Type Parameters:
Data - an implementation of AbstractKVStorable, e.g. GeneralStorable

public class GlobalParameters<Data extends AbstractKVStorable>
extends java.lang.Object

This class represents all parameters, which are used globally in a DRUMS-Instance. The instance of GlobalParameters should be available in all internal Objects used by DRUMS.

Author:
Martin Nettling

Field Summary
 long BUCKET_MEMORY
          The amount of bytes all buckets are allowed to use.
 java.lang.String databaseDirectory
          The database directory.
 int elementSize
          The number bytes needed by an instance of AbstractKVStorable.
 long FILE_CHUNK_SIZE
          The size of one chunk in an HeaderIndexFile
 int HEADER_FILE_LOCK_RETRY
          the number of retries if a file is locked by another process
 int ID
          a identification number of this parameter set.
 int INITIAL_FILE_SIZE
          the initial size of a HeaderIndexFile.
 int INITIAL_INCREMENT_SIZE
          the initial size by which the file is enlarged, when no more records will fit into the file.
static java.util.concurrent.atomic.AtomicInteger INSTANCE_COUNT
          A global count of all instances of GlobalParameters.
 int keySize
          The size of the key of the implementation of AbstractKVStorable.
 java.lang.String linkDataFileExtension
          File extension of the database files that store the AbstractKVStorable.
 long MAX_BUCKET_STORAGE_TIME
          The maximal time in milliseconds a bucket is held in memory without synchronization attempt.
 long MAX_MEMORY_PER_BUCKET
          The maximal size of a bucket in bytes.
 int MEMORY_CHUNK
          the size of one chunk in memory
 int MIN_ELEMENT_IN_BUCKET_BEFORE_SYNC
          The minimal number of elements which must be in one bucket, before this bucket is allowed to be synchronized.
 int NUMBER_OF_SYNCHRONIZER_THREADS
          The number of threads used for synchronizing.
 java.lang.String PARAMETER_FILE
          The name of the underlying parameter file.
 long SYNC_CHUNK_SIZE
          The number of bytes, which are read and written at once during synchronization
 
Constructor Summary
GlobalParameters(Data prototype)
          The standard constructor.
GlobalParameters(java.lang.String paramFile, Data prototype)
          Initialize global parameters by those from the given parameter-file.
 
Method Summary
 void configToLogInfo()
          Outputs the configuration to the Logger.
 Data getPrototype()
          Returns a clone of the prototype.
 void initParameters()
          Initialises all Parameters.
static long parseSize(java.lang.String s)
          This methods parses the given String, which should represent a size, to a long.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE_COUNT

public static java.util.concurrent.atomic.AtomicInteger INSTANCE_COUNT
A global count of all instances of GlobalParameters. This variable is needed if more than one DRUMS will run in one JVM.


databaseDirectory

public java.lang.String databaseDirectory
The database directory. All records are written to files in this directory.


PARAMETER_FILE

public java.lang.String PARAMETER_FILE
The name of the underlying parameter file.


ID

public final int ID
a identification number of this parameter set. This variable is needed if more than one DRUMS is instantiated in one JVM.


BUCKET_MEMORY

public long BUCKET_MEMORY
The amount of bytes all buckets are allowed to use.


MAX_MEMORY_PER_BUCKET

public long MAX_MEMORY_PER_BUCKET
The maximal size of a bucket in bytes. If this size is exceeded, no more elements for this bucket are accepted, until it is synchronized to disk.


MEMORY_CHUNK

public int MEMORY_CHUNK
the size of one chunk in memory


HEADER_FILE_LOCK_RETRY

public int HEADER_FILE_LOCK_RETRY
the number of retries if a file is locked by another process


SYNC_CHUNK_SIZE

public long SYNC_CHUNK_SIZE
The number of bytes, which are read and written at once during synchronization


FILE_CHUNK_SIZE

public long FILE_CHUNK_SIZE
The size of one chunk in an HeaderIndexFile


NUMBER_OF_SYNCHRONIZER_THREADS

public int NUMBER_OF_SYNCHRONIZER_THREADS
The number of threads used for synchronizing.


MIN_ELEMENT_IN_BUCKET_BEFORE_SYNC

public int MIN_ELEMENT_IN_BUCKET_BEFORE_SYNC
The minimal number of elements which must be in one bucket, before this bucket is allowed to be synchronized.


linkDataFileExtension

public java.lang.String linkDataFileExtension
File extension of the database files that store the AbstractKVStorable.


INITIAL_INCREMENT_SIZE

public int INITIAL_INCREMENT_SIZE
the initial size by which the file is enlarged, when no more records will fit into the file.


INITIAL_FILE_SIZE

public int INITIAL_FILE_SIZE
the initial size of a HeaderIndexFile.


keySize

public final int keySize
The size of the key of the implementation of AbstractKVStorable.


elementSize

public final int elementSize
The number bytes needed by an instance of AbstractKVStorable.


MAX_BUCKET_STORAGE_TIME

public long MAX_BUCKET_STORAGE_TIME
The maximal time in milliseconds a bucket is held in memory without synchronization attempt.

Constructor Detail

GlobalParameters

public GlobalParameters(java.lang.String paramFile,
                        Data prototype)
Initialize global parameters by those from the given parameter-file.

Parameters:
paramFile - The name of the parameter-file
prototype - a prototype of the Data of this DRUMS

GlobalParameters

public GlobalParameters(Data prototype)
The standard constructor. Loads all parameters from drums.properties

Parameters:
prototype - a prototype of the Data of this DRUMS
Method Detail

getPrototype

public Data getPrototype()
Returns a clone of the prototype. If you need to access the prototype several times, you should create a pointer on your own instance.

Returns:
clone of the internal prototype

initParameters

public void initParameters()
Initialises all Parameters.


configToLogInfo

public void configToLogInfo()
Outputs the configuration to the Logger.


parseSize

public static long parseSize(java.lang.String s)
This methods parses the given String, which should represent a size, to a long. 'K' is interpreted as 1024, 'M' as 1024^2 and 'G' as 1024^3.

Parameters:
s - the String to parse
Returns:
size in byte. -1 if the String was not parsable.