diff options
author | Bernard Normier <bernard@zeroc.com> | 2014-09-10 19:09:53 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2014-09-10 19:09:53 +0000 |
commit | ac587d9f1a6d34e46956fd17c81f99beb7ed97ad (patch) | |
tree | fa09b2b2d5b6037c76976ee293eb0d15b7a93717 /cpp/src/IceGrid/RegistryAdminRouter.cpp | |
parent | Fix networkProxy test dependencies (diff) | |
download | ice-ac587d9f1a6d34e46956fd17c81f99beb7ed97ad.tar.bz2 ice-ac587d9f1a6d34e46956fd17c81f99beb7ed97ad.tar.xz ice-ac587d9f1a6d34e46956fd17c81f99beb7ed97ad.zip |
IceGrid::Admin now provides remote access to IceGrid registry and node Admin objects, and icegridadmin uses these
new operations to show the Ice log file for IceGrid registries and IceGrid nodes (ICE-2400)
Diffstat (limited to 'cpp/src/IceGrid/RegistryAdminRouter.cpp')
-rw-r--r-- | cpp/src/IceGrid/RegistryAdminRouter.cpp | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/cpp/src/IceGrid/RegistryAdminRouter.cpp b/cpp/src/IceGrid/RegistryAdminRouter.cpp new file mode 100644 index 00000000000..51c85c34dd2 --- /dev/null +++ b/cpp/src/IceGrid/RegistryAdminRouter.cpp @@ -0,0 +1,126 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <IceGrid/RegistryAdminRouter.h> +#include <Ice/Ice.h> + +using namespace IceGrid; +using namespace Ice; +using namespace std; + + +IceGrid::RegistryServerAdminRouter::RegistryServerAdminRouter(const DatabasePtr& database) : + _database(database) +{ +} + +ObjectPrx +IceGrid::RegistryServerAdminRouter::getTarget(const Current& current) +{ + ObjectPrx target = 0; + + try + { + target = _database->getServer(current.id.name)->getAdminProxy(); + } + catch(const ServerNotExistException&) + { + } + catch(const NodeUnreachableException&) + { + } + catch(const DeploymentException&) + { + } + + if(target == 0) + { + throw ObjectNotExistException(__FILE__, __LINE__); + } + + return target->ice_facet(current.facet); +} + + +IceGrid::RegistryNodeAdminRouter::RegistryNodeAdminRouter(const string& collocNodeName, const DatabasePtr& database) : + _collocNodeName(collocNodeName), + _database(database) +{ +} + +ObjectPrx +IceGrid::RegistryNodeAdminRouter::getTarget(const Current& current) +{ + ObjectPrx target; + + if(!_collocNodeName.empty() && current.id.name == _collocNodeName) + { + // Straight to the local Admin object + target = current.adapter->getCommunicator()->getAdmin(); + } + else + { + try + { + target = _database->getNode(current.id.name)->getAdminProxy(); + } + catch(const NodeUnreachableException&) + { + } + catch(const NodeNotExistException&) + { + } + + if(target == 0) + { + throw ObjectNotExistException(__FILE__, __LINE__); + } + } + + return target->ice_facet(current.facet); +} + + + +IceGrid::RegistryReplicaAdminRouter::RegistryReplicaAdminRouter(const string& name, + const DatabasePtr& database) : + _name(name), + _database(database) +{ +} + +ObjectPrx +IceGrid::RegistryReplicaAdminRouter::getTarget(const Current& current) +{ + ObjectPrx target; + + if(current.id.name == _name) + { + // Straight to the local Admin object + target = current.adapter->getCommunicator()->getAdmin(); + } + else + { + try + { + // Forward to Admin object in remote replica + target = _database->getReplica(current.id.name)->getAdminProxy(); + } + catch(const RegistryNotExistException&) + { + } + } + + if(target == 0) + { + throw ObjectNotExistException(__FILE__, __LINE__); + } + + return target->ice_facet(current.facet); +} |