/// <summary>
        /// Creates the specified action.
        /// </summary>
        /// <param name="observerSettings">The settings associated with the action observer.</param>
        /// <returns>Returns an instance of the SyncAction which is an instance of IAction.</returns>
        /// <exception cref="System.ArgumentNullException">actionSettings</exception>
        /// <exception cref="System.InvalidOperationException">
        /// </exception>
        /// <exception cref="ArgumentNullException">actionSettings
        /// or
        /// settings
        /// or
        /// serviceProvider</exception>
        /// <exception cref="InvalidOperationException"></exception>
        /// <exception cref="NotImplementedException"></exception>
        public override IActionObserver Create(Settings.Observer observerSettings)
        {
            if (observerSettings == null)
            {
                throw new ArgumentNullException(nameof(observerSettings));
            }
            var action = ActivatorUtilities.CreateInstance <WebPostActionObserver>(
                ServiceProvider,
                observerSettings.CloneAndMergeSettings(ApplicationSettings.SettingsGroups.Find(observerSettings.SettingsGroup)));

            return(action);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WebPostActionObserver"/> class.
        /// </summary>
        /// <param name="observerSettings">The observer settings.</param>
        /// <param name="loggingFactory">The logging factory.</param>
        /// <exception cref="System.ArgumentNullException">
        /// loggingFactory
        /// or
        /// observerSettings
        /// </exception>
        /// <exception cref="System.InvalidOperationException">A URL to the room must be provided for the WebPostActionObserver.</exception>
        public WebPostActionObserver(Settings.Observer observerSettings, ILoggerFactory loggingFactory)
        {
            if (loggingFactory == null)
            {
                throw new ArgumentNullException(nameof(loggingFactory));
            }
            Logger           = loggingFactory.CreateLogger <WebPostActionObserver>();
            ObserverSettings = observerSettings ?? throw new ArgumentNullException(nameof(observerSettings));

            if (string.IsNullOrEmpty(ObserverSettings.Settings.Url()))
            {
                throw new InvalidOperationException("A URL to the room must be provided for the WebPostActionObserver.");
            }
        }