~drizzle-trunk/drizzle/development

1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2009 Sun Microsystems, Inc.
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
5
 *
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.
9
 *
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.
14
 *
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
18
 */
19
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
20
21
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
22
#pragma once
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
23
1130.2.6 by Monty Taylor
Merged in latest plugin-slot-reorg.
24
#include <string>
25
#include <vector>
1966.2.6 by Brian Aker
This is from the catalog patch (I'm pushing it up as its own little thing
26
#include <map>
1130.2.6 by Monty Taylor
Merged in latest plugin-slot-reorg.
27
2173.2.1 by Monty Taylor
Fixes incorrect usage of include
28
#include <drizzled/visibility.h>
2119.4.1 by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by
29
2252.1.22 by Olaf van der Spek
Common fwd
30
namespace drizzled {
31
namespace plugin {
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
32
2318.2.42 by Olaf van der Spek
Refactor
33
class DRIZZLED_API Plugin : boost::noncopyable
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
34
{
35
private:
1964.2.9 by Monty Taylor
All protocol stuff except for the buffer_length. WTF?
36
  const std::string _name;
37
  bool _is_active;
38
  module::Module *_module;
39
  const std::string _type_name;
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
40
41
public:
2068.2.1 by Monty Taylor
Changed the plugin_registry to store a pair of plugin_type/plugin_name
42
  typedef std::pair<const std::string, const std::string> map_key;
43
  typedef std::map<const map_key, plugin::Plugin *> map;
1966.2.6 by Brian Aker
This is from the catalog patch (I'm pushing it up as its own little thing
44
  typedef std::vector<Plugin *> vector;
1130.2.24 by Monty Taylor
Additional changes to command_log to work with how jay was using active/enable.
45
1964.2.9 by Monty Taylor
All protocol stuff except for the buffer_length. WTF?
46
  explicit Plugin(const std::string &name, const std::string &type_name);
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
47
  virtual ~Plugin() {}
48
1784.4.1 by Paul McCullagh
Fixed PBXT recovery and shutdown, added shutdownPlugin() call to all plugins before the plugins are deleted
49
  /*
50
   * This method is called for all plug-ins on shutdown,
51
   * _before_ the plug-ins are deleted. It can be used
52
   * when shutdown code references other plug-ins.
53
   */
54
  virtual void shutdownPlugin()
55
  {
56
  }
1966.2.6 by Brian Aker
This is from the catalog patch (I'm pushing it up as its own little thing
57
58
  // This is run after all plugins have been initialized.
59
  virtual void prime()
60
  {
61
  }
2079.4.1 by Brian Aker
Merge in code to all plugins to do whatever they need to do once all other
62
63
  virtual void startup(drizzled::Session &)
64
  {
65
  }
1784.4.1 by Paul McCullagh
Fixed PBXT recovery and shutdown, added shutdownPlugin() call to all plugins before the plugins are deleted
66
 
1130.2.29 by Monty Taylor
Removed runtime active flag from plugin::Plugin. Put a runtime enabled flag on CommandApplier and CommandReplicator - we can refactor this down into plugin::Plugin later if we need to.
67
  void activate()
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
68
  {
1964.2.9 by Monty Taylor
All protocol stuff except for the buffer_length. WTF?
69
    _is_active= true;
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
70
  }
71
 
1130.2.29 by Monty Taylor
Removed runtime active flag from plugin::Plugin. Put a runtime enabled flag on CommandApplier and CommandReplicator - we can refactor this down into plugin::Plugin later if we need to.
72
  void deactivate()
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
73
  {
1964.2.9 by Monty Taylor
All protocol stuff except for the buffer_length. WTF?
74
    _is_active= false;
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
75
  }
76
 
1130.2.29 by Monty Taylor
Removed runtime active flag from plugin::Plugin. Put a runtime enabled flag on CommandApplier and CommandReplicator - we can refactor this down into plugin::Plugin later if we need to.
77
  bool isActive() const
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
78
  {
1964.2.9 by Monty Taylor
All protocol stuff except for the buffer_length. WTF?
79
    return _is_active;
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
80
  }
81
82
  const std::string &getName() const
83
  {
1964.2.9 by Monty Taylor
All protocol stuff except for the buffer_length. WTF?
84
    return _name;
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
85
  } 
86
1964.2.9 by Monty Taylor
All protocol stuff except for the buffer_length. WTF?
87
  void setModule(module::Module *module)
1130.2.2 by Monty Taylor
Added support for the global list of plugin::Plugin objects to slot::Function
88
  {
1964.2.9 by Monty Taylor
All protocol stuff except for the buffer_length. WTF?
89
    _module= module;
1130.2.2 by Monty Taylor
Added support for the global list of plugin::Plugin objects to slot::Function
90
  }
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
91
1192.2.5 by Monty Taylor
Replaced overridable virtual methods with passing name to constructor. Now individual plugins will not be allowed to set their own plugin type name. :)
92
  const std::string& getTypeName() const
1192.2.1 by Monty Taylor
Added the MODULES table.
93
  {
1964.2.9 by Monty Taylor
All protocol stuff except for the buffer_length. WTF?
94
    return _type_name;
1192.2.1 by Monty Taylor
Added the MODULES table.
95
  }
96
2139.3.11 by Brian Aker
Error log messages from Inno, most, not all are sent to the correct error
97
  virtual bool removeLast() const
98
  {
99
    return false;
100
  }
101
1192.2.1 by Monty Taylor
Added the MODULES table.
102
  const std::string& getModuleName() const;
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
103
};
104
} /* end namespace plugin */
105
} /* end namespace drizzled */
106