Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions Applications/ConsoleReferenceClient/ClientSamples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,6 @@ public void ExportNodesToNodeSet2(ISession session, IList<INode> nodes, string f
stopwatch.ElapsedMilliseconds);
}


/// <summary>
/// Exports nodes to separate NodeSet2 XML files, one per namespace.
/// Excludes OPC Foundation companion specifications (namespaces starting with http://opcfoundation.org/UA/).
Expand Down Expand Up @@ -1664,10 +1663,10 @@ public async Task<IReadOnlyDictionary<string, string>> ExportNodesToNodeSet2PerN
.GroupBy(node => node.NodeId.NamespaceIndex)
.Where(group =>
{
var namespaceUri = session.NamespaceUris.GetString(group.Key);
string namespaceUri = session.NamespaceUris.GetString(group.Key);
// Exclude OPC Foundation companion specifications
return !string.IsNullOrEmpty(namespaceUri) &&
!namespaceUri.StartsWith("http://opcfoundation.org/UA/", StringComparison.OrdinalIgnoreCase);
!namespaceUri.StartsWith("http://opcfoundation.org/UA/", StringComparison.OrdinalIgnoreCase);
})
.ToDictionary(
group => group.Key,
Expand All @@ -1676,16 +1675,16 @@ public async Task<IReadOnlyDictionary<string, string>> ExportNodesToNodeSet2PerN
var exportedFiles = new Dictionary<string, string>();

// Export each namespace to its own file
foreach (var kvp in nodesByNamespace)
foreach (KeyValuePair<ushort, List<INode>> kvp in nodesByNamespace)
{
cancellationToken.ThrowIfCancellationRequested();

var namespaceUri = session.NamespaceUris.GetString(kvp.Key);
string namespaceUri = session.NamespaceUris.GetString(kvp.Key);

// Create a safe filename from the namespace URI
var fileName = CreateSafeFileName(namespaceUri, kvp.Key);
var filePath = Path.Combine(outputDirectory, fileName);

string fileName = CreateSafeFileName(namespaceUri, kvp.Key);
string filePath = Path.Combine(outputDirectory, fileName);

m_logger.LogInformation(
"Exporting namespace {NamespaceIndex} ({NamespaceUri}): {Count} nodes to {FilePath}",
Expand Down Expand Up @@ -1729,14 +1728,13 @@ await Task.Run(() =>
private static string CreateSafeFileName(string namespaceUri, ushort namespaceIndex)
{
// Extract meaningful part from URI
var fileName = namespaceUri
.Replace("http://", "")
.Replace("https://", "")
.Replace("urn:", "");
string fileName = namespaceUri
.Replace("http://", string.Empty, StringComparison.OrdinalIgnoreCase)
.Replace("https://", string.Empty, StringComparison.OrdinalIgnoreCase)
.Replace("urn:", string.Empty, StringComparison.OrdinalIgnoreCase);

// Replace invalid filename characters
var invalidChars = Path.GetInvalidFileNameChars();
foreach (var c in invalidChars)
foreach (char c in Path.GetInvalidFileNameChars())
{
fileName = fileName.Replace(c, '_');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class ReferenceServer : ReverseConnectServer
/// always creates a CoreNodeManager which handles the built-in nodes defined by the specification.
/// Any additional NodeManagers are expected to handle application specific nodes.
/// </remarks>
protected override IMasterNodeManager CreateMasterNodeManager(
protected override MasterNodeManager CreateMasterNodeManager(
IServerInternal server,
ApplicationConfiguration configuration)
{
Expand Down Expand Up @@ -332,7 +332,7 @@ private void SessionManager_ImpersonateUser(ISession session, ImpersonateEventAr
m_logger.LogInformation(
Utils.TraceMasks.Security,
"X509 Token Accepted: {Identity}",
args.Identity?.DisplayName);
args.Identity.DisplayName);

return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected override void OnServerStarted(IServerInternal server)
/// always creates a CoreNodeManager which handles the built-in nodes defined by the specification.
/// Any additional NodeManagers are expected to handle application specific nodes.
/// </remarks>
protected override IMasterNodeManager CreateMasterNodeManager(
protected override MasterNodeManager CreateMasterNodeManager(
IServerInternal server,
ApplicationConfiguration configuration)
{
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Opc.Ua.PubSub/Transport/MqttPubSubConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,13 @@ public override async Task<bool> PublishNetworkMessageAsync(UaNetworkMessage net

try
{
IMqttClient publisherClient;
MqttClient publisherClient;
lock (Lock)
{
publisherClient = m_publisherMqttClient;
}

if (publisherClient != null && publisherClient.IsConnected)
if (publisherClient.IsConnected)
{
// get the encoded bytes
byte[] bytes = networkMessage.Encode(MessageContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public void HasApplicationSecureAdminAccess(ISystemContext context)
/// <inheritdoc/>
public void HasApplicationSecureAdminAccess(
ISystemContext context,
CertificateStoreIdentifier _)
CertificateStoreIdentifier trustedStore)
{
if (context is SessionSystemContext { OperationContext: OperationContext operationContext })
{
Expand Down
8 changes: 3 additions & 5 deletions Libraries/Opc.Ua.Server/NodeManager/IMasterNodeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ public interface IMasterNodeManager
/// <summary>
/// Returns the configuration node manager.
/// </summary>
IConfigurationNodeManager ConfigurationNodeManager { get; }
ConfigurationNodeManager ConfigurationNodeManager { get; }

/// <summary>
/// Returns the core node manager.
/// </summary>
ICoreNodeManager CoreNodeManager { get; }
CoreNodeManager CoreNodeManager { get; }

/// <summary>
/// Returns the diagnostics node manager.
/// </summary>
IDiagnosticsNodeManager DiagnosticsNodeManager { get; }
DiagnosticsNodeManager DiagnosticsNodeManager { get; }

/// <summary>
/// The node managers being managed.
Expand Down Expand Up @@ -221,7 +221,6 @@ ValueTask ModifyMonitoredItemsAsync(
/// </para>
/// </remarks>
/// <exception cref="ArgumentNullException">Throw if the namespaceUri or the nodeManager are null.</exception>

void RegisterNamespaceManager(string namespaceUri, IAsyncNodeManager nodeManager);

/// <summary>
Expand All @@ -248,7 +247,6 @@ ValueTask ModifyMonitoredItemsAsync(
/// Registers a set of node ids.
/// </summary>
/// <exception cref="ArgumentNullException"><paramref name="nodesToRegister"/> is <c>null</c>.</exception>

void RegisterNodes(OperationContext context, NodeIdCollection nodesToRegister, out NodeIdCollection registeredNodeIds);

/// <summary>
Expand Down
12 changes: 6 additions & 6 deletions Libraries/Opc.Ua.Server/NodeManager/MasterNodeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,15 @@ protected static PermissionType GetHistoryPermissionType(PerformUpdateType updat
}

/// <inheritdoc/>
public ICoreNodeManager CoreNodeManager => m_nodeManagers[1].SyncNodeManager as ICoreNodeManager;
public CoreNodeManager CoreNodeManager => m_nodeManagers[1].SyncNodeManager as CoreNodeManager;

/// <inheritdoc/>
public IDiagnosticsNodeManager DiagnosticsNodeManager
=> m_nodeManagers[0].SyncNodeManager as IDiagnosticsNodeManager;
public DiagnosticsNodeManager DiagnosticsNodeManager
=> m_nodeManagers[0].SyncNodeManager as DiagnosticsNodeManager;

/// <inheritdoc/>
public IConfigurationNodeManager ConfigurationNodeManager
=> m_nodeManagers[0].SyncNodeManager as IConfigurationNodeManager;
public ConfigurationNodeManager ConfigurationNodeManager
=> m_nodeManagers[0].SyncNodeManager as ConfigurationNodeManager;

/// <inheritdoc/>
public virtual async ValueTask StartupAsync(CancellationToken cancellationToken = default)
Expand Down Expand Up @@ -3468,7 +3468,7 @@ protected ServiceResult ValidateCallRequestItem(

// Initialize input arguments to empty collection if null.
// Methods with only output parameters (no input parameters) are valid.
callMethodRequest.InputArguments ??= new VariantCollection();
callMethodRequest.InputArguments ??= [];

return StatusCodes.Good;
}
Expand Down
10 changes: 5 additions & 5 deletions Libraries/Opc.Ua.Server/Server/IServerInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,25 @@ public interface IServerInternal : IAuditEventServer, IDisposable
/// The master node manager for the server.
/// </summary>
/// <value>The node manager.</value>
IMasterNodeManager NodeManager { get; }
MasterNodeManager NodeManager { get; }

/// <summary>
/// The internal node manager for the servers.
/// </summary>
/// <value>The core node manager.</value>
ICoreNodeManager CoreNodeManager { get; }
CoreNodeManager CoreNodeManager { get; }

/// <summary>
/// Returns the node manager that managers the server diagnostics.
/// </summary>
/// <value>The diagnostics node manager.</value>
IDiagnosticsNodeManager DiagnosticsNodeManager { get; }
DiagnosticsNodeManager DiagnosticsNodeManager { get; }

/// <summary>
/// Returns the node manager that managers the server configuration.
/// </summary>
/// <value>The configuration node manager.</value>
IConfigurationNodeManager ConfigurationNodeManager { get; }
ConfigurationNodeManager ConfigurationNodeManager { get; }

/// <summary>
/// The manager for events that all components use to queue events that occur.
Expand Down Expand Up @@ -298,7 +298,7 @@ void CreateServerObject(
/// Stores the MasterNodeManager and the CoreNodeManager
/// </summary>
/// <param name="nodeManager">The node manager.</param>
void SetNodeManager(IMasterNodeManager nodeManager);
void SetNodeManager(MasterNodeManager nodeManager);

/// <summary>
/// Stores the MainNodeManagerFactory
Expand Down
10 changes: 5 additions & 5 deletions Libraries/Opc.Ua.Server/Server/ServerInternalData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected virtual void Dispose(bool disposing)
/// Stores the MasterNodeManager, the DiagnosticsNodeManager and the CoreNodeManager
/// </summary>
/// <param name="nodeManager">The node manager.</param>
public void SetNodeManager(IMasterNodeManager nodeManager)
public void SetNodeManager(MasterNodeManager nodeManager)
{
NodeManager = nodeManager;
DiagnosticsNodeManager = nodeManager.DiagnosticsNodeManager;
Expand Down Expand Up @@ -285,7 +285,7 @@ public void SetModellingRulesManager(ModellingRulesManager modellingRulesManager
/// The master node manager for the server.
/// </summary>
/// <value>The node manager.</value>
public IMasterNodeManager NodeManager { get; private set; }
public MasterNodeManager NodeManager { get; private set; }

/// <inheritdoc/>
public IMainNodeManagerFactory MainNodeManagerFactory { get; private set; }
Expand All @@ -294,16 +294,16 @@ public void SetModellingRulesManager(ModellingRulesManager modellingRulesManager
/// The internal node manager for the servers.
/// </summary>
/// <value>The core node manager.</value>
public ICoreNodeManager CoreNodeManager { get; private set; }
public CoreNodeManager CoreNodeManager { get; private set; }

/// <summary>
/// Returns the node manager that managers the server diagnostics.
/// </summary>
/// <value>The diagnostics node manager.</value>
public IDiagnosticsNodeManager DiagnosticsNodeManager { get; private set; }
public DiagnosticsNodeManager DiagnosticsNodeManager { get; private set; }

/// <inheritdoc/>
public IConfigurationNodeManager ConfigurationNodeManager { get; private set; }
public ConfigurationNodeManager ConfigurationNodeManager { get; private set; }

/// <summary>
/// The manager for events that all components use to queue events that occur.
Expand Down
15 changes: 8 additions & 7 deletions Libraries/Opc.Ua.Server/Server/StandardServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2327,10 +2327,11 @@ public bool RegisterWithDiscoveryServer()
/// <inheritdoc/>
public async ValueTask<bool> RegisterWithDiscoveryServerAsync(CancellationToken ct = default)
{
var configuration = new ApplicationConfiguration(Configuration);

// use a dedicated certificate validator with the registration, but derive behavior from server config
configuration.CertificateValidator = new CertificateValidator(MessageContext.Telemetry);
var configuration = new ApplicationConfiguration(Configuration)
{
// use a dedicated certificate validator with the registration, but derive behavior from server config
CertificateValidator = new CertificateValidator(MessageContext.Telemetry)
};
await configuration
.CertificateValidator.UpdateAsync(
configuration.SecurityConfiguration,
Expand Down Expand Up @@ -2625,8 +2626,8 @@ protected virtual void OnApplicationCertificateError(
/// <summary>
/// Verifies that the request header is valid.
/// </summary>
/// <param name="requestHeader">The request header.</param>
/// <param name="secureChannelContext">The secure channel context.</param>
/// <param name="requestHeader">The request header.</param>
/// <param name="requestType">Type of the request.</param>
/// <exception cref="ServiceResultException"></exception>
protected virtual OperationContext ValidateRequest(
Expand Down Expand Up @@ -3044,7 +3045,7 @@ await base.StartApplicationAsync(configuration, cancellationToken)

// create the master node manager.
m_logger.LogInformation(Utils.TraceMasks.StartStop, "Server - CreateMasterNodeManager.");
IMasterNodeManager masterNodeManager = CreateMasterNodeManager(
MasterNodeManager masterNodeManager = CreateMasterNodeManager(
m_serverInternal,
configuration);

Expand Down Expand Up @@ -3626,7 +3627,7 @@ protected virtual ResourceManager CreateResourceManager(
/// <param name="server">The server.</param>
/// <param name="configuration">The configuration.</param>
/// <returns>Returns the master node manager for the server, the return type is <seealso cref="MasterNodeManager"/>.</returns>
protected virtual IMasterNodeManager CreateMasterNodeManager(
protected virtual MasterNodeManager CreateMasterNodeManager(
IServerInternal server,
ApplicationConfiguration configuration)
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Opc.Ua.Client.Tests/ReferenceServerWithLimits.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void SetMaxNumberOfContinuationPoints(uint maxNumberOfContinuationPoints)
}
}

protected override IMasterNodeManager CreateMasterNodeManager(
protected override MasterNodeManager CreateMasterNodeManager(
IServerInternal server,
ApplicationConfiguration configuration)
{
Expand Down
Loading