summaryrefslogtreecommitdiff
path: root/RC9/qpid/cpp/src/qpidd.cpp
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2009-01-13 18:11:43 +0000
committerRafael H. Schloming <rhs@apache.org>2009-01-13 18:11:43 +0000
commit7e34266b9a23f4536415bfbc3f161b84615b6550 (patch)
tree484008cf2d413f58b5e4ab80b373303c66200888 /RC9/qpid/cpp/src/qpidd.cpp
parent4612263ea692f00a4bd810438bdaf9bc88022091 (diff)
downloadqpid-python-M4.tar.gz
Tag M4 RC9M4
git-svn-id: https://svn.apache.org/repos/asf/qpid/tags/M4@734202 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'RC9/qpid/cpp/src/qpidd.cpp')
-rw-r--r--RC9/qpid/cpp/src/qpidd.cpp83
1 files changed, 83 insertions, 0 deletions
diff --git a/RC9/qpid/cpp/src/qpidd.cpp b/RC9/qpid/cpp/src/qpidd.cpp
new file mode 100644
index 0000000000..330f12ae83
--- /dev/null
+++ b/RC9/qpid/cpp/src/qpidd.cpp
@@ -0,0 +1,83 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "qpidd.h"
+#include "qpid/Plugin.h"
+#include "qpid/Version.h"
+#include "qpid/log/Logger.h"
+#include "qpid/log/Statement.h"
+#include "qpid/sys/Shlib.h"
+
+#include <iostream>
+#include <memory>
+using namespace std;
+
+auto_ptr<QpiddOptions> options;
+
+int main(int argc, char* argv[])
+{
+ try
+ {
+ {
+ BootstrapOptions bootOptions(argv[0]);
+ string defaultPath (bootOptions.module.loadDir);
+ // Parse only the common, load, and log options to see which
+ // modules need to be loaded. Once the modules are loaded,
+ // the command line will be re-parsed with all of the
+ // module-supplied options.
+ bootOptions.parse (argc, argv, bootOptions.common.config, true);
+ qpid::log::Logger::instance().configure(bootOptions.log);
+
+ for (vector<string>::iterator iter = bootOptions.module.load.begin();
+ iter != bootOptions.module.load.end();
+ iter++)
+ qpid::tryShlib (iter->data(), false);
+
+ if (!bootOptions.module.noLoad) {
+ bool isDefault = defaultPath == bootOptions.module.loadDir;
+ qpid::loadModuleDir (bootOptions.module.loadDir, isDefault);
+ }
+ }
+
+ // Parse options
+ options.reset(new QpiddOptions(argv[0]));
+ options->parse(argc, argv, options->common.config);
+
+ // Options that just print information.
+ if (options->common.help || options->common.version) {
+ if (options->common.version)
+ cout << "qpidd (" << qpid::product << ") version "
+ << qpid::version << endl;
+ else if (options->common.help)
+ options->usage();
+ return 0;
+ }
+
+ // Everything else is driven by the platform-specific broker
+ // logic.
+ QpiddBroker broker;
+ return broker.execute(options.get());
+ }
+ catch(const exception& e) {
+ QPID_LOG(critical, "Broker start-up failed: " << e.what());
+ }
+ return 1;
+}