@Override
public ILSMOperationTracker getOperationTracker(INCServiceContext ctx, IResource resource) {
try {
INcApplicationContext appCtx = (INcApplicationContext) ctx.getApplicationContext();
DatasetLifecycleManager dslcManager = (DatasetLifecycleManager) appCtx.getDatasetLifecycleManager();
DatasetResource dsr = dslcManager.getDatasetLifecycle(datasetId);
int partition = StoragePathUtil.getPartitionNumFromRelativePath(resource.getPath());
PrimaryIndexOperationTracker opTracker =
dslcManager.getOperationTracker(datasetId, partition, resource.getPath());
if (!(opTracker instanceof TestPrimaryIndexOperationTracker)) {
Field opTrackersField = DatasetResource.class.getDeclaredField("datasetPrimaryOpTrackers");
opTracker = new TestPrimaryIndexOperationTracker(datasetId, partition,
appCtx.getTransactionSubsystem().getLogManager(), dsr.getDatasetInfo(),
dslcManager.getComponentIdGenerator(datasetId, partition, resource.getPath()));
replaceMapEntry(opTrackersField, dsr, partition, opTracker);
}
return opTracker;
} catch (Exception e) {
throw new RuntimeException(e);
}
}