Improve property inheritance, first batch of SessionInitiators, rename providerId.
[shibboleth/sp.git] / shibsp / util / PropertySet.h
1 /*
2  *  Copyright 2001-2007 Internet2
3  * 
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 /**
18  * @file shibsp/util/PropertySet.h
19  * 
20  * Interface to a generic set of typed properties or a DOM container of additional data.
21  */
22
23 #ifndef __shibsp_propset_h__
24 #define __shibsp_propset_h__
25
26 #include <shibsp/base.h>
27 #include <xercesc/dom/DOM.hpp>
28
29 namespace shibsp {
30
31     /**
32      * Interface to a generic set of typed properties or a DOM container of additional data.
33      */
34     class SHIBSP_API PropertySet
35     {
36         MAKE_NONCOPYABLE(PropertySet);
37     protected:
38         PropertySet() {}
39     public:
40         virtual ~PropertySet() {}
41
42         /**
43          * Establishes a "parent" PropertySet to supply inherited settings.
44          *
45          * @param parent    the parent PropertySet to use
46          */
47         virtual void setParent(const PropertySet* parent)=0;
48
49         /**
50          * Returns a boolean-valued property.
51          * 
52          * @param name  property name
53          * @param ns    property namespace, or NULL
54          * @return a pair consisting of a NULL indicator and the property value iff the indicator is true
55          */
56         virtual std::pair<bool,bool> getBool(const char* name, const char* ns=NULL) const=0;
57
58         /**
59          * Returns a string-valued property.
60          * 
61          * @param name  property name
62          * @param ns    property namespace, or NULL
63          * @return a pair consisting of a NULL indicator and the property value iff the indicator is true
64          */
65         virtual std::pair<bool,const char*> getString(const char* name, const char* ns=NULL) const=0;
66
67         /**
68          * Returns a Unicode string-valued property.
69          * 
70          * @param name  property name
71          * @param ns    property namespace, or NULL
72          * @return a pair consisting of a NULL indicator and the property value iff the indicator is true
73          */
74         virtual std::pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=NULL) const=0;
75
76         /**
77          * Returns an unsigned integer-valued property.
78          * 
79          * @param name  property name
80          * @param ns    property namespace, or NULL
81          * @return a pair consisting of a NULL indicator and the property value iff the indicator is true
82          */
83         virtual std::pair<bool,unsigned int> getUnsignedInt(const char* name, const char* ns=NULL) const=0;
84
85         /**
86          * Returns an integer-valued property.
87          * 
88          * @param name  property name
89          * @param ns    property namespace, or NULL
90          * @return a pair consisting of a NULL indicator and the property value iff the indicator is true
91          */
92         virtual std::pair<bool,int> getInt(const char* name, const char* ns=NULL) const=0;
93
94         /**
95          * Returns a nested property set.
96          * 
97          * @param name  nested property set name
98          * @param ns    nested property set namespace, or NULL
99          * @return the nested property set, or NULL
100          */        
101         virtual const PropertySet* getPropertySet(const char* name, const char* ns="urn:mace:shibboleth:sp:config:2.0") const=0;
102         
103         /**
104          * Returns a DOM element representing the property container, if any.
105          * 
106          * @return a DOM element, or NULL
107          */
108         virtual const xercesc::DOMElement* getElement() const=0;
109     };
110 };
111
112 #endif /* __shibsp_propset_h__ */