[cpp-opensaml COMMIT] in /branches/REL_2/saml/saml2/metadata: AbstractMetadataProvider.h ObservableMetadataProvider.h...

noreply at shibboleth.net noreply at shibboleth.net
Fri Mar 16 18:46:13 GMT 2012


Author: scantor
Date: Fri Mar 16 18:46:13 2012
New Revision: 721

URL: http://svn.shibboleth.net/view/cpp-opensaml?rev=721&view=rev
Log:
https://issues.shibboleth.net/jira/browse/CPPOST-68

Modified:
    branches/REL_2/saml/saml2/metadata/AbstractMetadataProvider.h
    branches/REL_2/saml/saml2/metadata/ObservableMetadataProvider.h
    branches/REL_2/saml/saml2/metadata/impl/AbstractMetadataProvider.cpp
    branches/REL_2/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp
    branches/REL_2/saml/saml2/metadata/impl/ObservableMetadataProvider.cpp

Modified: branches/REL_2/saml/saml2/metadata/AbstractMetadataProvider.h
URL: http://svn.shibboleth.net/view/cpp-opensaml/branches/REL_2/saml/saml2/metadata/AbstractMetadataProvider.h?rev=721&r1=720&r2=721&view=diff
==============================================================================
--- branches/REL_2/saml/saml2/metadata/AbstractMetadataProvider.h (original)
+++ branches/REL_2/saml/saml2/metadata/AbstractMetadataProvider.h Fri Mar 16 18:46:13 2012
@@ -83,6 +83,7 @@
 
             void outputStatus(std::ostream& os) const;
             void emitChangeEvent() const;
+            void emitChangeEvent(const EntityDescriptor&) const;
             std::pair<const EntityDescriptor*,const RoleDescriptor*> getEntityDescriptor(const Criteria& criteria) const;
             const EntitiesDescriptor* getEntitiesDescriptor(const char* name, bool requireValidMetadata=true) const;
             const xmltooling::Credential* resolve(const xmltooling::CredentialCriteria* criteria=nullptr) const;

Modified: branches/REL_2/saml/saml2/metadata/ObservableMetadataProvider.h
URL: http://svn.shibboleth.net/view/cpp-opensaml/branches/REL_2/saml/saml2/metadata/ObservableMetadataProvider.h?rev=721&r1=720&r2=721&view=diff
==============================================================================
--- branches/REL_2/saml/saml2/metadata/ObservableMetadataProvider.h (original)
+++ branches/REL_2/saml/saml2/metadata/ObservableMetadataProvider.h Fri Mar 16 18:46:13 2012
@@ -59,6 +59,11 @@
              */
             virtual void emitChangeEvent() const;
 
+            /**
+             * Convenience method for notifying every registered Observer of an event.
+             */
+            virtual void emitChangeEvent(const EntityDescriptor& entity) const;
+
         public:
             virtual ~ObservableMetadataProvider();
             
@@ -79,6 +84,15 @@
                  * @param provider the provider being observed
                  */
                 virtual void onEvent(const ObservableMetadataProvider& provider) const=0;
+
+                /**
+                 * Called when a provider signals an event has occured.
+                 * The provider is already locked. 
+                 * 
+                 * @param provider the provider being observed
+                 * @param entity the entity that underwent modification
+                 */
+                virtual void onEvent(const ObservableMetadataProvider& provider, const EntityDescriptor& entity) const;
             };
             
             /**

Modified: branches/REL_2/saml/saml2/metadata/impl/AbstractMetadataProvider.cpp
URL: http://svn.shibboleth.net/view/cpp-opensaml/branches/REL_2/saml/saml2/metadata/impl/AbstractMetadataProvider.cpp?rev=721&r1=720&r2=721&view=diff
==============================================================================
--- branches/REL_2/saml/saml2/metadata/impl/AbstractMetadataProvider.cpp (original)
+++ branches/REL_2/saml/saml2/metadata/impl/AbstractMetadataProvider.cpp Fri Mar 16 18:46:13 2012
@@ -102,6 +102,14 @@
         for_each(c->second.begin(), c->second.end(), xmltooling::cleanup<Credential>());
     m_credentialMap.clear();
     ObservableMetadataProvider::emitChangeEvent();
+}
+
+void AbstractMetadataProvider::emitChangeEvent(const EntityDescriptor& entity) const
+{
+    for (credmap_t::iterator c = m_credentialMap.begin(); c!=m_credentialMap.end(); ++c)
+        for_each(c->second.begin(), c->second.end(), xmltooling::cleanup<Credential>());
+    m_credentialMap.clear();
+    ObservableMetadataProvider::emitChangeEvent(entity);
 }
 
 void AbstractMetadataProvider::indexEntity(EntityDescriptor* site, time_t& validUntil, bool replace) const

Modified: branches/REL_2/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp
URL: http://svn.shibboleth.net/view/cpp-opensaml/branches/REL_2/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp?rev=721&r1=720&r2=721&view=diff
==============================================================================
--- branches/REL_2/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp (original)
+++ branches/REL_2/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp Fri Mar 16 18:46:13 2012
@@ -232,7 +232,7 @@
         m_lock->wrlock();
 
         // Notify observers.
-        emitChangeEvent();
+        emitChangeEvent(*entity2);
 
         // Record the proper refresh time.
         m_cacheMap[entity2->getEntityID()] = now + cacheExp;

Modified: branches/REL_2/saml/saml2/metadata/impl/ObservableMetadataProvider.cpp

[... 29 lines stripped ...]


More information about the commits mailing list