~drizzle-trunk/drizzle/development

1273.13.1 by Brian Aker
First pass through data dictionary.
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2009 Sun Microsystems
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; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
20
1273.14.5 by Monty Taylor
Merged trunk.
21
#include "config.h"
22
1273.13.50 by Brian Aker
Additional plugins.
23
#include "plugin/registry_dictionary/dictionary.h"
24
#include "drizzled/plugin/library.h"
1273.13.1 by Brian Aker
First pass through data dictionary.
25
26
using namespace std;
27
using namespace drizzled;
28
1273.13.45 by Brian Aker
Update for test split.
29
static const string GPL("GPL");
30
static const string LGPL("LGPL");
31
static const string BSD("BSD");
32
static const string PROPRIETARY("PROPRIETARY");
33
1273.13.7 by Brian Aker
Updates to the classes (first pass).
34
ModulesTool::ModulesTool() :
1273.13.32 by Brian Aker
Big ole patch. This covers moving information_schema to old_* table names
35
  plugin::TableFunction("DATA_DICTIONARY", "MODULES")
1273.13.1 by Brian Aker
First pass through data dictionary.
36
{
1273.13.20 by Brian Aker
Updating other modules to use new interface.
37
  add_field("MODULE_NAME");
38
  add_field("MODULE_VERSION", 20);
39
  add_field("MODULE_AUTHOR");
1273.13.32 by Brian Aker
Big ole patch. This covers moving information_schema to old_* table names
40
  add_field("IS_BUILTIN", plugin::TableFunction::BOOLEAN);
1273.13.20 by Brian Aker
Updating other modules to use new interface.
41
  add_field("MODULE_LIBRARY", 254);
42
  add_field("MODULE_DESCRIPTION", 254);
43
  add_field("MODULE_LICENSE", 80);
1273.13.1 by Brian Aker
First pass through data dictionary.
44
}
45
1273.13.18 by Brian Aker
Update code, first pass through cleaner method for recursing through
46
ModulesTool::Generator::Generator(Field **arg) :
1273.13.32 by Brian Aker
Big ole patch. This covers moving information_schema to old_* table names
47
  plugin::TableFunction::Generator(arg)
1273.13.1 by Brian Aker
First pass through data dictionary.
48
{
1273.13.32 by Brian Aker
Big ole patch. This covers moving information_schema to old_* table names
49
  plugin::Registry &registry= plugin::Registry::singleton();
1273.13.1 by Brian Aker
First pass through data dictionary.
50
  modules= registry.getList(true);
51
  it= modules.begin();
52
}
53
1273.13.21 by Brian Aker
Fix interface (we no longer need Fields passed around).
54
bool ModulesTool::Generator::populate()
1273.13.1 by Brian Aker
First pass through data dictionary.
55
{
56
  if (it == modules.end())
57
    return false;
58
59
  {
1273.13.32 by Brian Aker
Big ole patch. This covers moving information_schema to old_* table names
60
    plugin::Module *module= *it;
61
    const plugin::Manifest &manifest= module->getManifest();
1273.13.20 by Brian Aker
Updating other modules to use new interface.
62
1273.13.45 by Brian Aker
Update for test split.
63
    /* MODULE_NAME */
1273.13.20 by Brian Aker
Updating other modules to use new interface.
64
    push(module->getName());
65
1273.13.45 by Brian Aker
Update for test split.
66
    /* MODULE_VERSION */
1273.13.20 by Brian Aker
Updating other modules to use new interface.
67
    push(manifest.version ? manifest.version : 0);
68
1273.13.45 by Brian Aker
Update for test split.
69
    /* MODULE_AUTHOR */
70
    manifest.author ? push(manifest.author) : push();
1273.13.20 by Brian Aker
Updating other modules to use new interface.
71
1273.13.45 by Brian Aker
Update for test split.
72
    /* IS_BUILTIN */
1273.13.20 by Brian Aker
Updating other modules to use new interface.
73
    push((module->plugin_dl == NULL));
74
1273.13.45 by Brian Aker
Update for test split.
75
    /* MODULE_LIBRARY */
76
    push((module->plugin_dl == NULL) ? "builtin" : module->plugin_dl->getName());
77
78
    /* MODULE_DESCRIPTION */
79
    manifest.descr ? push(manifest.descr) : push();
80
81
    /* MODULE_LICENSE */
1273.13.1 by Brian Aker
First pass through data dictionary.
82
    switch (manifest.license) {
83
    case PLUGIN_LICENSE_GPL:
1273.13.45 by Brian Aker
Update for test split.
84
      push(GPL);
1273.13.1 by Brian Aker
First pass through data dictionary.
85
      break;
86
    case PLUGIN_LICENSE_BSD:
1273.13.45 by Brian Aker
Update for test split.
87
      push(BSD);
1273.13.1 by Brian Aker
First pass through data dictionary.
88
      break;
89
    case PLUGIN_LICENSE_LGPL:
1273.13.45 by Brian Aker
Update for test split.
90
      push(LGPL);
1273.13.1 by Brian Aker
First pass through data dictionary.
91
      break;
92
    default:
1273.13.45 by Brian Aker
Update for test split.
93
      push(PROPRIETARY);
1273.13.1 by Brian Aker
First pass through data dictionary.
94
      break;
95
    }
96
  }
97
98
  it++;
99
100
  return true;
101
}