Пример #1
0
        /// <summary>
        /// Extension method for adding the Server watcher to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="name">Name of the ServerWatcher.</param>
        /// <param name="configuration">Configuration of ServerWatcher.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <param name="interval">Optional interval (5 seconds by default) after which the next check will be invoked.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddServerWatcher(
            this WardenConfiguration.Builder builder,
            string name,
            ServerWatcherConfiguration configuration,
            Action <WatcherHooksConfiguration.Builder> hooks = null,
            TimeSpan?interval = null)
        {
            builder.AddWatcher(ServerWatcher.Create(name, configuration), hooks, interval);

            return(builder);
        }
Пример #2
0
        protected ServerWatcher(string name, ServerWatcherConfiguration configuration)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Watcher name can not be empty.");
            }

            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration),
                                                "Server watcher configuration has not been provided.");
            }

            Name           = name;
            _configuration = configuration;
        }
Пример #3
0
 /// <summary>
 /// Factory method for creating a new instance of ServerWatcher with default name of Server watcher.
 /// </summary>
 /// <param name="configuration">Configuration of ServerWatcher.</param>
 /// <returns>A ServerWatcher instance.</returns>
 public static ServerWatcher Create(ServerWatcherConfiguration configuration)
 => new ServerWatcher(DefaultName, configuration);
Пример #4
0
 /// <summary>
 /// Factory method for creating a new instance of ServerWatcher.
 /// </summary>
 /// <param name="name">Name of the ServerWatcher.</param>
 /// <param name="configuration">Configuration of ServerWatcher.</param>
 /// <returns>A ServerWatcher instance.</returns>
 public static ServerWatcher Create(string name, ServerWatcherConfiguration configuration)
 => new ServerWatcher(name, configuration);
Пример #5
0
 /// <summary>
 /// Factory method for creating a new instance of ServerWatcher.
 /// </summary>
 /// <param name="name">Name of the ServerWatcher.</param>
 /// <param name="configuration">Configuration of ServerWatcher.</param>
 /// <param name="group">Optional name of the group that ServerWatcher belongs to.</param>
 /// <returns>A ServerWatcher instance.</returns>
 public static ServerWatcher Create(string name, ServerWatcherConfiguration configuration,
                                    string group = null)
 => new ServerWatcher(name, configuration, group);
Пример #6
0
 /// <summary>
 /// Factory method for creating a new instance of ServerWatcher with default name of Server watcher.
 /// </summary>
 /// <param name="configuration">Configuration of ServerWatcher.</param>
 /// <param name="group">Optional name of the group that ServerWatcher belongs to.</param>
 /// <returns>A ServerWatcher instance.</returns>
 public static ServerWatcher Create(ServerWatcherConfiguration configuration,
                                    string group = null)
 => Create(DefaultName, configuration, group);
Пример #7
0
 protected Configurator(string hostname, int port = 0)
 {
     ValidateHostnameAndPort(hostname, port);
     Configuration = new ServerWatcherConfiguration(hostname, port);
 }
Пример #8
0
 public Default(ServerWatcherConfiguration configuration) : base(configuration)
 {
     SetInstance(this);
 }
Пример #9
0
 protected Configurator(ServerWatcherConfiguration configuration) : base(configuration)
 {
 }