work on jobrunner

This commit is contained in:
Jonathan Jenne
2019-04-10 11:43:15 +02:00
parent 720618f29b
commit 2855cc6208
14 changed files with 103 additions and 54 deletions

View File

@@ -1,3 +1,5 @@
Public Class ADSyncArgs
Inherits JobArgs
Public RootPath As String
End Class

View File

@@ -1,9 +1,32 @@
Imports DigitalData.Modules.Jobs
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Interfaces
Imports DigitalData.Modules.Jobs
Imports DigitalData.Modules.Logging
Public Class ADSyncJob
Inherits JobBase
Implements IJob(Of ADSyncArgs)
Private _ADSync As ActiveDirectoryInterface
Public Sub New(LogConfig As LogConfig, Firebird As Firebird)
MyBase.New(LogConfig, Firebird)
End Sub
Public Sub Start(Arguments As ADSyncArgs) Implements IJob(Of ADSyncArgs).Start
_ADSync = New ActiveDirectoryInterface(_LogConfig, _Firebird, Arguments.RootPath)
'TODO: Do AD Sync!
If _ADSync.Authenticate() = False Then
_Logger.Warn("Job could not be completed! Authentication failed!")
Exit Sub
End If
End Sub
Public Function ShouldStart(Arguments As ADSyncArgs) As Boolean Implements IJob(Of ADSyncArgs).ShouldStart
Return Arguments.Enabled
End Function
End Class

4
Jobs/JobArgs.vb Normal file
View File

@@ -0,0 +1,4 @@
Public Class JobArgs
Public Enabled As Boolean
Public Interval As Long
End Class

14
Jobs/JobBase.vb Normal file
View File

@@ -0,0 +1,14 @@
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging
Public Class JobBase
Protected _LogConfig As LogConfig
Protected _Logger As Logger
Protected _Firebird As Firebird
Public Sub New(LogConfig As LogConfig, Firebird As Firebird)
_LogConfig = LogConfig
_Logger = LogConfig.GetLogger()
_Firebird = Firebird
End Sub
End Class

View File

@@ -4,4 +4,6 @@ End Interface
Public Interface IJob(Of T)
Sub Start(Arguments As T)
Function ShouldStart(Arguments As T) As Boolean
End Interface

View File

@@ -90,7 +90,9 @@
<Compile Include="EDMI\ZUGFeRD\WorkerArgs.vb" />
<Compile Include="EDMI\ZUGFeRD\XmlItemProperty.vb" />
<Compile Include="Exceptions.vb" />
<Compile Include="IJob.vb" />
<Compile Include="JobInterface.vb" />
<Compile Include="JobBase.vb" />
<Compile Include="JobArgs.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>