net.sf.joafip.service
Class AbstractFilePersistenceDelegate

java.lang.Object
  extended by net.sf.joafip.service.AbstractFilePersistenceDelegate
All Implemented Interfaces:
IFilePersistence
Direct Known Subclasses:
FilePersistence

@NotStorableClass
public abstract class AbstractFilePersistenceDelegate
extends java.lang.Object
implements IFilePersistence

all delegation to IStore for manager for file persistence of java object

Author:
luc peuvrier

Field Summary
protected  Logger _log
           
protected  JoafipMutex mutex
          for thread synchronization
protected  IStore store
          to manage root object persistence
 
Constructor Summary
AbstractFilePersistenceDelegate()
           
 
Method Summary
 java.util.Collection<ClassInfo> allClassInformation()
           
protected abstract  void assertNoObjectStored()
          assert there is no object stored
protected abstract  void assertSessionClosed()
           
protected abstract  void assertSessionOpenned()
           
 void checkIntegrity()
          check integrity
protected  void closeStore()
           
 java.lang.Object copy(java.lang.Object sourceObject)
          Deprecated. 
 java.lang.Object deepCopy(java.lang.Object sourceObject)
           
 void disableBackgroundGarbageSweep()
          disable background garbage sweep operation
 void enableBackgroundGarbageSweep(int sleepTime)
          enable background garbage sweep operation
 long freeSize()
          get number of free bytes in data file
 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()
           
 int getClassIdentifier(java.lang.Class<?> clazz)
           
 java.lang.ClassLoader getClassLoader()
           
 JoafipMutex getMutex()
           
 int getNumberOfDataRecord()
          get number of data record in heap file
 int getNumberOfFreeRecord()
          get number of free record in heap file
 int getNumberOfGarbageCandidate()
          get the number of known garbage candidate
 int getNumberOfModified()
           
 int getNumberOfToGarbage()
          get the number of record to garbage
 int getNumberOfVisited()
           
 java.lang.String getStorageFileName()
           
 java.util.Set<java.lang.String> getWritedSet()
          see IFilePersistence.setRecordSaveActions(boolean)
 boolean isProxy(java.lang.Object object)
          to know if object is a proxy
 void keptInMemory(java.lang.String key, java.lang.Object object)
          Inform that an object is kept in memory, never persisted
since a persisted object can reference a kept in memory object a key is use to make able to recreate link between read from storage object and kept in memory object
All instance of the object class can not be persisted
FIXME missing junit
 java.lang.String keyOfObjectKeptInMemory(java.lang.Object object)
           
 java.lang.Object newProxyInstance(java.lang.Class<?> objectClass, java.lang.Class<?>[] parameterTypes, java.lang.Object[] initargs)
           
 java.lang.Object newProxyInstance(java.lang.Object object)
           
 int numberOfObjectState()
           
protected  void openStore(boolean removeFiles)
           
 void setChangeLogEnabled(boolean enabled, int maxNumberOfChangeLog)
          set enable state of file change logging
 void setClassLoader(java.lang.ClassLoader classLoader)
          set the class loader use by proxy creation to define class
the class loader use by proxy creation to define class should be the same used to load class of object to be persisted
protected  void setEnumState(java.lang.Enum enumObject)
          set enum state from file
 void setForceEnhance(java.lang.Class objectClass)
          force class to be enhanced even if have public method if class not accessible see IFilePersistence.setForceEnhance(String)
 void setForceEnhance(java.lang.Class[] objectClasses)
          force classes to be enhanced even if have public method if class not accessible see IFilePersistence.setForceEnhance(String[])
 void setForceEnhance(java.lang.String objectClassName)
          force class to be enhanced even if have public method
 void setForceEnhance(java.lang.String[] objectClassNames)
          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
if class not accessible see IFilePersistence.setNoLazyLoad(String)
 void setNoLazyLoad(java.lang.Class[] objectClasses)
          set no use of lazy load for the classes
if class not accessible see IFilePersistence.setNoLazyLoad(String[])
 void setNoLazyLoad(java.lang.String objectClassName)
          set no use of lazy load for a class
 void setNoLazyLoad(java.lang.String[] objectClassNames)
          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
if class not accessible see IFilePersistence.setObjectIOForClass(String, Class)
 void setObjectIOForClass(java.lang.String objectClassName, java.lang.Class<? extends IObjectIO> objectIOClass)
          set object input output manager for a class
 void setRecordSaveActions(boolean recordActions)
          activation of object write recording when saving see IFilePersistence.getWritedSet()
 void setStorable(java.lang.Class objectClass)
          mark class to be storable
if class not accessible use IFilePersistence.setStorable(String)
 void setStorable(java.lang.Class[] objectClasses)
          mark classes to be storable if class not accessible use IFilePersistence.setStorable(String[])
 void setStorable(java.lang.String objectClassName)
          mark class to be storable
 void setStorable(java.lang.String[] objectClassNames)
          mark classes to be storable
protected  void setStore(IStore store)
           
 void setStoreNotUseStandardSerialization(java.lang.Class objectClass)
          set not use standard serialization for a serializable class
if class not accessible see IFilePersistence.setStoreNotUseStandardSerialization(String)
 void setStoreNotUseStandardSerialization(java.lang.Class[] objectClasses)
          set not use standard serialization for a serializable classes if class not accessible see IFilePersistence.setStoreNotUseStandardSerialization(String[])
 void setStoreNotUseStandardSerialization(java.lang.String objectClassName)
          set not use standard serialization for a serializable class
 void setStoreNotUseStandardSerialization(java.lang.String[] objectClassNames)
          set not use standard serialization for a serializable classes
 void setStoreOnlyMarkedStorable(boolean storeOnlyMarkedStorable)
          to specify if only class marked by StorableClass can be persisted or not
 void setStoreSerializeAndGZippedInOneRecord(java.lang.Class objectClass)
          set storage mode serialized and GZipped for a serializable class
if class not accessible see IFilePersistence.setStoreSerializeAndGZippedInOneRecord(String)
 void setStoreSerializeAndGZippedInOneRecord(java.lang.Class[] objectClasses)
          set storage mode serialized and GZipped for a serializable classes if class not accessible see IFilePersistence.setStoreSerializeAndGZippedInOneRecord(String[])
 void setStoreSerializeAndGZippedInOneRecord(java.lang.String objectClassName)
          set storage mode serialized and GZipped for a serializable class
 void setStoreSerializeAndGZippedInOneRecord(java.lang.String[] objectClassNames)
          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
if class is not accessible see IFilePersistence.setStoreSerializeAndZippedInOneRecord(String)
 void setStoreSerializeAndZippedInOneRecord(java.lang.Class[] objectClasses)
          set storage mode serialized and Zipped for a serializable classes if class is not accessible see IFilePersistence.setStoreSerializeAndZippedInOneRecord(String[])
 void setStoreSerializeAndZippedInOneRecord(java.lang.String objectClassName)
          set storage mode serialized and Zipped for a serializable class
 void setStoreSerializeAndZippedInOneRecord(java.lang.String[] objectClassNames)
          set storage mode serialized and Zipped for a serializable classes
 void setStoreSerializeInOneRecord(java.lang.Class objectClass)
          set storage mode serialized for a serializable class
if class is not accessible see IFilePersistence.setStoreSerializeInOneRecord(String)
 void setStoreSerializeInOneRecord(java.lang.Class[] objectClasses)
          set storage mode serialized for a serializable classes
if class is not accessible see IFilePersistence.setStoreSerializeInOneRecord(String[])
 void setStoreSerializeInOneRecord(java.lang.String objectClassName)
          set storage mode serialized for a serializable class
 void setStoreSerializeInOneRecord(java.lang.String[] objectClassNames)
          set storage mode serialized for a serializable classes
 void setSubstituteObjectManager(java.lang.Class<?> objectClass, java.lang.Class<?> substituteObjectClass, ISubstituteObjectManager substituteObjectManager)
          set substitution for object of a class writing and reading
if class is not accessible see IFilePersistence.setSubstituteObjectManager(String, Class, ISubstituteObjectManager)
 void setSubstituteObjectManager(java.lang.String objectClassName, java.lang.Class<?> substituteObjectClass, ISubstituteObjectManager substituteObjectManager)
          set substitution for object of a class writing and reading
 void setSubstitution(java.lang.Class replaced, java.lang.Class substitute, ISubsituteSynchronizer synchronizer)
          record a class substitution at write
if class is not accessible see IFilePersistence.setSubstitution(String, Class, ISubsituteSynchronizer)
 void setSubstitution(java.lang.String replacedName, java.lang.Class substitute, ISubsituteSynchronizer synchronizer)
          record a class substitution at write
 void setSubstitutionOfJavaUtilCollection()
          activate 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)
          set the compression level for class annotated StoreSerializeAndZippedInOneRecord or defined using IFilePersistence.setStoreSerializeAndZippedInOneRecord(Class) or IFilePersistence.setStoreSerializeAndZippedInOneRecord(Class[])
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
protected  void storeDoNotSave()
           
protected  java.lang.Object storeGetRoot()
           
protected  java.lang.Object storeSave(boolean closing)
           
protected  void storeSetRoot(java.lang.Object rootObject)
           
 long totalSize()
          get total size of data file
 long usedSize()
          get number of bytes used to store data in data file
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.joafip.service.IFilePersistence
clear, close, createAloneDataAccessSession, createDataAccessSession
 

Field Detail

_log

protected final transient Logger _log

store

protected transient IStore store
to manage root object persistence


mutex

protected transient JoafipMutex mutex
for thread synchronization

Constructor Detail

AbstractFilePersistenceDelegate

public AbstractFilePersistenceDelegate()
Method Detail

setStore

protected void setStore(IStore store)

getMutex

public JoafipMutex getMutex()

openStore

protected void openStore(boolean removeFiles)
                  throws StoreException,
                         StoreClassNotFoundException
Throws:
StoreException
StoreClassNotFoundException

closeStore

protected void closeStore()
                   throws StoreException
Throws:
StoreException

storeSave

protected java.lang.Object storeSave(boolean closing)
                              throws StoreException,
                                     StoreInvalidClassException,
                                     StoreNotSerializableException,
                                     StoreClassNotFoundException,
                                     StoreDataCorruptedException
Throws:
StoreException
StoreInvalidClassException
StoreNotSerializableException
StoreClassNotFoundException
StoreDataCorruptedException

storeDoNotSave

protected void storeDoNotSave()
                       throws StoreException
Throws:
StoreException

storeSetRoot

protected void storeSetRoot(java.lang.Object rootObject)
                     throws StoreException,
                            StoreInvalidClassException,
                            StoreNotSerializableException,
                            StoreClassNotFoundException,
                            StoreDataCorruptedException
Throws:
StoreException
StoreInvalidClassException
StoreNotSerializableException
StoreClassNotFoundException
StoreDataCorruptedException

storeGetRoot

protected java.lang.Object storeGetRoot()
                                 throws StoreException,
                                        StoreClassNotFoundException,
                                        StoreInvalidClassException,
                                        StoreDataCorruptedException,
                                        StoreNotSerializableException
Throws:
StoreException
StoreClassNotFoundException
StoreInvalidClassException
StoreDataCorruptedException
StoreNotSerializableException

setChangeLogEnabled

public void setChangeLogEnabled(boolean enabled,
                                int maxNumberOfChangeLog)
                         throws FilePersistenceException
Description copied from interface: IFilePersistence
set enable state of file change logging

Specified by:
setChangeLogEnabled in interface IFilePersistence
Parameters:
enabled - true if change log enabled
maxNumberOfChangeLog - max number of state change log
Throws:
FilePersistenceException

setZipCompressionLevel

public void setZipCompressionLevel(int zipCompressionLevel)
                            throws FilePersistenceException
Description copied from interface: IFilePersistence
set the compression level for class annotated StoreSerializeAndZippedInOneRecord or defined using IFilePersistence.setStoreSerializeAndZippedInOneRecord(Class) or IFilePersistence.setStoreSerializeAndZippedInOneRecord(Class[])
the compression level have value 0 thru 9:

Specified by:
setZipCompressionLevel in interface IFilePersistence
Parameters:
zipCompressionLevel - the zip the compression level (0-9) for object storing using zipped serialization
Throws:
FilePersistenceException

setGarbageListener

public void setGarbageListener(IGarbageListener listener)
                        throws FilePersistenceException
Description copied from interface: IFilePersistence
set garbage listener

Specified by:
setGarbageListener in interface IFilePersistence
Parameters:
listener - the garbage listener, can be null to remove previous one
Throws:
FilePersistenceException

setSubstitutionOfJavaUtilCollection

public void setSubstitutionOfJavaUtilCollection()
                                         throws FilePersistenceException
Description copied from interface: IFilePersistence
activate java util collection substitution

Specified by:
setSubstitutionOfJavaUtilCollection in interface IFilePersistence
Throws:
FilePersistenceException

setSubstitution

public void setSubstitution(java.lang.Class replaced,
                            java.lang.Class substitute,
                            ISubsituteSynchronizer synchronizer)
                     throws FilePersistenceException
Description copied from interface: IFilePersistence
record a class substitution at write
if class is not accessible see IFilePersistence.setSubstitution(String, Class, ISubsituteSynchronizer)

Specified by:
setSubstitution in interface IFilePersistence
Parameters:
replaced - the replaced class
substitute - the substitute for the replaced class
synchronizer - the state synchronizer for class and its substitute
Throws:
FilePersistenceException

setSubstitution

public void setSubstitution(java.lang.String replacedName,
                            java.lang.Class substitute,
                            ISubsituteSynchronizer synchronizer)
                     throws FilePersistenceException
Description copied from interface: IFilePersistence
record a class substitution at write

Specified by:
setSubstitution in interface IFilePersistence
Parameters:
replacedName - the replaced class by its name
substitute - the substitute for the replaced class
synchronizer - the state synchronizer for class and its substitute
Throws:
FilePersistenceException

setNoLazyLoad

public void setNoLazyLoad(java.lang.Class objectClass)
                   throws FilePersistenceException
Description copied from interface: IFilePersistence
set no use of lazy load for a class
if class not accessible see IFilePersistence.setNoLazyLoad(String)

Specified by:
setNoLazyLoad in interface IFilePersistence
Throws:
FilePersistenceException

setNoLazyLoad

public void setNoLazyLoad(java.lang.Class[] objectClasses)
                   throws FilePersistenceException
Description copied from interface: IFilePersistence
set no use of lazy load for the classes
if class not accessible see IFilePersistence.setNoLazyLoad(String[])

Specified by:
setNoLazyLoad in interface IFilePersistence
Throws:
FilePersistenceException

setNoLazyLoad

public void setNoLazyLoad(java.lang.String objectClassName)
Description copied from interface: IFilePersistence
set no use of lazy load for a class

Specified by:
setNoLazyLoad in interface IFilePersistence

setNoLazyLoad

public void setNoLazyLoad(java.lang.String[] objectClassNames)
Description copied from interface: IFilePersistence
set no use of lazy load for the classes

Specified by:
setNoLazyLoad in interface IFilePersistence

setStoreNotUseStandardSerialization

public void setStoreNotUseStandardSerialization(java.lang.Class objectClass)
                                         throws FilePersistenceException
Description copied from interface: IFilePersistence
set not use standard serialization for a serializable class
if class not accessible see IFilePersistence.setStoreNotUseStandardSerialization(String)

Specified by:
setStoreNotUseStandardSerialization in interface IFilePersistence
Throws:
FilePersistenceException

setStoreNotUseStandardSerialization

public void setStoreNotUseStandardSerialization(java.lang.Class[] objectClasses)
                                         throws FilePersistenceException
Description copied from interface: IFilePersistence
set not use standard serialization for a serializable classes if class not accessible see IFilePersistence.setStoreNotUseStandardSerialization(String[])

Specified by:
setStoreNotUseStandardSerialization in interface IFilePersistence
Throws:
FilePersistenceException

setStoreNotUseStandardSerialization

public void setStoreNotUseStandardSerialization(java.lang.String objectClassName)
                                         throws FilePersistenceException
Description copied from interface: IFilePersistence
set not use standard serialization for a serializable class

Specified by:
setStoreNotUseStandardSerialization in interface IFilePersistence
Throws:
FilePersistenceException

setStoreNotUseStandardSerialization

public void setStoreNotUseStandardSerialization(java.lang.String[] objectClassNames)
                                         throws FilePersistenceException
Description copied from interface: IFilePersistence
set not use standard serialization for a serializable classes

Specified by:
setStoreNotUseStandardSerialization in interface IFilePersistence
Throws:
FilePersistenceException

setStoreSerializeAndGZippedInOneRecord

public void setStoreSerializeAndGZippedInOneRecord(java.lang.Class objectClass)
                                            throws FilePersistenceException
Description copied from interface: IFilePersistence
set storage mode serialized and GZipped for a serializable class
if class not accessible see IFilePersistence.setStoreSerializeAndGZippedInOneRecord(String)

Specified by:
setStoreSerializeAndGZippedInOneRecord in interface IFilePersistence
Throws:
FilePersistenceException

setStoreSerializeAndGZippedInOneRecord

public void setStoreSerializeAndGZippedInOneRecord(java.lang.Class[] objectClasses)
                                            throws FilePersistenceException
Description copied from interface: IFilePersistence
set storage mode serialized and GZipped for a serializable classes if class not accessible see IFilePersistence.setStoreSerializeAndGZippedInOneRecord(String[])

Specified by:
setStoreSerializeAndGZippedInOneRecord in interface IFilePersistence
Throws:
FilePersistenceException

setStoreSerializeAndGZippedInOneRecord

public void setStoreSerializeAndGZippedInOneRecord(java.lang.String objectClassName)
                                            throws FilePersistenceException
Description copied from interface: IFilePersistence
set storage mode serialized and GZipped for a serializable class

Specified by:
setStoreSerializeAndGZippedInOneRecord in interface IFilePersistence
Throws:
FilePersistenceException

setStoreSerializeAndGZippedInOneRecord

public void setStoreSerializeAndGZippedInOneRecord(java.lang.String[] objectClassNames)
                                            throws FilePersistenceException
Description copied from interface: IFilePersistence
set storage mode serialized and GZipped for a serializable classes

Specified by:
setStoreSerializeAndGZippedInOneRecord in interface IFilePersistence
Throws:
FilePersistenceException

setStoreSerializeAndZippedInOneRecord

public void setStoreSerializeAndZippedInOneRecord(java.lang.Class objectClass)
                                           throws FilePersistenceException
Description copied from interface: IFilePersistence
set storage mode serialized and Zipped for a serializable class
if class is not accessible see IFilePersistence.setStoreSerializeAndZippedInOneRecord(String)

Specified by:
setStoreSerializeAndZippedInOneRecord in interface IFilePersistence
Throws:
FilePersistenceException

setStoreSerializeAndZippedInOneRecord

public void setStoreSerializeAndZippedInOneRecord(java.lang.Class[] objectClasses)
                                           throws FilePersistenceException
Description copied from interface: IFilePersistence
set storage mode serialized and Zipped for a serializable classes if class is not accessible see IFilePersistence.setStoreSerializeAndZippedInOneRecord(String[])

Specified by:
setStoreSerializeAndZippedInOneRecord in interface IFilePersistence
Throws:
FilePersistenceException

setStoreSerializeAndZippedInOneRecord

public void setStoreSerializeAndZippedInOneRecord(java.lang.String objectClassName)
                                           throws FilePersistenceException
Description copied from interface: IFilePersistence
set storage mode serialized and Zipped for a serializable class

Specified by:
setStoreSerializeAndZippedInOneRecord in interface IFilePersistence
Throws:
FilePersistenceException

setStoreSerializeAndZippedInOneRecord

public void setStoreSerializeAndZippedInOneRecord(java.lang.String[] objectClassNames)
                                           throws FilePersistenceException
Description copied from interface: IFilePersistence
set storage mode serialized and Zipped for a serializable classes

Specified by:
setStoreSerializeAndZippedInOneRecord in interface IFilePersistence
Throws:
FilePersistenceException

setStoreSerializeInOneRecord

public void setStoreSerializeInOneRecord(java.lang.Class objectClass)
                                  throws FilePersistenceException
Description copied from interface: IFilePersistence
set storage mode serialized for a serializable class
if class is not accessible see IFilePersistence.setStoreSerializeInOneRecord(String)

Specified by:
setStoreSerializeInOneRecord in interface IFilePersistence
Throws:
FilePersistenceException

setStoreSerializeInOneRecord

public void setStoreSerializeInOneRecord(java.lang.Class[] objectClasses)
                                  throws FilePersistenceException
Description copied from interface: IFilePersistence
set storage mode serialized for a serializable classes
if class is not accessible see IFilePersistence.setStoreSerializeInOneRecord(String[])

Specified by:
setStoreSerializeInOneRecord in interface IFilePersistence
Throws:
FilePersistenceException

setStoreSerializeInOneRecord

public void setStoreSerializeInOneRecord(java.lang.String objectClassName)
                                  throws FilePersistenceException
Description copied from interface: IFilePersistence
set storage mode serialized for a serializable class

Specified by:
setStoreSerializeInOneRecord in interface IFilePersistence
Throws:
FilePersistenceException

setStoreSerializeInOneRecord

public void setStoreSerializeInOneRecord(java.lang.String[] objectClassNames)
                                  throws FilePersistenceException
Description copied from interface: IFilePersistence
set storage mode serialized for a serializable classes

Specified by:
setStoreSerializeInOneRecord in interface IFilePersistence
Throws:
FilePersistenceException

setStorable

public void setStorable(java.lang.Class objectClass)
                 throws FilePersistenceException
Description copied from interface: IFilePersistence
mark class to be storable
if class not accessible use IFilePersistence.setStorable(String)

Specified by:
setStorable in interface IFilePersistence
Throws:
FilePersistenceException

setStorable

public void setStorable(java.lang.Class[] objectClasses)
                 throws FilePersistenceException
Description copied from interface: IFilePersistence
mark classes to be storable if class not accessible use IFilePersistence.setStorable(String[])

Specified by:
setStorable in interface IFilePersistence
Throws:
FilePersistenceException

setStorable

public void setStorable(java.lang.String objectClassName)
                 throws FilePersistenceException
Description copied from interface: IFilePersistence
mark class to be storable

Specified by:
setStorable in interface IFilePersistence
Throws:
FilePersistenceException

setStorable

public void setStorable(java.lang.String[] objectClassNames)
                 throws FilePersistenceException
Description copied from interface: IFilePersistence
mark classes to be storable

Specified by:
setStorable in interface IFilePersistence
Throws:
FilePersistenceException

setForceEnhance

public void setForceEnhance(java.lang.Class objectClass)
                     throws FilePersistenceException
Description copied from interface: IFilePersistence
force class to be enhanced even if have public method if class not accessible see IFilePersistence.setForceEnhance(String)

Specified by:
setForceEnhance in interface IFilePersistence
Throws:
FilePersistenceException

setForceEnhance

public void setForceEnhance(java.lang.Class[] objectClasses)
                     throws FilePersistenceException
Description copied from interface: IFilePersistence
force classes to be enhanced even if have public method if class not accessible see IFilePersistence.setForceEnhance(String[])

Specified by:
setForceEnhance in interface IFilePersistence
Throws:
FilePersistenceException

setForceEnhance

public void setForceEnhance(java.lang.String objectClassName)
Description copied from interface: IFilePersistence
force class to be enhanced even if have public method

Specified by:
setForceEnhance in interface IFilePersistence

setForceEnhance

public void setForceEnhance(java.lang.String[] objectClassNames)
Description copied from interface: IFilePersistence
force classes to be enhanced even if have public method

Specified by:
setForceEnhance in interface IFilePersistence

setObjectIOForClass

public void setObjectIOForClass(java.lang.Class<?> objectClass,
                                java.lang.Class<? extends IObjectIO> objectIOClass)
                         throws FilePersistenceException
Description copied from interface: IFilePersistence
set object input output manager for a class
if class not accessible see IFilePersistence.setObjectIOForClass(String, Class)

Specified by:
setObjectIOForClass in interface IFilePersistence
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

setObjectIOForClass

public void setObjectIOForClass(java.lang.String objectClassName,
                                java.lang.Class<? extends IObjectIO> objectIOClass)
                         throws FilePersistenceException
Description copied from interface: IFilePersistence
set object input output manager for a class

Specified by:
setObjectIOForClass in interface IFilePersistence
Parameters:
objectClassName - the class by its name 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

public void storedEnum(java.lang.Class<? extends java.lang.Enum>[] enumClasses)
                throws FilePersistenceException
Description copied from interface: IFilePersistence
inform that enum classes are persisted

Specified by:
storedEnum in interface IFilePersistence
Parameters:
enumClasses - the enum classes
Throws:
FilePersistenceException

storedEnum

public void storedEnum(java.lang.Class<? extends java.lang.Enum> enumClass)
                throws FilePersistenceException
Description copied from interface: IFilePersistence
inform that enum class is persisted

Specified by:
storedEnum in interface IFilePersistence
Parameters:
enumClass - the enum class
Throws:
FilePersistenceException

storedEnum

public void storedEnum(java.lang.Enum enumObject)
                throws FilePersistenceException
Description copied from interface: IFilePersistence
inform that enum object is persisted

Specified by:
storedEnum in interface IFilePersistence
Throws:
FilePersistenceException

setEnumState

protected void setEnumState(java.lang.Enum enumObject)
                     throws FilePersistenceException
set enum state from file

Parameters:
enumObject - the enum for which state must be set
Throws:
FilePersistenceException

setSubstituteObjectManager

public void setSubstituteObjectManager(java.lang.Class<?> objectClass,
                                       java.lang.Class<?> substituteObjectClass,
                                       ISubstituteObjectManager substituteObjectManager)
                                throws FilePersistenceException
Description copied from interface: IFilePersistence
set substitution for object of a class writing and reading
if class is not accessible see IFilePersistence.setSubstituteObjectManager(String, Class, ISubstituteObjectManager)

Specified by:
setSubstituteObjectManager in interface IFilePersistence
Parameters:
objectClass - the class of object to substitute
substituteObjectClass - the substitute object class
substituteObjectManager - the substitute manager to use
Throws:
FilePersistenceException

setSubstituteObjectManager

public void setSubstituteObjectManager(java.lang.String objectClassName,
                                       java.lang.Class<?> substituteObjectClass,
                                       ISubstituteObjectManager substituteObjectManager)
                                throws FilePersistenceException
Description copied from interface: IFilePersistence
set substitution for object of a class writing and reading

Specified by:
setSubstituteObjectManager in interface IFilePersistence
Parameters:
objectClassName - the class by its name of object to substitute
substituteObjectClass - the substitute object class
substituteObjectManager - the substitute manager to use
Throws:
FilePersistenceException

garbageSweep

public int garbageSweep()
                 throws FilePersistenceException
Description copied from interface: IFilePersistence
garbage sweep, remove data record for object not attached to root
should be call only when session closed

Specified by:
garbageSweep in interface IFilePersistence
Returns:
number of garbage data record sweeped
Throws:
FilePersistenceException

assertSessionClosed

protected abstract void assertSessionClosed()
                                     throws FilePersistenceException
Throws:
FilePersistenceException

assertSessionOpenned

protected abstract void assertSessionOpenned()
                                      throws FilePersistenceException
Throws:
FilePersistenceException

enableBackgroundGarbageSweep

public void enableBackgroundGarbageSweep(int sleepTime)
                                  throws FilePersistenceException
Description copied from interface: IFilePersistence
enable background garbage sweep operation

Specified by:
enableBackgroundGarbageSweep in interface IFilePersistence
Parameters:
sleepTime - sleep time between garbage sweep operation
Throws:
FilePersistenceException

disableBackgroundGarbageSweep

public void disableBackgroundGarbageSweep()
                                   throws FilePersistenceException
Description copied from interface: IFilePersistence
disable background garbage sweep operation

Specified by:
disableBackgroundGarbageSweep in interface IFilePersistence
Throws:
FilePersistenceException

getNumberOfGarbageCandidate

public int getNumberOfGarbageCandidate()
                                throws FilePersistenceException
Description copied from interface: IFilePersistence
get the number of known garbage candidate

Specified by:
getNumberOfGarbageCandidate in interface IFilePersistence
Returns:
the number of garbage candidate
Throws:
FilePersistenceException

getNumberOfToGarbage

public int getNumberOfToGarbage()
                         throws FilePersistenceException
Description copied from interface: IFilePersistence
get the number of record to garbage

Specified by:
getNumberOfToGarbage in interface IFilePersistence
Returns:
the number of to garbage record
Throws:
FilePersistenceException

getNumberOfDataRecord

public int getNumberOfDataRecord()
                          throws FilePersistenceException
Description copied from interface: IFilePersistence
get number of data record in heap file

Specified by:
getNumberOfDataRecord in interface IFilePersistence
Returns:
number of data record in heap file
Throws:
FilePersistenceException

getNumberOfFreeRecord

public int getNumberOfFreeRecord()
                          throws FilePersistenceException
Description copied from interface: IFilePersistence
get number of free record in heap file

Specified by:
getNumberOfFreeRecord in interface IFilePersistence
Returns:
number of free record in heap file
Throws:
FilePersistenceException

usedSize

public long usedSize()
              throws FilePersistenceException
Description copied from interface: IFilePersistence
get number of bytes used to store data in data file

Specified by:
usedSize in interface IFilePersistence
Returns:
number of bytes used to store data in data file
Throws:
FilePersistenceException

freeSize

public long freeSize()
              throws FilePersistenceException
Description copied from interface: IFilePersistence
get number of free bytes in data file

Specified by:
freeSize in interface IFilePersistence
Returns:
number of free bytes in data file
Throws:
FilePersistenceException

totalSize

public long totalSize()
               throws FilePersistenceException
Description copied from interface: IFilePersistence
get total size of data file

Specified by:
totalSize in interface IFilePersistence
Returns:
total size of data file
Throws:
FilePersistenceException

numberOfObjectState

public int numberOfObjectState()
                        throws FilePersistenceException
Specified by:
numberOfObjectState in interface IFilePersistence
Returns:
number of object in memory with knew persistent state
Throws:
FilePersistenceException

getNumberOfModified

public int getNumberOfModified()
                        throws FilePersistenceException
Specified by:
getNumberOfModified in interface IFilePersistence
Returns:
number of modified object saved
Throws:
FilePersistenceException

getNumberOfVisited

public int getNumberOfVisited()
                       throws FilePersistenceException
Specified by:
getNumberOfVisited in interface IFilePersistence
Returns:
number of object visited for save
Throws:
FilePersistenceException

checkIntegrity

public void checkIntegrity()
                    throws FilePersistenceException
Description copied from interface: IFilePersistence
check integrity

Specified by:
checkIntegrity in interface IFilePersistence
Throws:
FilePersistenceException

getStorageFileName

public java.lang.String getStorageFileName()
                                    throws FilePersistenceException
Specified by:
getStorageFileName in interface IFilePersistence
Returns:
data storage file name
Throws:
FilePersistenceException

getBackupFileName

public java.lang.String getBackupFileName()
                                   throws FilePersistenceException
Specified by:
getBackupFileName in interface IFilePersistence
Returns:
file name for backup logging
Throws:
FilePersistenceException

getChangeFileName

public java.lang.String getChangeFileName()
                                   throws FilePersistenceException
Specified by:
getChangeFileName in interface IFilePersistence
Returns:
file name for change logging
Throws:
FilePersistenceException

copy

@Deprecated
public java.lang.Object copy(java.lang.Object sourceObject)
                      throws FilePersistenceException
Deprecated. 

Description copied from interface: IFilePersistence
deprecated, see IFilePersistence.deepCopy(Object)

Specified by:
copy in interface IFilePersistence
Returns:
deep copy of object
Throws:
FilePersistenceException

deepCopy

public java.lang.Object deepCopy(java.lang.Object sourceObject)
                          throws FilePersistenceException
Specified by:
deepCopy in interface IFilePersistence
Returns:
deep copy of object
Throws:
FilePersistenceException

xmlExport

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

Specified by:
xmlExport in interface IFilePersistence
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

public void xmlImport(java.lang.String directoryName)
               throws FilePersistenceException,
                      FilePersistenceClassNotFoundException,
                      FilePersistenceInvalidClassException,
                      FilePersistenceDataCorruptedException,
                      FilePersistenceNotSerializableException
Description copied from interface: IFilePersistence
import from exported data in directoryName directory

Specified by:
xmlImport in interface IFilePersistence
Parameters:
directoryName - directory name where are stored exported data to import
Throws:
FilePersistenceException
FilePersistenceClassNotFoundException
FilePersistenceInvalidClassException
FilePersistenceDataCorruptedException
FilePersistenceNotSerializableException

assertNoObjectStored

protected abstract void assertNoObjectStored()
                                      throws FilePersistenceException,
                                             FilePersistenceClassNotFoundException,
                                             FilePersistenceInvalidClassException,
                                             FilePersistenceDataCorruptedException,
                                             FilePersistenceNotSerializableException
assert there is no object stored

Throws:
FilePersistenceNotSerializableException
FilePersistenceDataCorruptedException
FilePersistenceInvalidClassException
FilePersistenceClassNotFoundException
FilePersistenceException

setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)
                    throws FilePersistenceException
Description copied from interface: IFilePersistence
set the class loader use by proxy creation to define class
the class loader use by proxy creation to define class should be the same used to load class of object to be persisted

Specified by:
setClassLoader in interface IFilePersistence
Throws:
FilePersistenceException

getClassLoader

public java.lang.ClassLoader getClassLoader()
                                     throws FilePersistenceException
Specified by:
getClassLoader in interface IFilePersistence
Returns:
the class loader use by proxy creation to define class
Throws:
FilePersistenceException

newProxyInstance

public java.lang.Object newProxyInstance(java.lang.Object object)
                                  throws FilePersistenceException
Specified by:
newProxyInstance in interface IFilePersistence
Parameters:
object - object to copy where all instance will be replaced by proxy
Returns:
the proxied object
Throws:
FilePersistenceException

newProxyInstance

public java.lang.Object newProxyInstance(java.lang.Class<?> objectClass,
                                         java.lang.Class<?>[] parameterTypes,
                                         java.lang.Object[] initargs)
                                  throws FilePersistenceException
Specified by:
newProxyInstance in interface IFilePersistence
Parameters:
objectClass - the object to create class
parameterTypes - parameters type, see Class.getConstructor(Class...)
initargs - the construction parameters, see Constructor.newInstance(Object...)
Returns:
the proxied object where all instance are loaded proxy
Throws:
FilePersistenceException

setStoreOnlyMarkedStorable

public void setStoreOnlyMarkedStorable(boolean storeOnlyMarkedStorable)
Description copied from interface: IFilePersistence
to specify if only class marked by StorableClass can be persisted or not

Specified by:
setStoreOnlyMarkedStorable in interface IFilePersistence

getClassIdentifier

public int getClassIdentifier(java.lang.Class<?> clazz)
                       throws FilePersistenceException,
                              FilePersistenceClassNotFoundException
Specified by:
getClassIdentifier in interface IFilePersistence
Returns:
joafip internal class identifier
Throws:
FilePersistenceException
FilePersistenceClassNotFoundException

allClassInformation

public java.util.Collection<ClassInfo> allClassInformation()
Specified by:
allClassInformation in interface IFilePersistence
Returns:
information on all knew classes

isProxy

public boolean isProxy(java.lang.Object object)
Description copied from interface: IFilePersistence
to know if object is a proxy

Specified by:
isProxy in interface IFilePersistence
Parameters:
object - the object to test
Returns:
true if object is a proxy

keptInMemory

public void keptInMemory(java.lang.String key,
                         java.lang.Object object)
                  throws FilePersistenceException
Description copied from interface: IFilePersistence
Inform that an object is kept in memory, never persisted
since a persisted object can reference a kept in memory object a key is use to make able to recreate link between read from storage object and kept in memory object
All instance of the object class can not be persisted
FIXME missing junit

Specified by:
keptInMemory in interface IFilePersistence
Parameters:
key - key associated to the object
object - the not persisted object kept in memory
Throws:
FilePersistenceException

keyOfObjectKeptInMemory

public java.lang.String keyOfObjectKeptInMemory(java.lang.Object object)
Specified by:
keyOfObjectKeptInMemory in interface IFilePersistence
Parameters:
object - the not persisted object kept in memory
Returns:
the key associated to the object

setRecordSaveActions

public void setRecordSaveActions(boolean recordActions)
Description copied from interface: IFilePersistence
activation of object write recording when saving see IFilePersistence.getWritedSet()

Specified by:
setRecordSaveActions in interface IFilePersistence
Parameters:
recordActions - true to activate object write recording

getWritedSet

public java.util.Set<java.lang.String> getWritedSet()
Description copied from interface: IFilePersistence
see IFilePersistence.setRecordSaveActions(boolean)

Specified by:
getWritedSet in interface IFilePersistence
Returns:
wrote object set since last save


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