Add operation executor

This commit is contained in:
2025-10-25 20:30:49 +09:00
parent 59470b49d1
commit 891d462af1
19 changed files with 144 additions and 52 deletions

View File

@ -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);
}
}
}

View 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);
}
}

View 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();
}
}
}

View File

@ -0,0 +1,7 @@
namespace Hcs.WebApp.BackgroundServices.Executors
{
public interface IExecutor
{
Task<string> ExecuteAsync(CancellationToken cancellationToken);
}
}