Value object used to carry information about the status of a job or step execution. ExitStatus is immutable and therefore thread-safe. More...

Inheritance diagram for Summer.Batch.Core.ExitStatus:

Public Member Functions

 ExitStatus (string exitCode, string exitDescription="")
 Custom constructor using a code and a description. More...
 
ExitStatus And (ExitStatus status)
 Creates a new ExistStatus with a logical combination of the exit code, and a concatenation of the descriptions. If either value has a higher severity then its exit code will be used in the result. In the case of equal severity, the exit code is replaced if the new value is alphabetically greater. More...
 
int CompareTo (ExitStatus status)
 see IComparable More...
 
override string ToString ()
 ToString override More...
 
override bool Equals (object obj)
 Compare the fields one by one. Equals override. More...
 
override int GetHashCode ()
 Compatible with the Equals implementation. GetHashCode override. More...
 
ExitStatus ReplaceExitCode (string code)
 Adds an exit code to an existing ExistStatus. If there is already a code present, it will be replaced. More...
 
bool IsRunning ()
 Check if this status represents a running process. More...
 
ExitStatus AddExitDescription (string description)
 Add an exit description to an existing ExistStatus. If there is already a description present the two will be concatenated with a semicolon. More...
 
ExitStatus AddExitDescription (Exception exception)
 Extract the stack trace from the throwable provided and append it to the exist description. More...
 

Static Public Member Functions

static bool IsNonDefaultExitStatus (ExitStatus status)
 Checks whether the given ExitStatus is a known exit code. More...
 

Static Public Attributes

static readonly ExitStatus Unknown = new ExitStatus("UNKNOWN")
 Convenient constant value representing unknown state - assumed not continuable. More...
 
static readonly ExitStatus Executing = new ExitStatus("EXECUTING")
 Convenient constant value representing continuable state where processing is still taking place, so no further action is required. Used for asynchronous execution scenarios where the processing is happening in another thread or process and the caller is not required to wait for the result. More...
 
static readonly ExitStatus Completed = new ExitStatus("COMPLETED")
 Convenient constant value representing finished processing. More...
 
static readonly ExitStatus Noop = new ExitStatus("NOOP")
 Convenient constant value representing job that did no processing (e.g. because it was already complete). More...
 
static readonly ExitStatus Failed = new ExitStatus("FAILED")
 Convenient constant value representing finished processing with an error. More...
 
static readonly ExitStatus Stopped = new ExitStatus("STOPPED")
 Convenient constant value representing finished processing with interrupted status. More...
 

Properties

string ExitCode [get]
 Exit code More...
 
string ExitDescription [get]
 Exit description. More...
 

Detailed Description

Value object used to carry information about the status of a job or step execution. ExitStatus is immutable and therefore thread-safe.

Constructor & Destructor Documentation

Summer.Batch.Core.ExitStatus.ExitStatus ( string  exitCode,
string  exitDescription = "" 
)

Custom constructor using a code and a description.

Parameters
exitCode
exitDescription

Member Function Documentation

ExitStatus Summer.Batch.Core.ExitStatus.AddExitDescription ( string  description)

Add an exit description to an existing ExistStatus. If there is already a description present the two will be concatenated with a semicolon.

Parameters
descriptionthe description to add
Returns
a new ExitStatus with the same properties but a new exit description
ExitStatus Summer.Batch.Core.ExitStatus.AddExitDescription ( Exception  exception)

Extract the stack trace from the throwable provided and append it to the exist description.

Parameters
exceptionthe given exception
Returns
a new ExitStatus with the stack trace appended
ExitStatus Summer.Batch.Core.ExitStatus.And ( ExitStatus  status)

Creates a new ExistStatus with a logical combination of the exit code, and a concatenation of the descriptions. If either value has a higher severity then its exit code will be used in the result. In the case of equal severity, the exit code is replaced if the new value is alphabetically greater.

Severity is defined by the exit code:

  • Codes beginning with EXECUTING have severity 1
  • Codes beginning with COMPLETED have severity 2
  • Codes beginning with NOOP have severity 3
  • Codes beginning with STOPPED have severity 4
  • Codes beginning with FAILED have severity 5
  • Codes beginning with UNKNOWN have severity 6

Others have severity 7, so custom exit codes always win. If the input is null just return this.

Parameters
statusan ExitStatus to combine with this one.
Returns
a new ExitStatus combining the current value and the argument provided.
int Summer.Batch.Core.ExitStatus.CompareTo ( ExitStatus  status)

see IComparable

Parameters
statusan ExitStatus to compare
Returns
greater than zero, 0, less than zero according to the severity and exit code
override bool Summer.Batch.Core.ExitStatus.Equals ( object  obj)

Compare the fields one by one. Equals override.

Parameters
obj
Returns
override int Summer.Batch.Core.ExitStatus.GetHashCode ( )

Compatible with the Equals implementation. GetHashCode override.

Returns
static bool Summer.Batch.Core.ExitStatus.IsNonDefaultExitStatus ( ExitStatus  status)
static

Checks whether the given ExitStatus is a known exit code.

Parameters
statusthe exit code to be evaluated
Returns
true if the value matches a known exit code
bool Summer.Batch.Core.ExitStatus.IsRunning ( )

Check if this status represents a running process.

Returns
true if the exit code is "EXECUTING" or "UNKNOWN"
ExitStatus Summer.Batch.Core.ExitStatus.ReplaceExitCode ( string  code)

Adds an exit code to an existing ExistStatus. If there is already a code present, it will be replaced.

Parameters
codecode
Returns
a new ExistStatus with the same properties but a new exit code
override string Summer.Batch.Core.ExitStatus.ToString ( )

ToString override

Returns

Member Data Documentation

readonly ExitStatus Summer.Batch.Core.ExitStatus.Completed = new ExitStatus("COMPLETED")
static

Convenient constant value representing finished processing.

readonly ExitStatus Summer.Batch.Core.ExitStatus.Executing = new ExitStatus("EXECUTING")
static

Convenient constant value representing continuable state where processing is still taking place, so no further action is required. Used for asynchronous execution scenarios where the processing is happening in another thread or process and the caller is not required to wait for the result.

readonly ExitStatus Summer.Batch.Core.ExitStatus.Failed = new ExitStatus("FAILED")
static

Convenient constant value representing finished processing with an error.

readonly ExitStatus Summer.Batch.Core.ExitStatus.Noop = new ExitStatus("NOOP")
static

Convenient constant value representing job that did no processing (e.g. because it was already complete).

readonly ExitStatus Summer.Batch.Core.ExitStatus.Stopped = new ExitStatus("STOPPED")
static

Convenient constant value representing finished processing with interrupted status.

readonly ExitStatus Summer.Batch.Core.ExitStatus.Unknown = new ExitStatus("UNKNOWN")
static

Convenient constant value representing unknown state - assumed not continuable.

Property Documentation

string Summer.Batch.Core.ExitStatus.ExitCode
get

Exit code

string Summer.Batch.Core.ExitStatus.ExitDescription
get

Exit description.


The documentation for this class was generated from the following file:
  • Summer.Batch.Core/Core/ExitStatus.cs