public PluginCredentialProviderBuilder( IExtensionLocator extensionLocator, Configuration.ISettings settings, Common.ILogger logger) : this(extensionLocator, settings, logger, new EnvironmentVariableWrapper()) { }
public PluginCredentialProviderBuilder( IExtensionLocator extensionLocator, Configuration.ISettings settings, Common.ILogger logger, Common.IEnvironmentVariableReader envarReader) { if (extensionLocator == null) { throw new ArgumentNullException(nameof(extensionLocator)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (envarReader == null) { throw new ArgumentNullException(nameof(envarReader)); } _extensionLocator = extensionLocator; _settings = settings; _logger = logger; _envarReader = envarReader; }
public SchemaReader([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider) { this.serviceProvider = serviceProvider; var componentModel = this.serviceProvider.GetService<SComponentModel, IComponentModel>(); this.serializerLocator = new StandardSerializerLocator(componentModel.DefaultExportProvider); this.extensionLocator = new StandardExtensionLocator(componentModel.DefaultExportProvider); }
public SchemaReader([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider) { this.serviceProvider = serviceProvider; var componentModel = this.serviceProvider.GetService <SComponentModel, IComponentModel>(); this.serializerLocator = new StandardSerializerLocator(componentModel.DefaultExportProvider); this.extensionLocator = new StandardExtensionLocator(componentModel.DefaultExportProvider); }
public ExtensionManager( IExtensionLocator extensionLocator, IEnumerable<IExtensionLoader> loaders, ILoggerFactory loggerFactory) { _extensionLocator = extensionLocator; _loaders = loaders.OrderBy(x => x.Order).ToArray(); _logger = loggerFactory.CreateLogger<ExtensionManager>(); T = NullLocalizer.Instance; }
public ExtensionManager( IExtensionLocator extensionLocator, IEnumerable <IExtensionLoader> loaders, ILogger <ExtensionManager> logger) { _extensionLocator = extensionLocator; _loaders = loaders.OrderBy(x => x.Order).ToArray(); _logger = logger; T = NullLocalizer.Instance; }
public NuGetExtensionDownloader( IOptions <ExtensionOptions> options, IExtensionLocator extensionLocator, Lazy <IPackageDownloader> packageDownloader, ILogger <NuGetExtensionDownloader> logger) { _options = options ?? throw new ArgumentNullException(nameof(options)); _extensionLocator = extensionLocator ?? throw new ArgumentNullException(nameof(extensionLocator)); _packageDownloader = packageDownloader ?? throw new ArgumentNullException(nameof(packageDownloader)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public ExtensionManager( IExtensionLocator extensionLocator, IEnumerable<IExtensionLoader> loaders, ITypeFeatureProvider typeFeatureProvider, ILogger<ExtensionManager> logger) { _typeFeatureProvider = typeFeatureProvider; _extensionLocator = extensionLocator; _loaders = loaders.OrderBy(x => x.Order).ToArray(); _logger = logger; T = NullLocalizer.Instance; }
public ExtensionProvider( IEnumerable <IExtensionLoader> loaders, IUpgradeAssistantConfigurationLoader configurationLoader, ExtensionInstanceFactory factory, IExtensionLocator extensionLocator, IOptions <ExtensionOptions> options, ILogger <ExtensionProvider> logger) { if (extensionLocator is null) { throw new ArgumentNullException(nameof(extensionLocator)); } if (options is null) { throw new ArgumentNullException(nameof(options)); } _factory = factory ?? throw new ArgumentNullException(nameof(factory)); _loaders = loaders ?? throw new ArgumentNullException(nameof(loaders)); _configurationLoader = configurationLoader ?? throw new ArgumentNullException(nameof(configurationLoader)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _extensions = new Lazy <IEnumerable <ExtensionInstance> >(() => { var list = new List <ExtensionInstance>(); var opts = options.Value; // Required extensions are required for all commands UA may handle, as opposed to other extensions that augment certain commands foreach (var path in opts.RequiredExtensions) { LoadPath(path, isDefault: true); } // Required extensions must load, otherwise they may be turned off if (!opts.LoadExtensions) { return(list); } foreach (var path in opts.DefaultExtensions) { LoadPath(path, isDefault: true); } foreach (var path in opts.ExtensionPaths) { LoadPath(path, isDefault: false); } foreach (var path in Registered.Select(extensionLocator.GetInstallPath)) { LoadPath(path, isDefault: false); } logger.LogInformation("Loaded {Count} extensions", list.Count); if (opts.AdditionalOptions.Any()) { list.Add(LoadOptionsExtension(opts.AdditionalOptions)); } list.AddRange(opts.Extensions); return(list); void LoadPath(string path, bool isDefault) { if (OpenExtension(path) is ExtensionInstance extension) { if (isDefault) { extension = extension with { Version = opts.CurrentVersion }; } if (opts.CheckMinimumVersion && extension.MinUpgradeAssistantVersion is Version minVersion && minVersion > opts.CurrentVersion) { logger.LogWarning("Could not load extension from {Path}. Requires at least v{Version} of Upgrade Assistant and current version is {UpgradeAssistantVersion}.", path, minVersion, opts.CurrentVersion); } else { list.Add(extension); } } else { logger.LogWarning("Could not load extension from {Path}", path); } } }); }