org.datanucleus.jdo
Class JDOSequenceImpl

java.lang.Object
  extended by org.datanucleus.jdo.JDOSequenceImpl
All Implemented Interfaces:
javax.jdo.datastore.Sequence, NucleusSequence

public class JDOSequenceImpl
extends java.lang.Object
implements javax.jdo.datastore.Sequence, NucleusSequence

Basic generic implementation of a JDO2 datastore sequence for DB4O datastores. Utilises the "org.datanucleus.store_valuegenerator" extensions.


Field Summary
protected  ValueGenerator generator
          The generator for the sequence.
protected static Localiser LOCALISER
          Localisation of messages
protected  ObjectManager om
          The controlling Object Manager.
protected  SequenceMetaData seqMetaData
          Name of the sequence.
protected  StoreManager storeManager
          Store Manager where we obtain our sequence.
 
Constructor Summary
JDOSequenceImpl(ObjectManager objectMgr, StoreManager storeMgr, SequenceMetaData seqmd)
          Constructor.
 
Method Summary
 void allocate(int additional)
          Method to allocate a set of elements.
 java.lang.Object current()
          Accessor for the current element.
 long currentValue()
          Accessor for the current element in the sequence as a long.
 java.lang.String getName()
          Accessor for the sequence name.
 java.lang.Object next()
          Accessor for the next element in the sequence.
 long nextValue()
          Accessor for the next element in the sequence as a long.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localisation of messages


storeManager

protected final StoreManager storeManager
Store Manager where we obtain our sequence.


seqMetaData

protected final SequenceMetaData seqMetaData
Name of the sequence.


generator

protected final ValueGenerator generator
The generator for the sequence.


om

protected final ObjectManager om
The controlling Object Manager.

Constructor Detail

JDOSequenceImpl

public JDOSequenceImpl(ObjectManager objectMgr,
                       StoreManager storeMgr,
                       SequenceMetaData seqmd)
Constructor.

Parameters:
objectMgr - The Object Manager managing the sequence
storeMgr - Manager of the store where we obtain the sequence
seqmd - MetaData defining the sequence
Method Detail

getName

public java.lang.String getName()
Accessor for the sequence name.

Specified by:
getName in interface javax.jdo.datastore.Sequence
Specified by:
getName in interface NucleusSequence
Returns:
The sequence name

allocate

public void allocate(int additional)
Method to allocate a set of elements.

Specified by:
allocate in interface javax.jdo.datastore.Sequence
Specified by:
allocate in interface NucleusSequence
Parameters:
additional - The number of additional elements to allocate

next

public java.lang.Object next()
Accessor for the next element in the sequence.

Specified by:
next in interface javax.jdo.datastore.Sequence
Specified by:
next in interface NucleusSequence
Returns:
The next element

nextValue

public long nextValue()
Accessor for the next element in the sequence as a long.

Specified by:
nextValue in interface javax.jdo.datastore.Sequence
Specified by:
nextValue in interface NucleusSequence
Returns:
The next element
Throws:
javax.jdo.JDODataStoreException - Thrown if not numeric

current

public java.lang.Object current()
Accessor for the current element.

Specified by:
current in interface javax.jdo.datastore.Sequence
Specified by:
current in interface NucleusSequence
Returns:
The current element.

currentValue

public long currentValue()
Accessor for the current element in the sequence as a long.

Specified by:
currentValue in interface javax.jdo.datastore.Sequence
Specified by:
currentValue in interface NucleusSequence
Returns:
The current element
Throws:
javax.jdo.JDODataStoreException - Thrown if not numeric


Copyright © 2009. All Rights Reserved.