Add API for status generation.
authorScott Cantor <cantor.2@osu.edu>
Wed, 21 Sep 2011 17:10:59 +0000 (17:10 +0000)
committerScott Cantor <cantor.2@osu.edu>
Wed, 21 Sep 2011 17:10:59 +0000 (17:10 +0000)
saml/saml2/metadata/MetadataProvider.h
saml/saml2/metadata/impl/ChainingMetadataProvider.cpp
saml/saml2/metadata/impl/MetadataProvider.cpp

index 145b763..63c74e7 100644 (file)
@@ -30,6 +30,7 @@
 #include <saml/base.h>
 
 #include <vector>
+#include <iostream>
 #include <xmltooling/exceptions.h>
 #include <xmltooling/security/CredentialResolver.h>
 
@@ -121,6 +122,14 @@ namespace opensaml {
             virtual void init()=0;
 
             /**
+             * Generate an XML representation of the provider's status. The XML must be
+             * well-formed, but is otherwise arbitrary.
+             *
+             * @param os    stream to write status information to
+             */
+            virtual void outputStatus(std::ostream& os) const;
+
+            /**
              * Gets the entire metadata tree, after the registered filter has been applied.
              * The caller MUST unlock the provider when finished with the data.
              *
index 81f6bf1..5bb1f50 100644 (file)
@@ -33,6 +33,7 @@
 #include "saml2/metadata/MetadataCredentialCriteria.h"
 
 #include <memory>
+#include <functional>
 #include <xercesc/util/XMLUniDefs.hpp>
 #include <xmltooling/logging.h>
 #include <xmltooling/util/Threads.h>
@@ -64,6 +65,7 @@ namespace opensaml {
             Lockable* lock();
             void unlock();
             void init();
+            void outputStatus(ostream& os) const;
             const XMLObject* getMetadata() const;
             const EntitiesDescriptor* getEntitiesDescriptor(const char* name, bool requireValidMetadata=true) const;
             pair<const EntityDescriptor*,const RoleDescriptor*> getEntityDescriptor(const Criteria& criteria) const;
@@ -224,6 +226,13 @@ void ChainingMetadataProvider::init()
     m_feedTag = SAMLArtifact::toHex(m_feedTag);
 }
 
+void ChainingMetadataProvider::outputStatus(ostream& os) const
+{
+    for (vector<MetadataProvider*>::const_iterator i=m_providers.begin(); i!=m_providers.end(); ++i) {
+        (*i)->outputStatus(os);
+    }
+}
+
 Lockable* ChainingMetadataProvider::lock()
 {
     return this;   // we're not lockable ourselves...
index 6cb7f93..6498750 100644 (file)
@@ -165,6 +165,10 @@ void MetadataProvider::doFilters(XMLObject& xmlObject) const
     }
 }
 
+void MetadataProvider::outputStatus(ostream& os) const
+{
+}
+
 const EntitiesDescriptor* MetadataProvider::getEntitiesDescriptor(const XMLCh* name, bool strict) const
 {
     auto_ptr_char temp(name);