FilesTapiBridgeFactory
using kCura.WinEDDS.Service.Kepler;
using Relativity.DataExchange.Service;
using Relativity.DataExchange.Transfer;
using Relativity.Logging;
using System;
using System.Threading;
namespace Relativity.DataExchange.Export.VolumeManagerV2.Download.TapiHelpers
{
public class FilesTapiBridgeFactory : ITapiBridgeFactory
{
private readonly IRelativityFileShareSettings ;
private readonly ILog _logger;
private readonly TapiBridgeParametersFactory _tapiBridgeParametersFactory;
private readonly ITapiObjectService _tapiObjectService;
private readonly CancellationToken _token;
private Func<string> _getCorrelationId;
public FilesTapiBridgeFactory(TapiBridgeParametersFactory factory, ITapiObjectService tapiObjectService, ILog logger, IRelativityFileShareSettings settings, CancellationToken token, Func<string> getCorrelationId)
{
_tapiBridgeParametersFactory = factory.ThrowIfNull("factory");
_tapiObjectService = tapiObjectService.ThrowIfNull("tapiObjectService");
_logger = logger.ThrowIfNull<ILog>("logger");
_fileshareSettings = settings;
_token = token;
_getCorrelationId = getCorrelationId;
}
public ITapiBridge Create()
{
DownloadTapiBridgeParameters2 downloadTapiBridgeParameters = _tapiBridgeParametersFactory.CreateTapiBridgeParametersFromConfiguration();
if (_fileshareSettings == null) {
_tapiObjectService.ApplyUnmappedFileRepositoryParameters(downloadTapiBridgeParameters);
_logger.LogWarning("Applying Transfer API bridge parameter changes because the file share settings are unmapped. ForceClientCandidates={ForceClientCandidates}, ForceAsperaClient={ForceAsperaClient}, ForceFileShareClient={ForceFileShareClient}, ForceHttpClient={ForceHttpClient}", new object[4] {
downloadTapiBridgeParameters.ForceClientCandidates,
downloadTapiBridgeParameters.ForceAsperaClient,
downloadTapiBridgeParameters.ForceFileShareClient,
downloadTapiBridgeParameters.ForceHttpClient
});
} else {
downloadTapiBridgeParameters.FileShare = _fileshareSettings.UncPath;
downloadTapiBridgeParameters.TransferCredential = _fileshareSettings.TransferCredential;
}
DownloadTapiBridge2 downloadTapiBridge = TapiBridgeFactory.CreateDownloadBridge(downloadTapiBridgeParameters, _logger, _token, _getCorrelationId, new WebApiVsKeplerFactory(_logger), new RelativityManagerServiceFactory());
downloadTapiBridge.LogTransferParameters();
return downloadTapiBridge;
}
}
}