~drizzle-trunk/drizzle/development

1144.5.4 by Padraig O'Sullivan
Updated the licence to be BSD since I don't see why this would need to be GPL.
1
/* 
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
2
 * Copyright (C) 2009, Padraig O'Sullivan
1144.5.4 by Padraig O'Sullivan
Updated the licence to be BSD since I don't see why this would need to be GPL.
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are met:
7
 *
8
 *   * Redistributions of source code must retain the above copyright notice,
9
 *     this list of conditions and the following disclaimer.
10
 *   * Redistributions in binary form must reproduce the above copyright notice,
11
 *     this list of conditions and the following disclaimer in the documentation
12
 *     and/or other materials provided with the distribution.
1144.5.7 by Padraig O'Sullivan
Updated the BSD header to actually have my name instead of capttofu's!
13
 *   * Neither the name of Padraig O'Sullivan nor the names of its contributors
1144.5.4 by Padraig O'Sullivan
Updated the licence to be BSD since I don't see why this would need to be GPL.
14
 *     may be used to endorse or promote products derived from this software
15
 *     without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27
 * THE POSSIBILITY OF SUCH DAMAGE.
1144.5.1 by Padraig O'Sullivan
Created plugin which simply adds I_S tables for querying memcached stats.
28
 */
29
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
30
#include <config.h>
31
#include <drizzled/show.h>
32
#include <drizzled/gettext.h>
1660.8.1 by Vijay Samuel
Merge refactored commandline for memcached_stats using boost::program_options
33
#include <boost/program_options.hpp>
34
#include <drizzled/module/option_map.h>
1144.5.1 by Padraig O'Sullivan
Created plugin which simply adds I_S tables for querying memcached stats.
35
#include "stats_table.h"
1144.5.2 by Padraig O'Sullivan
Added another I_S table for memcached. This time added an I_S table for
36
#include "analysis_table.h"
1144.5.3 by Padraig O'Sullivan
Added support for system variables to set the memcached servers whose
37
#include "sysvar_holder.h"
1144.5.1 by Padraig O'Sullivan
Created plugin which simply adds I_S tables for querying memcached stats.
38
39
#include <string>
40
#include <map>
41
1660.8.1 by Vijay Samuel
Merge refactored commandline for memcached_stats using boost::program_options
42
namespace po=boost::program_options;
1964.2.8 by Monty Taylor
Updated memcached_stats plugin.
43
44
namespace drizzle_plugin
45
{
46
1144.5.1 by Padraig O'Sullivan
Created plugin which simply adds I_S tables for querying memcached stats.
47
48
/*
1300.2.2 by Joe Daly
port memcached stats plugin to use data_dictionary
49
 * DATA_DICTIONARY tables.
50
 */
51
static AnalysisTableTool *analysis_table_tool; 
52
53
static StatsTableTool *stats_table_tool;
1144.5.1 by Padraig O'Sullivan
Created plugin which simply adds I_S tables for querying memcached stats.
54
55
/*
56
 * System variable related variables.
57
 */
1964.2.8 by Monty Taylor
Updated memcached_stats plugin.
58
static std::string sysvar_memcached_servers;
1144.5.1 by Padraig O'Sullivan
Created plugin which simply adds I_S tables for querying memcached stats.
59
60
/**
61
 * Initialize the memcached stats plugin.
62
 *
63
 * @param[in] registry the drizzled::plugin::Registry singleton
64
 * @return false on success; true on failure.
65
 */
1964.2.8 by Monty Taylor
Updated memcached_stats plugin.
66
static int init(drizzled::module::Context &context)
1144.5.1 by Padraig O'Sullivan
Created plugin which simply adds I_S tables for querying memcached stats.
67
{
1964.2.8 by Monty Taylor
Updated memcached_stats plugin.
68
  const drizzled::module::option_map &vm= context.getOptions();
1144.5.3 by Padraig O'Sullivan
Added support for system variables to set the memcached servers whose
69
1144.5.1 by Padraig O'Sullivan
Created plugin which simply adds I_S tables for querying memcached stats.
70
  /* we are good to go */
1964.2.8 by Monty Taylor
Updated memcached_stats plugin.
71
  stats_table_tool= new StatsTableTool; 
1324.2.2 by Monty Taylor
Use the plugin::Context everywhere.
72
  context.add(stats_table_tool);
1300.2.2 by Joe Daly
port memcached stats plugin to use data_dictionary
73
1964.2.8 by Monty Taylor
Updated memcached_stats plugin.
74
  analysis_table_tool= new AnalysisTableTool;
1324.2.2 by Monty Taylor
Use the plugin::Context everywhere.
75
  context.add(analysis_table_tool);
1144.5.1 by Padraig O'Sullivan
Created plugin which simply adds I_S tables for querying memcached stats.
76
1964.2.8 by Monty Taylor
Updated memcached_stats plugin.
77
  context.registerVariable(new sys_var_std_string("servers",
78
                                                  sysvar_memcached_servers));
79
                          
1144.5.8 by Padraig O'Sullivan
Updating the init and deinit method to return the correct type (int instead
80
  return 0;
1144.5.1 by Padraig O'Sullivan
Created plugin which simply adds I_S tables for querying memcached stats.
81
}
82
1660.8.1 by Vijay Samuel
Merge refactored commandline for memcached_stats using boost::program_options
83
static void init_options(drizzled::module::option_context &context)
84
{
85
  context("servers",
1964.2.8 by Monty Taylor
Updated memcached_stats plugin.
86
          po::value<std::string>()->default_value(""),
2068.4.1 by Andrew Hutchings
Fix intl domain
87
          _("List of memcached servers."));
1660.8.1 by Vijay Samuel
Merge refactored commandline for memcached_stats using boost::program_options
88
}
89
1964.2.8 by Monty Taylor
Updated memcached_stats plugin.
90
} /* namespace drizzle_plugin */
1144.5.1 by Padraig O'Sullivan
Created plugin which simply adds I_S tables for querying memcached stats.
91
1228.1.5 by Monty Taylor
Merged in some naming things.
92
DRIZZLE_DECLARE_PLUGIN
1144.5.1 by Padraig O'Sullivan
Created plugin which simply adds I_S tables for querying memcached stats.
93
{
1241.10.2 by Monty Taylor
Added support for embedding the drizzle version number in the plugin file.
94
  DRIZZLE_VERSION_ID,
1144.5.1 by Padraig O'Sullivan
Created plugin which simply adds I_S tables for querying memcached stats.
95
  "memcached_stats",
1144.5.4 by Padraig O'Sullivan
Updated the licence to be BSD since I don't see why this would need to be GPL.
96
  "1.0",
1144.5.1 by Padraig O'Sullivan
Created plugin which simply adds I_S tables for querying memcached stats.
97
  "Padraig O'Sullivan",
98
  N_("Memcached Stats as I_S tables"),
1144.5.4 by Padraig O'Sullivan
Updated the licence to be BSD since I don't see why this would need to be GPL.
99
  PLUGIN_LICENSE_BSD,
1964.2.8 by Monty Taylor
Updated memcached_stats plugin.
100
  drizzle_plugin::init,   /* Plugin Init      */
2095.3.1 by Monty Taylor
Re-purpose the old plugin sysvar slot in the struct to be a depends list.
101
  NULL, /* depends */
1964.2.8 by Monty Taylor
Updated memcached_stats plugin.
102
  drizzle_plugin::init_options    /* config options   */
1144.5.1 by Padraig O'Sullivan
Created plugin which simply adds I_S tables for querying memcached stats.
103
}
1228.1.5 by Monty Taylor
Merged in some naming things.
104
DRIZZLE_DECLARE_PLUGIN_END;