Package com.ibm.di.api.tm
Class TombstoneManager
- java.lang.Object
-
- com.ibm.di.api.tm.TombstoneManager
-
public class TombstoneManager extends java.lang.ObjectThis class is used to manage Tombstone objects. It contains methods to retrieve and delete tombstone objects on a specific criteria.
-
-
Field Summary
Fields Modifier and Type Field Description static intCOMPONENT_TYPE_ASSEMBLY_LINEThis constant could be used as value for theTombstone.PROPERTY_NAME_COMPONENT_TYPE_IDproperty.static intCOMPONENT_TYPE_CONFIG_INSTANCEThis constant could be used as value for theTombstone.PROPERTY_NAME_COMPONENT_TYPE_IDproperty.static intCOMPONENT_TYPE_EVENT_HANDLERThis constant could be used as value for theTombstone.PROPERTY_NAME_COMPONENT_TYPE_IDproperty.static java.lang.StringPROP_AUTODEL_AGEWhen this property is present and contains an integer value greater than 0 the Tombstone Manager will automatically delete all tombstone records that are older than the specified number of days.static java.lang.StringPROP_AUTODEL_RECORDS_MAXThis property specifies the number of tombstone records to keep when the logic for leveling is triggered as per thePROP_AUTODEL_RECORDS_TRIGGERproperty.static java.lang.StringPROP_AUTODEL_RECORDS_TRIGGERThis property specifies the total number of tombstone records that will trigger the logic for leveling the number of tombstone records to a certain number.
The default value for this property is "10000".static java.lang.StringPROP_CREATE_ALLWhen this property is set to "true" the Tombstone Manager will create tombstones for every AssemblyLine and Config Instance regardless of the values specified in the configurations.static java.lang.StringPROP_CREATE_TABLEThis property is used to override the default "CREATE TABLE..." SQL statement.static java.lang.StringPROP_FIELD_COMPONENT_NAMEA constant for the column "COMPONENT_NAME"static java.lang.StringPROP_FIELD_COMPONENT_TYPE_IDA constant for the column "COMPONENT_TYPE_ID"static java.lang.StringPROP_FIELD_CONFIGURATIONA constant for the column "CONFIGURATION"static java.lang.StringPROP_FIELD_CREATED_ONA constant for the column "CREATED_ON"static java.lang.StringPROP_FIELD_ERROR_DESCRA constant for the column "ERROR_DESCR"static java.lang.StringPROP_FIELD_EVENT_TYPE_IDA constant for the column "EVENT_TYPE_ID"static java.lang.StringPROP_FIELD_EXIT_CODEA constant for the column "EXIT_CODE"static java.lang.StringPROP_FIELD_GUIDA constant for the column "GUID"static java.lang.StringPROP_FIELD_IDA constant for the column - IDstatic java.lang.StringPROP_FIELD_START_TIMEA constant for the column "START_TIME"static java.lang.StringPROP_FIELD_STATSA constant for the column "STATS"static java.lang.StringPROP_FIELD_USER_MESSAGEA constant for the column "USER_MESSAGE"static java.lang.StringPROP_UPDATE_TABLEThis property is used to override the default "INSERT INTO..." SQL statement.static java.lang.StringTABLE_NAMEThis constant has the name of the table that will be created/queried.
-
Constructor Summary
Constructors Constructor Description TombstoneManager()Default constructor for this object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdeleteALTombstones(java.lang.String aAssemblyLineName, java.lang.String aConfigID)Deletes all Tombstone objects created for the specified AssemblyLine.intdeleteALTombstones(java.lang.String aAssemblyLineName, java.lang.String aConfigID, int aDays)Deletes all Tombstone objects for a specified AssemblyLine that are older than the specified number of days.intdeleteALTombstones(java.lang.String aAssemblyLineName, java.lang.String aConfigID, java.util.Date olderThanDate)Deletes all Tombstone objects for a specified AssemblyLine that are older than the specified date.intdeleteALTombstones(java.lang.String aAssemblyLineName, java.lang.String aConfigID, java.util.Date startDate, java.util.Date endDate)Deletes all Tombstone objects for a specified AssemblyLine that are in the specifiedDaterange.intdeleteCITombstones(java.lang.String aConfigID)Deletes all tombstones for a specified Config Instance.intdeleteCITombstones(java.lang.String aConfigID, int aDays)Deletes all Tombstone objects for a specified Config Instance that are older than the specified number of days.booleandeleteTombstone(java.lang.String aGUID)Deletes a tombstone.intdeleteTombstones(int aDaysCount)Deletes all Tombstone objects that are older than the specified number of days.protected voiddoInsert(int aComponentTypeID, int aEventTypeID, long aStartTime, long aCreatedOn, java.lang.String aComponentName, java.lang.String aConfiguration, int aExitCode, java.lang.String aErrorDescr, java.lang.String aGUID, byte[] aStats, java.lang.String aUserMessage)Inserts a tombstone record in the back-end database.protected voidfinalize()Close the prepared statement.java.util.List<java.lang.String>getAssemblyLineNames(java.lang.String configInstanceId)Tombstone[]getAssemblyLineTombstones(java.lang.String aAssemblyLineName, java.lang.String aConfigID)Get all available tombstones for a specified AssemblyLine.Tombstone[]getAssemblyLineTombstones(java.lang.String assemblyLineName, java.lang.String configID, int recentNumberOfTombstones)Gets the recent n number of tombstones for a specified AssemblyLineTombstone[]getAssemblyLineTombstones(java.lang.String aAssemblyLineName, java.lang.String aConfigID, java.util.Date aStartTime, java.util.Date aEndTime)Get all available tombstones for a specified AssemblyLine with timestamps in the interval specified by aStartTime and aEndTime.java.util.List<java.lang.String>getConfigInstanceIDs()Tombstone[]getConfigInstanceTombstones(java.lang.String aConfigID)Get all available tombstones for a specified Configuration Instance.Tombstone[]getConfigInstanceTombstones(java.lang.String aConfigID, java.util.Date aStartTime, java.util.Date aEndTime)Get all available tombstones for a specified ConfigInstance with timestamps in the interval specified by aStartTime and aEndTime.java.sql.ConnectiongetConnection()Gets the JDBC connection.TombstonegetTombstone(java.lang.String aGUID)Get single tombstone object, uniquely identified by the specified GUIDTombstone[]getTombstones(java.util.Date aStartTime, java.util.Date aEndTime)Get all available tombstones with timestamps in the interval specified by aStartTime and aEndTime.intgetTombstonesCount()booleanhasTombstones(java.lang.String configInstanceId)booleanhasTombstones(java.lang.String configInstanceId, java.lang.String alName)intkeepMostRecentALTombstones(java.lang.String aAssemblyLineName, java.lang.String aConfigID, int aRecentTombstonesToKeep)Deletes all tombstones for a specified AssemblyLine except a specified number of most recently created ones.intkeepMostRecentCITombstones(java.lang.String aConfigID, int aRecentTombstonesToKeep)Deletes all tombstones for a Config Instance except a specified number of recently created ones.intkeepMostRecentTombstones(int aRecentTombstonesToKeep)Deletes all tombstone object records except a specified number of most recently created ones.voidsetConnection(java.sql.Connection aConnection)Sets the JDBC connection.voidstartAutoCleaner()Starts a new thread for the TombstoneAutoCleaner
-
-
-
Field Detail
-
PROP_AUTODEL_AGE
public static final java.lang.String PROP_AUTODEL_AGE
When this property is present and contains an integer value greater than 0 the Tombstone Manager will automatically delete all tombstone records that are older than the specified number of days. The logic for tombstone record deletion is triggered on TDI Server startup and once a day on a long running TDI Server.
The default value for this property is "0".- See Also:
- Constant Field Values
-
PROP_AUTODEL_RECORDS_TRIGGER
public static final java.lang.String PROP_AUTODEL_RECORDS_TRIGGER
This property specifies the total number of tombstone records that will trigger the logic for leveling the number of tombstone records to a certain number.
The default value for this property is "10000".- See Also:
- Constant Field Values
-
PROP_AUTODEL_RECORDS_MAX
public static final java.lang.String PROP_AUTODEL_RECORDS_MAX
This property specifies the number of tombstone records to keep when the logic for leveling is triggered as per thePROP_AUTODEL_RECORDS_TRIGGERproperty. Alter the cleanup only the most recent (the value of this property) number of records will be kept.
The default value for this property is "5000".- See Also:
- Constant Field Values
-
PROP_CREATE_ALL
public static final java.lang.String PROP_CREATE_ALL
When this property is set to "true" the Tombstone Manager will create tombstones for every AssemblyLine and Config Instance regardless of the values specified in the configurations. This is useful to turn on tombstone creation for pre-6.1 configurations that do not have tombstone values without modifying the configurations.
The default value for this property is "false".- See Also:
- Constant Field Values
-
PROP_CREATE_TABLE
public static final java.lang.String PROP_CREATE_TABLE
This property is used to override the default "CREATE TABLE..." SQL statement. Use it if you want to add more records in the new table.- See Also:
- Constant Field Values
-
PROP_UPDATE_TABLE
public static final java.lang.String PROP_UPDATE_TABLE
This property is used to override the default "INSERT INTO..." SQL statement. Use it if you want to add more records in the new table.- See Also:
- Constant Field Values
-
COMPONENT_TYPE_CONFIG_INSTANCE
public static final int COMPONENT_TYPE_CONFIG_INSTANCE
This constant could be used as value for theTombstone.PROPERTY_NAME_COMPONENT_TYPE_IDproperty.
The value of this constant is: 0- See Also:
- Constant Field Values
-
COMPONENT_TYPE_ASSEMBLY_LINE
public static final int COMPONENT_TYPE_ASSEMBLY_LINE
This constant could be used as value for theTombstone.PROPERTY_NAME_COMPONENT_TYPE_IDproperty.
The value of this constant is: 1- See Also:
- Constant Field Values
-
COMPONENT_TYPE_EVENT_HANDLER
public static final int COMPONENT_TYPE_EVENT_HANDLER
This constant could be used as value for theTombstone.PROPERTY_NAME_COMPONENT_TYPE_IDproperty.
The value of this constant is: 2- See Also:
- Constant Field Values
-
TABLE_NAME
public static final java.lang.String TABLE_NAME
This constant has the name of the table that will be created/queried.- See Also:
- Constant Field Values
-
PROP_FIELD_ID
public static final java.lang.String PROP_FIELD_ID
A constant for the column - ID- See Also:
- Constant Field Values
-
PROP_FIELD_COMPONENT_TYPE_ID
public static final java.lang.String PROP_FIELD_COMPONENT_TYPE_ID
A constant for the column "COMPONENT_TYPE_ID"- See Also:
- Constant Field Values
-
PROP_FIELD_EVENT_TYPE_ID
public static final java.lang.String PROP_FIELD_EVENT_TYPE_ID
A constant for the column "EVENT_TYPE_ID"- See Also:
- Constant Field Values
-
PROP_FIELD_START_TIME
public static final java.lang.String PROP_FIELD_START_TIME
A constant for the column "START_TIME"- See Also:
- Constant Field Values
-
PROP_FIELD_CREATED_ON
public static final java.lang.String PROP_FIELD_CREATED_ON
A constant for the column "CREATED_ON"- See Also:
- Constant Field Values
-
PROP_FIELD_COMPONENT_NAME
public static final java.lang.String PROP_FIELD_COMPONENT_NAME
A constant for the column "COMPONENT_NAME"- See Also:
- Constant Field Values
-
PROP_FIELD_CONFIGURATION
public static final java.lang.String PROP_FIELD_CONFIGURATION
A constant for the column "CONFIGURATION"- See Also:
- Constant Field Values
-
PROP_FIELD_EXIT_CODE
public static final java.lang.String PROP_FIELD_EXIT_CODE
A constant for the column "EXIT_CODE"- See Also:
- Constant Field Values
-
PROP_FIELD_ERROR_DESCR
public static final java.lang.String PROP_FIELD_ERROR_DESCR
A constant for the column "ERROR_DESCR"- See Also:
- Constant Field Values
-
PROP_FIELD_GUID
public static final java.lang.String PROP_FIELD_GUID
A constant for the column "GUID"- See Also:
- Constant Field Values
-
PROP_FIELD_STATS
public static final java.lang.String PROP_FIELD_STATS
A constant for the column "STATS"- See Also:
- Constant Field Values
-
PROP_FIELD_USER_MESSAGE
public static final java.lang.String PROP_FIELD_USER_MESSAGE
A constant for the column "USER_MESSAGE"- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TombstoneManager
public TombstoneManager() throws DIExceptionDefault constructor for this object. Constructing this object will try to create a new table in the back-end store, if the table does not already exist.From 7.0 the cleaning process will not be triggered in the constructor but should be started immediately after that using startAutoCleaner() method.
- Throws:
DIException
-
-
Method Detail
-
startAutoCleaner
public void startAutoCleaner()
Starts a new thread for the TombstoneAutoCleaner
-
getTombstone
public Tombstone getTombstone(java.lang.String aGUID) throws DIException
Get single tombstone object, uniquely identified by the specified GUID- Parameters:
aGUID- The GUID of the requested tombstone- Returns:
- Tombstone object
- Throws:
DIException
-
getAssemblyLineTombstones
public Tombstone[] getAssemblyLineTombstones(java.lang.String assemblyLineName, java.lang.String configID, int recentNumberOfTombstones) throws DIException
Gets the recent n number of tombstones for a specified AssemblyLine- Parameters:
assemblyLineName- The name of the AssemblyLine.configID- The name of the AssmeblyLine's configuration.recentNumberOfTombstones- The recent n number of tombstones to be returned.- Returns:
- an array of Tombstone objects.
- Throws:
DIException- Since:
- 6.1.1
-
getAssemblyLineTombstones
public Tombstone[] getAssemblyLineTombstones(java.lang.String aAssemblyLineName, java.lang.String aConfigID) throws DIException
Get all available tombstones for a specified AssemblyLine.- Parameters:
aAssemblyLineName- The name of the AssemblyLine whose tombstones will be extracted.aConfigID- The AssemblyLine's configuration.- Returns:
- An array of Tombstone objects for the specified AssemblyLine.
- Throws:
DIException
-
getAssemblyLineTombstones
public Tombstone[] getAssemblyLineTombstones(java.lang.String aAssemblyLineName, java.lang.String aConfigID, java.util.Date aStartTime, java.util.Date aEndTime) throws DIException
Get all available tombstones for a specified AssemblyLine with timestamps in the interval specified by aStartTime and aEndTime.- Parameters:
aAssemblyLineName- The name of the AssemblyLine whose tombstones will be extracted.aConfigID- The AssemblyLine's configuration.aStartTime- The start time of the period for which tombstones are retrieved.aEndTime- The end time of the period for which tombstones are retrieved.- Returns:
- An array of Tombstone objects for the specified AssemblyLine.
- Throws:
DIException
-
getConfigInstanceTombstones
public Tombstone[] getConfigInstanceTombstones(java.lang.String aConfigID) throws DIException
Get all available tombstones for a specified Configuration Instance.- Parameters:
aConfigID- The configuration ID.- Returns:
- An array of Config Instance Tombstone objects.
- Throws:
DIException
-
getConfigInstanceTombstones
public Tombstone[] getConfigInstanceTombstones(java.lang.String aConfigID, java.util.Date aStartTime, java.util.Date aEndTime) throws DIException
Get all available tombstones for a specified ConfigInstance with timestamps in the interval specified by aStartTime and aEndTime.- Parameters:
aConfigID- The configuration ID.aStartTime- The start time of the period for which tombstone records are retrieved.aEndTime- The end time of the period for which tombstone records are retrieved.- Returns:
- An array of Config Instance Tombstone objects.
- Throws:
DIException
-
getTombstones
public Tombstone[] getTombstones(java.util.Date aStartTime, java.util.Date aEndTime) throws DIException
Get all available tombstones with timestamps in the interval specified by aStartTime and aEndTime.- Parameters:
aStartTime- The start time of the period for which tombstone records are retrieved.aEndTime- The end time of the period for which tombstone records are retrieved.- Returns:
- An array of Tombstone objects.
- Throws:
DIException
-
deleteTombstones
public int deleteTombstones(int aDaysCount) throws DIExceptionDeletes all Tombstone objects that are older than the specified number of days.- Parameters:
aDaysCount- Number of days.- Returns:
- The number of deleted tombstone records.
- Throws:
DIException- if an error occurs.
-
keepMostRecentTombstones
public int keepMostRecentTombstones(int aRecentTombstonesToKeep) throws DIExceptionDeletes all tombstone object records except a specified number of most recently created ones.- Parameters:
aRecentTombstonesToKeep- number of recent tombstones to keep.- Returns:
- The number of deleted tombstone records.
- Throws:
DIException
-
deleteALTombstones
public int deleteALTombstones(java.lang.String aAssemblyLineName, java.lang.String aConfigID) throws DIExceptionDeletes all Tombstone objects created for the specified AssemblyLine.- Parameters:
aAssemblyLineName- The name of the AssemblyLine.aConfigID- The AssmeblyLine configuration.- Returns:
- The number of deleted records.
- Throws:
DIException- if an error occurs.
-
deleteALTombstones
public int deleteALTombstones(java.lang.String aAssemblyLineName, java.lang.String aConfigID, int aDays) throws DIExceptionDeletes all Tombstone objects for a specified AssemblyLine that are older than the specified number of days.- Parameters:
aAssemblyLineName- The name of the AssemblyLine.aConfigID- The AssemblyLine configuration.aDays- Number of days.- Returns:
- The number of deleted tombstone records.
- Throws:
DIException- if an error occurs.
-
deleteALTombstones
public int deleteALTombstones(java.lang.String aAssemblyLineName, java.lang.String aConfigID, java.util.Date olderThanDate) throws DIExceptionDeletes all Tombstone objects for a specified AssemblyLine that are older than the specified date.- Parameters:
aAssemblyLineName- The name of the AssemblyLine.aConfigID- The AssemblyLine configuration.olderThanDate- Date- Returns:
- The number of deleted tombstone records.
- Throws:
DIException- if an error occurs.
-
deleteALTombstones
public int deleteALTombstones(java.lang.String aAssemblyLineName, java.lang.String aConfigID, java.util.Date startDate, java.util.Date endDate) throws DIExceptionDeletes all Tombstone objects for a specified AssemblyLine that are in the specifiedDaterange.- Parameters:
aAssemblyLineName- The name of the AssemblyLine.aConfigID- The AssemblyLine configuration.startDate- DateendDate- Date- Returns:
- The number of deleted tombstone records.
- Throws:
DIException- if an error occurs.
-
keepMostRecentALTombstones
public int keepMostRecentALTombstones(java.lang.String aAssemblyLineName, java.lang.String aConfigID, int aRecentTombstonesToKeep) throws DIExceptionDeletes all tombstones for a specified AssemblyLine except a specified number of most recently created ones.- Parameters:
aAssemblyLineName- The name of the AssemblyLine whose tombstone records will be deleted.aConfigID- The AssemblyLine configuration.aRecentTombstonesToKeep- Number of recent tombstones to keep.- Returns:
- The number of deleted records.
- Throws:
DIException
-
deleteCITombstones
public int deleteCITombstones(java.lang.String aConfigID) throws DIExceptionDeletes all tombstones for a specified Config Instance.- Parameters:
aConfigID- The configuration ID.- Returns:
- The number of deleted tombstone records.
- Throws:
DIException- if an error occurs.
-
deleteCITombstones
public int deleteCITombstones(java.lang.String aConfigID, int aDays) throws DIExceptionDeletes all Tombstone objects for a specified Config Instance that are older than the specified number of days.- Parameters:
aConfigID- The configuration ID.aDays- Number of days.- Returns:
- The number of deleted tombstone records.
- Throws:
DIException- if an error occurs.
-
keepMostRecentCITombstones
public int keepMostRecentCITombstones(java.lang.String aConfigID, int aRecentTombstonesToKeep) throws DIExceptionDeletes all tombstones for a Config Instance except a specified number of recently created ones.- Parameters:
aConfigID- The configuration ID.aRecentTombstonesToKeep- The number of most recent tombstones to keep.- Returns:
- The number of deleted records.
- Throws:
DIException
-
deleteTombstone
public boolean deleteTombstone(java.lang.String aGUID) throws DIExceptionDeletes a tombstone.- Parameters:
aGUID- The GUID of the tombstone to delete.- Returns:
- true only when the tombstone with the specified GUID is found and deleted.
- Throws:
DIException- if an error occurs.
-
setConnection
public void setConnection(java.sql.Connection aConnection)
Sets the JDBC connection.- Parameters:
aConnection- the connection to use.
-
getConnection
public java.sql.Connection getConnection()
Gets the JDBC connection.- Returns:
- the connection to the database.
-
getTombstonesCount
public int getTombstonesCount() throws DIException- Returns:
- the number of Tombstones in the back-end store.
- Throws:
DIException- if an error occurs.
-
doInsert
protected void doInsert(int aComponentTypeID, int aEventTypeID, long aStartTime, long aCreatedOn, java.lang.String aComponentName, java.lang.String aConfiguration, int aExitCode, java.lang.String aErrorDescr, java.lang.String aGUID, byte[] aStats, java.lang.String aUserMessage) throws DIExceptionInserts a tombstone record in the back-end database.- Parameters:
aComponentTypeID- the type of the component.aEventTypeID- the type of the event.aStartTime- the time the component was started.aCreatedOn- the time the component was created.aComponentName- the name of the component.aConfiguration- the configuration id of the configInstance the AL was started in.aExitCode- the code the component exited with.aErrorDescr- the description of the error (if any) the component ended with.aGUID- the globally unique identifier of the tombstone.aStats- the statistics as a serialized Entry object.aUserMessage- the user message.- Throws:
DIException- if an error occurs.
-
finalize
protected void finalize() throws java.lang.ThrowableClose the prepared statement.- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
getConfigInstanceIDs
public java.util.List<java.lang.String> getConfigInstanceIDs() throws DIException- Throws:
DIException
-
hasTombstones
public boolean hasTombstones(java.lang.String configInstanceId) throws DIException- Throws:
DIException
-
getAssemblyLineNames
public java.util.List<java.lang.String> getAssemblyLineNames(java.lang.String configInstanceId) throws DIException- Throws:
DIException
-
hasTombstones
public boolean hasTombstones(java.lang.String configInstanceId, java.lang.String alName) throws DIException- Throws:
DIException
-
-