2 * Licensed to the University Corporation for Advanced Internet
3 * Development, Inc. (UCAID) under one or more contributor license
4 * agreements. See the NOTICE file distributed with this work for
5 * additional information regarding copyright ownership.
7 * UCAID licenses this file to you under the Apache License,
8 * Version 2.0 (the "License"); you may not use this file except
9 * in compliance with the License. You may obtain a copy of the
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17 * either express or implied. See the License for the specific
18 * language governing permissions and limitations under the License.
22 * @file shibsp/util/PropertySet.h
24 * Interface to a generic set of typed properties or a DOM container of additional data.
27 #ifndef __shibsp_propset_h__
28 #define __shibsp_propset_h__
30 #include <shibsp/util/SPConstants.h>
34 #include <xercesc/dom/DOM.hpp>
39 * Interface to a generic set of typed properties or a DOM container of additional data.
41 class SHIBSP_API PropertySet
43 MAKE_NONCOPYABLE(PropertySet);
47 virtual ~PropertySet();
50 * Returns parent of this PropertySet, if any.
52 * @return the parent object, or nullptr
54 virtual const PropertySet* getParent() const=0;
57 * Establishes a "parent" PropertySet to supply inherited settings.
59 * @param parent the parent PropertySet to use
61 virtual void setParent(const PropertySet* parent)=0;
64 * Returns a boolean-valued property.
66 * @param name property name
67 * @param ns property namespace, or nullptr
68 * @return a pair consisting of a nullptr indicator and the property value iff the indicator is true
70 virtual std::pair<bool,bool> getBool(const char* name, const char* ns=nullptr) const=0;
73 * Returns a string-valued property.
75 * @param name property name
76 * @param ns property namespace, or nullptr
77 * @return a pair consisting of a nullptr indicator and the property value iff the indicator is true
79 virtual std::pair<bool,const char*> getString(const char* name, const char* ns=nullptr) const=0;
82 * Returns a Unicode string-valued property.
84 * @param name property name
85 * @param ns property namespace, or nullptr
86 * @return a pair consisting of a nullptr indicator and the property value iff the indicator is true
88 virtual std::pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=nullptr) const=0;
91 * Returns an unsigned integer-valued property.
93 * @param name property name
94 * @param ns property namespace, or nullptr
95 * @return a pair consisting of a nullptr indicator and the property value iff the indicator is true
97 virtual std::pair<bool,unsigned int> getUnsignedInt(const char* name, const char* ns=nullptr) const=0;
100 * Returns an integer-valued property.
102 * @param name property name
103 * @param ns property namespace, or nullptr
104 * @return a pair consisting of a nullptr indicator and the property value iff the indicator is true
106 virtual std::pair<bool,int> getInt(const char* name, const char* ns=nullptr) const=0;
109 * Returns a map of all known properties in string form.
111 * @param properties map to populate
113 virtual void getAll(std::map<std::string,const char*>& properties) const=0;
116 * Returns a nested property set.
118 * @param name nested property set name
119 * @param ns nested property set namespace, or nullptr
120 * @return the nested property set, or nullptr
122 virtual const PropertySet* getPropertySet(const char* name, const char* ns=shibspconstants::ASCII_SHIB2SPCONFIG_NS) const=0;
125 * Returns a DOM element representing the property container, if any.
127 * @return a DOM element, or nullptr
129 virtual const xercesc::DOMElement* getElement() const=0;
133 #endif /* __shibsp_propset_h__ */