summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/DescriptorHelper.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2007-06-12 15:42:23 +0200
committerBenoit Foucher <benoit@zeroc.com>2007-06-12 15:42:23 +0200
commit607a0c7f320dacb590d0816ab0b121a2b6c784e7 (patch)
treec576a0ab9e31b1e57f66c4a85c457331e1889230 /cpp/src/IceGrid/DescriptorHelper.cpp
parentSupport for Sun Studio 12 (CC 5.9) (diff)
downloadice-607a0c7f320dacb590d0816ab0b121a2b6c784e7.tar.bz2
ice-607a0c7f320dacb590d0816ab0b121a2b6c784e7.tar.xz
ice-607a0c7f320dacb590d0816ab0b121a2b6c784e7.zip
Fixed bug 2220
Diffstat (limited to 'cpp/src/IceGrid/DescriptorHelper.cpp')
-rw-r--r--cpp/src/IceGrid/DescriptorHelper.cpp90
1 files changed, 86 insertions, 4 deletions
diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp
index 57a5b0c5641..c41aa5c04de 100644
--- a/cpp/src/IceGrid/DescriptorHelper.cpp
+++ b/cpp/src/IceGrid/DescriptorHelper.cpp
@@ -977,6 +977,18 @@ CommunicatorHelper::getIds(multiset<string>& adapterIds, multiset<Ice::Identity>
}
}
+void
+CommunicatorHelper::getReplicaGroups(set<string>& replicaGroups) const
+{
+ for(AdapterDescriptorSeq::const_iterator p = _desc->adapters.begin(); p != _desc->adapters.end(); ++p)
+ {
+ if(!p->replicaGroupId.empty())
+ {
+ replicaGroups.insert(p->replicaGroupId);
+ }
+ }
+}
+
void
CommunicatorHelper::instantiateImpl(const CommunicatorDescriptorPtr& instance, const Resolver& resolve) const
{
@@ -992,10 +1004,18 @@ CommunicatorHelper::instantiateImpl(const CommunicatorDescriptorPtr& instance, c
adapter.registerProcess = p->registerProcess;
adapter.serverLifetime = p->serverLifetime;
adapter.replicaGroupId = resolve.asId(p->replicaGroupId, "object adapter replica group id", true);
- if(!adapter.replicaGroupId.empty() && !resolve.hasReplicaGroup(adapter.replicaGroupId))
- {
- resolve.exception("unknown replica group `" + adapter.replicaGroupId + "'");
- }
+
+ //
+ // Don't check for unknown replica groups here. This check is
+ // instead done by the database before the application is
+ // added. It's legal for an OA to refer to a replica group
+ // from another application.
+ //
+ //if(!adapter.replicaGroupId.empty() && !resolve.hasReplicaGroup(adapter.replicaGroupId))
+ //{
+ //resolve.exception("unknown replica group `" + adapter.replicaGroupId + "'");
+ //}
+
adapter.priority = resolve.asInt(p->priority, "object adapter priority");
adapter.objects = resolve(p->objects, "well-known");
adapter.allocatables = resolve(p->allocatables, "allocatable");
@@ -1505,6 +1525,16 @@ IceBoxHelper::getIds(multiset<string>& adapterIds, multiset<Ice::Identity>& obje
}
void
+IceBoxHelper::getReplicaGroups(set<string>& replicaGroups) const
+{
+ CommunicatorHelper::getReplicaGroups(replicaGroups);
+ for(vector<ServiceInstanceHelper>::const_iterator p = _services.begin(); p != _services.end(); ++p)
+ {
+ p->getReplicaGroups(replicaGroups);
+ }
+}
+
+void
IceBoxHelper::print(const Ice::CommunicatorPtr& communicator, Output& out) const
{
print(communicator, out, ServerInfo());
@@ -1694,6 +1724,13 @@ ServiceInstanceHelper::getIds(multiset<string>& adapterIds, multiset<Ice::Identi
}
void
+ServiceInstanceHelper::getReplicaGroups(set<string>& replicaGroups) const
+{
+ assert(_service.getDescriptor());
+ _service.getReplicaGroups(replicaGroups);
+}
+
+void
ServiceInstanceHelper::print(const Ice::CommunicatorPtr& communicator, Output& out) const
{
if(_service.getDescriptor())
@@ -1875,6 +1912,13 @@ ServerInstanceHelper::getIds(multiset<string>& adapterIds, multiset<Ice::Identit
_serverInstance->getIds(adapterIds, objectIds);
}
+void
+ServerInstanceHelper::getReplicaGroups(set<string>& replicaGroups) const
+{
+ assert(_serverInstance);
+ _serverInstance->getReplicaGroups(replicaGroups);
+}
+
NodeHelper::NodeHelper(const string& name,
const NodeDescriptor& descriptor,
const Resolver& appResolve,
@@ -2137,6 +2181,21 @@ NodeHelper::getIds(multiset<string>& serverIds, multiset<string>& adapterIds, mu
}
}
+void
+NodeHelper::getReplicaGroups(set<string>& replicaGroups) const
+{
+ assert(_instantiated);
+ ServerInstanceHelperDict::const_iterator p;
+ for(p = _serverInstances.begin(); p != _serverInstances.end(); ++p)
+ {
+ p->second.getReplicaGroups(replicaGroups);
+ }
+ for(p = _servers.begin(); p != _servers.end(); ++p)
+ {
+ p->second.getReplicaGroups(replicaGroups);
+ }
+}
+
const NodeDescriptor&
NodeHelper::getDefinition() const
{
@@ -2700,6 +2759,29 @@ ApplicationHelper::getIds(set<string>& serverIds, set<string>& adapterIds, set<I
copy(oIds.begin(), oIds.end(), inserter(objectIds, objectIds.begin()));
}
+void
+ApplicationHelper::getReplicaGroups(set<string>& replicaGroups, set<string>& adapterReplicaGroups) const
+{
+ ReplicaGroupDescriptorSeq::const_iterator r;
+ for(r = _def.replicaGroups.begin(); r != _def.replicaGroups.end(); ++r)
+ {
+ replicaGroups.insert(r->id);
+ }
+
+ set<string> allAdapterReplicaGroups;
+ for(NodeHelperDict::const_iterator p = _nodes.begin(); p != _nodes.end(); ++p)
+ {
+ p->second.getReplicaGroups(allAdapterReplicaGroups);
+ }
+
+ //
+ // Only return references to replica groups which don't belong to
+ // this application.
+ //
+ set_difference(allAdapterReplicaGroups.begin(), allAdapterReplicaGroups.end(),
+ replicaGroups.begin(), replicaGroups.end(), set_inserter(adapterReplicaGroups));
+}
+
const ApplicationDescriptor&
ApplicationHelper::getDefinition() const
{