diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-09-24 17:07:33 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-09-24 17:07:33 -0400 |
commit | 080656b952732140cae223651714b0a0fc460b08 (patch) | |
tree | fea62f6e795b522ac64230c0a67f7c9cd89544ef /cpp/src | |
parent | Fixed test warning (diff) | |
download | ice-080656b952732140cae223651714b0a0fc460b08.tar.bz2 ice-080656b952732140cae223651714b0a0fc460b08.tar.xz ice-080656b952732140cae223651714b0a0fc460b08.zip |
Squashed commit of the following:
commit 67f0310e1125b278157942d1387f694d9bf9921a
Author: Bernard Normier <bernard@zeroc.com>
Date: Mon Sep 24 16:56:17 2007 -0400
Added ability to retrieve server properties from IceGrid GUI
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/IceGrid/AdminI.cpp | 15 | ||||
-rw-r--r-- | cpp/src/IceGrid/AdminI.h | 1 | ||||
-rw-r--r-- | cpp/src/IceGrid/Internal.ice | 10 | ||||
-rw-r--r-- | cpp/src/IceGrid/ServerI.cpp | 52 | ||||
-rw-r--r-- | cpp/src/IceGrid/ServerI.h | 1 |
5 files changed, 79 insertions, 0 deletions
diff --git a/cpp/src/IceGrid/AdminI.cpp b/cpp/src/IceGrid/AdminI.cpp index dd5a7fa0dce..141112c5b59 100644 --- a/cpp/src/IceGrid/AdminI.cpp +++ b/cpp/src/IceGrid/AdminI.cpp @@ -358,6 +358,21 @@ AdminI::getServerPid(const string& id, const Current&) const } } +Ice::PropertyDict +AdminI::getServerProperties(const string& id, const Current&) const +{ + ServerProxyWrapper proxy(_database, id); + try + { + return proxy->getProperties(); + } + catch(const Ice::Exception& ex) + { + proxy.handleException(ex); + return Ice::PropertyDict(); + } +} + void AdminI::startServer(const string& id, const Current&) { diff --git a/cpp/src/IceGrid/AdminI.h b/cpp/src/IceGrid/AdminI.h index a5c63735ad9..1d4356b994a 100644 --- a/cpp/src/IceGrid/AdminI.h +++ b/cpp/src/IceGrid/AdminI.h @@ -49,6 +49,7 @@ public: virtual ServerInfo getServerInfo(const ::std::string&, const Ice::Current&) const; virtual ServerState getServerState(const ::std::string&, const Ice::Current&) const; virtual Ice::Int getServerPid(const ::std::string&, const Ice::Current&) const; + virtual Ice::PropertyDict getServerProperties(const ::std::string&, const Ice::Current&) const; virtual void startServer(const ::std::string&, const Ice::Current&); virtual void stopServer(const ::std::string&, const Ice::Current&); virtual void patchServer_async(const AMD_Admin_patchServerPtr&, const ::std::string&, bool, const Ice::Current&); diff --git a/cpp/src/IceGrid/Internal.ice b/cpp/src/IceGrid/Internal.ice index 4f3cdbfa291..85ab0cc5fc6 100644 --- a/cpp/src/IceGrid/Internal.ice +++ b/cpp/src/IceGrid/Internal.ice @@ -14,6 +14,7 @@ #include <Ice/BuiltinSequences.ice> #include <Ice/ProcessF.ice> #include <Ice/Locator.ice> +#include <Ice/Properties.ice> #include <Glacier2/Session.ice> #include <IceGrid/Admin.ice> @@ -281,6 +282,15 @@ interface Server extends FileReader **/ ["nonmutating", "cpp:const"] idempotent int getPid(); + + /** + * + * Get the server properties + * + **/ + ["cpp:const"] idempotent Ice::PropertyDict getProperties() + throws ServerUnreachableException; + /** * * Set the process proxy. diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp index 0ec35344f6e..072c76d30ad 100644 --- a/cpp/src/IceGrid/ServerI.cpp +++ b/cpp/src/IceGrid/ServerI.cpp @@ -742,6 +742,55 @@ ServerI::getPid(const Ice::Current&) const return _node->getActivator()->getServerPid(_id); } +Ice::PropertyDict +ServerI::getProperties(const Ice::Current&) const +{ + Ice::ProcessPrx process = 0; + { + Lock sync(*this); + checkDestroyed(); + + // + // Wait for _process to be set + // + while(_desc->processRegistered && _process == 0) + { + wait(); + checkDestroyed(); + } + process = _process; + } + + if(process == 0) + { + throw ServerUnreachableException(_id, "no Admin object"); + } + + try + { + return Ice::PropertiesAdminPrx::uncheckedCast(process, "Properties")->getPropertiesForPrefix(""); + } + catch(const Ice::FacetNotExistException&) + { + // + // Probably an old server + // + throw ServerUnreachableException(_id, "no Properties facet"); + } + catch(const Ice::ObjectNotExistException&) + { + // + // Looks like the server was shut down + // + throw ServerUnreachableException(_id, "no Admin object"); + } + catch(const Ice::LocalException& ex) + { + throw ServerUnreachableException(_id, ex.what()); + } +} + + void ServerI::setEnabled(bool enabled, const ::Ice::Current&) { @@ -810,6 +859,7 @@ ServerI::setProcess_async(const AMD_Server_setProcessPtr& amdCB, const Ice::Proc checkDestroyed(); _process = process; deact = _state == DeactivatingWaitForProcess; + notifyAll(); } amdCB->ice_response(); if(deact) @@ -2355,6 +2405,7 @@ ServerI::setStateNoSync(InternalServerState st, const std::string& reason) InternalServerState previous = _state; _state = st; + // // Check if some commands are done. // @@ -2427,6 +2478,7 @@ ServerI::setStateNoSync(InternalServerState st, const std::string& reason) _destroy->finished(); _destroy = 0; } + notifyAll(); // for getProperties() break; default: break; diff --git a/cpp/src/IceGrid/ServerI.h b/cpp/src/IceGrid/ServerI.h index ac50abfb299..350d121f5ca 100644 --- a/cpp/src/IceGrid/ServerI.h +++ b/cpp/src/IceGrid/ServerI.h @@ -79,6 +79,7 @@ public: virtual ServerState getState(const ::Ice::Current& = Ice::Current()) const; virtual Ice::Int getPid(const ::Ice::Current& = Ice::Current()) const; + virtual Ice::PropertyDict getProperties(const ::Ice::Current& = Ice::Current()) const; virtual void setEnabled(bool, const ::Ice::Current&); virtual bool isEnabled(const ::Ice::Current& = Ice::Current()) const; |