Server API support for the Tombstone Manager
You can use the information and example code provided here to provide Server API support for the Tombstone Manager.
What is a tombstone:
The Server API provides a new class com.ibm.di.api.Tombstone whose instances represent tombstone objects. The public interface of the Tombstone class follows:
public class Tombstone implements Serializable {
public int getComponentTypeID ()
public int getEventTypeID ()
public java.utilDate getStartTime ()
public java.utilDate getTombstoneCreateTime ()
public String getComponentName ()
public String getConfigID ()
public int getExitCode ()
public String getErrorDescription ()
public String getGUID ()
public Entry getStat ()
public String getUserMessage ()
}
Retrieving tombstones:
import com.ibm.di.api.remote.TombstoneManager;
...
TombstoneManager tombstoneManager = session.getTombstoneManager();
With
the Tombstone Manager at hand, you can search for specific Tombstones.
The following code iterates through all tombstones created last week: Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, -7);
Tombstone[] tombstones = tombstoneManager.getTombstones(calendar.getTime(), new Date());
for (int i = 0; i < tombstones.length; ++i) {
System.out.println("Tombstone found for : "+tombstones[i].getComponentName());
System.out.println("\t GUID : "+tombstones[i].getGUID());
System.out.println("\t statistics : "+tombstones[i].getStatistics());
}
All tombstones for a particular AssemblyLine can be retrieved
this way (the example AssemblyLine is named "myline" and the ID of
the configuration is "C__TDI_myconfig.xml"): Tombstone[] alTombstones = tombstoneManager.getAssemblyLineTombstones("AssemblyLines/myline",
"C__TDI_myconfig.xml");
The following new Server API calls are provided for querying the Tombstone Manager – these are methods of the com.ibm.di.api.local.TombstoneManager interface:
- Tombstone getTombstone (String aGUID)
Returns a single tombstone object uniquely identified by the specified GUID.
- Tombstone[] getAssemblyLineTombstones (String aAssemblyLineName,
String aConfigID)
Returns all available tombstones for the specified AssemblyLine.
- Tombstone[] getAssemblyLineTombstones (String aAssemblyLineName,
String aConfigID, java.util.Date aStartTime, java.util.Date aEndTime)
Returns all available tombstones for the specified AssemblyLine with timestamps in the interval specified by aStartTime and aEndTime.
- Tombstone[] getConfigInstanceTombstones (String aConfigID)
Returns all available tombstones for the specified Config Instance.
- Tombstone[] getConfigInstanceTombstones (String aConfigID)
Returns all available tombstones for the specified Config Instance.
- Tombstone[] getTombstones (java.util.Date aStartTime,
java.util.Date aEndTime)
Returns all available tombstones with timestamps in the interval specified by aStartTime and aEndTime.
Deleting tombstones:
When tombstones are no longer needed they should be deleted.
tombstoneManager.deleteTombstones(7);
The following Server API calls are provided for deleting old tombstone records:
- int deleteTombstones (int aDays)
Deletes all tombstones that are older than the specified number of days. Returns the number of deleted tombstone records.
- int keepMostRecentTombstones (int aMostResentToKeep)
After this method is executed only the aMostRecentToKeep most recent tombstone records are kept and all other are deleted. Returns the number of deleted tombstone records.
- int deleteALTombstones (String aAssemblyLineName, String
aConfigID)
Deletes all tombstones for specified AssemblyLine. Returns the number of deleted tombstone records.
- int deleteALTombstones (String aAssemblyLineName, String
aConfigID, int aDays)
Deletes all tombstones for the specified AssemblyLine that are older than the specified number of days. Returns the number of deleted tombstone records.
- int keepMostRecentALTombstones (String aAssemblyLineName,
String aConfigID, int aMostResentToKeep)
After this method is executed only the aMostRecentToKeep most recent tombstone records for the specified AssemblyLine are kept and all other are deleted. Returns the number of deleted tombstone records.
- int deleteCITombstones (String aConfigID)
Deletes all tombstones for specified Config Instance. Returns the number of deleted tombstone records.
- int deleteCITombstones (String aConfigID, int aDays)
Deletes all tombstones for the specified Config Instance that are older than the specified number of days. Returns the number of deleted tombstone records.
- int keepMostRecentCITombstones (String aConfigID, int
aMostResentToKeep)
After this method is executed only the aMostRecentToKeep most recent tombstone records for the specified Config Instance are kept and all other are deleted. Returns the number of deleted tombstone records.
- boolean deleteTombstone (String aGUID)
Deletes the tombstone with the specified GUID. Returns true only when the tombstone object with the specified GUID is found and deleted.