org.neodatis.odb.core.layers.layer3
Interface IObjectWriter
-
- All Superinterfaces:
- ITwoPhaseInit
- All Known Implementing Classes:
- AbstractObjectWriter, LocalObjectWriter, ServerObjectWriter
public interface IObjectWriter extends ITwoPhaseInit
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description ClassInfoaddClass(ClassInfo newClassInfo, boolean addDependentClasses)ClassInfoListaddClasses(ClassInfoList classInfoList)voidafterInit()longassociateIdToObject(byte idType, byte idStatus, long currentBlockIdPosition, OID oid, long objectPosition, boolean writeInTransaction)Associate an object OID to its positionvoidclose()voidcreateEmptyDatabaseHeader(long creationDate, java.lang.String user, java.lang.String password)Creates the header of the fileOIDdelete(ObjectInfoHeader header)voidflush()IFileSystemInterfacegetFsi()IIdManagergetIdManager()ISessiongetSession()OIDinsertNonNativeObject(OID oid, NonNativeObjectInfo nnoi, boolean isNewObject)intmanageIndexesForDelete(OID oid, NonNativeObjectInfo nnoi)Insert the object in the indexintmanageIndexesForInsert(OID oid, NonNativeObjectInfo nnoi)Insert the object in the indexintmanageIndexesForUpdate(OID oid, NonNativeObjectInfo nnoi, NonNativeObjectInfo oldMetaRepresentation)intmarkAsDeleted(long currentPosition, OID oid, boolean writeInTransaction)Mark a block as deletedlongmarkIdBlockAsFull(long blockPosition, long nextBlockPosition, boolean writeInTransaction)Marks a block of type id as full, changes the status and the next block positionClassInfopersistClass(ClassInfo newClassInfo, int lastClassInfoIndex, boolean addClass, boolean addDependentClasses)Persist a single class info - This method is used by the XML Importer.voidsetTriggerManager(ITriggerManager triggerManager)voidupdateClassInfo(ClassInfo classInfo, boolean writeInTransaction)voidupdateClassPositionForClassOIDWithPosition(long idPosition, long objectPosition, boolean writeInTransaction)Udates the real class positon of the class OIDvoidupdateInstanceFieldsOfClassInfo(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 oidvoidupdateNextObjectFieldOfObjectInfo(OID objectOID, OID nextObjectOID, boolean writeInTransaction)Update next object oid field of the object at the specific positionOIDupdateNonNativeObjectInfo(NonNativeObjectInfo nnoi, boolean forceUpdate)Updates an object.voidupdateObjectPositionForObjectOIDWithPosition(long idPosition, long objectPosition, boolean writeInTransaction)Updates the real object position of the object OIDvoidupdatePreviousObjectFieldOfObjectInfo(OID objectOID, OID previousObjectOID, boolean writeInTransaction)Updates the previous object position field of the object at objectPositionvoidupdateStatusForIdWithPosition(long idPosition, byte newStatus, boolean writeInTransaction)longwriteAtomicNativeObject(AtomicNativeObjectInfo anoi, boolean writeInTransaction, int totalSpaceIfString)voidwriteClassInfoHeader(ClassInfo classInfo, long position, boolean writeInTransaction)Write the class info header to the database filelongwriteIdBlock(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 classesvoidwriteLastODBCloseStatus(boolean ok, boolean writeInTransaction)Write the status of the last odb closevoidwriteLastTransactionId(TransactionId transactionId)OIDwriteNonNativeObjectInfo(OID existingOid, NonNativeObjectInfo objectInfo, long position, boolean writeDataInTransaction, boolean isNewObject)Write an object representation to database file-
Methods inherited from interface org.neodatis.odb.core.ITwoPhaseInit
init2
-
-
-
-
Method Detail
-
addClasses
ClassInfoList addClasses(ClassInfoList classInfoList)
-
writeClassInfoHeader
void writeClassInfoHeader(ClassInfo classInfo, long position, boolean writeInTransaction)
Write the class info header to the database file- Parameters:
classInfo- The class info to be writtenposition- The position at which it must be writtenwriteInTransaction- true if the write must be done in transaction, false to write directly
-
updateClassInfo
void updateClassInfo(ClassInfo classInfo, boolean writeInTransaction)
-
updateNonNativeObjectInfo
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.
- Parameters:
nnoi- The meta representation of the object to be updatedforceUpdate- when true, no verification is done to check if update must be done.- Returns:
- The oid of the object, as a negative number
-
writeNonNativeObjectInfo
OID writeNonNativeObjectInfo(OID existingOid, NonNativeObjectInfo objectInfo, long position, boolean writeDataInTransaction, boolean isNewObject)
Write an object representation to database file- Parameters:
existingOid- The oid of the object, can be nullobjectInfo- The Object meta representationposition- The position where the object must be written, can be -1writeDataInTransaction- To indicate if the write must be done in or out of transaction- Returns:
- The oid of the object
- Throws:
java.lang.Exception
-
writeAtomicNativeObject
long writeAtomicNativeObject(AtomicNativeObjectInfo anoi, boolean writeInTransaction, int totalSpaceIfString)
-
getIdManager
IIdManager getIdManager()
-
getSession
ISession getSession()
-
close
void close()
-
getFsi
IFileSystemInterface getFsi()
-
createEmptyDatabaseHeader
void createEmptyDatabaseHeader(long creationDate, java.lang.String user, java.lang.String password)Creates the header of the file- Parameters:
creationDate- The creation dateuser- The userpassword- The password
-
markAsDeleted
int markAsDeleted(long currentPosition, OID oid, boolean writeInTransaction)Mark a block as deleted- Parameters:
currentPosition-- Returns:
- The block size
-
manageIndexesForInsert
int manageIndexesForInsert(OID oid, NonNativeObjectInfo nnoi)
Insert the object in the index- Parameters:
oid- The object idnnoi- The object meta represenation- Returns:
- The number of indexes
-
manageIndexesForDelete
int manageIndexesForDelete(OID oid, NonNativeObjectInfo nnoi)
Insert the object in the index- Parameters:
oid- The object idnnoi- The object meta represenation- Returns:
- The number of indexes
- Throws:
java.lang.Exception
-
manageIndexesForUpdate
int manageIndexesForUpdate(OID oid, NonNativeObjectInfo nnoi, NonNativeObjectInfo oldMetaRepresentation)
-
writeLastODBCloseStatus
void writeLastODBCloseStatus(boolean ok, boolean writeInTransaction)Write the status of the last odb close
-
flush
void flush()
-
delete
OID delete(ObjectInfoHeader header)
-
updateStatusForIdWithPosition
void updateStatusForIdWithPosition(long idPosition, byte newStatus, boolean writeInTransaction)
-
updateObjectPositionForObjectOIDWithPosition
void updateObjectPositionForObjectOIDWithPosition(long idPosition, long objectPosition, boolean writeInTransaction)Updates the real object position of the object OID- Parameters:
idPosition- The OID positionobjectPosition- The real object positionwriteInTransaction- To indicate if write must be done in transaction
-
updateClassPositionForClassOIDWithPosition
void updateClassPositionForClassOIDWithPosition(long idPosition, long objectPosition, boolean writeInTransaction)Udates the real class positon of the class OID- Parameters:
idPosition-objectPosition-writeInTransaction-
-
associateIdToObject
long associateIdToObject(byte idType, byte idStatus, long currentBlockIdPosition, OID oid, long objectPosition, boolean writeInTransaction)Associate an object OID to its position- Parameters:
idType- The type : can be object or classidStatus- The status of the OIDcurrentBlockIdPosition- The current OID block positionoid- The OIDobjectPosition- The positionwriteInTransaction- To indicate if write must be executed in transaction- Returns:
-
markIdBlockAsFull
long markIdBlockAsFull(long blockPosition, long nextBlockPosition, boolean writeInTransaction)Marks a block of type id as full, changes the status and the next block position- Parameters:
blockPosition-nextBlockPosition-writeInTransaction-- Returns:
- The block position
-
writeIdBlock
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- Parameters:
position- Position at which the block must be written, if -1, take the next available positionidBlockSize- The block size in byteblockStatus- The block statusblockNumber- The number of the blockpreviousBlockPosition- The position of the previous block of the same typewriteInTransaction- To indicate if write must be done in transaction- Returns:
- The position of the id
-
updatePreviousObjectFieldOfObjectInfo
void updatePreviousObjectFieldOfObjectInfo(OID objectOID, OID previousObjectOID, boolean writeInTransaction)
Updates the previous object position field of the object at objectPosition- Parameters:
objectOID-previousObjectOID-writeInTransaction-
-
updateNextObjectFieldOfObjectInfo
void updateNextObjectFieldOfObjectInfo(OID objectOID, OID nextObjectOID, boolean writeInTransaction)
Update next object oid field of the object at the specific position- Parameters:
objectOID-nextObjectOID-writeInTransaction-
-
updateInstanceFieldsOfClassInfo
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- Parameters:
classInfo- The class info to be updatedwriteInTransaction- To specify if it must be part of a transaction
-
afterInit
void afterInit()
-
persistClass
ClassInfo persistClass(ClassInfo newClassInfo, int lastClassInfoIndex, boolean addClass, boolean addDependentClasses)
Persist a single class info - This method is used by the XML Importer.
-
writeLastTransactionId
void writeLastTransactionId(TransactionId transactionId)
-
setTriggerManager
void setTriggerManager(ITriggerManager triggerManager)
-
insertNonNativeObject
OID insertNonNativeObject(OID oid, NonNativeObjectInfo nnoi, boolean isNewObject)
- Parameters:
oid- The Oid of the object to be insertednnoi- The object meta representation The object to be inserted in the databaseisNewObject- To indicate if object is new- Returns:
- The position of the inserted object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG