com.metamatrix.common.id.dbid
Class DBIDGenerator

java.lang.Object
  extended by com.metamatrix.common.id.dbid.DBIDGenerator

public class DBIDGenerator
extends java.lang.Object


Field Summary
static java.lang.String SERVICE_ID
           
static java.lang.String VM_ID
           
 
Method Summary
 long getID(java.lang.String context)
          Call to get a unique id for the given context and by default the the id numbers cannot be rolled over and reused.
 long getID(java.lang.String context, boolean enableRollOver)
          call to get a unique id for the given context and pass true if the id numbers can be rolled over and reused.
static DBIDGenerator getInstance()
           
 void setCacheBlockSize(java.lang.String context, long cache)
          Call to set the incremental block size for a specific context.
 void setUseMemoryIDGeneration()
          Call when the persistent storage of ID's is not to be used.
 void setUseMemoryIDGeneration(boolean useInMemory)
          Call to switch whether persistent storage of ID's is to be used.
 void shutDown()
          Call when the DBIDGenerator is no longer needed and the database connections can be closed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VM_ID

public static final java.lang.String VM_ID
See Also:
Constant Field Values

SERVICE_ID

public static final java.lang.String SERVICE_ID
See Also:
Constant Field Values
Method Detail

getID

public long getID(java.lang.String context,
                  boolean enableRollOver)
           throws DBIDGeneratorException
call to get a unique id for the given context and pass true if the id numbers can be rolled over and reused.

Parameters:
context - that identifies a unique entity
enableRollOver - is true if the ids can reused
Returns:
long is the next id
Throws:
DBIDGeneratorException

getID

public long getID(java.lang.String context)
           throws DBIDGeneratorException
Call to get a unique id for the given context and by default the the id numbers cannot be rolled over and reused.

Parameters:
context - that identifies a unique entity
Returns:
long is the next id
Throws:
DBIDGeneratorException

setCacheBlockSize

public void setCacheBlockSize(java.lang.String context,
                              long cache)
                       throws DBIDGeneratorException
Call to set the incremental block size for a specific context. This is a way to tune the caching which will reduce the number of database reads that occur. By increasing the cache, it should reduce the number of database reads.

Parameters:
context - that identifies a unique entity
cache - is the size of the blocks to use
Throws:
DBIDGeneratorException

setUseMemoryIDGeneration

public void setUseMemoryIDGeneration()
Call when the persistent storage of ID's is not to be used. This will cause the id's to be generated in memory and will not be written to the database for later use for a starting point. This was made available for the CDK because it needs to load runtime metadata disconnected from the application server or database.


setUseMemoryIDGeneration

public void setUseMemoryIDGeneration(boolean useInMemory)
Call to switch whether persistent storage of ID's is to be used.

Parameters:
useInMemory - whether or not to use in Memory ID generation

shutDown

public void shutDown()
Call when the DBIDGenerator is no longer needed and the database connections can be closed.


getInstance

public static DBIDGenerator getInstance()


Copyright © 2009. All Rights Reserved.