~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/registry.h

Merge Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#ifndef DRIZZLED_PLUGIN_REGISTRY_H
21
21
#define DRIZZLED_PLUGIN_REGISTRY_H
22
22
 
23
 
#include "drizzled/slot/function.h"
24
 
#include "drizzled/slot/listen.h"
25
 
 
26
23
#include <string>
27
24
#include <vector>
28
25
#include <map>
29
26
 
30
 
class StorageEngine;
31
 
class InfoSchemaTable;
32
 
class Logging_handler;
33
 
class Error_message_handler;
34
 
class Authentication;
35
 
class QueryCache;
 
27
#include "drizzled/gettext.h"
 
28
#include "drizzled/unireg.h"
36
29
 
37
30
namespace drizzled
38
31
{
39
32
namespace plugin
40
33
{
41
 
class CommandReplicator;
42
 
class CommandApplier;
43
34
class Handle;
44
 
class SchedulerFactory;
45
35
 
46
36
class Registry
47
37
{
63
53
 
64
54
  void add(Handle *plugin);
65
55
 
66
 
  std::vector<Handle *> get_list(bool active);
67
 
 
68
 
  void add(StorageEngine *engine);
69
 
  void add(InfoSchemaTable *schema_table);
70
 
  void add(Logging_handler *handler);
71
 
  void add(Error_message_handler *handler);
72
 
  void add(Authentication *auth);
73
 
  void add(QueryCache *qcache);
74
 
  void add(SchedulerFactory *scheduler);
75
 
  void add(drizzled::plugin::CommandReplicator *replicator);
76
 
  void add(drizzled::plugin::CommandApplier *applier);
77
 
 
78
 
  void remove(StorageEngine *engine);
79
 
  void remove(InfoSchemaTable *schema_table);
80
 
  void remove(Logging_handler *handler);
81
 
  void remove(Error_message_handler *handler);
82
 
  void remove(Authentication *auth);
83
 
  void remove(QueryCache *qcache);
84
 
  void remove(SchedulerFactory *scheduler);
85
 
  void remove(drizzled::plugin::CommandReplicator *replicator);
86
 
  void remove(drizzled::plugin::CommandApplier *applier);
87
 
 
88
 
  ::drizzled::slot::Function function;
89
 
  ::drizzled::slot::Listen listen;
 
56
  std::vector<Handle *> getList(bool active);
 
57
 
 
58
  template<class T>
 
59
  void add(T *plugin)
 
60
  {
 
61
    bool failed= T::addPlugin(plugin);
 
62
    if (failed)
 
63
    {
 
64
      /* Can't use errmsg_printf here because we might be initializing the
 
65
       * error_message plugin.
 
66
       */
 
67
      /**
 
68
       * @TODO
 
69
       * Once plugin-base-class is merged, we'll add in this statment
 
70
       * fprintf(stderr,
 
71
       *       _("Fatal error: Failed initializing %s plugin."),
 
72
       *       plugin->getName().c_str());
 
73
       */
 
74
      unireg_abort(1);
 
75
    }
 
76
  }
 
77
 
 
78
  template<class T>
 
79
  void remove(T *plugin)
 
80
  {
 
81
    T::removePlugin(plugin);
 
82
  }
 
83
 
90
84
};
91
85
 
92
86
} /* end namespace plugin */