Interface IProcessingUnit
-
- All Known Implementing Classes:
AbstractProcessingUnitImpl,AbstractProcessingUnitPersistenceImpl,TestProcessingUnit
public interface IProcessingUnitDefines the processing unit interface.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longestimateNumberOfUnitsToProcess(IProcessingUnitContext processingUnitContext)Estimate the number of units to process.java.util.List<ParameterDefinition>getParameterDefinition()Gets the parameter definition list of the processing.voidinitialize(java.util.List<Parameter> parameterList, IProcessingUnitContext processingUnitContext)Initializes the processing unit.voidonStop()This method will be called in case on a stop before.voidonSuccess()This method will be called after a success end.IProcessingUnitStatusprocessUnit(IProcessingUnitProgress processingProgress, IProcessingUnitContext processingUnitContext)Process unit: This method will be called until theIProcessingUnitStatus.hasNext()returns false.voidreleaseResource()Release resources will be called to release all internal referenced resources after a processing success, error or by asuspendProcessing(see method below).voidresumeProcessing(IProcessingUnitPersistence processingPersistence, IProcessingUnitContext processingUnitContext)After suspending a processing unit can be resumed.IProcessingUnitPersistencesuspendProcessing()Suspends the processing: The processing is able to persist its state with the help of theIProcessingUnitPersistenceobject.voidvalidateParameterList(java.util.List<Parameter> parameterList)Validate the parameter list consistency of this class with the parameters.
-
-
-
Method Detail
-
getParameterDefinition
java.util.List<ParameterDefinition> getParameterDefinition()
Gets the parameter definition list of the processing.- Returns:
- the parameter definition list or null in case of no parameters
-
validateParameterList
void validateParameterList(java.util.List<Parameter> parameterList) throws ValidationException
Validate the parameter list consistency of this class with the parameters. Typical it will be called during the initialization. It can be used to verify if the parameter of this processing are well defined.- Parameters:
parameterList- the parameter list.- Throws:
ValidationException- This will be throw in case the consistency check failures.
-
initialize
void initialize(java.util.List<Parameter> parameterList, IProcessingUnitContext processingUnitContext) throws ValidationException, ProcessingException
Initializes the processing unit. This will called as first to initialize the processing unit.- Parameters:
parameterList- the parameter list to run the processing.processingUnitContext- the processing context.- Throws:
ValidationException- This will be throw in case the consistency check failures.ProcessingException- Throws this exception in case of initialization failures.
-
estimateNumberOfUnitsToProcess
long estimateNumberOfUnitsToProcess(IProcessingUnitContext processingUnitContext) throws ProcessingException
Estimate the number of units to process. It will be called once afterinitialize(List, IProcessingUnitContext). It set the the number of units to process in the objectIProcessingUnitProgress. In case there are more elements to process than estimated, the progress will adapted. In case of aresumeProcessing(IProcessingUnitPersistence, IProcessingUnitContext)it will not be called again.- Parameters:
processingUnitContext- the processing context.- Returns:
- returns the number of units to process
- Throws:
ProcessingException- Throws this exception in case of initialization failures.
-
processUnit
IProcessingUnitStatus processUnit(IProcessingUnitProgress processingProgress, IProcessingUnitContext processingUnitContext) throws ProcessingException
Process unit: This method will be called until theIProcessingUnitStatus.hasNext()returns false. Important: this method have to process the sequential or in a small block size.- Parameters:
processingProgress- the processing progressprocessingUnitContext- the processing unit context.- Returns:
- the process status
- Throws:
ProcessingException- In case of any failures occurs.
-
onSuccess
void onSuccess()
This method will be called after a success end.
-
onStop
void onStop()
This method will be called in case on a stop before.
-
releaseResource
void releaseResource() throws ProcessingExceptionRelease resources will be called to release all internal referenced resources after a processing success, error or by asuspendProcessing(see method below). It will be called afteronSuccessoronStop.- Throws:
ProcessingException- Throws this exception in case of releasing failure.
-
suspendProcessing
IProcessingUnitPersistence suspendProcessing() throws ProcessingException
Suspends the processing: The processing is able to persist its state with the help of theIProcessingUnitPersistenceobject. On a resume this instance of theIProcessingUnitPersistencewill be returned (see method below).- Returns:
- the processing persistence which contains all information to resume processing later (see resumeProcessing).
- Throws:
ProcessingException- Throws this exception in case of while suspend the processing any failures occurs.
-
resumeProcessing
void resumeProcessing(IProcessingUnitPersistence processingPersistence, IProcessingUnitContext processingUnitContext) throws ProcessingException
After suspending a processing unit can be resumed. The parameter list of the initialization is passed as well theIProcessingUnitPersistencewhich was returned by the suspendProcessing method.- Parameters:
processingPersistence- the processing persistence to resume after suspending.processingUnitContext- the processing unit context- Throws:
ProcessingException- Throws this exception in case of while resume the processing any failures occurs.
-
-