2 * Copyright 2001-2009 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @file shibsp/util/PropertySet.h
20 * Interface to a generic set of typed properties or a DOM container of additional data.
23 #ifndef __shibsp_propset_h__
24 #define __shibsp_propset_h__
26 #include <shibsp/util/SPConstants.h>
30 #include <xercesc/dom/DOM.hpp>
35 * Interface to a generic set of typed properties or a DOM container of additional data.
37 class SHIBSP_API PropertySet
39 MAKE_NONCOPYABLE(PropertySet);
43 virtual ~PropertySet();
46 * Returns parent of this PropertySet, if any.
48 * @return the parent object, or NULL
50 virtual const PropertySet* getParent() const=0;
53 * Establishes a "parent" PropertySet to supply inherited settings.
55 * @param parent the parent PropertySet to use
57 virtual void setParent(const PropertySet* parent)=0;
60 * Returns a boolean-valued property.
62 * @param name property name
63 * @param ns property namespace, or NULL
64 * @return a pair consisting of a NULL indicator and the property value iff the indicator is true
66 virtual std::pair<bool,bool> getBool(const char* name, const char* ns=NULL) const=0;
69 * Returns a string-valued property.
71 * @param name property name
72 * @param ns property namespace, or NULL
73 * @return a pair consisting of a NULL indicator and the property value iff the indicator is true
75 virtual std::pair<bool,const char*> getString(const char* name, const char* ns=NULL) const=0;
78 * Returns a Unicode string-valued property.
80 * @param name property name
81 * @param ns property namespace, or NULL
82 * @return a pair consisting of a NULL indicator and the property value iff the indicator is true
84 virtual std::pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=NULL) const=0;
87 * Returns an unsigned integer-valued property.
89 * @param name property name
90 * @param ns property namespace, or NULL
91 * @return a pair consisting of a NULL indicator and the property value iff the indicator is true
93 virtual std::pair<bool,unsigned int> getUnsignedInt(const char* name, const char* ns=NULL) const=0;
96 * Returns an integer-valued property.
98 * @param name property name
99 * @param ns property namespace, or NULL
100 * @return a pair consisting of a NULL indicator and the property value iff the indicator is true
102 virtual std::pair<bool,int> getInt(const char* name, const char* ns=NULL) const=0;
105 * Returns a map of all known properties in string form.
107 * @param properties map to populate
109 virtual void getAll(std::map<std::string,const char*>& properties) const=0;
112 * Returns a nested property set.
114 * @param name nested property set name
115 * @param ns nested property set namespace, or NULL
116 * @return the nested property set, or NULL
118 virtual const PropertySet* getPropertySet(const char* name, const char* ns=shibspconstants::ASCII_SHIB2SPCONFIG_NS) const=0;
121 * Returns a DOM element representing the property container, if any.
123 * @return a DOM element, or NULL
125 virtual const xercesc::DOMElement* getElement() const=0;
129 #endif /* __shibsp_propset_h__ */