diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-09-30 04:58:01 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-09-30 04:58:01 +0000 |
commit | a795900d002f4182b13b32f6ebf3391458786123 (patch) | |
tree | 3a75ed09a7ce57e0253f54ee6f0cbcf08dfba3ac /cpp/src/IceGrid/Util.cpp | |
parent | Bug 498. (diff) | |
download | ice-a795900d002f4182b13b32f6ebf3391458786123.tar.bz2 ice-a795900d002f4182b13b32f6ebf3391458786123.tar.xz ice-a795900d002f4182b13b32f6ebf3391458786123.zip |
Added support for <adapter name>.ReplicaId.
Diffstat (limited to 'cpp/src/IceGrid/Util.cpp')
-rw-r--r-- | cpp/src/IceGrid/Util.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/cpp/src/IceGrid/Util.cpp b/cpp/src/IceGrid/Util.cpp index b112e396591..7b7a9e70c44 100644 --- a/cpp/src/IceGrid/Util.cpp +++ b/cpp/src/IceGrid/Util.cpp @@ -35,7 +35,7 @@ IceGrid::toString(const vector<string>& v, const string& sep) } string -IceGrid::getProperty(const PropertyDescriptorSeq& properties, const string& name) +IceGrid::getProperty(const PropertyDescriptorSeq& properties, const string& name, const string& def) { for(PropertyDescriptorSeq::const_iterator p = properties.begin(); p != properties.end(); ++p) { @@ -44,5 +44,23 @@ IceGrid::getProperty(const PropertyDescriptorSeq& properties, const string& name return p->value; } } - return ""; + return def; +} + +string +IceGrid::getReplicaId(const AdapterDescriptor& adapter, const CommunicatorDescriptorPtr& comm, const string& serverId) +{ + if(!adapter.replicaId.empty()) + { + return adapter.replicaId; + } + + // + // Compute the default replica id of an object adapter: if the + // adapter belongs to a service the replica id will be "<server + // id>.<service name>", if the adapter belongs to a server its + // replica id will be "<server id>". + // + ServiceDescriptorPtr service = ServiceDescriptorPtr::dynamicCast(comm); + return service ? serverId + "." + service->name : serverId; } |