2 * Copyright 2001-2006 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/SPConfig.h
20 * Library configuration
23 #ifndef __shibsp_config_h__
24 #define __shibsp_config_h__
26 #include <shibsp/base.h>
27 #include <xmltooling/PluginManager.h>
28 #include <xercesc/dom/DOM.hpp>
32 * Shibboleth Service Provider Library
36 class SHIBSP_API AccessControl;
37 class SHIBSP_API Handler;
38 class SHIBSP_API ListenerService;
39 class SHIBSP_API RequestMapper;
40 class SHIBSP_API ServiceProvider;
42 #if defined (_MSC_VER)
43 #pragma warning( push )
44 #pragma warning( disable : 4250 4251 )
48 * Singleton object that manages library startup/shutdown.
50 class SHIBSP_API SPConfig
52 MAKE_NONCOPYABLE(SPConfig);
54 virtual ~SPConfig() {}
57 * Returns the global configuration object for the library.
59 * @return reference to the global library configuration object
61 static SPConfig& getConfig();
64 * Bitmask values representing subsystems of the library.
80 * Set a bitmask of subsystems to activate.
82 * @param enabled bitmask of component constants
84 void setFeatures(unsigned long enabled) {
89 * Test whether a subsystem is enabled.
91 * @param feature subsystem/component to test
92 * @return true iff feature is enabled
94 bool isEnabled(components_t feature) {
95 return (m_features & feature)>0;
101 * Each process using the library MUST call this function exactly once
102 * before using any library classes.
104 * @param catalog_path delimited set of schema catalog files to load
105 * @return true iff initialization was successful
107 virtual bool init(const char* catalog_path)=0;
112 * Each process using the library SHOULD call this function exactly once
113 * before terminating itself.
115 virtual void term()=0;
118 * Sets the global ServiceProvider instance.
119 * This method must be externally synchronized with any code that uses the object.
120 * Any previously set object is destroyed.
122 * @param serviceProvider new ServiceProvider instance to store
124 void setServiceProvider(ServiceProvider* serviceProvider);
127 * Returns the global ServiceProvider instance.
129 * @return global ServiceProvider or NULL
131 ServiceProvider* getServiceProvider() const {
132 return m_serviceProvider;
136 * Manages factories for AccessControl plugins.
138 xmltooling::PluginManager<AccessControl,const xercesc::DOMElement*> AccessControlManager;
141 * Manages factories for Handler plugins that implement AssertionConsumerService functionality.
143 xmltooling::PluginManager<Handler,const xercesc::DOMElement*> AssertionConsumerServiceManager;
146 * Manages factories for Handler plugins that implement customized functionality.
148 xmltooling::PluginManager<Handler,const xercesc::DOMElement*> HandlerManager;
151 * Manages factories for ListenerService plugins.
153 xmltooling::PluginManager<ListenerService,const xercesc::DOMElement*> ListenerServiceManager;
156 * Manages factories for Handler plugins that implement ManageNameIDService functionality.
158 xmltooling::PluginManager<Handler,const xercesc::DOMElement*> ManageNameIDServiceManager;
161 * Manages factories for RequestMapper plugins.
163 xmltooling::PluginManager<RequestMapper,const xercesc::DOMElement*> RequestMapperManager;
166 * Manages factories for ServiceProvider plugins.
168 xmltooling::PluginManager<ServiceProvider,const xercesc::DOMElement*> ServiceProviderManager;
171 * Manages factories for Handler plugins that implement SessionInitiator functionality.
173 xmltooling::PluginManager<Handler,const xercesc::DOMElement*> SessionInitiatorManager;
176 * Manages factories for Handler plugins that implement SingleLogoutService functionality.
178 xmltooling::PluginManager<Handler,const xercesc::DOMElement*> SingleLogoutServiceManager;
181 SPConfig() : m_serviceProvider(NULL) {}
183 /** Global ServiceProvider instance. */
184 ServiceProvider* m_serviceProvider;
187 unsigned long m_features;
190 #if defined (_MSC_VER)
191 #pragma warning( pop )
196 #endif /* __shibsp_config_h__ */