00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <config.h>
00022
00023 #include <plugin/registry_dictionary/dictionary.h>
00024 #include <drizzled/module/library.h>
00025
00026 using namespace std;
00027 using namespace drizzled;
00028
00029
00030
00031
00032
00033 static const string GPL_STRING("GPL");
00034 static const string LGPL_STRING("LGPL");
00035 static const string BSD_STRING("BSD");
00036 static const string PROPRIETARY_STRING("PROPRIETARY");
00037
00038 ModulesTool::ModulesTool() :
00039 plugin::TableFunction("DATA_DICTIONARY", "MODULES")
00040 {
00041 add_field("MODULE_NAME");
00042 add_field("MODULE_VERSION", 20);
00043 add_field("MODULE_AUTHOR");
00044 add_field("IS_BUILTIN", plugin::TableFunction::BOOLEAN, 0, false);
00045 add_field("MODULE_LIBRARY", 254);
00046 add_field("MODULE_DESCRIPTION", 254);
00047 add_field("MODULE_LICENSE", 80);
00048 }
00049
00050 ModulesTool::Generator::Generator(Field **arg) :
00051 plugin::TableFunction::Generator(arg)
00052 {
00053 module::Registry ®istry= module::Registry::singleton();
00054 modules= registry.getList();
00055 it= modules.begin();
00056 }
00057
00058 bool ModulesTool::Generator::populate()
00059 {
00060 if (it == modules.end())
00061 return false;
00062
00063 {
00064 module::Module *module= *it;
00065 const module::Manifest &manifest= module->getManifest();
00066
00067
00068 push(module->getName());
00069
00070
00071 push(manifest.version ? manifest.version : 0);
00072
00073
00074 manifest.author ? push(manifest.author) : push();
00075
00076
00077 push((module->plugin_dl == NULL));
00078
00079
00080 push((module->plugin_dl == NULL) ? "builtin" : module->plugin_dl->getName());
00081
00082
00083 manifest.descr ? push(manifest.descr) : push();
00084
00085
00086 switch (manifest.license) {
00087 case PLUGIN_LICENSE_GPL:
00088 push(GPL_STRING);
00089 break;
00090 case PLUGIN_LICENSE_BSD:
00091 push(BSD_STRING);
00092 break;
00093 case PLUGIN_LICENSE_LGPL:
00094 push(LGPL_STRING);
00095 break;
00096 default:
00097 push(PROPRIETARY_STRING);
00098 break;
00099 }
00100 }
00101
00102 it++;
00103
00104 return true;
00105 }