/// <summary> /// Initializes a new instance of the <see cref="MetadataViewerService" /> class. /// </summary> /// <param name="httpClient">The HTTP client.</param> /// <param name="configurationManager">The configuration manager.</param> /// <param name="libraryMonitor">The directory watchers.</param> /// <param name="logManager">The log manager.</param> /// <param name="fileSystem">The file system.</param> public MetadataViewerService(IServerConfigurationManager configurationManager, ILogManager logManager, IFileSystem fileSystem, IServerApplicationHost appHost) { _logger = logManager.GetLogger("ProviderManager"); _configurationManager = configurationManager; _fileSystem = fileSystem; var metadataServices = appHost.GetExports <IMetadataService>(); var metadataProviders = appHost.GetExports <IMetadataProvider>(); _metadataServices = metadataServices.OrderBy(i => i.Order).ToArray(); _metadataProviders = metadataProviders.ToArray(); _externalIds = appHost.GetExports <IExternalId>().ToArray(); }
/// <summary> /// Initializes a new instance of the <see cref="MetadataViewerService" /> class. /// </summary> /// <param name="httpClient">The HTTP client.</param> /// <param name="configurationManager">The configuration manager.</param> /// <param name="libraryMonitor">The directory watchers.</param> /// <param name="logManager">The log manager.</param> /// <param name="fileSystem">The file system.</param> public MetadataViewerService(IServerConfigurationManager configurationManager, ILogManager logManager, IFileSystem fileSystem, IServerApplicationHost appHost) { _logger = logManager.GetLogger("ProviderManager"); _configurationManager = configurationManager; _fileSystem = fileSystem; var metadataServices = appHost.GetExports<IMetadataService>(); var metadataProviders = appHost.GetExports<IMetadataProvider>(); _metadataServices = metadataServices.OrderBy(i => i.Order).ToArray(); _metadataProviders = metadataProviders.ToArray(); _externalIds = appHost.GetExports<IExternalId>().ToArray(); }
/// <summary> /// Adds the rest handlers. /// </summary> /// <param name="services">The services.</param> public void Init(IEnumerable <IService> services) { _restServices.AddRange(services); ServiceController = new ServiceController(); _logger.Info("Calling ServiceStack AppHost.Init"); var types = _restServices.Select(r => r.GetType()).ToArray(); ServiceController.Init(this, types); var list = new List <Action <IRequest, IResponse, object> >(); foreach (var filter in _appHost.GetExports <IRequestFilter>()) { list.Add(filter.Filter); } RequestFilters = list.ToArray(); ResponseFilters = new Action <IRequest, IResponse, object>[] { new ResponseFilter(_logger).FilterResponse }; }
public ActionResult <IEnumerable <ConfigurationPageInfo?> > GetConfigurationPages( [FromQuery] bool?enableInMainMenu, [FromQuery] ConfigurationPageType?pageType) { const string unavailableMessage = "The server is still loading. Please try again momentarily."; var pages = _appHost.GetExports <IPluginConfigurationPage>().ToList(); if (pages == null) { return(NotFound(unavailableMessage)); } // Don't allow a failing plugin to fail them all var configPages = pages.Select(p => { try { return(new ConfigurationPageInfo(p)); } catch (Exception ex) { _logger.LogError(ex, "Error getting plugin information from {Plugin}", p.GetType().Name); return(null); } }) .Where(i => i != null) .ToList(); configPages.AddRange(_appHost.Plugins.SelectMany(GetConfigPages)); if (pageType.HasValue) { configPages = configPages.Where(p => p !.ConfigurationPageType == pageType).ToList(); } if (enableInMainMenu.HasValue) { configPages = configPages.Where(p => p !.EnableInMainMenu == enableInMainMenu.Value).ToList(); } return(configPages); }
public override void Configure() { var requestFilters = _appHost.GetExports <IRequestFilter>().ToList(); foreach (var filter in requestFilters) { GlobalRequestFilters.Add(filter.Filter); } GlobalResponseFilters.Add(new ResponseFilter(_logger).FilterResponse); }
/// <summary> /// Adds the rest handlers. /// </summary> /// <param name="services">The services.</param> public void Init(IEnumerable <IService> services) { _restServices.AddRange(services); ServiceController = CreateServiceController(); _logger.Info("Calling ServiceStack AppHost.Init"); ServiceController.Init(this); var requestFilters = _appHost.GetExports <IRequestFilter>().ToList(); foreach (var filter in requestFilters) { RequestFilters.Add(filter.Filter); } ResponseFilters.Add(new ResponseFilter(_logger).FilterResponse); }