Add operation executor
This commit is contained in:
@ -0,0 +1,13 @@
|
||||
using Hcs.Broker;
|
||||
using Hcs.WebApp.Data.Hcs;
|
||||
|
||||
namespace Hcs.WebApp.BackgroundServices.Executors._15_7_0_1.NsiCommon
|
||||
{
|
||||
public class ExportAllRegistryElementsExecutor(IClient client, Operation operation) : ExecutorBase(client, operation)
|
||||
{
|
||||
public override async Task<string> ExecuteAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
return await client.NsiCommon.RequestExportNsiItemAsync(1, Service.Async.NsiCommon.ListGroup.NSI, cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
13
Hcs.WebApp/BackgroundServices/Executors/ExecutorBase.cs
Normal file
13
Hcs.WebApp/BackgroundServices/Executors/ExecutorBase.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using Hcs.Broker;
|
||||
using Hcs.WebApp.Data.Hcs;
|
||||
|
||||
namespace Hcs.WebApp.BackgroundServices.Executors
|
||||
{
|
||||
public abstract class ExecutorBase(IClient client, Operation operation) : IExecutor
|
||||
{
|
||||
protected readonly IClient client = client;
|
||||
protected readonly Operation operation = operation;
|
||||
|
||||
public abstract Task<string> ExecuteAsync(CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
20
Hcs.WebApp/BackgroundServices/Executors/ExecutorFactory.cs
Normal file
20
Hcs.WebApp/BackgroundServices/Executors/ExecutorFactory.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using Hcs.Broker;
|
||||
using Hcs.WebApp.BackgroundServices.Executors._15_7_0_1.NsiCommon;
|
||||
using Hcs.WebApp.Data.Hcs;
|
||||
|
||||
namespace Hcs.WebApp.BackgroundServices.Executors
|
||||
{
|
||||
public class ExecutorFactory
|
||||
{
|
||||
public IExecutor CreateExecutor(IClient client, Operation operation)
|
||||
{
|
||||
switch (operation.Type)
|
||||
{
|
||||
case Operation.OperationType.NsiCommon_15_7_0_1_ExportAllRegistryElements:
|
||||
return new ExportAllRegistryElementsExecutor(client, operation);
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Hcs.WebApp/BackgroundServices/Executors/IExecutor.cs
Normal file
7
Hcs.WebApp/BackgroundServices/Executors/IExecutor.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace Hcs.WebApp.BackgroundServices.Executors
|
||||
{
|
||||
public interface IExecutor
|
||||
{
|
||||
Task<string> ExecuteAsync(CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user