Example #1
0
        private bool ParseIncludeGatewayHealthCheck(IPluginRequest request)
        {
            bool includeGatewayHealthChecksValue = false;

            if (request.ContainsRequestArgument(IncludeGatewayHealthChecksPluginArgumentKey))
            {
                try
                {
                    includeGatewayHealthChecksValue = PluginArgumentHelper.GetAsBoolean(IncludeGatewayHealthChecksPluginArgumentKey, request);
                }
                catch (FormatException)
                {
                    Log.WarnFormat("Invalid value was specified for plugin argument key '{0}': valid values are either 'true' or 'false'.  Proceeding with default value of '{1}'..", IncludeGatewayHealthChecksPluginArgumentKey, includeGatewayHealthChecksValue);
                }
            }

            // Log results.
            if (includeGatewayHealthChecksValue)
            {
                Log.Info("Including gateway health check requests due to user request.");
            }
            else
            {
                Log.InfoFormat("Excluding gateway health check requests from plugin output.  Use the plugin argument '{0}:true' if you wish to include them.", IncludeGatewayHealthChecksPluginArgumentKey);
            }

            return(includeGatewayHealthChecksValue);
        }
Example #2
0
        protected void HandlePluginRequestArguments(IPluginRequest pluginRequest)
        {
            if (pluginRequest.ContainsRequestArgument(IncludeGatewayHealthChecksPluginArgumentKey))
            {
                try
                {
                    includeGatewayHealthCheckRequests = PluginArgumentHelper.GetAsBoolean(IncludeGatewayHealthChecksPluginArgumentKey, pluginRequest);
                }
                catch (FormatException)
                {
                    Log.WarnFormat("Invalid value was specified for plugin argument key '{0}': valid values are either 'true' or 'false'.  Proceeding with default value of '{1}'..",
                                   IncludeGatewayHealthChecksPluginArgumentKey, includeGatewayHealthCheckRequests.ToString().ToLowerInvariant());
                }
            }

            // Log results.
            if (includeGatewayHealthCheckRequests)
            {
                Log.Info("Including gateway health check requests due to user request.");
            }
            else
            {
                Log.InfoFormat("Excluding gateway health check requests from plugin output.  Use the plugin argument '{0}:true' if you wish to include them.", IncludeGatewayHealthChecksPluginArgumentKey);
            }
        }
Example #3
0
        /// <summary>
        /// Calculates the output database name for the given plugin.  If no plugin-specific database is requested, defer to the global name.
        /// </summary>
        protected string GetOutputDatabaseName(string pluginName, IPluginRequest pluginRequest, PluginExecutionRequest pluginExecutionRequest)
        {
            string pluginDatabaseNameRequestArgumentKey = String.Format("{0}.DatabaseName", pluginName);

            if (pluginRequest.ContainsRequestArgument(pluginDatabaseNameRequestArgumentKey))
            {
                string requestedPluginDatabaseName = pluginRequest.GetRequestArgument(pluginDatabaseNameRequestArgumentKey).ToString();
                if (!String.IsNullOrWhiteSpace(requestedPluginDatabaseName))
                {
                    Log.InfoFormat("Redirecting output from the {0} plugin to user-requested database '{1}'.", pluginName, requestedPluginDatabaseName);
                    return(requestedPluginDatabaseName);
                }
            }

            return(pluginExecutionRequest.PostgresDatabaseName);
        }
Example #4
0
        public static int GetMaxQueryLength(IPluginRequest pluginRequest, string maxQueryLengthArgumentKey, int defaultIfNotFound)
        {
            if (pluginRequest.ContainsRequestArgument(maxQueryLengthArgumentKey))
            {
                try
                {
                    return(PluginArgumentHelper.GetAsInt(maxQueryLengthArgumentKey, pluginRequest));
                }
                catch (FormatException)
                {
                    return(defaultIfNotFound);
                }
            }

            return(defaultIfNotFound);
        }