|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectmarf.Storage.StorageManager
Class StorageManager.
Almost every concrete module must inherit from this class. If that's not possible, implement IStorageManager interface.
$Id: StorageManager.java,v 1.26 2006/01/02 22:24:00 mokhov Exp $
| 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(). |
java.lang.Object |
clone()
Implements Cloneable for this StorageManager. |
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. |
boolean |
equals(java.lang.Object poStorageManager)
Checks equality of two storage managers whether the parameter is not null and its toString() output is equal to this one. |
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. |
int |
hashCode()
Overrides hashCode() since equals() is overridden by
returning the hash code of the toString(). |
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. |
java.lang.String |
toString()
Default implementation of the toString() for all stoage manager derivatives. |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected transient int iCurrentDumpMode
Can either be one of the DUMP_ flags,
with the DUMP_GZIP_BINARY being the default.
protected transient java.lang.String strFilename
protected java.lang.Object oObjectToSerialize
backSynchronizeObject()protected transient boolean bDumpOnNotFound
true (the default), causes
restoreBinary() or restoreGzipBinary()
to create a file if it does not exist. If set to false,
an exception is thrown.
- Since:
- 0.3.0
- See Also:
restoreBinary(),
restoreGzipBinary()
| Constructor Detail |
public StorageManager()
StorageManager(null, getClass().getName()).
Sets internal filename to the class name of the derivative.
StorageManager(Object, String),
strFilenamepublic StorageManager(java.lang.String pstrFilename)
StorageManager(null, pstrFilename).
pstrFilename - customized filenameStorageManager(Object, String),
strFilenamepublic StorageManager(java.lang.Object poObjectToSerialize)
poObjectToSerialize - reference to object to be dumped to a fileoObjectToSerialize,
bDumpOnNotFound
public StorageManager(java.lang.Object poObjectToSerialize,
java.lang.String pstrFilename)
poObjectToSerialize - reference to object to be dumped to a filepstrFilename - customized filenameoObjectToSerialize,
strFilename,
bDumpOnNotFound
public StorageManager(java.lang.String pstrFilename,
boolean pbDumpOnNotFound)
StorageManager(null, pstrFilename).
pstrFilename - customized filenamepbDumpOnNotFound - if true, a dump file will be created if it does not exist;
if false, an exception will be thrownStorageManager(Object, String),
strFilename
public StorageManager(java.lang.Object poObjectToSerialize,
boolean pbDumpOnNotFound)
poObjectToSerialize - reference to object to be dumped to a filepbDumpOnNotFound - if true, a dump file will be created if it does not exist;
if false, an exception will be thrownoObjectToSerialize,
bDumpOnNotFound
public StorageManager(java.lang.Object poObjectToSerialize,
java.lang.String pstrFilename,
boolean pbDumpOnNotFound)
poObjectToSerialize - reference to object to be dumped to a filepstrFilename - customized filenamepbDumpOnNotFound - if true, a dump file will be created if it does not exist;
if false, an exception will be thrownoObjectToSerialize,
strFilename| Method Detail |
public void dump()
throws StorageException
dump*() methods based on the current dump mode.
If the derivatives use only DUMP_GZIP_BINARY or DUMP_BINARY modes, the
need not do anything except implementing backSynchronizeObject(). For the
rest of modes they only have to override a corresponding dump*() method.
dump in interface IStorageManagerStorageException - if saving to a file for some reason fails or
the dump mode set to an unsupported valueIStorageManager.DUMP_GZIP_BINARY,
IStorageManager.DUMP_BINARY,
dumpGzipBinary(),
dumpCSV(),
dumpBinary(),
dumpXML(),
dumpHTML(),
dumpSQL(),
backSynchronizeObject(),
iCurrentDumpMode
public void dumpGzipBinary()
throws StorageException
dumpGzipBinary in interface IStorageManagerStorageException - in case of I/O or otherwise error during object dumpoObjectToSerialize,
strFilename
public void dumpBinary()
throws StorageException
dumpBinary in interface IStorageManagerStorageException - in case of I/O or otherwise error during object dumpoObjectToSerialize,
strFilename
public void dumpCSV()
throws StorageException
dump()
with the CSV dump mode, they must override this method.
dumpCSV in interface IStorageManagerNotImplementedException
StorageException, - declared, but never thrown
StorageException - in case of I/O or otherwise errordump()
public void dumpXML()
throws StorageException
dump()
with the XML dump mode, they must override this method.
dumpXML in interface IStorageManagerNotImplementedException
StorageException, - declared, but never thrown
StorageException - in case of I/O or otherwise errordump()
public void dumpHTML()
throws StorageException
dump()
with the HTML dump mode, they must override this method.
dumpHTML in interface IStorageManagerNotImplementedException
StorageException, - declared, but never thrown
StorageException - in case of I/O or otherwise errordump()
public void dumpSQL()
throws StorageException
dump()
with the SQL dump mode, they must override this method.
dumpSQL in interface IStorageManagerNotImplementedException
StorageException, - declared, but never thrown
StorageException - in case of I/O or otherwise errordump()
public void restore()
throws StorageException
restore*() methods based on the current dump mode.
If the derivatives use only DUMP_GZIP_BINARY or DUMP_BINARY modes, the
need not do anything except implementing backSynchronizeObject(). For the
rest of modes they only have to override a corresponding restore*() method.
restore in interface IStorageManagerStorageException - if loading from a file for some reason fails or
the dump mode set to an unsupported valueIStorageManager.DUMP_GZIP_BINARY,
IStorageManager.DUMP_BINARY,
dumpGzipBinary(),
dumpCSV(),
dumpBinary(),
dumpXML(),
dumpHTML(),
dumpSQL(),
backSynchronizeObject(),
iCurrentDumpMode
public void restoreBinary()
throws StorageException
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.
restoreBinary in interface IStorageManagerStorageException - in case of I/O or otherwise error during object retorationbackSynchronizeObject(),
strFilename
public void restoreGzipBinary()
throws StorageException
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.
restoreGzipBinary in interface IStorageManagerStorageException - in case of I/O or otherwise error during object retorationbackSynchronizeObject(),
strFilename
public void restoreCSV()
throws StorageException
restore()
with the CSV dump mode, they must override this method.
restoreCSV in interface IStorageManagerNotImplementedException
StorageException, - declared, but never thrown
StorageException - in case of I/O or otherwise errorrestore()
public void restoreXML()
throws StorageException
restore()
with the XML dump mode, they must override this method.
restoreXML in interface IStorageManagerNotImplementedException
StorageException, - declared, but never thrown
StorageException - in case of I/O or otherwise errorrestore()
public void restoreHTML()
throws StorageException
restore()
with the HTML dump mode, they must override this method.
restoreHTML in interface IStorageManagerNotImplementedException
StorageException, - declared, but never thrown
StorageException - in case of I/O or otherwise errorrestore()
public void restoreSQL()
throws StorageException
restore()
with the SQL dump mode, they must override this method.
restoreSQL in interface IStorageManagerNotImplementedException
StorageException, - declared, but never thrown
StorageException - in case of I/O or otherwise errorrestore()public void backSynchronizeObject()
restore(). By default
this method is unimplemented.
NotImplementedExceptionrestore()public java.lang.String getFilename()
public void setFilename(java.lang.String pstrFilename)
pstrFilename - new filenamepublic java.lang.String getDefaultExtension()
public static java.lang.String getDefaultExtension(int piDumpMode)
piDumpMode - dump mode to query extensions map by
public final int getDumpMode()
public final void setDumpMode(int piCurrentDumpMode)
piCurrentDumpMode - the modepublic final boolean enableDumpOnNotFound(boolean pbEnable)
pbEnable - new value of the flag
bDumpOnNotFoundpublic java.lang.Object clone()
Object.clone()public boolean equals(java.lang.Object poStorageManager)
Object.equals(java.lang.Object)public int hashCode()
hashCode() since equals() is overridden by
returning the hash code of the toString().
Object.hashCode(),
equals(Object)public java.lang.String toString()
Object.toString()public static java.lang.String getMARFSourceCodeRevision()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||