public abstract class WorkerUsingDeltaService extends java.lang.Object implements Worker
DeltaService
. Provides service reference handling and methods to invoke the
DeltaService
methods and measure the durations of the calls in the task context counters.Constructor and Description |
---|
WorkerUsingDeltaService() |
Modifier and Type | Method and Description |
---|---|
State |
checkDeltaStateTimed(java.lang.String jobRunId,
Record record,
java.lang.String deltaHash,
TaskContext taskContext)
invoke
DeltaService.checkState(String, String, String, String) and measure time as duration
checkDeltaState. |
void |
deleteDeltaEntryTimed(java.lang.String sourceId,
DeltaService.EntryId entryId,
TaskContext taskContext)
invoke
DeltaService#deleteEntry(String, String) and measure time as duration deleteDeltaEntry. |
protected java.lang.String |
getCompoundId(Record record)
get value of attribute
ImportingConstants.ATTRIBUTE_COMPOUNDID . |
protected static DeltaImportStrategy |
getDeltaImportStrategy(AnyMap taskParameters)
get deltaImportStrategy parameter from task parameters.
|
protected DeltaImportStrategy |
getDeltaImportStrategy(TaskContext taskContext)
get deltaImportStrategy parameter from task context.
|
protected java.lang.String |
getJobRunId(TaskContext taskContext)
get job run id from task.
|
protected java.lang.String |
getRequiredParameter(TaskContext taskContext,
java.lang.String parameter)
get a string parameter.
|
java.util.Collection<DeltaService.EntryId> |
getUnvisitedEntriesTimed(java.lang.String jobRunId,
java.lang.String sourceAndShardPrefix,
TaskContext taskContext)
invoke
DeltaService.getUnvisitedEntries(String, String) and measure time as duration
getUnvisitedRecords. |
protected boolean |
isCompound(Record record)
check if attribute
ImportingConstants.ATTRIBUTE_COMPOUNDFLAG is set to true. |
void |
markAsUpdatedTimed(java.lang.String jobRunId,
Record record,
java.lang.String deltaHash,
TaskContext taskContext)
invoke
DeltaService.markAsUpdated(String, String, String, String) and measure time as duration
markAsUpdated. |
void |
markCompoundElementsVisitedTimed(java.lang.String jobRunId,
Record record,
TaskContext taskContext)
invoke
DeltaService.markCompoundElementsVisited(String, String, String) and measure time as duration
markCompoundElementsVisited. |
void |
setDeltaService(DeltaService service)
DS service reference bind method.
|
void |
unsetDeltaService(DeltaService service)
DS service reference unbind method.
|
protected java.lang.String getJobRunId(TaskContext taskContext)
java.lang.IllegalArgumentException
- if not set.protected java.lang.String getRequiredParameter(TaskContext taskContext, java.lang.String parameter)
java.lang.IllegalArgumentException
- if not set.protected DeltaImportStrategy getDeltaImportStrategy(TaskContext taskContext)
DeltaImportStrategy.FULL
if parameter is
not set or value is invalid.protected static DeltaImportStrategy getDeltaImportStrategy(AnyMap taskParameters)
DeltaImportStrategy.FULL
if parameter
is not set or value is invalid.protected java.lang.String getCompoundId(Record record)
ImportingConstants.ATTRIBUTE_COMPOUNDID
.protected boolean isCompound(Record record)
ImportingConstants.ATTRIBUTE_COMPOUNDFLAG
is set to true.public State checkDeltaStateTimed(java.lang.String jobRunId, Record record, java.lang.String deltaHash, TaskContext taskContext) throws DeltaException
DeltaService.checkState(String, String, String, String)
and measure time as duration
checkDeltaState.DeltaException
public void markCompoundElementsVisitedTimed(java.lang.String jobRunId, Record record, TaskContext taskContext) throws DeltaException
DeltaService.markCompoundElementsVisited(String, String, String)
and measure time as duration
markCompoundElementsVisited.DeltaException
public void markAsUpdatedTimed(java.lang.String jobRunId, Record record, java.lang.String deltaHash, TaskContext taskContext) throws DeltaException
DeltaService.markAsUpdated(String, String, String, String)
and measure time as duration
markAsUpdated.DeltaException
public java.util.Collection<DeltaService.EntryId> getUnvisitedEntriesTimed(java.lang.String jobRunId, java.lang.String sourceAndShardPrefix, TaskContext taskContext) throws DeltaException
DeltaService.getUnvisitedEntries(String, String)
and measure time as duration
getUnvisitedRecords.DeltaException
public void deleteDeltaEntryTimed(java.lang.String sourceId, DeltaService.EntryId entryId, TaskContext taskContext) throws DeltaException
DeltaService#deleteEntry(String, String)
and measure time as duration deleteDeltaEntry.DeltaException
public void setDeltaService(DeltaService service)
public void unsetDeltaService(DeltaService service)