namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions; /// /// Abstraction over the process-wide driver registry. Runtime consumes this instead of /// DriverFactoryRegistry directly so the Runtime project doesn't pull in /// ZB.MOM.WW.OtOpcUa.Core (which would drag in Polly + driver hosting). The fused /// Host binds a DriverFactoryRegistryAdapter after every Driver.*.Register() /// extension has run. /// public interface IDriverFactory { /// /// Return a new for the given , or /// null when no factory is registered for that type (missing assembly, typo, etc.). /// The DriverHostActor logs + skips the row rather than failing the whole apply. /// /// The driver type name (e.g., "Modbus", "FOCAS"). /// The driver instance identifier. /// The driver configuration as a JSON string. /// A new IDriver instance, or null if the driver type is not supported. IDriver? TryCreate(string driverType, string driverInstanceId, string driverConfigJson); /// Driver-type names this factory can materialise. Mostly for diagnostics + logs. IReadOnlyCollection SupportedTypes { get; } } /// /// Returns null from every call. Bound when the /// fused Host hasn't registered any concrete driver assemblies yet (Mac dev path, smoke /// tests). DriverHostActor sees zero supported types and treats the deployment as a no-op. /// public sealed class NullDriverFactory : IDriverFactory { public static readonly NullDriverFactory Instance = new(); private NullDriverFactory() { } /// Creates a driver (always returns null in this null implementation). /// The driver type name. /// The driver instance identifier. /// The driver configuration as a JSON string. /// Always returns null. public IDriver? TryCreate(string driverType, string driverInstanceId, string driverConfigJson) => null; /// Gets the collection of supported driver types (empty in this null implementation). public IReadOnlyCollection SupportedTypes { get; } = Array.Empty(); }