~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/loader.cc

  • Committer: lbieber
  • Date: 2010-09-22 03:57:16 UTC
  • mfrom: (1783.1.3 build)
  • Revision ID: lbieber@orisndriz08-20100922035716-9r10weyqvpxfn633
Merge Monty - fix processing of configuration files
Merge Brian - Pushes up thread ownership to the modules that create them.
Merge Monty - fix bug 643814 - add links for drizzle7 changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
class sys_var_pluginvar;
72
72
static vector<sys_var_pluginvar *> plugin_sysvar_vec;
73
73
 
74
 
char *opt_plugin_add= NULL;
75
 
char *opt_plugin_remove= NULL;
76
 
char *opt_plugin_load= NULL;
 
74
typedef vector<string> PluginOptions;
 
75
static PluginOptions opt_plugin_load;
 
76
static PluginOptions opt_plugin_add;
 
77
static PluginOptions opt_plugin_remove;
77
78
char *opt_plugin_dir_ptr;
78
79
char opt_plugin_dir[FN_REFLEN];
79
 
const char *opt_plugin_load_default= PANDORA_PLUGIN_LIST;
80
80
const char *builtin_plugins= PANDORA_BUILTIN_LIST;
81
81
 
82
82
/* Note that 'int version' must be the first field of every plugin
356
356
  return false;
357
357
}
358
358
 
 
359
static void compose_plugin_options(vector<string> &target,
 
360
                                   vector<string> options)
 
361
{
 
362
  for (vector<string>::iterator it= options.begin();
 
363
       it != options.end();
 
364
       ++it)
 
365
  {
 
366
    tokenize(*it, target, ",", true);
 
367
  }
 
368
}
 
369
 
 
370
void compose_plugin_add(vector<string> options)
 
371
{
 
372
  compose_plugin_options(opt_plugin_add, options);
 
373
}
 
374
 
 
375
void compose_plugin_remove(vector<string> options)
 
376
{
 
377
  compose_plugin_options(opt_plugin_remove, options);
 
378
}
 
379
 
 
380
void notify_plugin_load(string in_plugin_load)
 
381
{
 
382
  tokenize(in_plugin_load, opt_plugin_load, ",", true);
 
383
}
359
384
 
360
385
/*
361
386
  The logic is that we first load and initialize all compiled in plugins.
374
399
 
375
400
  initialized= 1;
376
401
 
377
 
  vector<string> builtin_list;
 
402
  PluginOptions builtin_list;
378
403
  tokenize(builtin_plugins, builtin_list, ",", true);
379
404
 
380
405
  bool load_failed= false;
381
 
  vector<string> plugin_list;
382
 
  if (opt_plugin_load)
383
 
  {
384
 
    tokenize(opt_plugin_load, plugin_list, ",", true);
385
 
  }
386
 
  else
387
 
  {
388
 
    tokenize(opt_plugin_load_default, plugin_list, ",", true);
389
 
  }
390
 
  if (opt_plugin_add)
391
 
  {
392
 
    tokenize(opt_plugin_add, plugin_list, ",", true);
393
 
  }
394
 
 
395
 
  if (opt_plugin_remove)
396
 
  {
397
 
    vector<string> plugins_to_remove;
398
 
    tokenize(opt_plugin_remove, plugins_to_remove, ",", true);
399
 
    plugin_prune_list(plugin_list, plugins_to_remove);
400
 
    plugin_prune_list(builtin_list, plugins_to_remove);
 
406
 
 
407
  if (opt_plugin_add.size() > 0)
 
408
  {
 
409
    opt_plugin_load.insert(opt_plugin_load.end(),
 
410
                           opt_plugin_add.begin(),
 
411
                           opt_plugin_add.end());
 
412
  }
 
413
 
 
414
  if (opt_plugin_remove.size() > 0)
 
415
  {
 
416
    plugin_prune_list(opt_plugin_load, opt_plugin_remove);
 
417
    plugin_prune_list(builtin_list, opt_plugin_remove);
401
418
  }
402
419
 
403
420
 
414
431
  }
415
432
 
416
433
  /* Uniquify the list */
417
 
  const set<string> plugin_list_set(plugin_list.begin(), plugin_list.end());
 
434
  const set<string> plugin_list_set(opt_plugin_load.begin(),
 
435
                                    opt_plugin_load.end());
418
436
  
419
437
  /* Register all dynamic plugins */
420
438
  load_failed= plugin_load_list(registry, &tmp_root,