org.sourceforge.jemm.database.components.interfaces
Interface DBObjectHandler

All Superinterfaces:
ObjectAccessor
All Known Implementing Classes:
DefaultDBObjectHandler

public interface DBObjectHandler
extends ObjectAccessor

Internal object handler for the MemoryDatabase

Author:
Rory Graves

Method Summary
 boolean checkExists(ID objectId)
           
 ID createObject(ClientId clientId, ClassId classId)
          Creates a new object with the given class type.
 StoredListObject getListObject(ID objectId)
          Returns the stored jemm list object referred to by 'id'
 StoredMapObject getMapObject(ID objectId)
          Returns the stored jemm map object referred to by 'id'
 int getNoLocksHeld()
          Debug method to return the number of locks currently held
 StoredObject getObject(ID objectId)
           
 int getObjectCount()
           
 StoredSetObject getSetObject(ID objectId)
          Returns the stored jemm set object referred to by 'id'
 StoredUserObject getUserObject(ID objectId)
          Returns the stored user object referred to by 'id'
 void registerType(ClassId typeClassId, TypeHandler handler)
          Register a type handler for the given type class.
 void release(StoredObject object)
           
 void removeObject(ID id)
          Remote the object with the given id.
 void setObjectStatusListener(ObjectStatusListener objectStatusListener)
          Sets the object status listener.
 ObjectSyncResp synchroniseObject(ID objectId, ObjectSyncData syncData)
           
 void update(StoredObject object)
          Update the given stored object, persisting its state.
 
Methods inherited from interface org.sourceforge.jemm.database.ObjectAccessor
getObjectChildren, idIterator
 

Method Detail

setObjectStatusListener

void setObjectStatusListener(ObjectStatusListener objectStatusListener)
Sets the object status listener.

Parameters:
objectStatusListener - The new object status listener to use.

getObject

StoredObject getObject(ID objectId)
Specified by:
getObject in interface ObjectAccessor

update

void update(StoredObject object)
Update the given stored object, persisting its state.

Parameters:
object - The object to update

getUserObject

StoredUserObject getUserObject(ID objectId)
Returns the stored user object referred to by 'id'

Specified by:
getUserObject in interface ObjectAccessor
Parameters:
objectId - The id of the object to retrieve.
Throws:
java.lang.IllegalArgumentException - If 'id' is null.
java.lang.IllegalStateException - If the object is not in the database (an internal error), or the type of the retrieved object is not a user object.

getListObject

StoredListObject getListObject(ID objectId)
Description copied from interface: ObjectAccessor
Returns the stored jemm list object referred to by 'id'

Specified by:
getListObject in interface ObjectAccessor

getSetObject

StoredSetObject getSetObject(ID objectId)
Description copied from interface: ObjectAccessor
Returns the stored jemm set object referred to by 'id'

Specified by:
getSetObject in interface ObjectAccessor
Parameters:
objectId - The id of the set to retrieve.

getMapObject

StoredMapObject getMapObject(ID objectId)
Description copied from interface: ObjectAccessor
Returns the stored jemm map object referred to by 'id'

Specified by:
getMapObject in interface ObjectAccessor
Parameters:
objectId - The id of the map to retrieve.

createObject

ID createObject(ClientId clientId,
                ClassId classId)
Creates a new object with the given class type.

N.b. Once initialisation is complete - caller should call objectAccessor.initialisationFinished on the returned id.

Specified by:
createObject in interface ObjectAccessor
Parameters:
classId - The classId of the new object.
Returns:
The id of the newly created object.

synchroniseObject

ObjectSyncResp synchroniseObject(ID objectId,
                                 ObjectSyncData syncData)
Parameters:
objectId - The id of the object being synchronized
syncData - The synchronisation data, containing updated fields and current client version.
Returns:
The synchronized object response data.

removeObject

void removeObject(ID id)
Remote the object with the given id.

Specified by:
removeObject in interface ObjectAccessor
Parameters:
id - The id of the object to remove.

getObjectCount

int getObjectCount()
Returns:
The number of objects held in this database.

checkExists

boolean checkExists(ID objectId)
Specified by:
checkExists in interface ObjectAccessor

release

void release(StoredObject object)
Specified by:
release in interface ObjectAccessor

getNoLocksHeld

int getNoLocksHeld()
Debug method to return the number of locks currently held

Returns:
The number of lock currently held

registerType

void registerType(ClassId typeClassId,
                  TypeHandler handler)
Register a type handler for the given type class.

Parameters:
typeClassId - The class id of the type class being handled.
handler - The registered handler.


Copyright © 2009. All Rights Reserved.