net.sf.joafip.service
Interface IFilePersistence

All Known Implementing Classes:
AbstractFilePersistenceDelegate, FilePersistence

public interface IFilePersistence

Author:
luc peuvrier

Method Summary
 void checkIntegrity()
          check integrity
 void close()
          close ( important to close files )
do not save modification
 java.lang.Object copy(java.lang.Object sourceObject)
           
 DataAccessSession createDataAccessSession()
           
 void disableBackgroundGarbageSweep()
          disable background garbage sweep operation
 void enableBackgroundGarbageSweep(int sleepTime)
          enable background garbage sweep operation
 long freeSize()
           
 int garbageSweep()
          garbage sweep, remove data record for object not attached to root
should be call only when session closed
 java.lang.String getBackupFileName()
           
 java.lang.String getChangeFileName()
           
 java.lang.ClassLoader getClassLoader()
           
 int getNumberOfDataRecord()
           
 int getNumberOfFreeRecord()
           
 int getNumberOfGarbageCandidate()
           
 int getNumberOfModified()
           
 int getNumberOfToGarbage()
           
 int getNumberOfVisited()
           
 java.lang.String getStorageFileName()
           
 int numberOfObjectState()
           
 void setChangeLogEnabled(boolean enabled, int maxNumberOfChangeLog)
          set enable state of file change logging
 void setClassLoader(java.lang.ClassLoader classLoader)
           
 void setForceEnhance(java.lang.Class objectClass)
          force class to be enhanced even if have public method
 void setForceEnhance(java.lang.Class[] objectClasses)
          force classes to be enhanced even if have public method
 void setGarbageListener(IGarbageListener listener)
          set garbage listener
 void setNoLazyLoad(java.lang.Class objectClass)
          set no use of lazy load for a class
 void setNoLazyLoad(java.lang.Class[] objectClasses)
          set no use of lazy load for the classes
 void setObjectIOForClass(java.lang.Class<?> objectClass, java.lang.Class<? extends IObjectIO> objectIOClass)
          set object input output manager for a class
 void setStoreNotUseStandardSerialization(java.lang.Class objectClass)
          set not use standard serialization for a serializable class
 void setStoreNotUseStandardSerialization(java.lang.Class[] objectClasses)
          set not use standard serialization for a serializable classes
 void setStoreSerializeAndGZippedInOneRecord(java.lang.Class objectClass)
          set storage mode serialized and GZipped for a serializable class
 void setStoreSerializeAndGZippedInOneRecord(java.lang.Class[] objectClasses)
          set storage mode serialized and GZipped for a serializable classes
 void setStoreSerializeAndZippedInOneRecord(java.lang.Class objectClass)
          set storage mode serialized and Zipped for a serializable class
 void setStoreSerializeAndZippedInOneRecord(java.lang.Class[] objectClasses)
          set storage mode serialized and Zipped for a serializable classes
 void setStoreSerializeInOneRecord(java.lang.Class objectClass)
          set storage mode serialized for a serializable class
 void setStoreSerializeInOneRecord(java.lang.Class[] objectClasses)
          set storage mode serialized for a serializable classes
 void setSubstitution(java.lang.Class replaced, java.lang.Class substitute, ISubsituteSynchronizer synchronizer)
          record a class substitution association
All file persistence instance use same substitution
 void setSubstitutionOfJavaUtilCollection()
          set java util collection substitution
PVector for Vector PLinkedList for LinkedList PArrayList for ArrayList PHashSet for HashSet PLinkedHashSet for LinkedHashSet PTreeSet for TreeSet PHashMap for HashMap PLinkedHashMap for LinkedHashMap PTreeMap for TreeMap PHashMap for HashTable
 void setZipCompressionLevel(int zipCompressionLevel)
          the compression level have value 0 thru 9:
#NO_COMPRESSION #BEST_SPEED ....
 void storedEnum(java.lang.Class<? extends java.lang.Enum> enumClass)
          inform that enum class is persisted
 void storedEnum(java.lang.Class<? extends java.lang.Enum>[] enumClasses)
          inform that enum classes are persisted
 void storedEnum(java.lang.Enum enumObject)
          inform that enum object is persisted
 long totalSize()
           
 long usedSize()
           
 void xmlExport(java.lang.String directoryName, java.lang.String temporaryDirectoryName, boolean exportPersistedClassByteCode)
          export persisted data in file export.xml put in directoryName directory
can also export byte code of class of persisted object
 void xmlImport(java.lang.String directoryName)
          import from exported data in directoryName directory
 

Method Detail

setChangeLogEnabled

void setChangeLogEnabled(boolean enabled,
                         int maxNumberOfChangeLog)
                         throws FilePersistenceException
set enable state of file change logging

Parameters:
enabled - true if change log enabled
maxNumberOfChangeLog - max number of state change log
Throws:
FilePersistenceException

setZipCompressionLevel

void setZipCompressionLevel(int zipCompressionLevel)
                            throws FilePersistenceException
the compression level have value 0 thru 9:

Parameters:
zipCompressionLevel - the zip the compression level (0-9) for object storing using zipped serialization
Throws:
FilePersistenceException

setGarbageListener

void setGarbageListener(IGarbageListener listener)
                        throws FilePersistenceException
set garbage listener

Parameters:
listener - th garbage listener, can be null to remove previous one
Throws:
FilePersistenceException

setSubstitutionOfJavaUtilCollection

void setSubstitutionOfJavaUtilCollection()
                                         throws FilePersistenceException
set java util collection substitution

Throws:
FilePersistenceException

setSubstitution

void setSubstitution(java.lang.Class replaced,
                     java.lang.Class substitute,
                     ISubsituteSynchronizer synchronizer)
                     throws FilePersistenceException
record a class substitution association
All file persistence instance use same substitution

Parameters:
replaced - the replaced class
substitute - the subsitutute for the replaced class
synchronizer - the state synchronizer for class and its substitute
Throws:
FilePersistenceException

setNoLazyLoad

void setNoLazyLoad(java.lang.Class objectClass)
set no use of lazy load for a class

Parameters:
objectClass -

setNoLazyLoad

void setNoLazyLoad(java.lang.Class[] objectClasses)
set no use of lazy load for the classes

Parameters:
objectClasses -

setStoreNotUseStandardSerialization

void setStoreNotUseStandardSerialization(java.lang.Class objectClass)
                                         throws FilePersistenceException
set not use standard serialization for a serializable class

Parameters:
objectClass -
Throws:
FilePersistenceException

setStoreNotUseStandardSerialization

void setStoreNotUseStandardSerialization(java.lang.Class[] objectClasses)
                                         throws FilePersistenceException
set not use standard serialization for a serializable classes

Parameters:
objectClasses -
Throws:
FilePersistenceException

setStoreSerializeAndGZippedInOneRecord

void setStoreSerializeAndGZippedInOneRecord(java.lang.Class objectClass)
                                            throws FilePersistenceException
set storage mode serialized and GZipped for a serializable class

Parameters:
objectClass -
Throws:
FilePersistenceException

setStoreSerializeAndGZippedInOneRecord

void setStoreSerializeAndGZippedInOneRecord(java.lang.Class[] objectClasses)
                                            throws FilePersistenceException
set storage mode serialized and GZipped for a serializable classes

Parameters:
objectClasses -
Throws:
FilePersistenceException

setStoreSerializeAndZippedInOneRecord

void setStoreSerializeAndZippedInOneRecord(java.lang.Class objectClass)
                                           throws FilePersistenceException
set storage mode serialized and Zipped for a serializable class

Parameters:
objectClass -
Throws:
StoreException
FilePersistenceException

setStoreSerializeAndZippedInOneRecord

void setStoreSerializeAndZippedInOneRecord(java.lang.Class[] objectClasses)
                                           throws FilePersistenceException
set storage mode serialized and Zipped for a serializable classes

Parameters:
objectClasses -
Throws:
FilePersistenceException

setStoreSerializeInOneRecord

void setStoreSerializeInOneRecord(java.lang.Class objectClass)
                                  throws FilePersistenceException
set storage mode serialized for a serializable class

Parameters:
objectClass -
Throws:
FilePersistenceException

setStoreSerializeInOneRecord

void setStoreSerializeInOneRecord(java.lang.Class[] objectClasses)
                                  throws FilePersistenceException
set storage mode serialized for a serializable classes

Parameters:
objectClasses -
Throws:
FilePersistenceException

setForceEnhance

void setForceEnhance(java.lang.Class objectClass)
force class to be enhanced even if have public method

Parameters:
objectClass -

setForceEnhance

void setForceEnhance(java.lang.Class[] objectClasses)
force classes to be enhanced even if have public method

Parameters:
objectClasses -

setObjectIOForClass

void setObjectIOForClass(java.lang.Class<?> objectClass,
                         java.lang.Class<? extends IObjectIO> objectIOClass)
                         throws FilePersistenceException
set object input output manager for a class

Parameters:
objectClass - the class for which is provide the object input output
objectIOClass - object input output manager class for the class
Throws:
FilePersistenceException - object I/O construction failure

storedEnum

void storedEnum(java.lang.Class<? extends java.lang.Enum>[] enumClasses)
                throws FilePersistenceException
inform that enum classes are persisted

Parameters:
enumClasses - the enum classes
Throws:
FilePersistenceException

storedEnum

void storedEnum(java.lang.Class<? extends java.lang.Enum> enumClass)
                throws FilePersistenceException
inform that enum class is persisted

Parameters:
enumClass - the enum class
Throws:
FilePersistenceException

storedEnum

void storedEnum(java.lang.Enum enumObject)
                throws FilePersistenceException
inform that enum object is persisted

Parameters:
enumClass - the enum class
Throws:
FilePersistenceException

garbageSweep

int garbageSweep()
                 throws FilePersistenceException
garbage sweep, remove data record for object not attached to root
should be call only when session closed

Returns:
number of garbage data record sweeped
Throws:
FilePersistenceException

enableBackgroundGarbageSweep

void enableBackgroundGarbageSweep(int sleepTime)
                                  throws FilePersistenceException
enable background garbage sweep operation

Parameters:
sleepTime - sleep time between garbage sweep operation
Throws:
FilePersistenceException

disableBackgroundGarbageSweep

void disableBackgroundGarbageSweep()
                                   throws FilePersistenceException
disable background garbage sweep operation

Throws:
FilePersistenceException

getNumberOfGarbageCandidate

int getNumberOfGarbageCandidate()
                                throws FilePersistenceException
Returns:
the number of garbage candidate
Throws:
FilePersistenceException

getNumberOfToGarbage

int getNumberOfToGarbage()
                         throws FilePersistenceException
Returns:
the number of to garbage record
Throws:
FilePersistenceException

getNumberOfDataRecord

int getNumberOfDataRecord()
                          throws FilePersistenceException
Returns:
number of data record in heap file
Throws:
FilePersistenceException

getNumberOfFreeRecord

int getNumberOfFreeRecord()
                          throws FilePersistenceException
Returns:
number of free record in heap file
Throws:
FilePersistenceException

usedSize

long usedSize()
              throws FilePersistenceException
Returns:
number of bytes used to store data in data file
Throws:
FilePersistenceException

freeSize

long freeSize()
              throws FilePersistenceException
Returns:
number of free bytes in data file
Throws:
FilePersistenceException

totalSize

long totalSize()
               throws FilePersistenceException
Returns:
total size of data file
Throws:
FilePersistenceException

numberOfObjectState

int numberOfObjectState()
                        throws FilePersistenceException
Returns:
number of object in memory with knew persistent state
Throws:
FilePersistenceException

getNumberOfModified

int getNumberOfModified()
                        throws FilePersistenceException
Returns:
number of modified object saved
Throws:
FilePersistenceException

getNumberOfVisited

int getNumberOfVisited()
                       throws FilePersistenceException
Returns:
number of object visited for save
Throws:
FilePersistenceException

checkIntegrity

void checkIntegrity()
                    throws FilePersistenceException
check integrity

Throws:
FilePersistenceException

getStorageFileName

java.lang.String getStorageFileName()
                                    throws FilePersistenceException
Returns:
data storage file name
Throws:
FilePersistenceException

getBackupFileName

java.lang.String getBackupFileName()
                                   throws FilePersistenceException
Returns:
file name for backup logging
Throws:
FilePersistenceException

getChangeFileName

java.lang.String getChangeFileName()
                                   throws FilePersistenceException
Returns:
file name for change logging
Throws:
FilePersistenceException

close

void close()
           throws FilePersistenceException
close ( important to close files )
do not save modification

Throws:
FilePersistenceException

createDataAccessSession

DataAccessSession createDataAccessSession()
                                          throws FilePersistenceException
Returns:
a new created data access session
Throws:
FilePersistenceException

copy

java.lang.Object copy(java.lang.Object sourceObject)
                      throws FilePersistenceException
Parameters:
sourceObject -
Returns:
copy of object
Throws:
FilePersistenceException

xmlExport

void xmlExport(java.lang.String directoryName,
               java.lang.String temporaryDirectoryName,
               boolean exportPersistedClassByteCode)
               throws FilePersistenceException,
                      FilePersistenceClassNotFoundException,
                      FilePersistenceInvalidClassException,
                      FilePersistenceDataCorruptedException,
                      FilePersistenceNotSerializableException
export persisted data in file export.xml put in directoryName directory
can also export byte code of class of persisted object

Parameters:
directoryName - directory name where store export
temporaryDirectoryName - temporary directory name used to store temporary files while exporting
exportPersistedClassByteCode - true if export persisted class byte code
Throws:
FilePersistenceException
FilePersistenceClassNotFoundException
FilePersistenceInvalidClassException
FilePersistenceDataCorruptedException
FilePersistenceNotSerializableException

xmlImport

void xmlImport(java.lang.String directoryName)
               throws FilePersistenceException,
                      FilePersistenceClassNotFoundException,
                      FilePersistenceInvalidClassException,
                      FilePersistenceDataCorruptedException,
                      FilePersistenceNotSerializableException
import from exported data in directoryName directory

Parameters:
directoryName - directory name where are stored exported data to import
Throws:
FilePersistenceException
FilePersistenceClassNotFoundException
FilePersistenceInvalidClassException
FilePersistenceDataCorruptedException
FilePersistenceNotSerializableException

setClassLoader

void setClassLoader(java.lang.ClassLoader classLoader)
                    throws FilePersistenceException
Throws:
FilePersistenceException

getClassLoader

java.lang.ClassLoader getClassLoader()
                                     throws FilePersistenceException
Throws:
FilePersistenceException


Copyright © 2007-2009 Luc Peuvrier. All Rights Reserved.