summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2007-11-30 15:27:49 -0500
committerBernard Normier <bernard@zeroc.com>2007-11-30 15:27:49 -0500
commite5c6f17ce67f71bacdc4d2a01be487907e08f8cc (patch)
tree1289b3dd8e93fe0e36be8ecdff2f024bb1c57271 /cpp/src
parentMerge branch 'master' of ssh://cvs.zeroc.com/home/git/ice (diff)
downloadice-e5c6f17ce67f71bacdc4d2a01be487907e08f8cc.tar.bz2
ice-e5c6f17ce67f71bacdc4d2a01be487907e08f8cc.tar.xz
ice-e5c6f17ce67f71bacdc4d2a01be487907e08f8cc.zip
Added Properties facet to IceBox services
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/IceBox/ServiceManagerI.cpp74
-rw-r--r--cpp/src/IceGrid/NodeServerAdminRouter.cpp14
-rw-r--r--cpp/src/IceGrid/ServerI.cpp19
-rw-r--r--cpp/src/IceGrid/ServerI.h4
4 files changed, 74 insertions, 37 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();
}
diff --git a/cpp/src/IceGrid/NodeServerAdminRouter.cpp b/cpp/src/IceGrid/NodeServerAdminRouter.cpp
index 62d9c5c4dcb..cb9c07be364 100644
--- a/cpp/src/IceGrid/NodeServerAdminRouter.cpp
+++ b/cpp/src/IceGrid/NodeServerAdminRouter.cpp
@@ -65,9 +65,9 @@ IceGrid::NodeServerAdminRouter::ice_invoke_async(const AMD_Array_Object_ice_invo
}
//
- // Then get a proxy to the real admin object
+ // Then get a proxy to the Process facet of the real admin object
//
- ObjectPrx target = server->getRealAdmin();
+ ObjectPrx target = server->getProcess();
if(target == 0)
{
@@ -75,9 +75,15 @@ IceGrid::NodeServerAdminRouter::ice_invoke_async(const AMD_Array_Object_ice_invo
}
//
- // Set the facet
+ // If this is a legacy Process proxy with no facet, we keep target as is
//
- target = target->ice_facet(current.facet);
+ if(current.facet != "Process")
+ {
+ //
+ // Set the facet
+ //
+ target = target->ice_facet(current.facet);
+ }
//
// Call with AMI
diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp
index f6806884fb5..7132944a443 100644
--- a/cpp/src/IceGrid/ServerI.cpp
+++ b/cpp/src/IceGrid/ServerI.cpp
@@ -743,30 +743,17 @@ ServerI::getPid(const Ice::Current&) const
}
Ice::ObjectPrx
-ServerI::getRealAdmin() const
+ServerI::getProcess() const
{
Lock sync(*this);
-
- //
- // Don't wait for the process activation to avoid blocking the thread. The
- // caller should ensure that the server is active before invoking server
- // admin objects instead. He can do that by calling Admin::startServer().
- //
-// //
-// // Wait for _process to be set if the server is being activated.
-// //
-// while(_desc->processRegistered && _process == 0 && _state > Inactive && _state < Deactivating)
-// {
-// wait();
-// }
-
+
if(_process == 0 || _state <= Inactive || _state >= Deactivating)
{
return 0;
}
else
{
- return _process->ice_facet("");
+ return _process;
}
}
diff --git a/cpp/src/IceGrid/ServerI.h b/cpp/src/IceGrid/ServerI.h
index 3e70d8e2849..f3fb183a5c8 100644
--- a/cpp/src/IceGrid/ServerI.h
+++ b/cpp/src/IceGrid/ServerI.h
@@ -110,9 +110,9 @@ public:
void terminated(const std::string&, int);
//
- // A proxy to the real Admin object; called by the AdminFacade servant implementation
+ // A proxy to the Process facet of the real Admin object; called by the AdminFacade servant implementation
//
- Ice::ObjectPrx getRealAdmin() const;
+ Ice::ObjectPrx getProcess() const;
private: