summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker
diff options
context:
space:
mode:
authorNuno Santos <nsantos@apache.org>2008-04-15 16:12:01 +0000
committerNuno Santos <nsantos@apache.org>2008-04-15 16:12:01 +0000
commit8507479d8ec50b4854b866a547932e5e38db1cd1 (patch)
treecfb71795c9441265e280f6ccdd2666abf1c4decb /cpp/src/qpid/broker
parentc61ea56812df14a7465cb17d840039996e85fe78 (diff)
downloadqpid-python-8507479d8ec50b4854b866a547932e5e38db1cd1.tar.gz
QPID-921: applied qpid-patch36.diff on behalf of Ted Ross
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@648308 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker')
-rw-r--r--cpp/src/qpid/broker/Broker.cpp4
-rw-r--r--cpp/src/qpid/broker/Queue.cpp2
-rw-r--r--cpp/src/qpid/broker/System.cpp40
-rw-r--r--cpp/src/qpid/broker/System.h3
-rw-r--r--cpp/src/qpid/broker/Vhost.cpp2
5 files changed, 42 insertions, 9 deletions
diff --git a/cpp/src/qpid/broker/Broker.cpp b/cpp/src/qpid/broker/Broker.cpp
index b9268db9e5..689fb0687c 100644
--- a/cpp/src/qpid/broker/Broker.cpp
+++ b/cpp/src/qpid/broker/Broker.cpp
@@ -136,7 +136,7 @@ Broker::Broker(const Broker::Options& conf) :
managementAgent->setInterval (conf.mgmtPubInterval);
qpid::management::PackageQpid packageInitializer (managementAgent);
- System* system = new System ();
+ System* system = new System (dataDir.isEnabled () ? dataDir.getPath () : string ());
systemObject = System::shared_ptr (system);
mgmtObject = management::Broker::shared_ptr (new management::Broker (this, system, conf.port));
@@ -149,7 +149,7 @@ Broker::Broker(const Broker::Options& conf) :
mgmtObject->set_dataDirEnabled (dataDir.isEnabled ());
mgmtObject->set_dataDir (dataDir.getPath ());
- managementAgent->addObject (mgmtObject, 1, 0);
+ managementAgent->addObject (mgmtObject, 1, 1);
// Since there is currently no support for virtual hosts, a placeholder object
// representing the implied single virtual host is added here to keep the
diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp
index 591e9796d6..b3d8fda53b 100644
--- a/cpp/src/qpid/broker/Queue.cpp
+++ b/cpp/src/qpid/broker/Queue.cpp
@@ -69,7 +69,7 @@ Queue::Queue(const string& _name, bool _autodelete,
if (agent.get () != 0)
{
mgmtObject = management::Queue::shared_ptr
- (new management::Queue (this, parent, _name, _store != 0, _autodelete, 0));
+ (new management::Queue (this, parent, _name, _store != 0, _autodelete, _owner != 0));
// Add the object to the management agent only if this queue is not durable.
// If it's durable, we will add it later when the queue is assigned a persistenceId.
diff --git a/cpp/src/qpid/broker/System.cpp b/cpp/src/qpid/broker/System.cpp
index 87d5185b97..33a9db46a2 100644
--- a/cpp/src/qpid/broker/System.cpp
+++ b/cpp/src/qpid/broker/System.cpp
@@ -19,19 +19,51 @@
#include "System.h"
#include "qpid/management/ManagementAgent.h"
+#include "qpid/framing/Uuid.h"
#include <sys/utsname.h>
+#include <iostream>
+#include <fstream>
-using namespace qpid::broker;
using qpid::management::ManagementAgent;
+using namespace qpid::broker;
+using namespace std;
-System::System ()
+System::System (string _dataDir)
{
ManagementAgent::shared_ptr agent = ManagementAgent::getAgent ();
if (agent.get () != 0)
{
+ framing::Uuid systemId;
+
+ if (_dataDir.empty ())
+ {
+ systemId.generate ();
+ }
+ else
+ {
+ string filename (_dataDir + "/systemId");
+ ifstream inFile (filename.c_str ());
+
+ if (inFile.good ())
+ {
+ inFile >> systemId;
+ inFile.close ();
+ }
+ else
+ {
+ systemId.generate ();
+ ofstream outFile (filename.c_str ());
+ if (outFile.good ())
+ {
+ outFile << systemId << endl;
+ outFile.close ();
+ }
+ }
+ }
+
mgmtObject = management::System::shared_ptr
- (new management::System (this, "host"));
+ (new management::System (this, systemId));
struct utsname _uname;
if (uname (&_uname) == 0)
{
@@ -42,7 +74,7 @@ System::System ()
mgmtObject->set_machine (std::string (_uname.machine));
}
- agent->addObject (mgmtObject, 3, 0);
+ agent->addObject (mgmtObject, 3, 1);
}
}
diff --git a/cpp/src/qpid/broker/System.h b/cpp/src/qpid/broker/System.h
index a1a710f2b2..0d63bd1b3d 100644
--- a/cpp/src/qpid/broker/System.h
+++ b/cpp/src/qpid/broker/System.h
@@ -23,6 +23,7 @@
#include "qpid/management/Manageable.h"
#include "qpid/management/System.h"
#include <boost/shared_ptr.hpp>
+#include <string>
namespace qpid {
namespace broker {
@@ -37,7 +38,7 @@ class System : public management::Manageable
typedef boost::shared_ptr<System> shared_ptr;
- System ();
+ System (std::string _dataDir);
management::ManagementObject::shared_ptr GetManagementObject (void) const
{ return mgmtObject; }
diff --git a/cpp/src/qpid/broker/Vhost.cpp b/cpp/src/qpid/broker/Vhost.cpp
index 06a8c8eca3..c2c7e985b4 100644
--- a/cpp/src/qpid/broker/Vhost.cpp
+++ b/cpp/src/qpid/broker/Vhost.cpp
@@ -33,7 +33,7 @@ Vhost::Vhost (management::Manageable* parentBroker)
{
mgmtObject = management::Vhost::shared_ptr
(new management::Vhost (this, parentBroker, "/"));
- agent->addObject (mgmtObject, 2, 0);
+ agent->addObject (mgmtObject, 2, 1);
}
}
}