Skip to content

Commit e4a099a

Browse files
committed
Merge branch 'develop'
2 parents 0ba5ba5 + 340f181 commit e4a099a

File tree

133 files changed

+1127
-366
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+1127
-366
lines changed

src/Api/DicomAssociationInfo.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
using System;
18+
using System.Collections.Generic;
1819

1920
namespace Monai.Deploy.InformaticsGateway.Api
2021
{
@@ -30,14 +31,21 @@ public class DicomAssociationInfo : MongoDBEntityBase
3031
public string Errors { get; set; } = string.Empty;
3132
public TimeSpan Duration { get; private set; } = default!;
3233

34+
public HashSet<string> PayloadIds { get; private set; }
35+
3336
public DicomAssociationInfo()
3437
{
3538
FileCount = 0;
39+
PayloadIds = new HashSet<string>();
3640
}
3741

38-
public void FileReceived()
42+
public void FileReceived(string? payloadId)
3943
{
40-
FileCount++;
44+
if (!string.IsNullOrWhiteSpace(payloadId))
45+
{
46+
FileCount++;
47+
PayloadIds.Add(payloadId);
48+
}
4149
}
4250

4351
public void Disconnect()

src/Api/GlobalSuppressions.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2022 MONAI Consortium
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
// This file is used by Code Analysis to maintain SuppressMessage
18+
// attributes that are applied to this project.
19+
// Project-level suppressions either have no target or are given
20+
// a specific target and scoped to a namespace, type, member, etc.
21+
22+
using System.Diagnostics.CodeAnalysis;
23+
24+
[assembly: SuppressMessage("Sonar Code Smell", "S2094: Remove this empty class, write its code or make it an \"interface\"", Justification = "placeholder code")]

src/Api/SourceApplicationEntity.cs

100644100755
File mode changed.

src/Api/Storage/FileStorageMetadata.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public abstract record FileStorageMetadata
6969
/// Gets or sets the data origin of this file.
7070
/// </summary>
7171
[JsonPropertyName("dataOrigin"), JsonInclude]
72-
public DataOrigin DataOrigin { get; private set; }
72+
public DataOrigin DataOrigin { get; private set; } = new();
7373

7474
/// <summary>
7575
/// Gets a list of workflows designated for the file.

src/Api/Storage/StorageObjectMetadata.cs

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class StorageObjectMetadata
4040
/// Gets the file extension.
4141
/// </summary>
4242
[JsonPropertyName("fileExtension")]
43-
public string FileExtension { get; init; } = default!;
43+
public string FileExtension { get; init; }
4444

4545
/// <summary>
4646
/// Gets or sets the content type of the file.
@@ -83,7 +83,7 @@ public class StorageObjectMetadata
8383
/// Gets or sets whether upload failed.
8484
/// </summary>
8585
[JsonPropertyName("isUploadFailed"), JsonInclude]
86-
public bool IsUploadFailed { get; private set; } = default!;
86+
public bool IsUploadFailed { get; private set; }
8787

8888
[JsonPropertyName("isMoveCompleted"), JsonInclude]
8989
public bool IsMoveCompleted { get; private set; } = default!;

src/CLI/Services/DockerRunner.cs

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public async Task<RunnerState> IsApplicationRunning(ImageVersion imageVersion, C
6464
return new RunnerState { IsRunning = false };
6565
}
6666

67-
return new RunnerState { IsRunning = true, Id = matches.First().ID };
67+
return new RunnerState { IsRunning = true, Id = matches[0].ID };
6868
}
6969

7070
public async Task<ImageVersion> GetLatestApplicationVersion(CancellationToken cancellationToken = default)
@@ -98,7 +98,7 @@ public async Task<IList<ImageVersion>> GetApplicationVersions(string version, Ca
9898
};
9999
_logger.RetrievingImagesFromDocker();
100100
var images = await _dockerClient.Images.ListImagesAsync(parameters, cancellationToken).ConfigureAwait(false);
101-
return images?.Select(p => new ImageVersion { Version = p.RepoTags.First(), Id = p.ID, Created = p.Created }).ToList();
101+
return images?.Select(p => new ImageVersion { Version = p.RepoTags[0], Id = p.ID, Created = p.Created }).ToList();
102102
}
103103

104104
public async Task<bool> StartApplication(ImageVersion imageVersion, CancellationToken cancellationToken = default)

src/CLI/Services/NLogConfigurationOptionAccessor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public interface INLogConfigurationOptionAccessor
3030

3131
public class NLogConfigurationOptionAccessor : INLogConfigurationOptionAccessor
3232
{
33+
public const string NlogSchema = "http://www.nlog-project.org/schemas/NLog.xsd";
3334
private readonly XmlDocument _xmlDocument;
3435
private readonly XmlNamespaceManager _namespaceManager;
3536

@@ -44,7 +45,7 @@ public NLogConfigurationOptionAccessor(IFileSystem fileSystem)
4445
_xmlDocument = new XmlDocument();
4546
_xmlDocument.LoadXml(xml);
4647
_namespaceManager = new XmlNamespaceManager(_xmlDocument.NameTable);
47-
_namespaceManager.AddNamespace("ns", "http://www.nlog-project.org/schemas/NLog.xsd");
48+
_namespaceManager.AddNamespace("ns", NlogSchema);
4849
}
4950

5051
public string LogStoragePath

src/Client.Common/UriExtensions.cs

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static Uri EnsureUriEndsWithSlash(this Uri input)
2828

2929
var str = input.ToString();
3030

31-
if (!string.IsNullOrWhiteSpace(str) && !str.EndsWith("/"))
31+
if (!string.IsNullOrWhiteSpace(str) && !str.EndsWith('/'))
3232
{
3333
#pragma warning disable S1075 // URIs should not be hardcoded
3434
return new Uri(str + '/');

src/Client/HttpContentExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ internal static class HttpContentExtensions
2424
{
2525
public static async System.Threading.Tasks.Task<T> ReadAsAsync<T>(this HttpContent httpContent, CancellationToken cancellationToken)
2626
{
27-
var json = await httpContent.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
2827
using (var contentStream = await httpContent.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false))
2928
{
3029
return await JsonSerializer.DeserializeAsync<T>(contentStream, Configuration.JsonSerializationOptions, cancellationToken: cancellationToken).ConfigureAwait(false);

src/Client/Test/packages.lock.json

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,17 @@
16591659
"System.Text.Encoding": "4.3.0"
16601660
}
16611661
},
1662+
"System.Text.Encoding.Extensions": {
1663+
"type": "Transitive",
1664+
"resolved": "4.3.0",
1665+
"contentHash": "YVMK0Bt/A43RmwizJoZ22ei2nmrhobgeiYwFzC4YAN+nue8RF6djXDMog0UCn+brerQoYVyaS+ghy9P/MUVcmw==",
1666+
"dependencies": {
1667+
"Microsoft.NETCore.Platforms": "1.1.0",
1668+
"Microsoft.NETCore.Targets": "1.1.0",
1669+
"System.Runtime": "4.3.0",
1670+
"System.Text.Encoding": "4.3.0"
1671+
}
1672+
},
16621673
"System.Text.Encodings.Web": {
16631674
"type": "Transitive",
16641675
"resolved": "6.0.0",
@@ -1764,6 +1775,47 @@
17641775
"System.Xml.ReaderWriter": "4.3.0"
17651776
}
17661777
},
1778+
"System.Xml.ReaderWriter": {
1779+
"type": "Transitive",
1780+
"resolved": "4.3.0",
1781+
"contentHash": "GrprA+Z0RUXaR4N7/eW71j1rgMnEnEVlgii49GZyAjTH7uliMnrOU3HNFBr6fEDBCJCIdlVNq9hHbaDR621XBA==",
1782+
"dependencies": {
1783+
"System.Collections": "4.3.0",
1784+
"System.Diagnostics.Debug": "4.3.0",
1785+
"System.Globalization": "4.3.0",
1786+
"System.IO": "4.3.0",
1787+
"System.IO.FileSystem": "4.3.0",
1788+
"System.IO.FileSystem.Primitives": "4.3.0",
1789+
"System.Resources.ResourceManager": "4.3.0",
1790+
"System.Runtime": "4.3.0",
1791+
"System.Runtime.Extensions": "4.3.0",
1792+
"System.Runtime.InteropServices": "4.3.0",
1793+
"System.Text.Encoding": "4.3.0",
1794+
"System.Text.Encoding.Extensions": "4.3.0",
1795+
"System.Text.RegularExpressions": "4.3.0",
1796+
"System.Threading.Tasks": "4.3.0",
1797+
"System.Threading.Tasks.Extensions": "4.3.0"
1798+
}
1799+
},
1800+
"System.Xml.XDocument": {
1801+
"type": "Transitive",
1802+
"resolved": "4.3.0",
1803+
"contentHash": "5zJ0XDxAIg8iy+t4aMnQAu0MqVbqyvfoUVl1yDV61xdo3Vth45oA2FoY4pPkxYAH5f8ixpmTqXeEIya95x0aCQ==",
1804+
"dependencies": {
1805+
"System.Collections": "4.3.0",
1806+
"System.Diagnostics.Debug": "4.3.0",
1807+
"System.Diagnostics.Tools": "4.3.0",
1808+
"System.Globalization": "4.3.0",
1809+
"System.IO": "4.3.0",
1810+
"System.Reflection": "4.3.0",
1811+
"System.Resources.ResourceManager": "4.3.0",
1812+
"System.Runtime": "4.3.0",
1813+
"System.Runtime.Extensions": "4.3.0",
1814+
"System.Text.Encoding": "4.3.0",
1815+
"System.Threading": "4.3.0",
1816+
"System.Xml.ReaderWriter": "4.3.0"
1817+
}
1818+
},
17671819
"xunit.abstractions": {
17681820
"type": "Transitive",
17691821
"resolved": "2.0.3",
@@ -1827,6 +1879,7 @@
18271879
"Monai.Deploy.InformaticsGateway.Database.Api": "[1.0.0, )",
18281880
"Monai.Deploy.InformaticsGateway.Database.EntityFramework": "[1.0.0, )",
18291881
"Monai.Deploy.InformaticsGateway.DicomWeb.Client": "[1.0.0, )",
1882+
"Monai.Deploy.InformaticsGateway.PlugIns.RemoteAppExecution": "[1.0.0, )",
18301883
"Monai.Deploy.Messaging.RabbitMQ": "[1.0.0, )",
18311884
"Monai.Deploy.Security": "[0.1.3, )",
18321885
"Monai.Deploy.Storage.MinIO": "[0.2.18, )",
@@ -1889,7 +1942,8 @@
18891942
"type": "Project",
18901943
"dependencies": {
18911944
"Monai.Deploy.InformaticsGateway.Api": "[1.0.0, )",
1892-
"Monai.Deploy.InformaticsGateway.Configuration": "[1.0.0, )"
1945+
"Monai.Deploy.InformaticsGateway.Configuration": "[1.0.0, )",
1946+
"NLog": "[5.2.3, )"
18931947
}
18941948
},
18951949
"monai.deploy.informaticsgateway.database.entityframework": {
@@ -1921,6 +1975,23 @@
19211975
"System.Linq.Async": "[6.0.1, )",
19221976
"fo-dicom": "[5.1.1, )"
19231977
}
1978+
},
1979+
"monai.deploy.informaticsgateway.plugins.remoteappexecution": {
1980+
"type": "Project",
1981+
"dependencies": {
1982+
"Microsoft.EntityFrameworkCore": "[6.0.21, )",
1983+
"Microsoft.EntityFrameworkCore.Relational": "[6.0.21, )",
1984+
"Microsoft.EntityFrameworkCore.Sqlite": "[6.0.21, )",
1985+
"Microsoft.Extensions.Configuration": "[6.0.1, )",
1986+
"Microsoft.Extensions.Configuration.FileExtensions": "[6.0.0, )",
1987+
"Microsoft.Extensions.Configuration.Json": "[6.0.0, )",
1988+
"Monai.Deploy.InformaticsGateway.Api": "[1.0.0, )",
1989+
"Monai.Deploy.InformaticsGateway.Configuration": "[1.0.0, )",
1990+
"Monai.Deploy.InformaticsGateway.Database.Api": "[1.0.0, )",
1991+
"MongoDB.Driver": "[2.21.0, )",
1992+
"NLog": "[5.2.3, )",
1993+
"Polly": "[7.2.4, )"
1994+
}
19241995
}
19251996
}
19261997
}

src/Configuration/ConfigurationValidator.cs

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private bool IsValidDirectory(string source, string directory)
120120
private bool IsValidBucketName(string source, string bucketName)
121121
{
122122
var valid = IsNotNullOrWhiteSpace(source, bucketName);
123-
var regex = new Regex("(?=^.{3,63}$)(^[a-z0-9]+[a-z0-9\\-]+[a-z0-9]+$)", new RegexOptions(), TimeSpan.FromSeconds(5));
123+
var regex = new Regex("(?=^.{3,63}$)(^[a-z0-9]+[a-z0-9\\-]+[a-z0-9]+$)", RegexOptions.None, TimeSpan.FromSeconds(5));
124124
if (!regex.IsMatch(bucketName))
125125
{
126126
valid = false;

src/Configuration/ValidationExtensions.cs

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public static bool IsAeTitleValid(string source, string aeTitle, IList<string> v
112112

113113
if (!string.IsNullOrWhiteSpace(aeTitle) &&
114114
aeTitle.Length <= 15 &&
115-
Regex.IsMatch(aeTitle, @"^[a-zA-Z0-9_\-]+$"))
115+
Regex.IsMatch(aeTitle, @"^[a-zA-Z0-9_\-]+$", RegexOptions.None, TimeSpan.FromSeconds(2)))
116116
{
117117
return true;
118118
}
@@ -124,8 +124,8 @@ public static bool IsAeTitleValid(string source, string aeTitle, IList<string> v
124124
public static bool IsValidHostNameIp(string source, string hostIp, IList<string> validationErrors = null)
125125
{
126126
if (!string.IsNullOrWhiteSpace(hostIp) &&
127-
(Regex.IsMatch(hostIp, @"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$") || // IP address
128-
Regex.IsMatch(hostIp, @"^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$"))) // Host/domain name
127+
(Regex.IsMatch(hostIp, @"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$", RegexOptions.None, TimeSpan.FromSeconds(2)) || // IP address
128+
Regex.IsMatch(hostIp, @"^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$", RegexOptions.None, TimeSpan.FromSeconds(2)))) // Host/domain name
129129
{
130130
return true;
131131
}

src/Database/Api/DatabaseRegistrationBase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
*/
1616

1717
using Microsoft.Extensions.DependencyInjection;
18+
using Microsoft.Extensions.Logging;
1819

1920
namespace Monai.Deploy.InformaticsGateway.Database.Api
2021
{
2122
public abstract class DatabaseRegistrationBase
2223
{
23-
public abstract IServiceCollection Configure(IServiceCollection services, DatabaseType databaseType, string? connectionString);
24+
public abstract IServiceCollection Configure(IServiceCollection services, DatabaseType databaseType, string? connectionString, ILogger logger);
2425
}
2526
}

src/Database/Api/Monai.Deploy.InformaticsGateway.Database.Api.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
<Compile Include="..\..\AssemblyInfo.cs" Link="AssemblyInfo.cs" />
3636
</ItemGroup>
3737

38+
<ItemGroup>
39+
<PackageReference Include="NLog" Version="5.2.3" />
40+
</ItemGroup>
41+
3842
<ItemGroup>
3943
<ProjectReference Include="..\..\Api\Monai.Deploy.InformaticsGateway.Api.csproj" />
4044
<ProjectReference Include="..\..\Configuration\Monai.Deploy.InformaticsGateway.Configuration.csproj" />

src/Database/Api/Repositories/ISourceApplicationEntityRepository.cs

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public interface ISourceApplicationEntityRepository
2525

2626
Task<SourceApplicationEntity?> FindByNameAsync(string name, CancellationToken cancellationToken = default);
2727

28-
Task<SourceApplicationEntity[]?> FindByAETAsync(string name, CancellationToken cancellationToken = default);
28+
Task<SourceApplicationEntity[]?> FindByAETAsync(string aeTitle, CancellationToken cancellationToken = default);
2929

3030
Task<SourceApplicationEntity> AddAsync(SourceApplicationEntity item, CancellationToken cancellationToken = default);
3131

src/Database/Api/Repositories/IVirtualApplicationEntityRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public interface IVirtualApplicationEntityRepository
2525

2626
Task<VirtualApplicationEntity?> FindByNameAsync(string name, CancellationToken cancellationToken = default);
2727

28-
Task<VirtualApplicationEntity?> FindByAeTitleAsync(string name, CancellationToken cancellationToken = default);
28+
Task<VirtualApplicationEntity?> FindByAeTitleAsync(string aeTitle, CancellationToken cancellationToken = default);
2929

3030
Task<VirtualApplicationEntity> AddAsync(VirtualApplicationEntity item, CancellationToken cancellationToken = default);
3131

src/Database/Api/Repositories/StorageMetadataRepositoryBase.cs

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public virtual async Task<bool> DeleteAsync(string correlationId, string identit
7373
return false;
7474
}
7575

76-
protected abstract Task<bool> DeleteInternalAsync(StorageMetadataWrapper toBeDeleted, CancellationToken cancellationToken);
76+
protected abstract Task<bool> DeleteInternalAsync(StorageMetadataWrapper metadata, CancellationToken cancellationToken = default);
7777

7878
public abstract Task DeletePendingUploadsAsync(CancellationToken cancellationToken = default);
7979

@@ -98,7 +98,7 @@ public virtual async Task UpdateAsync(FileStorageMetadata metadata, Cancellation
9898
_logger.StorageMetadataSaved();
9999
}
100100

101-
protected abstract Task UpdateInternal(StorageMetadataWrapper obj, CancellationToken cancellationToken = default);
101+
protected abstract Task UpdateInternal(StorageMetadataWrapper metadata, CancellationToken cancellationToken = default);
102102

103103
protected abstract Task<StorageMetadataWrapper?> FindByIds(string id, string correlationId, CancellationToken cancellationToken = default);
104104

src/Database/Api/StorageMetadataWrapper.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ public StorageMetadataWrapper(FileStorageMetadata metadata)
5252
{
5353
Guard.Against.Null(metadata, nameof(metadata));
5454

55-
_options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
56-
_options.Converters.Add(new JsonStringEnumConverter());
57-
5855
CorrelationId = metadata.CorrelationId;
5956
Identity = metadata.Id;
6057
Update(metadata);

src/Database/Api/Test/packages.lock.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,11 @@
316316
"resolved": "13.0.3",
317317
"contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ=="
318318
},
319+
"NLog": {
320+
"type": "Transitive",
321+
"resolved": "5.2.3",
322+
"contentHash": "rHTNRtQF5qYqLutSR9ldUWXglKym/KA1R6GKw4JtDvza8i5+kgfmeKH75Ccn1noeJIOjHLXorphMxKk3EiN2tg=="
323+
},
319324
"NuGet.Frameworks": {
320325
"type": "Transitive",
321326
"resolved": "6.5.0",
@@ -1256,7 +1261,8 @@
12561261
"type": "Project",
12571262
"dependencies": {
12581263
"Monai.Deploy.InformaticsGateway.Api": "[1.0.0, )",
1259-
"Monai.Deploy.InformaticsGateway.Configuration": "[1.0.0, )"
1264+
"Monai.Deploy.InformaticsGateway.Configuration": "[1.0.0, )",
1265+
"NLog": "[5.2.3, )"
12601266
}
12611267
}
12621268
}

src/Database/Api/packages.lock.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
"version": 1,
33
"dependencies": {
44
"net6.0": {
5+
"NLog": {
6+
"type": "Direct",
7+
"requested": "[5.2.3, )",
8+
"resolved": "5.2.3",
9+
"contentHash": "rHTNRtQF5qYqLutSR9ldUWXglKym/KA1R6GKw4JtDvza8i5+kgfmeKH75Ccn1noeJIOjHLXorphMxKk3EiN2tg=="
10+
},
511
"Ardalis.GuardClauses": {
612
"type": "Transitive",
713
"resolved": "4.1.1",

0 commit comments

Comments
 (0)