com.ibm.di.fc
Class DeltaFC

java.lang.Object
  extended by com.ibm.di.fc.Function
      extended by com.ibm.di.fc.DeltaFC
All Implemented Interfaces:
FunctionInterface, VersionInfoInterface

public class DeltaFC
extends Function

The Delta Function Component encapsulates the Delta functionality for tracking changes in an input source using underlying database for comparison.

The main logic of this component is reused by the CSDeltaTaskComponent to maintain the Delta tab functionality for connectors in Iterator mode.

Since:
TDI 7.1

Field Summary
static java.lang.String PARAM_DETECT_ALL
          Parameter name.
static java.lang.String PARAM_DETECT_ATTRIBUTES
          Parameter name.
static java.lang.String PARAM_IGNORE_ATTRIBUTES
          Parameter name.
static java.lang.String PARAM_READ_COMMITTED
           
static java.lang.String PARAM_READ_UNCOMMITTED
           
static java.lang.String PARAM_REPEATABLE_READ
           
static java.lang.String PARAM_SERIALIZABLE
           
 TaskStatistics stats
          This is the statistics object for the component
 
Fields inherited from class com.ibm.di.fc.Function
logger
 
Constructor Summary
DeltaFC()
           
 
Method Summary
 void closeDelta()
          Closes connection to the Delta Store.
 void commitDeltaState()
          Commit the last transactions in Derby database
 void commitOnEndIter()
          Commit if in commit mode "On end of AL cycle"
static ResourceHash getResHash()
          Used by the script 'deleteDelta' in the tdi.xml for this component.
 java.lang.String getStatisticsString()
          This method is used to report different types of made changes.
 java.lang.String getVersion()
          Version information.
 void initialize(java.lang.Object obj)
          Called once to initialize the Delta Function Component.
 boolean isReadingDeleted()
          Returns true if we are reading deleted entries at the moment
 boolean markEntryInDeltaStore(Entry work)
          Marks an Entry in the Delta Store.
 Entry nextDeletedEntry(Entry work)
          Return the next deleted entry.
 java.lang.Object perform(java.lang.Object obj)
          This method accepts an object of type Entry and computes Delta changes based on the used underlying Delta Store table.
 void rollbackDeltaState()
          Rollback the last transactions in Derby database
 void saveDeltaState()
          Commit the last transactions in Derby database (alias for commitDeltaState)
 void terminate()
          This method closes the internally used Delta Store.
 
Methods inherited from class com.ibm.di.fc.Function
debug, getConfiguration, getContext, getDebug, getLog, getParam, getRSInterface, getUI, initialize, logmsg, querySchema, setConfiguration, setContext, setDebug, setLog, setParam, setRSInterface, updateSchema, verifyInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stats

public TaskStatistics stats
This is the statistics object for the component


PARAM_READ_UNCOMMITTED

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

PARAM_READ_COMMITTED

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

PARAM_REPEATABLE_READ

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

PARAM_SERIALIZABLE

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

PARAM_IGNORE_ATTRIBUTES

public static final java.lang.String PARAM_IGNORE_ATTRIBUTES
Parameter name. When selected changes in attributes listed in "Attribute List" parameter will be ignored.

See Also:
Constant Field Values

PARAM_DETECT_ATTRIBUTES

public static final java.lang.String PARAM_DETECT_ATTRIBUTES
Parameter name. When selected only changes in attributes listed in "Attribute List" parameter will be detected.

See Also:
Constant Field Values

PARAM_DETECT_ALL

public static final java.lang.String PARAM_DETECT_ALL
Parameter name. When selected change sin all attributes will be selected and "Attribute List" parameter will be disabled.

See Also:
Constant Field Values
Constructor Detail

DeltaFC

public DeltaFC()
Method Detail

getResHash

public static ResourceHash getResHash()
Used by the script 'deleteDelta' in the tdi.xml for this component.

Returns:
The resource object.

initialize

public void initialize(java.lang.Object obj)
                throws java.lang.Exception
Called once to initialize the Delta Function Component.

Specified by:
initialize in interface FunctionInterface
Overrides:
initialize in class Function
Parameters:
obj - ignored
Throws:
java.lang.Exception - if an error occurs

perform

public java.lang.Object perform(java.lang.Object obj)
                         throws java.lang.Exception
This method accepts an object of type Entry and computes Delta changes based on the used underlying Delta Store table.

Parameters:
obj - Entry object
Returns:
Returns Delta tagged Entry
Throws:
java.lang.Exception - if the parameter is not an instance of the Entry class, if the FC has not been initialized or if the method fails

nextDeletedEntry

public Entry nextDeletedEntry(Entry work)
                       throws java.lang.Exception
Return the next deleted entry.

Parameters:
work - the work entry to fill in
Returns:
the work entry filled with the next deleted entry
Throws:
java.lang.Exception - if a problem occurs

markEntryInDeltaStore

public boolean markEntryInDeltaStore(Entry work)
Marks an Entry in the Delta Store. This can be useful if the current change can not be propagated properly, and you want to roll back the delta state. You can then use code like this, assuming this Component is called MyIterator:
 MyComponent.rollbackDeltaState();
 MyComponent.markEntryInDeltaStore(work);
 MyComponent.commitDeltaState();
 

Parameters:
work - The Entry that contains the key information
Returns:
true if the Entry contained a meaningful key and could be marked in the Delta Store

rollbackDeltaState

public void rollbackDeltaState()
                        throws java.sql.SQLException
Rollback the last transactions in Derby database

Throws:
java.sql.SQLException - Thrown if an error occurs
See Also:
markEntryInDeltaStore(Entry)

saveDeltaState

public void saveDeltaState()
                    throws java.sql.SQLException
Commit the last transactions in Derby database (alias for commitDeltaState)

Throws:
java.sql.SQLException - Thrown if an error occurs

commitOnEndIter

public void commitOnEndIter()
                     throws java.sql.SQLException
Commit if in commit mode "On end of AL cycle"

Throws:
java.sql.SQLException - Thrown if an error occurs

commitDeltaState

public void commitDeltaState()
                      throws java.sql.SQLException
Commit the last transactions in Derby database

Throws:
java.sql.SQLException - Thrown if an error occurs

closeDelta

public void closeDelta()
                throws java.lang.Exception
Closes connection to the Delta Store.

Throws:
java.lang.Exception

getStatisticsString

public java.lang.String getStatisticsString()
This method is used to report different types of made changes.

Returns:
The statistics for this run;

getVersion

public java.lang.String getVersion()
Version information.

Returns:
version information.

terminate

public void terminate()
               throws java.lang.Exception
This method closes the internally used Delta Store.

Specified by:
terminate in interface FunctionInterface
Overrides:
terminate in class Function
Throws:
java.lang.Exception - An exception is thrown if this method fails.

isReadingDeleted

public boolean isReadingDeleted()
Returns true if we are reading deleted entries at the moment