org.objectweb.jorm.facility.naming.generator
Class LongGenIncr

java.lang.Object
  extended byorg.objectweb.jorm.lib.PBindingImpl
      extended byorg.objectweb.jorm.facility.naming.generator.LongGenIncr
All Implemented Interfaces:
LongGen, PAccessor, PBinding, PBindingCtrl, PLongGen, java.io.Serializable

public class LongGenIncr
extends PBindingImpl
implements PLongGen, PAccessor

Implements a long generator (LongGen) that produces new long ID merely by incrementing a persistent long variable.

Author:
P. Dechamboux
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.objectweb.jorm.lib.PBindingImpl
pClassMapping, pname, status
 
Fields inherited from interface org.objectweb.jorm.api.PBinding
ACTION_BIND, ACTION_EXIST, ACTION_EXPORT, ACTION_READ, ACTION_UNBIND, ACTION_UNEXPORT, ACTION_WRITE, LIFECYCLE_ACTIVEFORIO, LIFECYCLE_DELTOWRITE, LIFECYCLE_ERROR, LIFECYCLE_NEWTOWRITE, LIFECYCLE_NOTBOUND
 
Constructor Summary
LongGenIncr()
           
 
Method Summary
 long allocateIds(int allocate)
          Allocate a range of ids.
 long current()
          return the id that will be assigned next time.
 long genId()
          Generates a new long identifier.
 long genId(java.lang.Object conn)
           
 int getIncrement()
           
 java.lang.Object getMemoryInstance()
          It returns the memory instance within which the persistent variables are defined.
 void init(java.lang.String name, PClassMapping pcm, LongGenMgr mgr)
          Initializes this long generator.
 long paGetNextId()
          nextId getter.
 void paSetNextId(long val)
          nextId setter.
 void setIncrement(int incr)
           
 
Methods inherited from class org.objectweb.jorm.lib.PBindingImpl
bind, exist, export, export, getPClassMapping, getPName, getStatus, init, read, read, read, setPName, setStatus, unbind, unexport, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LongGenIncr

public LongGenIncr()
Method Detail

init

public void init(java.lang.String name,
                 PClassMapping pcm,
                 LongGenMgr mgr)
          throws PException
Initializes this long generator. Verifies if it already exists and if not, creates it.

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
Generates a new long identifier.

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

genId

public long genId(java.lang.Object conn)
           throws PException
Specified by:
genId in interface LongGen
Throws:
PException

allocateIds

public long allocateIds(int allocate)
                 throws PException
Description copied from interface: LongGen
Allocate a range of ids.

Specified by:
allocateIds in interface LongGen
Parameters:
allocate -
Returns:
the last identifier allocated
Throws:
PException

setIncrement

public void setIncrement(int incr)
Specified by:
setIncrement in interface LongGen

getIncrement

public int getIncrement()
Specified by:
getIncrement in interface LongGen

current

public long current()
Description copied from interface: LongGen
return the id that will be assigned next time.

Specified by:
current in interface LongGen

getMemoryInstance

public java.lang.Object getMemoryInstance()
It returns the memory instance within which the persistent variables are defined.

Specified by:
getMemoryInstance in interface PAccessor
Returns:
The actual object containing memory persistent variables.

paGetNextId

public long paGetNextId()
nextId getter.


paSetNextId

public void paSetNextId(long val)
nextId setter.