public class WriteStepRunner extends java.lang.Object implements StepRunner
| Modifier and Type | Field and Description |
|---|---|
protected long |
csvFilesProcessed |
protected java.lang.String |
inputFilePath |
protected java.lang.String |
inputFileType |
protected java.util.concurrent.atomic.AtomicBoolean |
isStopped |
protected org.slf4j.Logger |
logger |
protected java.lang.String |
outputCollections |
protected java.lang.String |
outputFormat |
protected java.lang.String |
outputPermissions |
protected java.lang.String |
outputURIPrefix |
protected java.lang.String |
outputURIReplacement |
protected java.lang.String |
separator |
| Constructor and Description |
|---|
WriteStepRunner(com.marklogic.hub.HubClient hubClient,
HubProject hubProject) |
| Modifier and Type | Method and Description |
|---|---|
void |
awaitCompletion()
Blocks until the step execution is complete.
|
void |
awaitCompletion(long timeout,
java.util.concurrent.TimeUnit unit)
Blocks until the step execution is complete.
|
protected java.nio.file.Path |
determineInputFilePath(java.lang.String inputFilePath) |
protected java.lang.String |
generateUriForCsv(java.lang.String parentPath,
java.lang.String os) |
int |
getBatchSize()
Returns the batch size
|
protected java.lang.String |
getPrefixedEncodedURI(java.lang.String filename) |
protected void |
loadStepRunnerParameters() |
StepRunner |
onFinished(StepFinishedListener listener)
Sets the finished listener for when the item has processed (similar to a finally)
|
StepRunner |
onItemComplete(StepItemCompleteListener listener)
Sets a listener on each item completing
|
StepRunner |
onItemFailed(StepItemFailureListener listener)
Sets the failure listener for each item in the flow
|
StepRunner |
onStatusChanged(StepStatusListener listener)
Sets the status change listener on the flowrunner object
|
RunStepResponse |
run()
Runs the flow and creates the job
|
RunStepResponse |
run(java.util.Collection<java.lang.String> uris)
Runs the flow and creates the job.
|
protected void |
runStatusListener(double uriSize,
StepMetrics stepMetrics) |
void |
stop()
Stops the step run
|
StepRunner |
withBatchSize(int batchSize)
Sets the batch size for the step runner
|
StepRunner |
withDestinationDatabase(java.lang.String destinationDatabase) |
StepRunner |
withFlow(Flow flow)
Sets the flow to be used with the step runner
|
StepRunner |
withJobId(java.lang.String jobId)
Sets the batch size for the step runner
|
StepRunner |
withOptions(java.util.Map<java.lang.String,java.lang.Object> options)
Sets the options to be passed into the xqy or sjs flow in the $options or options variables of main.
|
StepRunner |
withStep(java.lang.String step)
Sets the batch size for the step runner
|
StepRunner |
withStepConfig(java.util.Map<java.lang.String,java.lang.Object> stepConfig)
Sets the config to be used in orchestrating the step.
|
StepRunner |
withStepDefinition(StepDefinition stepDefinition) |
StepRunner |
withStopOnFailure(boolean stopOnFailure)
Sets if this will stop the job on a failure, or if it will continue on
|
StepRunner |
withThreadCount(int threadCount)
Sets the thread count for the flowrunner
|
protected long csvFilesProcessed
protected final org.slf4j.Logger logger
protected java.lang.String inputFilePath
protected java.lang.String outputCollections
protected java.lang.String outputPermissions
protected java.lang.String outputFormat
protected java.lang.String inputFileType
protected java.lang.String outputURIReplacement
protected java.lang.String outputURIPrefix
protected java.lang.String separator
protected java.util.concurrent.atomic.AtomicBoolean isStopped
public WriteStepRunner(com.marklogic.hub.HubClient hubClient,
HubProject hubProject)
public StepRunner withFlow(Flow flow)
StepRunnerwithFlow in interface StepRunnerflow - the flow object to be usedpublic StepRunner withStep(java.lang.String step)
StepRunnerwithStep in interface StepRunnerstep - - the step to be run in the flowpublic StepRunner withJobId(java.lang.String jobId)
StepRunnerwithJobId in interface StepRunnerjobId - - the id of the jobpublic StepRunner withStepDefinition(StepDefinition stepDefinition)
public StepRunner withBatchSize(int batchSize)
StepRunnerwithBatchSize in interface StepRunnerbatchSize - - the size of the batch in integer formpublic StepRunner withThreadCount(int threadCount)
StepRunnerwithThreadCount in interface StepRunnerthreadCount - - the number of threads for the step runner to usepublic StepRunner withDestinationDatabase(java.lang.String destinationDatabase)
public StepRunner withStopOnFailure(boolean stopOnFailure)
StepRunnerwithStopOnFailure in interface StepRunnerstopOnFailure - - true to stop the job if a failure happenspublic StepRunner withOptions(java.util.Map<java.lang.String,java.lang.Object> options)
StepRunnerwithOptions in interface StepRunneroptions - - the object map of options as string/object pairpublic StepRunner withStepConfig(java.util.Map<java.lang.String,java.lang.Object> stepConfig)
StepRunnerwithStepConfig in interface StepRunnerstepConfig - - the object map of configurations for the step to execute as string/object pairpublic StepRunner onItemComplete(StepItemCompleteListener listener)
StepRunneronItemComplete in interface StepRunnerlistener - the listen object to setpublic StepRunner onItemFailed(StepItemFailureListener listener)
StepRunneronItemFailed in interface StepRunnerlistener - the listener for the failures in the flowpublic StepRunner onStatusChanged(StepStatusListener listener)
StepRunneronStatusChanged in interface StepRunnerlistener - - the listener for when the status changespublic StepRunner onFinished(StepFinishedListener listener)
StepRunneronFinished in interface StepRunnerlistener - - the listener for the flow item when it finishespublic void awaitCompletion()
StepRunnerawaitCompletion in interface StepRunnerpublic void awaitCompletion(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException,
java.util.concurrent.TimeoutException
StepRunnerawaitCompletion in interface StepRunnertimeout - the maximum time to waitunit - the time unit of the timeout argumentjava.lang.InterruptedException - if interrupted while waitingjava.util.concurrent.TimeoutException - if times outpublic int getBatchSize()
StepRunnergetBatchSize in interface StepRunnerpublic RunStepResponse run()
StepRunnerrun in interface StepRunnerpublic RunStepResponse run(java.util.Collection<java.lang.String> uris)
StepRunnerrun in interface StepRunneruris - the ids to pass to the harmonization flowpublic void stop()
StepRunnerstop in interface StepRunnerprotected void loadStepRunnerParameters()
protected java.nio.file.Path determineInputFilePath(java.lang.String inputFilePath)
protected java.lang.String generateUriForCsv(java.lang.String parentPath,
java.lang.String os)
protected java.lang.String getPrefixedEncodedURI(java.lang.String filename)
throws java.net.URISyntaxException
java.net.URISyntaxExceptionprotected void runStatusListener(double uriSize,
StepMetrics stepMetrics)