org.sandev.basics.DataManager
Interface UniqueIDManager


public interface UniqueIDManager

Persistency processing is where uniqueIDs are initially assigned and managed. This interface defines what is required in an implementing class so that different ID managers can be used with the same core persistency code.


Method Summary
 long getNextID(SandUpdateMessage msg)
          Return the next available uniqueID for this message class.
 void init(DataManagerNode dm)
          Set up for work.
 void notifyImport(SandPersistMessage spm)
          Allow bulk import operations to notify the counter when writing an instance directly.
 void remapIDs(long oldID, SandUpdateMessage msg, SandUpdateMessage[] remaps)
          Walk through the remap messages specified and change any oldID references to the new ID.
 

Method Detail

init

public void init(DataManagerNode dm)
          throws PersisterException
Set up for work. This method is called once before any persistence work is done.

Throws:
PersisterException

getNextID

public long getNextID(SandUpdateMessage msg)
               throws PersisterException
Return the next available uniqueID for this message class. This method must operate in an atomic fashion so that two of the same IDs will never be returned regardless of the number of threads running concurrently.

Throws:
PersisterException

remapIDs

public void remapIDs(long oldID,
                     SandUpdateMessage msg,
                     SandUpdateMessage[] remaps)
              throws PersisterException
Walk through the remap messages specified and change any oldID references to the new ID. The oldID is given, and the message which was changed to a new ID is also given. The remaps is an array of all the messages to be remapped, and they are changed in place. The message with the new ID is given so that it can be identified (if necessary) within the array of remaps.

Throws:
PersisterException

notifyImport

public void notifyImport(SandPersistMessage spm)
                  throws PersisterException
Allow bulk import operations to notify the counter when writing an instance directly. This allows the counter to keep track of uniqueIDs which may have been allocated through means other than getNextID.

Throws:
PersisterException