boost changes and header fixes
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / MetadataProvider.h
index 8009ada..05d2493 100644 (file)
@@ -1,17 +1,21 @@
-/*
- *  Copyright 2001-2009 Internet2
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * UCAID licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the
+ * License at
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
  */
 
 /**
@@ -26,6 +30,8 @@
 #include <saml/base.h>
 
 #include <vector>
+#include <iostream>
+#include <boost/ptr_container/ptr_vector.hpp>
 #include <xmltooling/exceptions.h>
 #include <xmltooling/security/CredentialResolver.h>
 
@@ -83,7 +89,7 @@ namespace opensaml {
              *
              * @param e DOM to supply configuration for provider
              */
-            MetadataProvider(const xercesc::DOMElement* e=NULL);
+            MetadataProvider(const xercesc::DOMElement* e=nullptr);
 
         public:
             /**
@@ -92,6 +98,13 @@ namespace opensaml {
             virtual ~MetadataProvider();
 
             /**
+             * Returns an identifier for the provider for logging/status purposes.
+             *
+             * @return an identifier, or null
+             */
+            virtual const char* getId() const;
+
+            /**
              * Adds a metadata filter to apply to any resolved metadata. Will not be applied
              * to metadata that is already loaded.
              *
@@ -117,6 +130,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.
              *
@@ -132,7 +153,7 @@ namespace opensaml {
              * @param name                  the name of the group
              * @param requireValidMetadata  indicates whether the metadata for the group must be valid/current
              *
-             * @return the group's metadata or NULL if there is no metadata or no valid metadata
+             * @return the group's metadata or nullptr if there is no metadata or no valid metadata
              */
             virtual const EntitiesDescriptor* getEntitiesDescriptor(const XMLCh* name, bool requireValidMetadata=true) const;
 
@@ -144,7 +165,7 @@ namespace opensaml {
              * @param name                  the name of the group
              * @param requireValidMetadata  indicates whether the metadata for the group must be valid/current
              *
-             * @return the group's metadata or NULL if there is no metadata or no valid metadata
+             * @return the group's metadata or nullptr if there is no metadata or no valid metadata
              */
             virtual const EntitiesDescriptor* getEntitiesDescriptor(const char* name, bool requireValidMetadata=true) const=0;
 
@@ -165,7 +186,7 @@ namespace opensaml {
                  * @param prot  protocol support constant, if any
                  * @param valid true iff stale metadata should be ignored
                  */
-                Criteria(const XMLCh* id, const xmltooling::QName* q=NULL, const XMLCh* prot=NULL, bool valid=true);
+                Criteria(const XMLCh* id, const xmltooling::QName* q=nullptr, const XMLCh* prot=nullptr, bool valid=true);
 
                 /**
                  * Constructor.
@@ -175,7 +196,7 @@ namespace opensaml {
                  * @param prot  protocol support constant, if any
                  * @param valid true iff stale metadata should be ignored
                  */
-                Criteria(const char* id, const xmltooling::QName* q=NULL, const XMLCh* prot=NULL, bool valid=true);
+                Criteria(const char* id, const xmltooling::QName* q=nullptr, const XMLCh* prot=nullptr, bool valid=true);
 
                 /**
                  * Constructor.
@@ -185,7 +206,7 @@ namespace opensaml {
                  * @param prot  protocol support constant, if any
                  * @param valid true iff stale metadata should be ignored
                  */
-                Criteria(const SAMLArtifact* a, const xmltooling::QName* q=NULL, const XMLCh* prot=NULL, bool valid=true);
+                Criteria(const SAMLArtifact* a, const xmltooling::QName* q=nullptr, const XMLCh* prot=nullptr, bool valid=true);
 
                 virtual ~Criteria();
 
@@ -217,7 +238,7 @@ namespace opensaml {
              *
              * @param criteria  lookup criteria
              *
-             * @return the entity's metadata (and optionally a role) or NULL if there is no qualifying metadata
+             * @return the entity's metadata (and optionally a role) or nullptr if there is no qualifying metadata
              */
             virtual std::pair<const EntityDescriptor*,const RoleDescriptor*> getEntityDescriptor(const Criteria& criteria) const=0;
 
@@ -230,7 +251,7 @@ namespace opensaml {
             void doFilters(xmltooling::XMLObject& xmlObject) const;
 
         private:
-            std::vector<MetadataFilter*> m_filters;
+            boost::ptr_vector<MetadataFilter> m_filters;
         };
 
 #if defined (_MSC_VER)
@@ -251,6 +272,9 @@ namespace opensaml {
         /** MetadataProvider that wraps a sequence of metadata providers. */
         #define CHAINING_METADATA_PROVIDER  "Chaining"
 
+        /** MetadataProvider that loads a directory of files. */
+        #define FOLDER_METADATA_PROVIDER  "Folder"
+
         /** MetadataProvider that returns an empty "dummy" entity descriptor. */
         #define NULL_METADATA_PROVIDER  "Null"