com.ibm.di.store
Class DeltaStore

java.lang.Object
  extended by com.ibm.di.store.DeltaStore

public class DeltaStore
extends Object

This class implements the functionality for creating and maintaining a single Delta Store table.

Note: For internal use only!


Field Summary
static String TABLE_PREFIX
           
 
Constructor Summary
DeltaStore(String identifier, boolean isRestarting)
           
DeltaStore(String identifier, boolean isRestarting, Log logger, boolean removeDeleted)
           
 
Method Summary
 void closeDelta()
           
 void closeReusedStatements()
           
 void commit()
          Commit the last transactions.
 void commitOnEndIter()
          Commit if in commit mode "On end of AL cycle".
 void deleteEntry(String key)
           
 Entry findEntry(String key)
           
 Entry findEntryVerify(String key)
           
 Entry getNextDeletedEntry(boolean deleteEntry)
          Returns the next deleted Entry.
 Entry getNextDeletedEntry(boolean deleteEntry, Set<String> keys)
          Returns the next deleted Entry, given a Set of keys for unchanged Entries.
 Entry getStatistics()
           
 String getStatisticsString()
           
 void insertEntry(String key, Entry entry)
           
 void rollback()
          Rollback the last transactions.
 void selectDeletedEntries()
          Selects the deleted entries from the Delta Store table.
 void setAllowDuplicateDeltaKeys(boolean allowDuplicateDeltaKeys)
          Indicates whether the duplicate delta keys are allowed.
 boolean setCommitMode(String mode)
          Set the commit behavior of Delta.
 void setRowLocking(int level)
          This method sets the transaction isolation level used when working with the Delta Store.
 void updateEntry(String key, Entry entry)
           
 void updateSequence(String key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLE_PREFIX

public static final String TABLE_PREFIX
See Also:
Constant Field Values
Constructor Detail

DeltaStore

public DeltaStore(String identifier,
                  boolean isRestarting,
                  Log logger,
                  boolean removeDeleted)
           throws Exception
Throws:
Exception

DeltaStore

public DeltaStore(String identifier,
                  boolean isRestarting)
           throws Exception
Throws:
Exception
Method Detail

setCommitMode

public boolean setCommitMode(String mode)
Set the commit behavior of Delta.

Parameters:
mode - The intended behavior. Possible values are:
  • "After every database operation"
  • "On Connector close"
  • "On end of AL cycle"
  • "No autocommit"
Returns:
false if the requested mode is not a legal value

closeDelta

public void closeDelta()
                throws SQLException
Throws:
SQLException

closeReusedStatements

public void closeReusedStatements()
                           throws SQLException
Throws:
SQLException

updateSequence

public void updateSequence(String key)
                    throws Exception
Throws:
Exception

updateEntry

public void updateEntry(String key,
                        Entry entry)
                 throws Exception
Throws:
Exception

insertEntry

public void insertEntry(String key,
                        Entry entry)
                 throws Exception
Throws:
Exception

findEntry

public Entry findEntry(String key)
                throws Exception
Throws:
Exception

findEntryVerify

public Entry findEntryVerify(String key)
                      throws Exception
Throws:
Exception

deleteEntry

public void deleteEntry(String key)
                 throws Exception
Throws:
Exception

selectDeletedEntries

public void selectDeletedEntries()
                          throws Exception
Selects the deleted entries from the Delta Store table.

Throws:
Exception - if a database access error occurs or the given parameters are not ResultSet constants indicating type and concurrency

getNextDeletedEntry

public Entry getNextDeletedEntry(boolean deleteEntry)
                          throws Exception
Returns the next deleted Entry.

Throws:
Exception

getNextDeletedEntry

public Entry getNextDeletedEntry(boolean deleteEntry,
                                 Set<String> keys)
                          throws Exception
Returns the next deleted Entry, given a Set of keys for unchanged Entries. Will not return any Entry with a key in the given Set.

Parameters:
deleteEntry - - If set, also delete the Entry from the deltaStore
keys - - Should be null, or a Set containing keys for unchanged entries
Returns:
The next deleted Entry
Throws:
Exception

getStatistics

public Entry getStatistics()

getStatisticsString

public String getStatisticsString()
Returns:
The statistics for this run
Since:
7.0

commit

public void commit()
            throws SQLException
Commit the last transactions. The operation will NOT be executed if at the moment the Delta Store is iterating deleted entries.

Throws:
SQLException - Thrown if an error occurs

rollback

public void rollback()
              throws SQLException
Rollback the last transactions. The operation will NOT be executed if at the moment the Delta Store is iterating deleted entries.

Throws:
SQLException - Thrown if an error occurs

commitOnEndIter

public void commitOnEndIter()
                     throws SQLException
Commit if in commit mode "On end of AL cycle". The operation will NOT be executed if at the moment the Delta Store is iterating deleted entries.

Throws:
SQLException - Thrown if an error occurs

setAllowDuplicateDeltaKeys

public void setAllowDuplicateDeltaKeys(boolean allowDuplicateDeltaKeys)
Indicates whether the duplicate delta keys are allowed.

Parameters:
allowDuplicateDeltaKeys - true if duplicate delta keys are allowed false otherwise

setRowLocking

public void setRowLocking(int level)
                   throws Exception
This method sets the transaction isolation level used when working with the Delta Store. Setting higher isolation level reduces the transaction anomalies known as 'dirty reads', 'repeatable reads' and 'phantom reads' by using row and table locks.

The transaction level is set only if transactions and the specified level are supported by the underlying database.

Parameters:
level - the integer value of the level as defined in the Connection
Throws:
SQLException - if a database access error occurs.
Exception