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)
StepRunner
withFlow
in interface StepRunner
flow
- the flow object to be usedpublic StepRunner withStep(java.lang.String step)
StepRunner
withStep
in interface StepRunner
step
- - the step to be run in the flowpublic StepRunner withJobId(java.lang.String jobId)
StepRunner
withJobId
in interface StepRunner
jobId
- - the id of the jobpublic StepRunner withStepDefinition(StepDefinition stepDefinition)
public StepRunner withBatchSize(int batchSize)
StepRunner
withBatchSize
in interface StepRunner
batchSize
- - the size of the batch in integer formpublic StepRunner withThreadCount(int threadCount)
StepRunner
withThreadCount
in interface StepRunner
threadCount
- - the number of threads for the step runner to usepublic StepRunner withDestinationDatabase(java.lang.String destinationDatabase)
public StepRunner withStopOnFailure(boolean stopOnFailure)
StepRunner
withStopOnFailure
in interface StepRunner
stopOnFailure
- - true to stop the job if a failure happenspublic StepRunner withOptions(java.util.Map<java.lang.String,java.lang.Object> options)
StepRunner
withOptions
in interface StepRunner
options
- - the object map of options as string/object pairpublic StepRunner withStepConfig(java.util.Map<java.lang.String,java.lang.Object> stepConfig)
StepRunner
withStepConfig
in interface StepRunner
stepConfig
- - the object map of configurations for the step to execute as string/object pairpublic StepRunner onItemComplete(StepItemCompleteListener listener)
StepRunner
onItemComplete
in interface StepRunner
listener
- the listen object to setpublic StepRunner onItemFailed(StepItemFailureListener listener)
StepRunner
onItemFailed
in interface StepRunner
listener
- the listener for the failures in the flowpublic StepRunner onStatusChanged(StepStatusListener listener)
StepRunner
onStatusChanged
in interface StepRunner
listener
- - the listener for when the status changespublic StepRunner onFinished(StepFinishedListener listener)
StepRunner
onFinished
in interface StepRunner
listener
- - the listener for the flow item when it finishespublic void awaitCompletion()
StepRunner
awaitCompletion
in interface StepRunner
public void awaitCompletion(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException
StepRunner
awaitCompletion
in interface StepRunner
timeout
- 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()
StepRunner
getBatchSize
in interface StepRunner
public RunStepResponse run()
StepRunner
run
in interface StepRunner
public RunStepResponse run(java.util.Collection<java.lang.String> uris)
StepRunner
run
in interface StepRunner
uris
- the ids to pass to the harmonization flowpublic void stop()
StepRunner
stop
in interface StepRunner
protected 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.URISyntaxException
protected void runStatusListener(double uriSize, StepMetrics stepMetrics)