summaryrefslogtreecommitdiff
path: root/cpp/lib/broker/Configuration.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2006-12-23 17:20:37 +0000
committerAlan Conway <aconway@apache.org>2006-12-23 17:20:37 +0000
commit6536407690660e10529c826ab3aa21baaa121ea1 (patch)
treeaacbd4397be2fc04e394d77f83732bd77e5f4b99 /cpp/lib/broker/Configuration.cpp
parenta958033ea68c9154da02d4378c4031f9dc02897e (diff)
downloadqpid-python-6536407690660e10529c826ab3aa21baaa121ea1.tar.gz
- rpm: make rpm now builds RPMs under rpm/ directory.
- src/qpidd.cpp: added --daemon option to run as daemon. - etc/qpidd: fixed bugs in init.rc script. - qpidc.spec: fixed rpmlint warnings, added apache URL git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@489905 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/lib/broker/Configuration.cpp')
-rw-r--r--cpp/lib/broker/Configuration.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/cpp/lib/broker/Configuration.cpp b/cpp/lib/broker/Configuration.cpp
index 65d60ae1ca..e83c359f2d 100644
--- a/cpp/lib/broker/Configuration.cpp
+++ b/cpp/lib/broker/Configuration.cpp
@@ -26,7 +26,8 @@ using namespace qpid::broker;
using namespace std;
Configuration::Configuration() :
- trace('t', "trace", "Print incoming & outgoing frames to the console (default=false)", false),
+ daemon('d', "daemon", "Run as system daemon, detached from terminal.", false),
+ trace('t', "trace", "Print incoming & outgoing frames to the console", false),
port('p', "port", "Set the port to listen on (default=5672)", 5672),
workerThreads("worker-threads", "Set the number of worker threads to use (default=5).", 5),
maxConnections("max-connections", "Set the maximum number of connections the broker can accept (default=500).", 500),
@@ -36,6 +37,7 @@ Configuration::Configuration() :
help("help", "Print usage information", false),
version("version", "Print version information", false)
{
+ options.push_back(&daemon);
options.push_back(&trace);
options.push_back(&port);
options.push_back(&workerThreads);
@@ -57,16 +59,16 @@ void Configuration::parse(char const *progName, int argc, char** argv){
for(op_iterator i = options.begin(); i < options.end() && !matched; i++){
matched = (*i)->parse(position, argv, argc);
}
- if(!matched){
- std::cerr<< "Warning: skipping unrecognised option " << argv[position] << std::endl;
- position++;
+ if(!matched) {
+ throw BadOptionException(
+ std::string("Unrecognised option: ")+argv[position]);
}
}
}
void Configuration::usage(){
std::cout << "Usage: " << programName << " [OPTION]..." << std::endl
- << "Start the Qpid broker daemon." << std::endl << std::endl
+ << "Start the Qpid AMQP broker daemon." << std::endl << std::endl
<< "Options:" << std::endl;
for(op_iterator i = options.begin(); i < options.end(); i++){
(*i)->print(std::cout);
@@ -84,6 +86,10 @@ bool Configuration::isVersion() const {
return version.getValue();
}
+bool Configuration::isDaemon() const {
+ return daemon.getValue();
+}
+
bool Configuration::isTrace() const {
return trace.getValue();
}