org.objectweb.jorm.facility.naming.longid
Class CompositePLongGen

java.lang.Object
  extended byorg.objectweb.jorm.facility.naming.longid.CompositePLongGen
All Implemented Interfaces:
LongGen, PLongGen

public class CompositePLongGen
extends java.lang.Object
implements PLongGen

This object long identifier generates identifier divided in two parts. The first part is the value representing a class persistent class. The second part is a value representing the instance of the class. In fact this generator adds a fixed value (class id) with another long values choosen by a sub PLongGen.

Author:
S.Chassande-Barrioz

Field Summary
protected  long cid
          The identifier of the persitent class
protected  int cidSize
           
protected  PLongGen objectIdGenerator
          The inner generator of object identifier
 
Constructor Summary
CompositePLongGen(PLongGen objectIdGenerator, long cid, int cidSize)
           
 
Method Summary
 long genId()
          Allocates a new composite identifier
 long genId(java.lang.Object conn)
          Allocates a new composite identifier
 long getCid()
           
 void init(java.lang.String name, PClassMapping pcm, LongGenMgr mgr)
          Initializes the underlying object identifier generator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objectIdGenerator

protected PLongGen objectIdGenerator
The inner generator of object identifier


cid

protected long cid
The identifier of the persitent class


cidSize

protected int cidSize
Constructor Detail

CompositePLongGen

public CompositePLongGen(PLongGen objectIdGenerator,
                         long cid,
                         int cidSize)
Method Detail

getCid

public long getCid()

init

public void init(java.lang.String name,
                 PClassMapping pcm,
                 LongGenMgr mgr)
          throws PException
Initializes the underlying object identifier generator

Specified by:
init in interface PLongGen
Parameters:
name - The name identifier associated with this long generator.
pcm - The associated PClassMapping.
mgr - The manager associated with this generator.
Throws:
PException

genId

public long genId()
           throws PException
Allocates a new composite identifier

Specified by:
genId in interface LongGen
Returns:
The new identifier.
Throws:
PException

genId

public long genId(java.lang.Object conn)
           throws PException
Allocates a new composite identifier

Specified by:
genId in interface LongGen
Parameters:
conn - is a way to access the data support
Throws:
PException