marf.Storage
Class Database

java.lang.Object
  extended by marf.Storage.StorageManager
      extended by marf.Storage.Database
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, IDatabase, IStorageManager

public class Database
extends StorageManager
implements IDatabase

Subject database. To be used by an application to contain information about known subjects (speakers, instruments, languages, etc).

$Id: Database.java,v 1.11 2007/12/23 06:29:46 mokhov Exp $

Since:
0.3.0.2
Version:
$Revision: 1.11 $
Author:
Serguei Mokhov
See Also:
Serialized Form

Field Summary
protected  boolean bConnected
          Indicates whether we are connected or not.
 
Fields inherited from class marf.Storage.StorageManager
bDumpOnNotFound, iCurrentDumpMode, oObjectToSerialize, strFilename
 
Fields inherited from interface marf.Storage.IDatabase
MARF_INTERFACE_CODE_REVISION
 
Fields inherited from interface marf.Storage.IStorageManager
DUMP_BINARY, DUMP_CSV_TEXT, DUMP_GZIP_BINARY, DUMP_HTML, DUMP_SQL, DUMP_XML, MARF_INTERFACE_CODE_REVISION, STORAGE_FILE_EXTENSIONS
 
Constructor Summary
Database()
          Default constructor with the StorageManager.
 
Method Summary
 void backSynchronizeObject()
          Implementation of back-synchronization of Database loaded object.
 java.lang.Object clone()
          Implements Cloneable interface for the Database object.
 void close()
          Closes (file) database connection.
 void connect()
          Connects to the database of subjects.
 int getIDByFilename(java.lang.String pstrFileName, boolean pbTraining)
          Given ID, fetches the corresponding filename.
static java.lang.String getMARFSourceCodeRevision()
          Returns source code revision information.
 java.lang.String getName(int piID)
          Retrieves subject's name by their ID.
 void query()
          Retrieves subject's data from the database and populates internal data structures.
 java.lang.String toString()
          Default implementation of the toString() for all storage manager derivatives.
 
Methods inherited from class marf.Storage.StorageManager
dump, dumpBinary, dumpCSV, dumpGzipBinary, dumpHTML, dumpSQL, dumpXML, enableDumpOnNotFound, equals, getDefaultExtension, getDefaultExtension, getDumpMode, getFilename, getObjectToSerialize, hashCode, restore, restoreBinary, restoreCSV, restoreGzipBinary, restoreHTML, restoreSQL, restoreXML, setDumpMode, setFilename
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

bConnected

protected boolean bConnected
Indicates whether we are connected or not.

Constructor Detail

Database

public Database()
Default constructor with the StorageManager.

See Also:
StorageManager
Method Detail

getIDByFilename

public int getIDByFilename(java.lang.String pstrFileName,
                           boolean pbTraining)
                    throws StorageException
Given ID, fetches the corresponding filename. Retrieves Speaker's ID by a sample filename.

Specified by:
getIDByFilename in interface IDatabase
Parameters:
pstrFileName - Name of a .wav file for which ID must be returned
pbTraining - indicates whether the filename is a training (true) sample or testing (false)
Returns:
int ID, -1 if not found
Throws:
StorageException

getName

public java.lang.String getName(int piID)
                         throws StorageException
Retrieves subject's name by their ID.

Specified by:
getName in interface IDatabase
Parameters:
piID - ID of a subject in the DB to return a name for
Returns:
name string
Throws:
StorageException

connect

public void connect()
             throws StorageException
Connects to the database of subjects.

Specified by:
connect in interface IDatabase
Throws:
StorageException

query

public void query()
           throws StorageException
Retrieves subject's data from the database and populates internal data structures.

Specified by:
query in interface IDatabase
Throws:
StorageException

close

public void close()
           throws StorageException
Closes (file) database connection.

Specified by:
close in interface IDatabase
Throws:
StorageException

backSynchronizeObject

public void backSynchronizeObject()
Implementation of back-synchronization of Database loaded object.

Overrides:
backSynchronizeObject in class StorageManager
Since:
0.3.0.5
See Also:
StorageManager.restore()

toString

public java.lang.String toString()
Default implementation of the toString() for all storage manager derivatives.

Overrides:
toString in class StorageManager
Since:
0.3.0.5
See Also:
Object.toString()

clone

public java.lang.Object clone()
Implements Cloneable interface for the Database object.

Overrides:
clone in class StorageManager
Since:
0.3.0.5
See Also:
Object.clone()

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Returns source code revision information.

Returns:
revision string


SourceForge Logo