HttpTransferClient
using System;
using System.ComponentModel.Composition;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
namespace Relativity.Transfer.Http
{
[TransferClientMetadata(Attributes = (TransferClientAttributes.Http | TransferClientAttributes.Slow), Client = WellKnownTransferClient.Http, Company = "kCura Corporation", Copyright = "Copyright © kCura Corp 2017", Description = "The document repository is accessed through the Relativity web service API over standard HTTP. This is the slowest of all methods, but is always available.", Id = "18F9E382-288C-4B6D-8AE8-FBA4D88CD841", DisplayName = "Web", Name = "Http", Version = "1.0")]
[Export(typeof(ITransferClient))]
internal sealed class HttpTransferClient : TransferClientBase
{
internal const string Description = "The document repository is accessed through the Relativity web service API over standard HTTP. This is the slowest of all methods, but is always available.";
[ImportingConstructor]
public HttpTransferClient([Import("RelativityConnectionInfo")] RelativityConnectionInfo connectionInfo, [Import("Logger")] ITransferLog log, [Import("ClientConfiguration")] ClientConfiguration configuration)
: this(connectionInfo, new WorkspaceService(connectionInfo, configuration, log), log, configuration)
{
}
public HttpTransferClient(RelativityConnectionInfo connectionInfo, IWorkspaceService workspaceService, ITransferLog log, ClientConfiguration configuration)
: base(connectionInfo, configuration, workspaceService, log, new Guid("18F9E382-288C-4B6D-8AE8-FBA4D88CD841"), WellKnownTransferClient.Http, "Http", "Web", new HttpPathValidationFactory(log))
{
}
[AsyncStateMachine(typeof(<OnCreateJobAsync>d__3))]
protected override Task<ITransferJob> OnCreateJobAsync(ITransferRequest request, CancellationToken token)
{
<OnCreateJobAsync>d__3 stateMachine = default(<OnCreateJobAsync>d__3);
stateMachine.<>t__builder = AsyncTaskMethodBuilder<ITransferJob>.Create();
stateMachine.<>4__this = this;
stateMachine.request = request;
stateMachine.token = token;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
protected override Task<ISupportCheckResult> OnSupportCheckAsync(CancellationToken token)
{
return Task.FromResult((ISupportCheckResult)new SupportCheckResult {
IsSupported = true
});
}
[AsyncStateMachine(typeof(<OnExecConnectionCheckAsync>d__5))]
protected override Task<IConnectionCheckResult> OnExecConnectionCheckAsync(DiagnosticsContext context, CancellationToken token)
{
<OnExecConnectionCheckAsync>d__5 stateMachine = default(<OnExecConnectionCheckAsync>d__5);
stateMachine.<>t__builder = AsyncTaskMethodBuilder<IConnectionCheckResult>.Create();
stateMachine.<>4__this = this;
stateMachine.context = context;
stateMachine.token = token;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
}
}