Add sslIndex option to override ACS index in metadata generation.
[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/util/SPConstants.h>
27 #include <map>
28 #include <xercesc/dom/DOM.hpp>
29
30 namespace shibsp {
31
32     /**
33      * Interface to a generic set of typed properties or a DOM container of additional data.
34      */
35     class SHIBSP_API PropertySet
36     {
37         MAKE_NONCOPYABLE(PropertySet);
38     protected:
39         PropertySet() {}
40     public:
41         virtual ~PropertySet() {}
42
43         /**
44          * Returns parent of this PropertySet, if any.
45          *
46          * @return the parent object, or NULL
47          */
48         virtual const PropertySet* getParent() const=0;
49
50         /**
51          * Establishes a "parent" PropertySet to supply inherited settings.
52          *
53          * @param parent    the parent PropertySet to use
54          */
55         virtual void setParent(const PropertySet* parent)=0;
56
57         /**
58          * Returns a boolean-valued property.
59          * 
60          * @param name  property name
61          * @param ns    property namespace, or NULL
62          * @return a pair consisting of a NULL indicator and the property value iff the indicator is true
63          */
64         virtual std::pair<bool,bool> getBool(const char* name, const char* ns=NULL) const=0;
65
66         /**
67          * Returns a string-valued property.
68          * 
69          * @param name  property name
70          * @param ns    property namespace, or NULL
71          * @return a pair consisting of a NULL indicator and the property value iff the indicator is true
72          */
73         virtual std::pair<bool,const char*> getString(const char* name, const char* ns=NULL) const=0;
74
75         /**
76          * Returns a Unicode string-valued property.
77          * 
78          * @param name  property name
79          * @param ns    property namespace, or NULL
80          * @return a pair consisting of a NULL indicator and the property value iff the indicator is true
81          */
82         virtual std::pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=NULL) const=0;
83
84         /**
85          * Returns an unsigned integer-valued property.
86          * 
87          * @param name  property name
88          * @param ns    property namespace, or NULL
89          * @return a pair consisting of a NULL indicator and the property value iff the indicator is true
90          */
91         virtual std::pair<bool,unsigned int> getUnsignedInt(const char* name, const char* ns=NULL) const=0;
92
93         /**
94          * Returns an integer-valued property.
95          * 
96          * @param name  property name
97          * @param ns    property namespace, or NULL
98          * @return a pair consisting of a NULL indicator and the property value iff the indicator is true
99          */
100         virtual std::pair<bool,int> getInt(const char* name, const char* ns=NULL) const=0;
101
102         /**
103          * Returns a map of all known properties in string form.
104          *
105          * @param properties    map to populate
106          */
107         virtual void getAll(std::map<std::string,const char*>& properties) const=0;
108
109         /**
110          * Returns a nested property set.
111          * 
112          * @param name  nested property set name
113          * @param ns    nested property set namespace, or NULL
114          * @return the nested property set, or NULL
115          */        
116         virtual const PropertySet* getPropertySet(const char* name, const char* ns=shibspconstants::ASCII_SHIB2SPCONFIG_NS) const=0;
117         
118         /**
119          * Returns a DOM element representing the property container, if any.
120          * 
121          * @return a DOM element, or NULL
122          */
123         virtual const xercesc::DOMElement* getElement() const=0;
124     };
125 };
126
127 #endif /* __shibsp_propset_h__ */