--- /dev/null
+/*\r
+ * Copyright 2001-2006 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+/**\r
+ * @file saml/security/ChainingMetadataProvider.h\r
+ * \r
+ * MetadataProvider that uses multiple providers in sequence.\r
+ */\r
+\r
+#ifndef __saml_chainmeta_h__\r
+#define __saml_chainmeta_h__\r
+\r
+#include <saml/saml2/metadata/ObservableMetadataProvider.h>\r
+#include <xmltooling/util/Threads.h>\r
+\r
+namespace opensaml {\r
+ namespace saml2md {\r
+ \r
+ /**\r
+ * MetadataProvider that uses multiple providers in sequence.\r
+ */\r
+ class SAML_API ChainingMetadataProvider\r
+ : public ObservableMetadataProvider, public ObservableMetadataProvider::Observer {\r
+ public:\r
+ /**\r
+ * Constructor.\r
+ * \r
+ * If a DOM is supplied, the following XML content is supported:\r
+ * \r
+ * <ul>\r
+ * <li><MetadataProvider> elements with a type attribute\r
+ * </ul>\r
+ * \r
+ * XML namespaces are ignored in the processing of this content.\r
+ * \r
+ * @param e DOM to supply configuration for provider\r
+ */\r
+ ChainingMetadataProvider(const DOMElement* e=NULL);\r
+ \r
+ /**\r
+ * Destructor will delete any embedded engines.\r
+ */\r
+ virtual ~ChainingMetadataProvider();\r
+ \r
+ /**\r
+ * Adds a provider for future calls. The provider <strong>MUST</strong> be\r
+ * initialized before adding it. \r
+ * \r
+ * @param newProvider provider to add\r
+ */\r
+ void addMetadataProvider(MetadataProvider* newProvider) {\r
+ m_providers.push_back(newProvider);\r
+ }\r
+ \r
+ /**\r
+ * Removes a provider. The caller must delete the provider if necessary.\r
+ * \r
+ * @param oldProvider provider to remove\r
+ * @return the old provider\r
+ */\r
+ MetadataProvider* removeMetadataProvider(MetadataProvider* oldProvider) {\r
+ for (std::vector<MetadataProvider*>::iterator i=m_providers.begin(); i!=m_providers.end(); i++) {\r
+ if (oldProvider==(*i)) {\r
+ m_providers.erase(i);\r
+ return oldProvider;\r
+ }\r
+ }\r
+ return NULL;\r
+ }\r
+\r
+ xmltooling::Lockable* lock();\r
+ void unlock();\r
+ void init();\r
+ const xmlsignature::KeyResolver* getKeyResolver() const;\r
+ const xmltooling::XMLObject* getMetadata() const;\r
+ const EntitiesDescriptor* getEntitiesDescriptor(const char* name, bool requireValidMetadata=true) const;\r
+ const EntityDescriptor* getEntityDescriptor(const char* id, bool requireValidMetadata=true) const;\r
+ const EntityDescriptor* getEntityDescriptor(const SAMLArtifact* artifact) const;\r
+ void onEvent(MetadataProvider& provider);\r
+ \r
+ private:\r
+ xmltooling::ThreadKey* m_tlsKey;\r
+ std::vector<MetadataProvider*> m_providers;\r
+ };\r
+ }; \r
+};\r
+\r
+#endif /* __saml_chainmeta_h__ */\r