1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#include "drizzled/server_includes.h"
21
#include "drizzled/plugin_registry.h"
23
#include "drizzled/plugin.h"
24
#include "drizzled/show.h"
25
#include "drizzled/handler.h"
26
#include "drizzled/errmsg.h"
27
#include "drizzled/authentication.h"
28
#include "drizzled/qcache.h"
29
#include "drizzled/scheduling.h"
30
#include "drizzled/logging.h"
31
#include "drizzled/sql_udf.h"
32
#include "drizzled/listen.h"
33
#include "drizzled/transaction_services.h"
41
static PluginRegistry the_registry;
43
PluginRegistry& PluginRegistry::getPluginRegistry()
48
st_plugin_int *PluginRegistry::find(const LEX_STRING *name)
50
string find_str(name->str,name->length);
51
transform(find_str.begin(), find_str.end(), find_str.begin(), ::tolower);
53
map<string, st_plugin_int *>::iterator map_iter;
54
map_iter= plugin_map.find(find_str);
55
if (map_iter != plugin_map.end())
56
return (*map_iter).second;
60
void PluginRegistry::add(st_plugin_int *plugin)
62
string add_str(plugin->name.str);
63
transform(add_str.begin(), add_str.end(),
64
add_str.begin(), ::tolower);
66
plugin_map[add_str]= plugin;
70
vector<st_plugin_int *> PluginRegistry::get_list(bool active)
72
st_plugin_int *plugin= NULL;
74
vector <st_plugin_int *> plugins;
75
plugins.reserve(plugin_map.size());
77
map<string, st_plugin_int *>::iterator map_iter;
78
for (map_iter= plugin_map.begin();
79
map_iter != plugin_map.end();
82
plugin= (*map_iter).second;
84
plugins.push_back(plugin);
85
else if (plugin->isInited)
86
plugins.push_back(plugin);
92
void PluginRegistry::add(StorageEngine *engine)
94
add_storage_engine(engine);
97
void PluginRegistry::add(InfoSchemaTable *schema_table)
99
add_infoschema_table(schema_table);
102
void PluginRegistry::add(Function_builder *udf)
107
void PluginRegistry::add(Logging_handler *handler)
112
void PluginRegistry::add(Error_message_handler *handler)
114
add_errmsg_handler(handler);
117
void PluginRegistry::add(Authentication *auth)
119
add_authentication(auth);
122
void PluginRegistry::add(QueryCache *qcache)
124
add_query_cache(qcache);
127
void PluginRegistry::add(SchedulerFactory *factory)
129
add_scheduler_factory(factory);
132
void PluginRegistry::add(const Listen &listen_obj)
134
add_listen(listen_obj);
137
void PluginRegistry::add(drizzled::plugin::Replicator *repl)
139
add_replicator(repl);
142
void PluginRegistry::remove(StorageEngine *engine)
144
remove_storage_engine(engine);
147
void PluginRegistry::remove(InfoSchemaTable *schema_table)
149
remove_infoschema_table(schema_table);
152
void PluginRegistry::remove(Function_builder *udf)
157
void PluginRegistry::remove(Logging_handler *handler)
159
remove_logger(handler);
162
void PluginRegistry::remove(Error_message_handler *handler)
164
remove_errmsg_handler(handler);
167
void PluginRegistry::remove(Authentication *auth)
169
remove_authentication(auth);
172
void PluginRegistry::remove(QueryCache *qcache)
174
remove_query_cache(qcache);
177
void PluginRegistry::remove(SchedulerFactory *factory)
179
remove_scheduler_factory(factory);
182
void PluginRegistry::remove(const Listen &listen_obj)
184
remove_listen(listen_obj);
187
void PluginRegistry::remove(drizzled::plugin::Replicator *repl)
189
remove_replicator(repl);