Skip to content

Commit

Permalink
Merge pull request #1 from ioanaanamariamarcu/integrationWithQuartz3
Browse files Browse the repository at this point in the history
Integration with quartz3
  • Loading branch information
ioanaanamariamarcu committed Oct 17, 2017
2 parents 8e21b82 + 63a4bef commit a5a44fe
Show file tree
Hide file tree
Showing 64 changed files with 471 additions and 2,875 deletions.
4 changes: 2 additions & 2 deletions src/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
using System.Reflection;

[assembly: AssemblyProductAttribute("CrystalQuartz")]
[assembly: AssemblyVersionAttribute("4.2.1.0")]
[assembly: AssemblyFileVersionAttribute("4.2.1.0")]
[assembly: AssemblyVersionAttribute("4.2.2.0")]
[assembly: AssemblyFileVersionAttribute("4.2.2.0")]
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using CrystalQuartz.Application.Comands.Outputs;
using CrystalQuartz.Application.Helpers;
Expand All @@ -11,13 +13,13 @@ protected AbstractOperationCommand(ISchedulerProvider schedulerProvider, ISchedu
{
}

protected override void InternalExecute(TInput input, SchedulerDataOutput output)
protected override async Task InternalExecute(TInput input, SchedulerDataOutput output)
{
PerformOperation(input);
await PerformOperation(input).ConfigureAwait(false);

SchedulerDataProvider.Data.MapToOutput(output);
(await SchedulerDataProvider.Data().ConfigureAwait(false)).MapToOutput(output);
}

protected abstract void PerformOperation(TInput input);
protected abstract Task PerformOperation(TInput input);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using System;
using System.Collections.Specialized;
Expand All @@ -21,9 +23,9 @@ protected AbstractSchedulerCommand(ISchedulerProvider schedulerProvider, ISchedu
_schedulerDataProvider = schedulerDataProvider;
}

protected IScheduler Scheduler
protected async Task<IScheduler> Scheduler()
{
get { return _schedulerProvider.Scheduler; }
return await _schedulerProvider.Scheduler().ConfigureAwait(false);
}

protected ISchedulerDataProvider SchedulerDataProvider
Expand Down
5 changes: 3 additions & 2 deletions src/CrystalQuartz.Application/Comands/AddTriggerCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Threading.Tasks;
using CrystalQuartz.Application.Comands.Inputs;
using CrystalQuartz.Application.Comands.Outputs;
using CrystalQuartz.Core;
Expand All @@ -15,7 +16,7 @@ public AddTriggerCommand(
{
}

protected override void InternalExecute(AddTriggerInput input, CommandResultWithErrorDetails output)
protected override async Task InternalExecute(AddTriggerInput input, CommandResultWithErrorDetails output)
{
TriggerBuilder triggerBuilder = TriggerBuilder
.Create()
Expand Down Expand Up @@ -50,7 +51,7 @@ protected override void InternalExecute(AddTriggerInput input, CommandResultWith
throw new ArgumentOutOfRangeException();
}

Scheduler.ScheduleJob(triggerBuilder.Build());
await (await Scheduler().ConfigureAwait(false)).ScheduleJob(triggerBuilder.Build()).ConfigureAwait(false);
}
}
}
10 changes: 6 additions & 4 deletions src/CrystalQuartz.Application/Comands/DeleteGroupCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using System.Linq;
using CrystalQuartz.Application.Comands.Inputs;
Expand All @@ -13,10 +15,10 @@ public DeleteGroupCommand(ISchedulerProvider schedulerProvider, ISchedulerDataPr
{
}

protected override void PerformOperation(GroupInput input)
protected override async Task PerformOperation(GroupInput input)
{
var keys = Scheduler.GetJobKeys(GroupMatcher<JobKey>.GroupEquals(input.Group));
Scheduler.DeleteJobs(keys.ToList());
var keys = await (await Scheduler().ConfigureAwait(false)).GetJobKeys(GroupMatcher<JobKey>.GroupEquals(input.Group)).ConfigureAwait(false);
await (await Scheduler().ConfigureAwait(false)).DeleteJobs(keys.ToList()).ConfigureAwait(false);
}
}
}
6 changes: 4 additions & 2 deletions src/CrystalQuartz.Application/Comands/DeleteJobCommand.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using CrystalQuartz.Application.Comands.Inputs;
Expand All @@ -11,9 +13,9 @@ public DeleteJobCommand(ISchedulerProvider schedulerProvider, ISchedulerDataProv
{
}

protected override void PerformOperation(JobInput input)
protected override async Task PerformOperation(JobInput input)
{
Scheduler.DeleteJob(new JobKey(input.Job, input.Group));
await (await Scheduler().ConfigureAwait(false)).DeleteJob(new JobKey(input.Job, input.Group)).ConfigureAwait(false);
}
}
}
8 changes: 5 additions & 3 deletions src/CrystalQuartz.Application/Comands/DeleteTriggerCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using CrystalQuartz.Application.Comands.Inputs;
using CrystalQuartz.Core;
Expand All @@ -11,10 +13,10 @@ public DeleteTriggerCommand(ISchedulerProvider schedulerProvider, ISchedulerData
{
}

protected override void PerformOperation(TriggerInput input)
protected override async Task PerformOperation(TriggerInput input)
{
var triggerKey = new TriggerKey(input.Trigger, input.Group);
Scheduler.UnscheduleJob(triggerKey);
await (await Scheduler().ConfigureAwait(false)).UnscheduleJob(triggerKey).ConfigureAwait(false);
}
}
}
8 changes: 5 additions & 3 deletions src/CrystalQuartz.Application/Comands/ExecuteNowCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using CrystalQuartz.Application.Comands.Inputs;
using CrystalQuartz.Core;
Expand All @@ -11,9 +13,9 @@ public ExecuteNowCommand(ISchedulerProvider schedulerProvider, ISchedulerDataPro
{
}

protected override void PerformOperation(JobInput input)
protected override async Task PerformOperation(JobInput input)
{
Scheduler.TriggerJob(new JobKey(input.Job, input.Group));
await (await Scheduler().ConfigureAwait(false)).TriggerJob(new JobKey(input.Job, input.Group)).ConfigureAwait(false);
}
}
}
6 changes: 4 additions & 2 deletions src/CrystalQuartz.Application/Comands/GetDataCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using CrystalQuartz.Application.Comands.Inputs;
using CrystalQuartz.Core;
Expand All @@ -10,7 +12,7 @@ public GetDataCommand(ISchedulerProvider schedulerProvider, ISchedulerDataProvid
{
}

protected override void PerformOperation(NoInput input)
protected override async Task PerformOperation(NoInput input)
{
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using System;
using System.Linq;
Expand All @@ -18,7 +20,7 @@ public GetEnvironmentDataCommand(string customCssUrl)
_customCssUrl = customCssUrl;
}

protected override void InternalExecute(NoInput input, EnvironmentDataOutput output)
protected override async Task InternalExecute(NoInput input, EnvironmentDataOutput output)
{
output.SelfVersion = GetAssemblyVersion(Assembly.GetCallingAssembly());
output.QuartzVersion = GetAssemblyVersion(Assembly.GetAssembly(typeof (IScheduler)));
Expand Down
8 changes: 5 additions & 3 deletions src/CrystalQuartz.Application/Comands/GetJobDetailsCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using System.Linq;
using CrystalQuartz.Application.Comands.Inputs;
Expand All @@ -12,9 +14,9 @@ public GetJobDetailsCommand(ISchedulerProvider schedulerProvider, ISchedulerData
{
}

protected override void InternalExecute(JobInput input, JobDetailsOutput output)
protected override async Task InternalExecute(JobInput input, JobDetailsOutput output)
{
var detailsData = SchedulerDataProvider.GetJobDetailsData(input.Job, input.Group);
var detailsData = await SchedulerDataProvider.GetJobDetailsData(input.Job, input.Group).ConfigureAwait(false);

output.JobDataMap = detailsData
.JobDataMap
Expand Down
8 changes: 5 additions & 3 deletions src/CrystalQuartz.Application/Comands/PauseGroupCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using CrystalQuartz.Application.Comands.Inputs;
using CrystalQuartz.Core;
Expand All @@ -12,9 +14,9 @@ public PauseGroupCommand(ISchedulerProvider schedulerProvider, ISchedulerDataPro
{
}

protected override void PerformOperation(GroupInput input)
protected override async Task PerformOperation(GroupInput input)
{
Scheduler.PauseJobs(GroupMatcher<JobKey>.GroupEquals(input.Group));
await (await Scheduler().ConfigureAwait(false)).PauseJobs(GroupMatcher<JobKey>.GroupEquals(input.Group)).ConfigureAwait(false);
}
}
}
8 changes: 5 additions & 3 deletions src/CrystalQuartz.Application/Comands/PauseJobCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using CrystalQuartz.Application.Comands.Inputs;
using CrystalQuartz.Core;
Expand All @@ -11,9 +13,9 @@ public PauseJobCommand(ISchedulerProvider schedulerProvider, ISchedulerDataProvi
{
}

protected override void PerformOperation(JobInput input)
protected override async Task PerformOperation(JobInput input)
{
Scheduler.PauseJob(new JobKey(input.Job, input.Group));
await (await Scheduler().ConfigureAwait(false)).PauseJob(new JobKey(input.Job, input.Group)).ConfigureAwait(false);
}
}
}
8 changes: 5 additions & 3 deletions src/CrystalQuartz.Application/Comands/PauseTriggerCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using CrystalQuartz.Application.Comands.Inputs;
using CrystalQuartz.Core;
Expand All @@ -11,10 +13,10 @@ public PauseTriggerCommand(ISchedulerProvider schedulerProvider, ISchedulerDataP
{
}

protected override void PerformOperation(TriggerInput input)
protected override async Task PerformOperation(TriggerInput input)
{
var triggerKey = new TriggerKey(input.Trigger, input.Group);
Scheduler.PauseTrigger(triggerKey);
await (await Scheduler().ConfigureAwait(false)).PauseTrigger(triggerKey).ConfigureAwait(false);
}
}
}
8 changes: 5 additions & 3 deletions src/CrystalQuartz.Application/Comands/ResumeGroupCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using CrystalQuartz.Application.Comands.Inputs;
using CrystalQuartz.Core;
Expand All @@ -12,9 +14,9 @@ public ResumeGroupCommand(ISchedulerProvider schedulerProvider, ISchedulerDataPr
{
}

protected override void PerformOperation(GroupInput input)
protected override async Task PerformOperation(GroupInput input)
{
Scheduler.ResumeJobs(GroupMatcher<JobKey>.GroupEquals(input.Group));
await (await Scheduler().ConfigureAwait(false)).ResumeJobs(GroupMatcher<JobKey>.GroupEquals(input.Group)).ConfigureAwait(false);
}
}
}
8 changes: 5 additions & 3 deletions src/CrystalQuartz.Application/Comands/ResumeJobCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using CrystalQuartz.Application.Comands.Inputs;
using CrystalQuartz.Core;
Expand All @@ -11,9 +13,9 @@ public ResumeJobCommand(ISchedulerProvider schedulerProvider, ISchedulerDataProv
{
}

protected override void PerformOperation(JobInput input)
protected override async Task PerformOperation(JobInput input)
{
Scheduler.ResumeJob(new JobKey(input.Job, input.Group));
await (await Scheduler().ConfigureAwait(false)).ResumeJob(new JobKey(input.Job, input.Group)).ConfigureAwait(false);
}
}
}
8 changes: 5 additions & 3 deletions src/CrystalQuartz.Application/Comands/ResumeTriggerCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using CrystalQuartz.Application.Comands.Inputs;
using CrystalQuartz.Core;
Expand All @@ -11,10 +13,10 @@ public ResumeTriggerCommand(ISchedulerProvider schedulerProvider, ISchedulerData
{
}

protected override void PerformOperation(TriggerInput input)
protected override async Task PerformOperation(TriggerInput input)
{
var triggerKey = new TriggerKey(input.Trigger, input.Group);
Scheduler.ResumeTrigger(triggerKey);
await (await Scheduler().ConfigureAwait(false)).ResumeTrigger(triggerKey).ConfigureAwait(false);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using CrystalQuartz.Application.Comands.Inputs;
using CrystalQuartz.Core;
using CrystalQuartz.Core.SchedulerProviders;

public class StartSchedulerCommand : AbstractOperationCommand<NoInput>
{
public StartSchedulerCommand(ISchedulerProvider schedulerProvider, ISchedulerDataProvider schedulerDataProvider) : base(schedulerProvider, schedulerDataProvider)
{
}

protected override void PerformOperation(NoInput input)
protected override async Task PerformOperation(NoInput input)
{
Scheduler.Start();
await (await Scheduler().ConfigureAwait(false)).Start().ConfigureAwait(false);
}
}
}
8 changes: 5 additions & 3 deletions src/CrystalQuartz.Application/Comands/StopSchedulerCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CrystalQuartz.Application.Comands
using System.Threading.Tasks;

namespace CrystalQuartz.Application.Comands
{
using CrystalQuartz.Application.Comands.Inputs;
using CrystalQuartz.Core;
Expand All @@ -10,9 +12,9 @@ public StopSchedulerCommand(ISchedulerProvider schedulerProvider, ISchedulerData
{
}

protected override void PerformOperation(NoInput input)
protected override async Task PerformOperation(NoInput input)
{
Scheduler.Shutdown(false);
await (await Scheduler().ConfigureAwait(false)).Shutdown(false).ConfigureAwait(false);
}
}
}
Loading

0 comments on commit a5a44fe

Please sign in to comment.