Jobs: Update to use Job Runner Table
This commit is contained in:
@@ -13,46 +13,17 @@ Public Class JobConfigParser
|
||||
''' </summary>
|
||||
''' <param name="ConfigString"></param>
|
||||
''' <returns>A populated JobConfig object</returns>
|
||||
Public Shared Function ParseConfig(ConfigString As String) As JobConfig
|
||||
If JobOptionsRegex.IsMatch(ConfigString) Then
|
||||
Dim oMatches = JobOptionsRegex.Matches(ConfigString)
|
||||
Dim oOptions As New JobConfig
|
||||
Public Shared Function ParseConfig(pJobConfig As JobConfig) As JobConfig
|
||||
|
||||
Dim oSplitOptions As String() = ConfigString.Split(ARGS_LIST_DELIMITER)
|
||||
' 24.11.2022: This only parses the optional Job arguments,
|
||||
' everything is comparmentalized in the Service config
|
||||
pJobConfig.Args = ParseOptionalArguments(pJobConfig.ArgsString)
|
||||
Return pJobConfig
|
||||
|
||||
If oSplitOptions.Length = 3 Then
|
||||
oOptions = ParseEnabled(oSplitOptions(0), oOptions)
|
||||
oOptions.CronExpression = oSplitOptions(1)
|
||||
oOptions.Arguments = ParseOptionalArguments(oSplitOptions(2))
|
||||
ElseIf oSplitOptions.Length = 2 Then
|
||||
oOptions = ParseEnabled(oSplitOptions(0), oOptions)
|
||||
oOptions.CronExpression = oSplitOptions(1)
|
||||
oOptions.Arguments = New Dictionary(Of String, String)
|
||||
Else
|
||||
Throw New ArgumentException("Config Malformed")
|
||||
End If
|
||||
|
||||
Return oOptions
|
||||
Else
|
||||
Throw New ArgumentException("Config Malformed")
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Shared Function ParseEnabled(EnabledValue As String, Options As JobConfig) As JobConfig
|
||||
Select Case EnabledValue
|
||||
Case "True"
|
||||
Options.Enabled = True
|
||||
Options.StartImmediately = False
|
||||
Case "Debug"
|
||||
Options.Enabled = True
|
||||
Options.StartImmediately = True
|
||||
Case Else
|
||||
Options.Enabled = False
|
||||
Options.StartImmediately = False
|
||||
End Select
|
||||
|
||||
Return Options
|
||||
End Function
|
||||
|
||||
Private Shared Function ParseOptionalArguments(ArgsString As String) As Dictionary(Of String, String)
|
||||
Dim oArgsDictionary As New Dictionary(Of String, String)
|
||||
|
||||
Reference in New Issue
Block a user