org.objectweb.jorm.facility.naming.olongid
Class LongIdManager

java.lang.Object
  extended byorg.objectweb.jorm.facility.naming.olongid.LongIdManager

public class LongIdManager
extends java.lang.Object

Is a manager helping the used of LongId identifier. A LongId is composed of two parts. The high bits describe the class identifier, whereas the low bits describes the object instance identifier. The limit between both parts are defined are building time (constructor). The allocation of identifiers is done through long generator. The manager permits to allocates PBinder and PNamingContext for normal class and generic class.

Author:
S.Chassande-Barrioz

Field Summary
static java.lang.String CLASS_ID_NAME
          Is the name of the persistent class used to load/store the association between a class name and its class identifier
static int DEFAULT_CID_SIZE
          Is the default size of the class identifier in term of number of bits
static java.lang.String ID_CLASS_NAME
          Is the name of the persistent class used to load/store the association between a class identifier and its class name.
static int LONG_SIZE
          is the number of bits of an identifier.
 
Constructor Summary
LongIdManager()
          Builds a LongIdManager with the default class identifier size.
LongIdManager(PMapper mapper)
          Builds and intializes a LongIdManager with the default class identifier size.
LongIdManager(PMapper mapper, int cidSize)
          Builds and intializes a LongIdManager with a particular class identifier size.
 
Method Summary
 int getCidSize()
           
 PMapper getMapper()
           
 PBinder newClassPBinder(java.lang.String className, java.lang.Object conn)
          Allocates a new PBinder for a normal persistent class (not a generic class).
 PNamingContext newClassPNamingContext()
          Allocates a new PNamingcontext for a normal persistent class (not a generic class).
 PBinder newGenClassPBinder()
          Allocates a new PBinder for gen class.
 void setCidSize(int cidSize)
           
 void setPMapper(PMapper mapper)
          Instanciates and initializes a LongGenMgr Allocates a class identifier generator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CID_SIZE

public static final int DEFAULT_CID_SIZE
Is the default size of the class identifier in term of number of bits

See Also:
Constant Field Values

LONG_SIZE

public static final int LONG_SIZE
is the number of bits of an identifier. It is equal to the number of bits of a long value (64)

See Also:
Constant Field Values

CLASS_ID_NAME

public static final java.lang.String CLASS_ID_NAME
Is the name of the persistent class used to load/store the association between a class name and its class identifier

See Also:
Constant Field Values

ID_CLASS_NAME

public static final java.lang.String ID_CLASS_NAME
Is the name of the persistent class used to load/store the association between a class identifier and its class name.

See Also:
Constant Field Values
Constructor Detail

LongIdManager

public LongIdManager()
Builds a LongIdManager with the default class identifier size. IMMPORTANT: a mapper must be assigned later.


LongIdManager

public LongIdManager(PMapper mapper)
              throws PException
Builds and intializes a LongIdManager with the default class identifier size.

Parameters:
mapper - is the mapper where the generator are persistent.

LongIdManager

public LongIdManager(PMapper mapper,
                     int cidSize)
              throws PException
Builds and intializes a LongIdManager with a particular class identifier size.

Parameters:
mapper - is the mapper where the generator are persistent.
cidSize - is the number of bits allocated for the class identifier among the number of bits of a long value (64).
Method Detail

getCidSize

public int getCidSize()

setCidSize

public void setCidSize(int cidSize)

getMapper

public PMapper getMapper()

setPMapper

public void setPMapper(PMapper mapper)
                throws PException
Instanciates and initializes a LongGenMgr Allocates a class identifier generator

Parameters:
mapper - the mapper where the id generator are stored
Throws:
PException - if no LongGenMgr has been found in the specified mapper.

newGenClassPBinder

public PBinder newGenClassPBinder()
                           throws PException
Allocates a new PBinder for gen class. This PBinder can be used as PNameCoder too.

Throws:
PException

newClassPNamingContext

public PNamingContext newClassPNamingContext()
                                      throws PException
Allocates a new PNamingcontext for a normal persistent class (not a generic class).

Throws:
PException

newClassPBinder

public PBinder newClassPBinder(java.lang.String className,
                               java.lang.Object conn)
                        throws PException
Allocates a new PBinder for a normal persistent class (not a generic class).

Parameters:
className - is the name of the persistent class
conn - is a way to access the data support. If the value is null, a connection is allocated from the mapper.
Throws:
PException