|
|||||||||
| Home >> All >> marf >> [ Storage overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
marf.Storage
Class StorageManager

java.lang.Objectmarf.Storage.StorageManager
- All Implemented Interfaces:
- IStorageManager, java.io.Serializable
- Direct Known Subclasses:
- Database, TrainingSet
- public abstract class StorageManager
- extends java.lang.Object
- implements IStorageManager
- extends java.lang.Object
Class StorageManager.
Almost every concrete module must inherit from this class. If that's not possible, implement IStorageManager interface.
$Id: StorageManager.java,v 1.23 2005/06/20 21:45:15 mokhov Exp $
- Since:
- 0.0.1
- Version:
- $Revision: 1.23 $
| Field Summary | |
protected boolean |
bDumpOnNotFound
If set to true (the default), causes
restoreBinary() or restoreGzipBinary()
to create a file if it does not exist. |
protected int |
iCurrentDumpMode
Indicates in which format dump training data. |
protected java.lang.Object |
oObjectToSerialize
Actual object to be serialized (primarily for GZIP and BINARY modes. |
protected java.lang.String |
strFilename
Filename of the file to be dumped/restored. |
| 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 | |
StorageManager()
Default constructor equivalent to StorageManager(null, getClass().getName()). |
|
StorageManager(java.lang.Object poObjectToSerialize)
General constructor with serializable object parameter. |
|
StorageManager(java.lang.Object poObjectToSerialize,
boolean pbDumpOnNotFound)
General constructor with serializable object parameter. |
|
StorageManager(java.lang.Object poObjectToSerialize,
java.lang.String pstrFilename)
General constructor with filename and serializable object parameters. |
|
StorageManager(java.lang.Object poObjectToSerialize,
java.lang.String pstrFilename,
boolean pbDumpOnNotFound)
General constructor with filename and serializable object parameters. |
|
StorageManager(java.lang.String pstrFilename)
Constructor with filename parameter equivalent to StorageManager(null, pstrFilename). |
|
StorageManager(java.lang.String pstrFilename,
boolean pbDumpOnNotFound)
Constructor with filename parameter equivalent to StorageManager(null, pstrFilename). |
|
| Method Summary | |
void |
backSynchronizeObject()
Must to be overridden by the modules that use object serialization with the generic implementation of restore(). |
void |
dump()
An object must know how dump itself or its data structures to a file. |
void |
dumpBinary()
Implements object dump in plain binary form without compression. |
void |
dumpCSV()
If derivatives use the generic implementation of dump()
with the CSV dump mode, they must override this method. |
void |
dumpGzipBinary()
Implements object dump in GZIP-compressed form. |
void |
dumpHTML()
If derivatives use the generic implementation of dump()
with the HTML dump mode, they must override this method. |
void |
dumpSQL()
If derivatives use the generic implementation of dump()
with the SQL dump mode, they must override this method. |
void |
dumpXML()
If derivatives use the generic implementation of dump()
with the XML dump mode, they must override this method. |
boolean |
enableDumpOnNotFound(boolean pbEnable)
Enables or disables creation of a file if it does not exist. |
java.lang.String |
getDefaultExtension()
Retrieves default filename extension of this storage manager. |
static java.lang.String |
getDefaultExtension(int piDumpMode)
Retrieves default filename extension depending on dump type. |
int |
getDumpMode()
Retrieves current dump mode. |
java.lang.String |
getFilename()
Retrieves inner filename reference. |
static java.lang.String |
getMARFSourceCodeRevision()
Returns source code revision information. |
void |
restore()
An object must know how restore itself or its data structures from a file. |
void |
restoreBinary()
Implements object loading from plain binary form without compression. |
void |
restoreCSV()
If derivatives use the generic implementation of restore()
with the CSV dump mode, they must override this method. |
void |
restoreGzipBinary()
Implements object loading from GZIP-compressed binary form. |
void |
restoreHTML()
If derivatives use the generic implementation of restore()
with the HTML dump mode, they must override this method. |
void |
restoreSQL()
If derivatives use the generic implementation of restore()
with the SQL dump mode, they must override this method. |
void |
restoreXML()
If derivatives use the generic implementation of restore()
with the XML dump mode, they must override this method. |
void |
setDumpMode(int piCurrentDumpMode)
Sets the dump mode. |
void |
setFilename(java.lang.String pstrFilename)
Allows to alter inner filename reference. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
iCurrentDumpMode
protected transient int iCurrentDumpMode
- Indicates in which format dump training data.
Can either be one of the
DUMP_flags, with theDUMP_GZIP_BINARYbeing the default.- Since:
- 0.2.0
strFilename
protected transient java.lang.String strFilename
- Filename of the file to be dumped/restored.
- Since:
- 0.3.0
oObjectToSerialize
protected java.lang.Object oObjectToSerialize
- Actual object to be serialized (primarily for GZIP and BINARY modes.
Has to be back-synchronized.
- Since:
- 0.3.0
- See Also:
backSynchronizeObject()55
bDumpOnNotFound
protected transient boolean bDumpOnNotFound
- If set to
true(the default), causesrestoreBinary()orrestoreGzipBinary()to create a file if it does not exist. If set tofalse, an exception is thrown.- Since:
- 0.3.0
- See Also:
restoreBinary()55 ,restoreGzipBinary()55
| Constructor Detail |
StorageManager
public StorageManager()
- Default constructor equivalent to
StorageManager(null, getClass().getName()). Sets internal filename to the class name of the derivative. - Since:
- 0.3.0
StorageManager
public StorageManager(java.lang.String pstrFilename)
- Constructor with filename parameter equivalent to
StorageManager(null, pstrFilename). - Since:
- 0.3.0
StorageManager
public StorageManager(java.lang.Object poObjectToSerialize)
- General constructor with serializable object parameter.
Sets internal filename to the class name of the parameter.
- Since:
- 0.3.0
StorageManager
public StorageManager(java.lang.Object poObjectToSerialize, java.lang.String pstrFilename)
- General constructor with filename and serializable object parameters.
- Since:
- 0.3.0
StorageManager
public StorageManager(java.lang.String pstrFilename, boolean pbDumpOnNotFound)
- Constructor with filename parameter equivalent to
StorageManager(null, pstrFilename). - Since:
- 0.3.0
StorageManager
public StorageManager(java.lang.Object poObjectToSerialize, boolean pbDumpOnNotFound)
- General constructor with serializable object parameter.
Sets internal filename to the class name of the parameter.
- Since:
- 0.3.0
StorageManager
public StorageManager(java.lang.Object poObjectToSerialize, java.lang.String pstrFilename, boolean pbDumpOnNotFound)
- General constructor with filename and serializable object parameters.
- Since:
- 0.3.0
| Method Detail |
dump
public void dump()
throws StorageException
- An object must know how dump itself or its data structures to a file.
Options are: Object serialization, XML, CSV, HTML, SQL. Internally, the method
calls all the
dump*()methods based on the current dump mode. If the derivatives use onlyDUMP_GZIP_BINARYorDUMP_BINARYmodes, the need not do anything except implementingbackSynchronizeObject(). For the rest of modes they only have to override a correspondingdump*()method.- Specified by:
dumpin interfaceIStorageManager
dumpGzipBinary
public void dumpGzipBinary()
throws StorageException
- Implements object dump in GZIP-compressed form. Attempts
to save internal object reference to the generater/specified filename
- Specified by:
dumpGzipBinaryin interfaceIStorageManager
- Since:
- 0.3.0
dumpBinary
public void dumpBinary()
throws StorageException
- Implements object dump in plain binary form without compression. Attempts
to save internal object reference to the generater/specified filename
- Specified by:
dumpBinaryin interfaceIStorageManager
- Since:
- 0.3.0
dumpCSV
public void dumpCSV()
throws StorageException
- If derivatives use the generic implementation of
dump()with the CSV dump mode, they must override this method.- Specified by:
dumpCSVin interfaceIStorageManager
- Since:
- 0.3.0
dumpXML
public void dumpXML()
throws StorageException
- If derivatives use the generic implementation of
dump()with the XML dump mode, they must override this method.- Specified by:
dumpXMLin interfaceIStorageManager
- Since:
- 0.3.0
dumpHTML
public void dumpHTML()
throws StorageException
- If derivatives use the generic implementation of
dump()with the HTML dump mode, they must override this method.- Specified by:
dumpHTMLin interfaceIStorageManager
- Since:
- 0.3.0
dumpSQL
public void dumpSQL()
throws StorageException
- If derivatives use the generic implementation of
dump()with the SQL dump mode, they must override this method.- Specified by:
dumpSQLin interfaceIStorageManager
- Since:
- 0.3.0
restore
public void restore()
throws StorageException
- An object must know how restore itself or its data structures from a file.
Options are: Object serialization, XML, CSV, HTML, SQL. Internally, the method
calls all the
restore*()methods based on the current dump mode. If the derivatives use onlyDUMP_GZIP_BINARYorDUMP_BINARYmodes, the need not do anything except implementingbackSynchronizeObject(). For the rest of modes they only have to override a correspondingrestore*()method.- Specified by:
restorein interfaceIStorageManager
restoreBinary
public void restoreBinary()
throws StorageException
- Implements object loading from plain binary form without compression. Attempts
to load internal object reference with the generater/specified filename. After,
calls
backSynchronizeObject()so the actual mode can reset back references in its own data structures. If the file that we attempt to load did not exist, it will be created.- Specified by:
restoreBinaryin interfaceIStorageManager
- Since:
- 0.3.0
restoreGzipBinary
public void restoreGzipBinary()
throws StorageException
- Implements object loading from GZIP-compressed binary form. Attempts
to load internal object reference with the generater/specified filename. After,
calls
backSynchronizeObject()so the actual mode can reset back references in its own data structures. If the file that we attempt to load did not exist, it will be created.- Specified by:
restoreGzipBinaryin interfaceIStorageManager
- Since:
- 0.3.0
restoreCSV
public void restoreCSV()
throws StorageException
- If derivatives use the generic implementation of
restore()with the CSV dump mode, they must override this method.- Specified by:
restoreCSVin interfaceIStorageManager
- Since:
- 0.3.0
restoreXML
public void restoreXML()
throws StorageException
- If derivatives use the generic implementation of
restore()with the XML dump mode, they must override this method.- Specified by:
restoreXMLin interfaceIStorageManager
- Since:
- 0.3.0
restoreHTML
public void restoreHTML()
throws StorageException
- If derivatives use the generic implementation of
restore()with the HTML dump mode, they must override this method.- Specified by:
restoreHTMLin interfaceIStorageManager
- Since:
- 0.3.0
restoreSQL
public void restoreSQL()
throws StorageException
- If derivatives use the generic implementation of
restore()with the SQL dump mode, they must override this method.- Specified by:
restoreSQLin interfaceIStorageManager
- Since:
- 0.3.0
backSynchronizeObject
public void backSynchronizeObject()
- Must to be overridden by the modules that use object serialization
with the generic implementation of
restore(). By default this method is unimplemented.- Since:
- 0.3.0
getFilename
public java.lang.String getFilename()
- Retrieves inner filename reference.
- Since:
- 0.3.0
setFilename
public void setFilename(java.lang.String pstrFilename)
- Allows to alter inner filename reference.
- Since:
- 0.3.0
getDefaultExtension
public java.lang.String getDefaultExtension()
- Retrieves default filename extension of this storage manager.
- Since:
- 0.3.0
getDefaultExtension
public static java.lang.String getDefaultExtension(int piDumpMode)
- Retrieves default filename extension depending on dump type.
- Since:
- 0.3.0
getDumpMode
public final int getDumpMode()
- Retrieves current dump mode.
- Since:
- 0.3.0
setDumpMode
public final void setDumpMode(int piCurrentDumpMode)
- Sets the dump mode.
- Since:
- 0.3.0
enableDumpOnNotFound
public final boolean enableDumpOnNotFound(boolean pbEnable)
- Enables or disables creation of a file if it does not exist.
- Since:
- 0.3.0
getMARFSourceCodeRevision
public static java.lang.String getMARFSourceCodeRevision()
- Returns source code revision information.
- Since:
- 0.3.0
|
|||||||||
| Home >> All >> marf >> [ Storage overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
marf.Storage.StorageManager