diff --git a/Service.JobRunner/JobRunner.vb b/Service.JobRunner/JobRunner.vb index 9bac2d36..76a81339 100644 --- a/Service.JobRunner/JobRunner.vb +++ b/Service.JobRunner/JobRunner.vb @@ -90,55 +90,8 @@ Public Class JobRunner Await _scheduler.Shutdown() End Sub - Public Class ADJob - Implements Quartz.IJob - Public Function Execute(context As IJobExecutionContext) As Task Implements Quartz.IJob.Execute - Dim oJobData = context.MergedJobDataMap - Dim oLogConfig As LogConfig = oJobData.Item("LogConfig") - Dim oFirebird As Firebird = oJobData.Item("Firebird") - Dim oMSSQL As MSSQLServer = oJobData.Item("MSSQL") - Dim oArgs As Dictionary(Of String, String) = oJobData.Item("Args") - Dim oADJobArgs = New ADSyncArgs() - If oArgs.ContainsKey("RootPath") Then - oADJobArgs.RootPath = oArgs.Item("RootPath") - End If - - If oArgs.ContainsKey("DisableFirebird") AndAlso oArgs.Item("DisableFirebird") = "True" Then - oFirebird = Nothing - End If - - If oArgs.ContainsKey("DisableMSSQL") AndAlso oArgs.Item("DisableMSSQL") = "True" Then - oMSSQL = Nothing - End If - - Dim oADSyncJob As New ADSyncJob(oLogConfig, oFirebird, oMSSQL) - oADSyncJob.Start(oADJobArgs) - - Return Task.FromResult(True) - End Function - End Class - Public Class TestJob - Implements Quartz.IJob - - Public Function Execute(context As IJobExecutionContext) As Task Implements Quartz.IJob.Execute - Dim oJobData = context.MergedJobDataMap - Dim oLogConfig As LogConfig = oJobData.Item("LogConfig") - Dim oLogger = oLogConfig.GetLogger() - - Dim oArgs As Dictionary(Of String, String) = oJobData.Item("Args") - - If oArgs.ContainsKey("Arg1") Then - Dim oArg1 As String = oArgs.Item("Arg1") - oLogger.Info("Running Test Job With Arg1: {0}", oArg1) - Else - oLogger.Warn("Running Test Job With missing Arg1 :/") - End If - - Return Task.FromResult(True) - End Function - End Class Private Class LogProvider Implements ILogProvider diff --git a/Service.JobRunner/JobRunner.vbproj b/Service.JobRunner/JobRunner.vbproj index c4872423..d00a9c6c 100644 --- a/Service.JobRunner/JobRunner.vbproj +++ b/Service.JobRunner/JobRunner.vbproj @@ -87,6 +87,8 @@ + + True Application.myapp @@ -148,6 +150,10 @@ {EAF0EA75-5FA7-485D-89C7-B2D843B03A96} Database + + {39EC839A-3C30-4922-A41E-6B09D1DDE5C3} + Jobs + {903B2D7D-3B80-4BE9-8713-7447B704E1B0} Logging diff --git a/Service.JobRunner/Jobs/ADJob.vb b/Service.JobRunner/Jobs/ADJob.vb new file mode 100644 index 00000000..9a94c2e6 --- /dev/null +++ b/Service.JobRunner/Jobs/ADJob.vb @@ -0,0 +1,34 @@ +Imports DigitalData.Modules.Database +Imports DigitalData.Modules.Jobs +Imports DigitalData.Modules.Logging +Imports Quartz + +Public Class ADJob + Implements Quartz.IJob + + Public Function Execute(context As IJobExecutionContext) As Task Implements Quartz.IJob.Execute + Dim oJobData = context.MergedJobDataMap + Dim oLogConfig As LogConfig = oJobData.Item("LogConfig") + Dim oFirebird As Firebird = oJobData.Item("Firebird") + Dim oArgs As Dictionary(Of String, String) = oJobData.Item("Args") + Dim oADJobArgs = New ADSyncArgs() + + If oArgs.ContainsKey("RootPath") Then + oADJobArgs.RootPath = oArgs.Item("RootPath") + End If + + If oArgs.ContainsKey("DisableFirebird") AndAlso oArgs.Item("DisableFirebird") = "True" Then + oFirebird = Nothing + End If + + Dim oMSSQL As MSSQLServer = oJobData.Item("MSSQL") + If oArgs.ContainsKey("DisableMSSQL") AndAlso oArgs.Item("DisableMSSQL") = "True" Then + oMSSQL = Nothing + End If + + Dim oADSyncJob As New ADSyncJob(oLogConfig, oFirebird, oMSSQL) + oADSyncJob.Start(oADJobArgs) + + Return Task.FromResult(True) + End Function +End Class \ No newline at end of file diff --git a/Service.JobRunner/Jobs/TestJob.vb b/Service.JobRunner/Jobs/TestJob.vb new file mode 100644 index 00000000..764e3b6f --- /dev/null +++ b/Service.JobRunner/Jobs/TestJob.vb @@ -0,0 +1,23 @@ +Imports DigitalData.Modules.Logging +Imports Quartz + +Public Class TestJob + Implements Quartz.IJob + + Public Function Execute(context As IJobExecutionContext) As Task Implements Quartz.IJob.Execute + Dim oJobData = context.MergedJobDataMap + Dim oLogConfig As LogConfig = oJobData.Item("LogConfig") + Dim oLogger = oLogConfig.GetLogger() + + Dim oArgs As Dictionary(Of String, String) = oJobData.Item("Args") + + If oArgs.ContainsKey("Arg1") Then + Dim oArg1 As String = oArgs.Item("Arg1") + oLogger.Info("Running Test Job With Arg1: {0}", oArg1) + Else + oLogger.Warn("Running Test Job With missing Arg1 :/") + End If + + Return Task.FromResult(True) + End Function +End Class \ No newline at end of file