org.neodatis.odb.impl.core.layers.layer3.engine
Class AbstractObjectWriter

java.lang.Object
  extended by org.neodatis.odb.impl.core.layers.layer3.engine.AbstractObjectWriter
All Implemented Interfaces:
ITwoPhaseInit, IObjectWriter
Direct Known Subclasses:
LocalObjectWriter, ServerObjectWriter

public abstract class AbstractObjectWriter
extends java.lang.Object
implements IObjectWriter

Manage all IO writing

Author:
olivier s

Field Summary
protected  IByteArrayConverter byteArrayConverter
           
 IClassIntrospector classIntrospector
           
protected  IObjectInfoComparator comparator
           
 IFileSystemInterface fsi
           
protected  IIdManager idManager
           
static java.lang.String LOG_ID
           
static java.lang.String LOG_ID_DEBUG
           
protected static int nbInPlaceUpdates
           
protected static int nbNormalUpdates
           
protected  IObjectReader objectReader
           
protected  IStorageEngine storageEngine
           
protected  ITriggerManager triggerManager
          To manage triggers
 
Constructor Summary
AbstractObjectWriter(IStorageEngine engine)
           
 
Method Summary
 ClassInfo addClass(ClassInfo newClassInfo, boolean addDependentClasses)
           
 ClassInfoList addClasses(ClassInfoList classInfoList)
           
 void afterInit()
           
 long associateIdToObject(byte idType, byte idStatus, long currentBlockIdPosition, OID oid, long objectPosition, boolean writeInTransaction)
          Associate an object OID to its position
abstract  IFileSystemInterface buildFSI()
           
 void close()
           
 void createEmptyDatabaseHeader(long creationDate, java.lang.String user, java.lang.String password)
          Creates the header of the file
 OID delete(ObjectInfoHeader header)
           
 java.lang.String depthToSpaces()
           
 void encodeOid(OID oid, byte[] bytes, int offset)
           
 void flush()
           
 IFileSystemInterface getFsi()
           
 IIdManager getIdManager()
           
static int getNbInPlaceUpdates()
           
static int getNbNormalUpdates()
           
protected  ObjectInfoHeader getObjectInfoHeader(OID oid, ICache cache)
           
abstract  ISession getSession()
           
 void init2()
          The init2 method is the two phase init implementation The FileSystemInterface depends on the session creation which is done by subclasses after the ObjectWriter constructor So we can not execute the buildFSI in the constructor as it would result in a non initialized object reference (the session)
 OID insertNonNativeObject(OID oid, NonNativeObjectInfo nnoi, boolean isNewObject)
           
(package private)  long internalStoreObject(NativeObjectInfo noi)
          Store a meta representation of a native object(already as meta representation)in ODBFactory database.
 int manageIndexesForDelete(OID oid, NonNativeObjectInfo nnoi)
          Insert the object in the index
 int manageIndexesForInsert(OID oid, NonNativeObjectInfo nnoi)
          Insert the object in the index
 int manageIndexesForUpdate(OID oid, NonNativeObjectInfo nnoi, NonNativeObjectInfo oldMetaRepresentation)
           
protected  void markAsAPointerTo(OID oid, long currentPosition, long newObjectPosition)
          Writes a pointer block : A pointer block is like a goto.
 int markAsDeleted(long currentPosition, OID oid, boolean writeInTransaction)
          Mark a block as deleted
 long markIdBlockAsFull(long blockPosition, long nextBlockPosition, boolean writeInTransaction)
          Marks a block of type id as full, changes the status and the next block position
 ClassInfo persistClass(ClassInfo newClassInfo, int lastClassInfoIndex, boolean addClass, boolean addDependentClasses)
          Persist a single class info - This method is used by the XML Importer.
static void resetNbUpdates()
           
 long safeOverWriteAtomicNativeObject(long position, AtomicNativeObjectInfo newAnoi, boolean writeInTransaction)
           
static void setNbInPlaceUpdates(int nbInPlaceUpdates)
           
static void setNbNormalUpdates(int nbNormalUpdates)
           
 void setTriggerManager(ITriggerManager triggerManager)
           
 void storeFreeSpace(long currentPosition, int blockSize)
           
 OID storeObject(OID oid, NonNativeObjectInfo nnoi)
          Store a meta representation of an object(already as meta representation)in ODBFactory database.
 void updateClassInfo(ClassInfo classInfo, boolean writeInTransaction)
           
 void updateClassPositionForClassOIDWithPosition(long idPosition, long objectPosition, boolean writeInTransaction)
          Udates the real class positon of the class OID
protected  void updateFirstInstanceFieldOfClassInfoWithId(OID classInfoId, long firstInstancePosition)
          Updates the first instance field of the class info into the database file
 void updateInstanceFieldsOfClassInfo(ClassInfo classInfo, boolean writeInTransaction)
          Updates the instance related field of the class info into the database file Updates the number of objects, the first object oid and the next class oid
protected  void updateLastInstanceFieldOfClassInfoWithId(OID classInfoId, long lastInstancePosition)
          Updates the last instance field of the class info into the database file
protected  void updateNbObjectsFieldOfClassInfo(OID classInfoId, long nbObjects)
          Updates the number of objects of the class info into the database file
 void updateNextObjectFieldOfObjectInfo(OID objectOID, OID nextObjectOID, boolean writeInTransaction)
          Update next object oid field of the object at the specific position
 ObjectInfoHeader updateNextObjectPreviousPointersInCache(OID nextObjectOID, OID previousObjectOID, ICache cache)
           
 OID updateNonNativeObjectInfo(NonNativeObjectInfo nnoi, boolean forceUpdate)
          Updates an object.
 OID updateObject(AbstractObjectInfo aoi, boolean forceUpdate)
           
 void updateObjectPositionForObjectOIDWithPosition(long idPosition, long objectPosition, boolean writeInTransaction)
          Updates the real object position of the object OID
 void updateObjectReference(long positionWhereTheReferenceIsStored, OID newOid, boolean writeInTransaction)
           Class User{ private String name; private Function function; } When an object of type User is stored, it stores a reference to its function object.
 void updatePreviousObjectFieldOfObjectInfo(OID objectOID, OID previousObjectOID, boolean writeInTransaction)
          Updates the previous object position field of the object at objectPosition
 ObjectInfoHeader updatePreviousObjectNextPointersInCache(OID nextObjectOID, OID previousObjectOID, ICache cache)
           
 void updateStatusForIdWithPosition(long idPosition, byte newStatus, boolean writeInTransaction)
           
 long writeAtomicNativeObject(AtomicNativeObjectInfo anoi, boolean writeInTransaction)
          Writes a natibve attribute
 long writeAtomicNativeObject(AtomicNativeObjectInfo anoi, boolean writeInTransaction, int totalSpaceIfString)
           
 void writeClassInfoBody(ClassInfo classInfo, long position, boolean writeInTransaction)
          Write the class info body to the database file.
 void writeClassInfoHeader(ClassInfo classInfo, long position, boolean writeInTransaction)
          Write the class info header to the database file
 long writeClassInfoIndexes(ClassInfo classInfo)
           
 void writeDatabaseCharacterEncoding(boolean writeInTransaction)
          Write the database characterEncoding
 DatabaseId writeDatabaseId(long creationDate, boolean writeInTransaction)
           
 void writeEncrytionFlag(boolean useEncryption, boolean writeInTransaction)
          Write the encryption flag : 0= no encryption, 1=with encryption
 long writeEnumNativeObject(EnumNativeObjectInfo anoi, boolean writeInTransaction)
           
 void writeFirstClassInfoOID(OID classInfoID, boolean inTransaction)
          Resets the position of the first class of the metamodel.
 long writeIdBlock(long position, int idBlockSize, byte blockStatus, int blockNumber, long previousBlockPosition, boolean writeInTransaction)
          Writes the header of a block of type ID - a block that contains ids of objects and classes
 void writeLastODBCloseStatus(boolean ok, boolean writeInTransaction)
          Write the status of the last odb close
 void writeLastTransactionId(TransactionId transactionId)
          Write the current transaction Id, out of transaction
protected  void writeNativeObjectHeader(int odbTypeId, boolean isNull, byte blockType, boolean writeDataInTransaction)
          Write the header of a native attribute
protected  void writeNonNativeNullObjectHeader(OID classInfoId, boolean writeInTransaction)
           
 OID writeNonNativeObjectInfo(OID existingOid, NonNativeObjectInfo objectInfo, long position, boolean writeDataInTransaction, boolean isNewObject)
          Write an object representation to database file
 OID writeNonNativeObjectInfoOld(OID existingOid, NonNativeObjectInfo objectInfo, long position, boolean writeDataInTransaction, boolean isNewObject)
           
protected  void writeNullNativeObjectHeader(int OdbTypeId, boolean writeInTransaction)
           
 void writeNumberOfClasses(long number, boolean writeInTransaction)
          Write the number of classes in meta-model
 void writeOid(OID oid, boolean writeInTransaction, java.lang.String label, int writeAction)
           
 void writeReplicationFlag(boolean useReplication, boolean writeInTransaction)
          Write the replication flag : 0= No replication, 1= Use replication
 void writeUserAndPassword(java.lang.String user, java.lang.String password, boolean writeInTransaction)
           
 void writeVersion(boolean writeInTransaction)
          Write the version in the database file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nbInPlaceUpdates

protected static int nbInPlaceUpdates

nbNormalUpdates

protected static int nbNormalUpdates

LOG_ID

public static final java.lang.String LOG_ID
See Also:
Constant Field Values

LOG_ID_DEBUG

public static final java.lang.String LOG_ID_DEBUG
See Also:
Constant Field Values

storageEngine

protected IStorageEngine storageEngine

objectReader

protected IObjectReader objectReader

classIntrospector

public IClassIntrospector classIntrospector

fsi

public IFileSystemInterface fsi

idManager

protected IIdManager idManager

triggerManager

protected ITriggerManager triggerManager
To manage triggers


byteArrayConverter

protected IByteArrayConverter byteArrayConverter

comparator

protected IObjectInfoComparator comparator
Constructor Detail

AbstractObjectWriter

public AbstractObjectWriter(IStorageEngine engine)
Method Detail

getSession

public abstract ISession getSession()
Specified by:
getSession in interface IObjectWriter

buildFSI

public abstract IFileSystemInterface buildFSI()

init2

public void init2()
The init2 method is the two phase init implementation The FileSystemInterface depends on the session creation which is done by subclasses after the ObjectWriter constructor So we can not execute the buildFSI in the constructor as it would result in a non initialized object reference (the session)

Specified by:
init2 in interface ITwoPhaseInit

afterInit

public void afterInit()
Specified by:
afterInit in interface IObjectWriter

createEmptyDatabaseHeader

public void createEmptyDatabaseHeader(long creationDate,
                                      java.lang.String user,
                                      java.lang.String password)
Creates the header of the file

Specified by:
createEmptyDatabaseHeader in interface IObjectWriter
Parameters:
creationDate - The creation date
user - The user
password - The password @

writeUserAndPassword

public void writeUserAndPassword(java.lang.String user,
                                 java.lang.String password,
                                 boolean writeInTransaction)

writeEncrytionFlag

public void writeEncrytionFlag(boolean useEncryption,
                               boolean writeInTransaction)
Write the encryption flag : 0= no encryption, 1=with encryption


writeVersion

public void writeVersion(boolean writeInTransaction)
Write the version in the database file


writeDatabaseId

public DatabaseId writeDatabaseId(long creationDate,
                                  boolean writeInTransaction)

writeReplicationFlag

public void writeReplicationFlag(boolean useReplication,
                                 boolean writeInTransaction)
Write the replication flag : 0= No replication, 1= Use replication


writeLastTransactionId

public void writeLastTransactionId(TransactionId transactionId)
Write the current transaction Id, out of transaction

Specified by:
writeLastTransactionId in interface IObjectWriter
Parameters:
transactionId -

writeNumberOfClasses

public void writeNumberOfClasses(long number,
                                 boolean writeInTransaction)
Write the number of classes in meta-model


writeLastODBCloseStatus

public void writeLastODBCloseStatus(boolean ok,
                                    boolean writeInTransaction)
Write the status of the last odb close

Specified by:
writeLastODBCloseStatus in interface IObjectWriter

writeDatabaseCharacterEncoding

public void writeDatabaseCharacterEncoding(boolean writeInTransaction)
Write the database characterEncoding


writeIdBlock

public long writeIdBlock(long position,
                         int idBlockSize,
                         byte blockStatus,
                         int blockNumber,
                         long previousBlockPosition,
                         boolean writeInTransaction)
Writes the header of a block of type ID - a block that contains ids of objects and classes

Specified by:
writeIdBlock in interface IObjectWriter
Parameters:
position - Position at which the block must be written, if -1, take the next available position
idBlockSize - The block size in byte
blockStatus - The block status
blockNumber - The number of the block
previousBlockPosition - The position of the previous block of the same type
writeInTransaction - To indicate if write must be done in transaction
Returns:
The position of the id @

markIdBlockAsFull

public long markIdBlockAsFull(long blockPosition,
                              long nextBlockPosition,
                              boolean writeInTransaction)
Marks a block of type id as full, changes the status and the next block position

Specified by:
markIdBlockAsFull in interface IObjectWriter
Parameters:
blockPosition -
nextBlockPosition -
writeInTransaction -
Returns:
The block position @

associateIdToObject

public long associateIdToObject(byte idType,
                                byte idStatus,
                                long currentBlockIdPosition,
                                OID oid,
                                long objectPosition,
                                boolean writeInTransaction)
Associate an object OID to its position

Specified by:
associateIdToObject in interface IObjectWriter
Parameters:
idType - The type : can be object or class
idStatus - The status of the OID
currentBlockIdPosition - The current OID block position
oid - The OID
objectPosition - The position
writeInTransaction - To indicate if write must be executed in transaction
Returns:
@

updateObjectPositionForObjectOIDWithPosition

public void updateObjectPositionForObjectOIDWithPosition(long idPosition,
                                                         long objectPosition,
                                                         boolean writeInTransaction)
Updates the real object position of the object OID

Specified by:
updateObjectPositionForObjectOIDWithPosition in interface IObjectWriter
Parameters:
idPosition - The OID position
objectPosition - The real object position
writeInTransactionTo - indicate if write must be done in transaction @

updateClassPositionForClassOIDWithPosition

public void updateClassPositionForClassOIDWithPosition(long idPosition,
                                                       long objectPosition,
                                                       boolean writeInTransaction)
Udates the real class positon of the class OID

Specified by:
updateClassPositionForClassOIDWithPosition in interface IObjectWriter
Parameters:
idPosition -
objectPosition -
writeInTransaction -

updateStatusForIdWithPosition

public void updateStatusForIdWithPosition(long idPosition,
                                          byte newStatus,
                                          boolean writeInTransaction)
Specified by:
updateStatusForIdWithPosition in interface IObjectWriter

persistClass

public ClassInfo persistClass(ClassInfo newClassInfo,
                              int lastClassInfoIndex,
                              boolean addClass,
                              boolean addDependentClasses)
Persist a single class info - This method is used by the XML Importer.

Specified by:
persistClass in interface IObjectWriter

addClass

public ClassInfo addClass(ClassInfo newClassInfo,
                          boolean addDependentClasses)
Specified by:
addClass in interface IObjectWriter

addClasses

public ClassInfoList addClasses(ClassInfoList classInfoList)
Specified by:
addClasses in interface IObjectWriter

writeClassInfoHeader

public void writeClassInfoHeader(ClassInfo classInfo,
                                 long position,
                                 boolean writeInTransaction)
Description copied from interface: IObjectWriter
Write the class info header to the database file

Specified by:
writeClassInfoHeader in interface IObjectWriter
Parameters:
classInfo - The class info to be written
position - The position at which it must be written
writeInTransaction - true if the write must be done in transaction, false to write directly

encodeOid

public void encodeOid(OID oid,
                      byte[] bytes,
                      int offset)

writeOid

public void writeOid(OID oid,
                     boolean writeInTransaction,
                     java.lang.String label,
                     int writeAction)

writeClassInfoBody

public void writeClassInfoBody(ClassInfo classInfo,
                               long position,
                               boolean writeInTransaction)
Write the class info body to the database file. TODO Check if we really must recall the writeClassInfoHeader

Parameters:
classInfo -
position - The position
writeInTransaction -

writeClassInfoIndexes

public long writeClassInfoIndexes(ClassInfo classInfo)

updateClassInfo

public void updateClassInfo(ClassInfo classInfo,
                            boolean writeInTransaction)
Specified by:
updateClassInfo in interface IObjectWriter

writeFirstClassInfoOID

public void writeFirstClassInfoOID(OID classInfoID,
                                   boolean inTransaction)
Resets the position of the first class of the metamodel. It Happens when database is being refactored

Parameters:
classInfoPosition -

writeNonNativeObjectInfo

public OID writeNonNativeObjectInfo(OID existingOid,
                                    NonNativeObjectInfo objectInfo,
                                    long position,
                                    boolean writeDataInTransaction,
                                    boolean isNewObject)
Description copied from interface: IObjectWriter
Write an object representation to database file

Specified by:
writeNonNativeObjectInfo in interface IObjectWriter
Parameters:
existingOid - The oid of the object, can be null
objectInfo - The Object meta representation
position - The position where the object must be written, can be -1
writeDataInTransaction - To indicate if the write must be done in or out of transaction
Returns:
The oid of the object

writeNonNativeObjectInfoOld

public OID writeNonNativeObjectInfoOld(OID existingOid,
                                       NonNativeObjectInfo objectInfo,
                                       long position,
                                       boolean writeDataInTransaction,
                                       boolean isNewObject)

manageIndexesForInsert

public int manageIndexesForInsert(OID oid,
                                  NonNativeObjectInfo nnoi)
Insert the object in the index

Specified by:
manageIndexesForInsert in interface IObjectWriter
Parameters:
oid - The object id
nnoi - The object meta represenation
Returns:
The number of indexes

manageIndexesForDelete

public int manageIndexesForDelete(OID oid,
                                  NonNativeObjectInfo nnoi)
Insert the object in the index

Specified by:
manageIndexesForDelete in interface IObjectWriter
Parameters:
oid - The object id
nnoi - The object meta represenation
Returns:
The number of indexes
Throws:
java.lang.Exception

manageIndexesForUpdate

public int manageIndexesForUpdate(OID oid,
                                  NonNativeObjectInfo nnoi,
                                  NonNativeObjectInfo oldMetaRepresentation)
Specified by:
manageIndexesForUpdate in interface IObjectWriter

insertNonNativeObject

public OID insertNonNativeObject(OID oid,
                                 NonNativeObjectInfo nnoi,
                                 boolean isNewObject)
Specified by:
insertNonNativeObject in interface IObjectWriter
Parameters:
oid - The Oid of the object to be inserted
nnoi - The object meta representation The object to be inserted in the database
isNewObject - To indicate if object is new
Returns:
The position of the inserted object

storeObject

public OID storeObject(OID oid,
                       NonNativeObjectInfo nnoi)
Store a meta representation of an object(already as meta representation)in ODBFactory database. To detect if object must be updated or insert, we use the cache. To update an object, it must be first selected from the database. When an object is to be stored, if it exist in the cache, then it will be updated, else it will be inserted as a new object. If the object is null, the cache will be used to check if the meta representation is in the cache

Parameters:
oid - The oid of the object to be inserted/updates
nnoi - The meta representation of an object
Returns:
The object position

internalStoreObject

long internalStoreObject(NativeObjectInfo noi)
Store a meta representation of a native object(already as meta representation)in ODBFactory database. A Native object is an object that use native language type, String for example To detect if object must be updated or insert, we use the cache. To update an object, it must be first selected from the database. When an object is to be stored, if it exist in the cache, then it will be updated, else it will be inserted as a new object. If the object is null, the cache will be used to check if the meta representation is in the cache

Parameters:
nnoi - The meta representation of an object
Returns:
The object position @

updateObject

public OID updateObject(AbstractObjectInfo aoi,
                        boolean forceUpdate)

updateNonNativeObjectInfo

public OID updateNonNativeObjectInfo(NonNativeObjectInfo nnoi,
                                     boolean forceUpdate)
Updates an object.
 Try to update in place. Only change what has changed. This is restricted to particular types (fixed size types). If in place update is 
 not possible, then deletes the current object and creates a new at the end of the database file and updates
 OID object position.
 
 @param object The object to be updated
 @param forceUpdate when true, no verification is done to check if update must be done.
 @return The oid of the object, as a negative number
 @

Specified by:
updateNonNativeObjectInfo in interface IObjectWriter
Parameters:
nnoi - The meta representation of the object to be updated
forceUpdate - when true, no verification is done to check if update must be done.
Returns:
The oid of the object, as a negative number

getObjectInfoHeader

protected ObjectInfoHeader getObjectInfoHeader(OID oid,
                                               ICache cache)

updateNextObjectPreviousPointersInCache

public ObjectInfoHeader updateNextObjectPreviousPointersInCache(OID nextObjectOID,
                                                                OID previousObjectOID,
                                                                ICache cache)

updatePreviousObjectNextPointersInCache

public ObjectInfoHeader updatePreviousObjectNextPointersInCache(OID nextObjectOID,
                                                                OID previousObjectOID,
                                                                ICache cache)

depthToSpaces

public java.lang.String depthToSpaces()

writeNullNativeObjectHeader

protected void writeNullNativeObjectHeader(int OdbTypeId,
                                           boolean writeInTransaction)

writeNonNativeNullObjectHeader

protected void writeNonNativeNullObjectHeader(OID classInfoId,
                                              boolean writeInTransaction)

writeNativeObjectHeader

protected void writeNativeObjectHeader(int odbTypeId,
                                       boolean isNull,
                                       byte blockType,
                                       boolean writeDataInTransaction)
Write the header of a native attribute

Parameters:
odbTypeId -
isNull -
writeDataInTransaction -

safeOverWriteAtomicNativeObject

public long safeOverWriteAtomicNativeObject(long position,
                                            AtomicNativeObjectInfo newAnoi,
                                            boolean writeInTransaction)
                                     throws java.lang.NumberFormatException,
                                            java.io.IOException
Throws:
java.lang.NumberFormatException
java.io.IOException

writeEnumNativeObject

public long writeEnumNativeObject(EnumNativeObjectInfo anoi,
                                  boolean writeInTransaction)

writeAtomicNativeObject

public long writeAtomicNativeObject(AtomicNativeObjectInfo anoi,
                                    boolean writeInTransaction)
Writes a natibve attribute

Parameters:
anoi -
writeInTransaction - To specify if data must be written in the transaction or directly to database file
Returns:
The object position
Throws:
java.lang.NumberFormatException

writeAtomicNativeObject

public long writeAtomicNativeObject(AtomicNativeObjectInfo anoi,
                                    boolean writeInTransaction,
                                    int totalSpaceIfString)
Specified by:
writeAtomicNativeObject in interface IObjectWriter

updatePreviousObjectFieldOfObjectInfo

public void updatePreviousObjectFieldOfObjectInfo(OID objectOID,
                                                  OID previousObjectOID,
                                                  boolean writeInTransaction)
Updates the previous object position field of the object at objectPosition

Specified by:
updatePreviousObjectFieldOfObjectInfo in interface IObjectWriter
Parameters:
objectOID -
previousObjectOID -
writeInTransaction -

updateNextObjectFieldOfObjectInfo

public void updateNextObjectFieldOfObjectInfo(OID objectOID,
                                              OID nextObjectOID,
                                              boolean writeInTransaction)
Update next object oid field of the object at the specific position

Specified by:
updateNextObjectFieldOfObjectInfo in interface IObjectWriter
Parameters:
objectOID -
nextObjectOID -
writeInTransaction -

markAsDeleted

public int markAsDeleted(long currentPosition,
                         OID oid,
                         boolean writeInTransaction)
Mark a block as deleted

Specified by:
markAsDeleted in interface IObjectWriter
Parameters:
currentPosition -
Returns:
The block size

storeFreeSpace

public void storeFreeSpace(long currentPosition,
                           int blockSize)

markAsAPointerTo

protected void markAsAPointerTo(OID oid,
                                long currentPosition,
                                long newObjectPosition)
Writes a pointer block : A pointer block is like a goto. It can be used for example when an instance has been updated. To enable all the references to it to be updated, we just create o pointer at the place of the updated instance. When searching for the instance, if the block type is POINTER, then the position will be set to the pointer position

Parameters:
currentPosition -
newObjectPosition -

updateInstanceFieldsOfClassInfo

public void updateInstanceFieldsOfClassInfo(ClassInfo classInfo,
                                            boolean writeInTransaction)
Updates the instance related field of the class info into the database file Updates the number of objects, the first object oid and the next class oid

Specified by:
updateInstanceFieldsOfClassInfo in interface IObjectWriter
Parameters:
classInfo - The class info to be updated
writeInTransaction - To specify if it must be part of a transaction @

updateLastInstanceFieldOfClassInfoWithId

protected void updateLastInstanceFieldOfClassInfoWithId(OID classInfoId,
                                                        long lastInstancePosition)
Updates the last instance field of the class info into the database file

Parameters:
classInfoPosition - The class info to be updated
lastInstancePosition - The last instance position @

updateFirstInstanceFieldOfClassInfoWithId

protected void updateFirstInstanceFieldOfClassInfoWithId(OID classInfoId,
                                                         long firstInstancePosition)
Updates the first instance field of the class info into the database file

Parameters:
classInfoPosition - The class info to be updated
firstInstancePosition - The first instance position @

updateNbObjectsFieldOfClassInfo

protected void updateNbObjectsFieldOfClassInfo(OID classInfoId,
                                               long nbObjects)
Updates the number of objects of the class info into the database file

Parameters:
classInfoPosition - The class info to be updated
nbObjects - The number of object @

updateObjectReference

public void updateObjectReference(long positionWhereTheReferenceIsStored,
                                  OID newOid,
                                  boolean writeInTransaction)
                      Class User{
                       private String name;
                       private Function function;
                     }
                     
                      When an object of type User is stored, it stores a reference to its function object.
                      If the function is set to another, the pointer to the function object must be changed.
                      for example, it was pointing to a function at the position 1407, the 1407 value is stored while
                      writing the USer object, let's say at the position 528. To make the user point to another function object (which exist at the position 1890)
                      The position 528 must be updated to 1890.
 
 
 

Parameters:
positionWhereTheReferenceIsStored -
newOid -

flush

public void flush()
Specified by:
flush in interface IObjectWriter

getIdManager

public IIdManager getIdManager()
Specified by:
getIdManager in interface IObjectWriter

close

public void close()
Specified by:
close in interface IObjectWriter

getNbInPlaceUpdates

public static int getNbInPlaceUpdates()

setNbInPlaceUpdates

public static void setNbInPlaceUpdates(int nbInPlaceUpdates)

getNbNormalUpdates

public static int getNbNormalUpdates()

setNbNormalUpdates

public static void setNbNormalUpdates(int nbNormalUpdates)

resetNbUpdates

public static void resetNbUpdates()

getFsi

public IFileSystemInterface getFsi()
Specified by:
getFsi in interface IObjectWriter

delete

public OID delete(ObjectInfoHeader header)
Specified by:
delete in interface IObjectWriter

setTriggerManager

public void setTriggerManager(ITriggerManager triggerManager)
Specified by:
setTriggerManager in interface IObjectWriter