diff options
author | Marc Laukien <marc@zeroc.com> | 2004-05-19 19:07:58 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2004-05-19 19:07:58 +0000 |
commit | 2cdceca8d842006ebb8e205b1ed98661aeaabf2c (patch) | |
tree | a0e98d6e228c59a843dbccb7dbed9647db0a8f87 /cpp | |
parent | formatting changes (diff) | |
download | ice-2cdceca8d842006ebb8e205b1ed98661aeaabf2c.tar.bz2 ice-2cdceca8d842006ebb8e205b1ed98661aeaabf2c.tar.xz ice-2cdceca8d842006ebb8e205b1ed98661aeaabf2c.zip |
findAllFacets
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/CHANGES | 2 | ||||
-rw-r--r-- | cpp/slice/Ice/FacetMap.ice | 2 | ||||
-rw-r--r-- | cpp/slice/Ice/ObjectAdapter.ice | 27 | ||||
-rw-r--r-- | cpp/src/Ice/ObjectAdapterI.cpp | 11 | ||||
-rw-r--r-- | cpp/src/Ice/ObjectAdapterI.h | 1 | ||||
-rw-r--r-- | cpp/src/Ice/ServantManager.cpp | 27 | ||||
-rw-r--r-- | cpp/src/Ice/ServantManager.h | 1 |
7 files changed, 65 insertions, 6 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index 379aa097470..584f21a9f46 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -82,7 +82,7 @@ Changes since version 1.3.0 * The object adapter is now used to register facets instead of the active facet map. The following operations have been added to Ice::ObjectAdapter: addFacet, addFacetWithUUID, removeFacet, - removeAllFacets, and findFacet. + removeAllFacets, findFacet, and findAllFacets. Please see the reference manual for more information. For naming consistency, the following object adapter operations have been diff --git a/cpp/slice/Ice/FacetMap.ice b/cpp/slice/Ice/FacetMap.ice index e02734274c8..14186b86142 100644 --- a/cpp/slice/Ice/FacetMap.ice +++ b/cpp/slice/Ice/FacetMap.ice @@ -14,9 +14,9 @@ module Ice { /** + * * A mapping from facet name to servant. * - * @see [ObjectAdapter::removeAllFacets] **/ local dictionary<string, Object> FacetMap; diff --git a/cpp/slice/Ice/ObjectAdapter.ice b/cpp/slice/Ice/ObjectAdapter.ice index 80b3011cc53..39b3d254475 100644 --- a/cpp/slice/Ice/ObjectAdapter.ice +++ b/cpp/slice/Ice/ObjectAdapter.ice @@ -268,19 +268,20 @@ local interface ObjectAdapter void removeFacet(Identity id, string facet); /** + * * Remove all facets with the given identity from the Active - * Servant Map (that is, completely remove the &Ice object, + * Servant Map (that is, completely remove the &Ice; object, * including it's default facet). Removing an identity that * is not in the map throws [NotRegisteredException]. * - * @param id The identity of the &Ice object to be removed. + * @param id The identity of the &Ice; object to be removed. * * @return A collection containing all the facet names and - * servants of the removed &Ice object. + * servants of the removed &Ice; object. * - * @see FacetMap * @see remove * @see removeFacet + * **/ FacetMap removeAllFacets(Identity id); @@ -331,6 +332,24 @@ local interface ObjectAdapter /** * + * Find all facets with the given identity in the Active Servant + * Map. + * + * @param id The identity of the &Ice; object for which the facets + * should be returned. + * + * @return A collection containing all the facet names and + * servants which have been found, or an empty map if there is no + * facet for the given identity. + * + * @see find + * @see findFacet + * + **/ + FacetMap findAllFacets(Identity id); + + /** + * * Look up a servant in this object adapter's Active Servant Map, * given a proxy. * diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index e11d858594a..88c175a885b 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -378,6 +378,17 @@ Ice::ObjectAdapterI::findFacet(const Identity& ident, const string& facet) return _servantManager->findServant(ident, facet); } +FacetMap +Ice::ObjectAdapterI::findAllFacets(const Identity& ident) +{ + IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this); + + checkForDeactivation(); + checkIdentity(ident); + + return _servantManager->findAllFacets(ident); +} + ObjectPtr Ice::ObjectAdapterI::findByProxy(const ObjectPrx& proxy) { diff --git a/cpp/src/Ice/ObjectAdapterI.h b/cpp/src/Ice/ObjectAdapterI.h index 59e3de66d2e..f6e9819c213 100644 --- a/cpp/src/Ice/ObjectAdapterI.h +++ b/cpp/src/Ice/ObjectAdapterI.h @@ -57,6 +57,7 @@ public: virtual FacetMap removeAllFacets(const Identity&); virtual ObjectPtr find(const Identity&); virtual ObjectPtr findFacet(const Identity&, const std::string&); + virtual FacetMap findAllFacets(const Identity&); virtual ObjectPtr findByProxy(const ObjectPrx&); virtual void addServantLocator(const ServantLocatorPtr&, const std::string&); diff --git a/cpp/src/Ice/ServantManager.cpp b/cpp/src/Ice/ServantManager.cpp index 2e1bba0bb0a..0f926568a7e 100644 --- a/cpp/src/Ice/ServantManager.cpp +++ b/cpp/src/Ice/ServantManager.cpp @@ -168,6 +168,33 @@ IceInternal::ServantManager::findServant(const Identity& ident, const string& fa } } +FacetMap +IceInternal::ServantManager::findAllFacets(const Identity& ident) const +{ + IceUtil::Mutex::Lock sync(*this); + + assert(_instance); // Must not be called after destruction. + + ServantMapMap::iterator p = _servantMapMapHint; + + ServantMapMap& servantMapMap = const_cast<ServantMapMap&>(_servantMapMap); + + if(p == servantMapMap.end() || p->first != ident) + { + p = servantMapMap.find(ident); + } + + if(p == servantMapMap.end()) + { + return FacetMap(); + } + else + { + _servantMapMapHint = p; + return p->second; + } +} + bool IceInternal::ServantManager::hasServant(const Identity& ident) const { diff --git a/cpp/src/Ice/ServantManager.h b/cpp/src/Ice/ServantManager.h index 6c97d498c00..9de57a7a219 100644 --- a/cpp/src/Ice/ServantManager.h +++ b/cpp/src/Ice/ServantManager.h @@ -36,6 +36,7 @@ public: void removeServant(const Ice::Identity&, const std::string&); Ice::FacetMap removeAllFacets(const Ice::Identity&); Ice::ObjectPtr findServant(const Ice::Identity&, const std::string&) const; + Ice::FacetMap findAllFacets(const Ice::Identity&) const; bool hasServant(const Ice::Identity&) const; void addServantLocator(const Ice::ServantLocatorPtr& locator, const std::string&); |