Starting to refactor session cache, eliminated IConfig class.
[shibboleth/cpp-sp.git] / shibsp / SPConfig.cpp
index 9e37be3..f789410 100644 (file)
  */
 
 #include "internal.h"
+#include "AccessControl.h"
 #include "exceptions.h"
-#include "ListenerService.h"
-#include "MetadataExt.h"
-#include "PKIXTrustEngine.h"
+#include "Handler.h"
+#include "RequestMapper.h"
+#include "ServiceProvider.h"
+#include "SessionCache.h"
 #include "SPConfig.h"
+#include "metadata/MetadataExt.h"
+#include "remoting/ListenerService.h"
+#include "security/PKIXTrustEngine.h"
 
 #include <log4cpp/Category.hh>
 #include <saml/SAMLConfig.h>
@@ -74,8 +79,11 @@ bool SPInternalConfig::init(const char* catalog_path)
         loglevel = SHIBSP_LOGGING;
     XMLToolingConfig::getConfig().log_config(loglevel);
 
-    if (catalog_path)
-        XMLToolingConfig::getConfig().catalog_path = catalog_path;
+    if (!catalog_path)
+        catalog_path = getenv("SHIBSP_SCHEMAS");
+    if (!catalog_path)
+        catalog_path = SHIBSP_SCHEMAS;
+    XMLToolingConfig::getConfig().catalog_path = catalog_path;
 
     if (!SAMLConfig::getConfig().init()) {
         log.fatal("failed to initialize OpenSAML library");
@@ -88,9 +96,13 @@ bool SPInternalConfig::init(const char* catalog_path)
     REGISTER_XMLTOOLING_EXCEPTION_FACTORY(ConfigurationException,shibsp);
     REGISTER_XMLTOOLING_EXCEPTION_FACTORY(ListenerException,shibsp);
     
-    registerListenerServices();
     registerMetadataExtClasses();
     registerPKIXTrustEngine();
+    registerAccessControls();
+    registerListenerServices();
+    registerRequestMappers();
+    registerSessionCaches();
+    registerServiceProviders();
 
     log.info("library initialization complete");
     return true;
@@ -104,10 +116,19 @@ void SPInternalConfig::term()
     Category& log=Category::getInstance(SHIBSP_LOGCAT".Config");
     log.info("shutting down the library");
 
-    //delete m_serviceProvider;
+    delete m_serviceProvider;
     m_serviceProvider = NULL;
     
+    SingleLogoutServiceManager.deregisterFactories();
+    SessionInitiatorManager.deregisterFactories();
+    SessionCacheManager.deregisterFactories();
+    ServiceProviderManager.deregisterFactories();
+    RequestMapperManager.deregisterFactories();
+    ManageNameIDServiceManager.deregisterFactories();
     ListenerServiceManager.deregisterFactories();
+    HandlerManager.deregisterFactories();
+    AssertionConsumerServiceManager.deregisterFactories();
+    AccessControlManager.deregisterFactories();
 
     SAMLConfig::getConfig().term();
     log.info("library shutdown complete");