summaryrefslogtreecommitdiff
path: root/cpp/src/IceBox/ServiceManagerI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceBox/ServiceManagerI.cpp')
-rw-r--r--cpp/src/IceBox/ServiceManagerI.cpp74
1 files changed, 59 insertions, 15 deletions
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp
index d85a4f2f1ca..88ee6a99ed4 100644
--- a/cpp/src/IceBox/ServiceManagerI.cpp
+++ b/cpp/src/IceBox/ServiceManagerI.cpp
@@ -52,9 +52,31 @@ private:
ServiceObserverPrx _observer;
};
-}
+class PropertiesAdminI : public PropertiesAdmin
+{
+public:
+
+ PropertiesAdminI(const PropertiesPtr& properties) :
+ _properties(properties)
+ {
+ }
+
+ virtual string getProperty(const string& name, const Current&)
+ {
+ return _properties->getProperty(name);
+ }
+
+ virtual PropertyDict getPropertiesForPrefix(const string& prefix, const Current&)
+ {
+ return _properties->getPropertiesForPrefix(prefix);
+ }
+
+private:
+ const PropertiesPtr _properties;
+};
+}
IceBox::ServiceManagerI::ServiceManagerI(CommunicatorPtr communicator, int& argc, char* argv[]) :
@@ -355,20 +377,6 @@ IceBox::ServiceManagerI::start()
cout << bundleName << " ready" << endl;
}
- if(adapter)
- {
- try
- {
- adapter->activate();
- }
- catch(const ObjectAdapterDeactivatedException&)
- {
- //
- // Expected if the communicator has been shutdown.
- //
- }
- }
-
//
// Register "this" as a facet to the Admin object, and then create
// Admin object
@@ -376,6 +384,18 @@ IceBox::ServiceManagerI::start()
try
{
_communicator->addAdminFacet(this, "IceBox.ServiceManager");
+
+ //
+ // Add a Properties facet for each service
+ //
+ for(vector<ServiceInfo>::iterator r = _services.begin(); r != _services.end(); ++r)
+ {
+ const ServiceInfo& info = *r;
+ CommunicatorPtr communicator = info.communicator != 0 ? info.communicator : _communicator;
+ _communicator->addAdminFacet(new PropertiesAdminI(communicator->getProperties()),
+ "IceBox.Service." + info.name + ".Properties");
+ }
+
_communicator->getAdmin();
}
catch(const ObjectAdapterDeactivatedException&)
@@ -384,6 +404,20 @@ IceBox::ServiceManagerI::start()
// Expected if the communicator has been shutdown.
//
}
+
+ if(adapter)
+ {
+ try
+ {
+ adapter->activate();
+ }
+ catch(const ObjectAdapterDeactivatedException&)
+ {
+ //
+ // Expected if the communicator has been shutdown.
+ //
+ }
+ }
}
catch(const FailureException& ex)
{
@@ -702,6 +736,7 @@ IceBox::ServiceManagerI::stopAll()
for(p = _services.rbegin(); p != _services.rend(); ++p)
{
ServiceInfo& info = *p;
+
if(info.active)
{
try
@@ -734,6 +769,15 @@ IceBox::ServiceManagerI::stopAll()
{
try
{
+ _communicator->removeAdminFacet("IceBox.Service." + info.name + ".Properties");
+ }
+ catch(const LocalException&)
+ {
+ // Ignored
+ }
+
+ try
+ {
info.communicator->shutdown();
info.communicator->waitForShutdown();
}