C# Class Summer.Batch.Core.Job.AbstractJob

Abstract implementation of the IJob interface. Common dependencies such as a IJobRepository, IJobExecutionListener's, and various configuration parameters are set here. Therefore, common error handling and listener calling activities are abstracted away from implementations.
Inheritance: IJob, IStepLocator, IInitializationPostOperations
Mostra file Open project: SummerBatch/SummerBatch

Protected Properties

Property Type Description
Logger Logger

Public Methods

Method Description
AfterPropertiesSet ( ) : void

Post-init. checks. @see IInitializationPostOperations#AfterPropertiesSet.

Execute ( JobExecution execution ) : void

Executes job.

GetStep ( string stepName ) : IStep

To be overriden by subclasses.

GetStepNames ( ) : ICollection

To be overriden by subclasses.

RegisterJobExecutionListener ( IJobExecutionListener listener ) : void

Register a single listener for the IJobExecutionListener callbacks.

SetJobExecutionListeners ( IJobExecutionListener listeners ) : void

Public setter for injecting IJobExecutionListeners. They will all be given the listener callbacks at the appropriate point in the job.

ToString ( ) : string

ToString override.

Protected Methods

Method Description
AbstractJob ( ) : NLog

Default constructor.

AbstractJob ( string name ) : NLog

Custom constructor with a name.

DoExecute ( JobExecution execution ) : void

Actual job execution. To be implemented by sub-classes.

GetDefaultExitStatusForFailure ( Exception ex, JobExecution execution ) : ExitStatus

Computes exit status depending on exception.

HandleStep ( IStep step, JobExecution execution ) : StepExecution

Convenience method for subclasses to delegate the handling of a specific step in the context of the current JobExecution . Clients of this method do not need access to the JobRepository, nor do they need to worry about populating the execution context on a restart, nor detecting the interrupted state (in job or step execution).

Private Methods

Method Description
HandleException ( JobExecution execution, Exception e ) : void

Exception handling.

HandleExecution ( JobExecution execution ) : void

Actual job execution. Delegates to DoExecute.

HandleJobInterruptedException ( JobExecution execution, JobInterruptedException e ) : void

Job interruption handling.

HandlePostExecution ( JobExecution execution ) : void

Call to listeners that might add some post execution behaviour.

UpdateStatus ( JobExecution jobExecution, BatchStatus status ) : void

Method Details

AbstractJob() protected method

Default constructor.
protected AbstractJob ( ) : NLog
return NLog

AbstractJob() protected method

Custom constructor with a name.
protected AbstractJob ( string name ) : NLog
name string
return NLog

AfterPropertiesSet() public method

Post-init. checks. @see IInitializationPostOperations#AfterPropertiesSet.
public AfterPropertiesSet ( ) : void
return void

DoExecute() protected abstract method

Actual job execution. To be implemented by sub-classes.
 
protected abstract DoExecute ( JobExecution execution ) : void
execution JobExecution
return void

Execute() public method

Executes job.
public Execute ( JobExecution execution ) : void
execution JobExecution
return void

GetDefaultExitStatusForFailure() protected method

Computes exit status depending on exception.
protected GetDefaultExitStatusForFailure ( Exception ex, JobExecution execution ) : ExitStatus
ex System.Exception
execution JobExecution
return ExitStatus

GetStep() public abstract method

To be overriden by subclasses.
public abstract GetStep ( string stepName ) : IStep
stepName string
return IStep

GetStepNames() public abstract method

To be overriden by subclasses.
public abstract GetStepNames ( ) : ICollection
return ICollection

HandleStep() protected method

Convenience method for subclasses to delegate the handling of a specific step in the context of the current JobExecution . Clients of this method do not need access to the JobRepository, nor do they need to worry about populating the execution context on a restart, nor detecting the interrupted state (in job or step execution).
     
protected HandleStep ( IStep step, JobExecution execution ) : StepExecution
step IStep the step to execute
execution JobExecution the current job execution
return StepExecution

RegisterJobExecutionListener() public method

Register a single listener for the IJobExecutionListener callbacks.
public RegisterJobExecutionListener ( IJobExecutionListener listener ) : void
listener IJobExecutionListener
return void

SetJobExecutionListeners() public method

Public setter for injecting IJobExecutionListeners. They will all be given the listener callbacks at the appropriate point in the job.
public SetJobExecutionListeners ( IJobExecutionListener listeners ) : void
listeners IJobExecutionListener
return void

ToString() public method

ToString override.
public ToString ( ) : string
return string

Property Details

Logger protected_oe static_oe property

Logger.
protected static Logger Logger
return Logger