org.sourceforge.jemm.client
Class RegistrationCache

java.lang.Object
  extended by org.sourceforge.jemm.client.DelegatingDatabase
      extended by org.sourceforge.jemm.client.RegistrationCache
All Implemented Interfaces:
Database

public class RegistrationCache
extends DelegatingDatabase
implements Database

An ObjectDatabase which caches calls to register and classinfo since they are effectively static for the lifetime of the client.

Author:
Paul Keeble

Constructor Summary
RegistrationCache(Database database)
           
 
Method Summary
 int cacheCount()
           
 ClassInfo getClassInfo(ClientId clientId, ClassId classId)
          Returns the class information for the given class id.
 EnumInfo getEnumInfo(ClientId clientId, EnumId enumId)
          Returns the information about the given enumeration.
 ClassId registerClass(ClientId clientId, ClassInfo classInfo)
          Register a user class.
 EnumId registerEnum(ClientId clientId, EnumInfo enumInfo)
          Register an enumerated type.
 
Methods inherited from class org.sourceforge.jemm.client.DelegatingDatabase
acquireLock, clientDisconnect, getDebugInterface, getObject, getRoot, newObject, processTypeRequest, referenceCleared, releaseLock, removeLockAcquiredListener, setClientLockAcquiredListener, setRoot, setRootIfNull, synchroniseObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sourceforge.jemm.database.Database
acquireLock, clientDisconnect, getDebugInterface, getObject, getRoot, newObject, processTypeRequest, referenceCleared, releaseLock, removeLockAcquiredListener, setClientLockAcquiredListener, setRoot, setRootIfNull, synchroniseObject
 

Constructor Detail

RegistrationCache

public RegistrationCache(Database database)
Method Detail

registerClass

public ClassId registerClass(ClientId clientId,
                             ClassInfo classInfo)
                      throws StructureModifiedException
Description copied from interface: Database
Register a user class.

Specified by:
registerClass in interface Database
Overrides:
registerClass in class DelegatingDatabase
Parameters:
clientId - The registering client.
classInfo - The information about the loaded user class (name/fields).
Returns:
The class id of the registered class.
Throws:
StructureModifiedException - if the class has been modified and the Database does not accept the change

registerEnum

public EnumId registerEnum(ClientId clientId,
                           EnumInfo enumInfo)
                    throws StructureModifiedException
Description copied from interface: Database
Register an enumerated type.

Specified by:
registerEnum in interface Database
Overrides:
registerEnum in class DelegatingDatabase
Parameters:
clientId - The identity of the registering client.
enumInfo - The EnumInfo describing the enumerated type.
Returns:
Returns the id of the registered enum type.
Throws:
StructureModifiedException - If a modification to the enum is detected.

getClassInfo

public ClassInfo getClassInfo(ClientId clientId,
                              ClassId classId)
Description copied from interface: Database
Returns the class information for the given class id.

Specified by:
getClassInfo in interface Database
Overrides:
getClassInfo in class DelegatingDatabase
Parameters:
clientId - The id of the requesting client.
classId - The id of the held class.
Returns:
The class information for the held class.

getEnumInfo

public EnumInfo getEnumInfo(ClientId clientId,
                            EnumId enumId)
Description copied from interface: Database
Returns the information about the given enumeration.

Specified by:
getEnumInfo in interface Database
Overrides:
getEnumInfo in class DelegatingDatabase
Parameters:
clientId - The id of the requesting client.
enumId - The id of the enumerated type.
Returns:
The classname of the registered enum type.

cacheCount

public int cacheCount()


Copyright © 2009. All Rights Reserved.