Reworked config class.
authorScott Cantor <cantor.2@osu.edu>
Mon, 9 Sep 2002 05:54:08 +0000 (05:54 +0000)
committerScott Cantor <cantor.2@osu.edu>
Mon, 9 Sep 2002 05:54:08 +0000 (05:54 +0000)
eduPerson/ScopedAttribute.cpp
include/shib.h
shib/ShibConfig.cpp

index 542f3a4..9510525 100644 (file)
@@ -109,7 +109,7 @@ bool ScopedAttribute::addValue(IDOM_Element* e)
 
 bool ScopedAttribute::accept(IDOM_Element* e) const
 {
-    IOriginSiteMapper* mapper=ShibConfig::getConfig()->origin_mapper;
+    IOriginSiteMapper* mapper=ShibConfig::getConfig().origin_mapper;
     Iterator<xstring> domains=mapper->getSecurityDomains(m_defaultScope.c_str());
     const XMLCh* this_scope=NULL;
     IDOM_Attr* scope=e->getAttributeNodeNS(NULL,Scope);
index bcd8af0..fff8163 100644 (file)
@@ -164,18 +164,15 @@ namespace shibboleth
     {
     public:
         // global per-process setup and shutdown of Shibboleth runtime
-        static bool init(ShibConfig* pconfig);
-        static void term();
+        virtual bool init();
+        virtual void term();
 
         // enables runtime and clients to access configuration
-        static const ShibConfig* getConfig();
+        static ShibConfig& getConfig();
 
     /* start of external configuration */
         IOriginSiteMapper* origin_mapper;
     /* end of external configuration */
-
-    private:
-        static const ShibConfig* g_config;
     };
 
     struct SHIB_EXPORTS Constants
index 2df0a8a..be431b3 100644 (file)
 #include <shib.h>
 using namespace shibboleth;
 
-// This is currently *NOT* threadsafe code.
 
-const ShibConfig* ShibConfig::g_config=NULL;
+ShibConfig g_config;
 
-bool ShibConfig::init(ShibConfig* pconfig)
+bool ShibConfig::init()
 {
-    if (!pconfig)
-        return false;
-    g_config=pconfig;
-
     // Register extension schema.
     saml::XML::registerSchema(XML::SHIB_NS,XML::SHIB_SCHEMA_ID);
 
@@ -83,7 +78,7 @@ void ShibConfig::term()
 {
 }
 
-const ShibConfig* ShibConfig::getConfig()
+ShibConfig& ShibConfig::getConfig()
 {
     return g_config;
 }