AzureFilesTransferClient
using System;
using System.ComponentModel.Composition;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
namespace Relativity.Transfer.AzureFiles
{
[TransferClientMetadata(Attributes = TransferClientAttributes.Fast, Client = WellKnownTransferClient.AzureFiles, Company = "Relativity ODA LLC", Copyright = "© Relativity", Description = "A client that uses Azure Files technology to transfer files.", DisplayName = "Azure Files", Id = "302B33BB-1CC5-4901-B1CD-78D755986E7A", Name = "Azure Files", Version = "1.0")]
[Export(typeof(ITransferClient))]
public class AzureFilesTransferClient : TransferClientBase
{
[ImportingConstructor]
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "2", Justification = "The assertion handles this already.")]
public AzureFilesTransferClient([Import("RelativityConnectionInfo")] RelativityConnectionInfo connectionInfo, [Import("Logger")] ITransferLog log, [Import("ClientConfiguration")] ClientConfiguration configuration)
: this(connectionInfo, new WorkspaceService(connectionInfo, log, configuration.MaxHttpRetryAttempts, configuration.HttpTimeoutSeconds), log, configuration)
{
}
public AzureFilesTransferClient(RelativityConnectionInfo connectionInfo, IWorkspaceService workspaceService, ITransferLog log, ClientConfiguration configuration)
: base(connectionInfo, configuration, workspaceService, log, new Guid("302B33BB-1CC5-4901-B1CD-78D755986E7A"), WellKnownTransferClient.AzureFiles, "Azure Files", "Azure Files")
{
}
protected override Task<IConnectionCheckResult> OnExecConnectionCheckAsync(DiagnosticsContext context, CancellationToken token)
{
return Task.FromResult((IConnectionCheckResult)new ConnectionCheckResult());
}
protected override Task<ISupportCheckResult> OnSupportCheckAsync(CancellationToken token)
{
return Task.FromResult((ISupportCheckResult)new SupportCheckResult {
IsSupported = true
});
}
protected override async Task<ITransferJob> OnCreateJobAsync(ITransferRequest request, CancellationToken token)
{
AzureFilesClientConfiguration configuration = new AzureFilesClientConfiguration(Configuration);
ITransferJobService transferJobService = CreateTransferJobService(request, configuration, token);
AzureFilesTransferCommand command = new AzureFilesTransferCommand(Log, request, transferJobService, FileSystemService, configuration);
TransferEngineJob job = new TransferEngineJob(Log, request, transferJobService, configuration, CreateRelativityServiceFactory(), command, new AzureFilesUncPathResolver(Workspace.DefaultFileShareUncPath), new AzureFilesUncPathResolver(Workspace.DefaultFileShareUncPath));
await job.StartAsync(token).ConfigureAwait(false);
return job;
}
protected override Task OnAutoConfigAsync(CancellationToken token)
{
return Task.FromResult(true);
}
}
}