summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/module.cpp12
-rw-r--r--src/mongo/db/module.h18
-rw-r--r--src/mongo/db/mongod_options.cpp11
-rw-r--r--src/mongo/db/mongod_options.h2
4 files changed, 31 insertions, 12 deletions
diff --git a/src/mongo/db/module.cpp b/src/mongo/db/module.cpp
index f3035b56dde..7229f329c44 100644
--- a/src/mongo/db/module.cpp
+++ b/src/mongo/db/module.cpp
@@ -17,14 +17,18 @@
#include "mongo/pch.h"
+#include "mongo/util/options_parser/option_section.h"
+
#include "mongo/db/module.h"
namespace mongo {
+ namespace moe = mongo::optionenvironment;
+
std::list<Module*> * Module::_all;
Module::Module( const string& name )
- : _name( name ) , _options( (string)"Module " + name + " options" ) {
+ : _name( name ) {
if ( ! _all )
_all = new list<Module*>();
_all->push_back( this );
@@ -32,17 +36,17 @@ namespace mongo {
Module::~Module() {}
- void Module::addOptions( boost::program_options::options_description& options ) {
+ void Module::addAllOptions(moe::OptionSection* options) {
if ( ! _all ) {
return;
}
for ( list<Module*>::iterator i=_all->begin(); i!=_all->end(); i++ ) {
Module* m = *i;
- options.add( m->_options );
+ m->addOptions(options);
}
}
- void Module::configAll( boost::program_options::variables_map& params ) {
+ void Module::configAll(moe::Environment& params) {
if ( ! _all ) {
return;
}
diff --git a/src/mongo/db/module.h b/src/mongo/db/module.h
index 662624aba9e..1a6e598fd5c 100644
--- a/src/mongo/db/module.h
+++ b/src/mongo/db/module.h
@@ -18,10 +18,12 @@
#pragma once
-#include <boost/program_options.hpp>
#include <list>
#include <string>
+#include "mongo/util/options_parser/environment.h"
+#include "mongo/util/options_parser/option_section.h"
+
namespace mongo {
/**
@@ -35,14 +37,15 @@ namespace mongo {
Module( const std::string& name );
virtual ~Module();
- boost::program_options::options_description_easy_init add_options() {
- return _options.add_options();
- }
+ /**
+ * add options to command line
+ */
+ virtual void addOptions(optionenvironment::OptionSection* options) = 0;
/**
* read config from command line
*/
- virtual void config( boost::program_options::variables_map& params ) = 0;
+ virtual void config(optionenvironment::Environment& params) = 0;
/**
* called after configuration when the server is ready start
@@ -58,13 +61,12 @@ namespace mongo {
// --- static things
- static void addOptions( boost::program_options::options_description& options );
- static void configAll( boost::program_options::variables_map& params );
+ static void addAllOptions(optionenvironment::OptionSection* options);
+ static void configAll(optionenvironment::Environment& params);
static void initAll();
private:
static std::list<Module*> * _all;
std::string _name;
- boost::program_options::options_description _options;
};
}
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp
index 5b4d877062e..edfcd18f80b 100644
--- a/src/mongo/db/mongod_options.cpp
+++ b/src/mongo/db/mongod_options.cpp
@@ -21,6 +21,7 @@
#include "mongo/base/status.h"
#include "mongo/bson/util/builder.h"
+#include "mongo/db/module.h"
#include "mongo/db/server_options.h"
#include "mongo/util/options_parser/option_description.h"
#include "mongo/util/options_parser/option_section.h"
@@ -361,6 +362,16 @@ namespace mongo {
return ret;
}
+ ret = addModuleOptions(options);
+ if (!ret.isOK()) {
+ return ret;
+ }
+
+ return Status::OK();
+ }
+
+ Status addModuleOptions(moe::OptionSection* options) {
+ Module::addAllOptions(options);
return Status::OK();
}
diff --git a/src/mongo/db/mongod_options.h b/src/mongo/db/mongod_options.h
index f87850ab2b7..6c4ed1347cc 100644
--- a/src/mongo/db/mongod_options.h
+++ b/src/mongo/db/mongod_options.h
@@ -27,4 +27,6 @@ namespace mongo {
namespace moe = mongo::optionenvironment;
Status addMongodOptions(moe::OptionSection* options);
+
+ Status addModuleOptions(moe::OptionSection* options);
}