Fixes for disabling xmlsec
authorScott Cantor <cantor.2@osu.edu>
Tue, 14 Mar 2006 03:39:19 +0000 (03:39 +0000)
committerScott Cantor <cantor.2@osu.edu>
Tue, 14 Mar 2006 03:39:19 +0000 (03:39 +0000)
configure.ac
xmltooling/XMLToolingConfig.cpp
xmltooling/internal.h
xmltoolingtest/XMLObjectBaseTestCase.h

index 6786afc..0ee3202 100644 (file)
@@ -159,11 +159,8 @@ AC_TRY_LINK(
 
 # XML-Security settings
 AC_ARG_WITH(xmlsec,
-            AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),
-            [if test x_$with_xmlsec != x_/usr; then
-                LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
-                CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
-            fi])
+            AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),,
+            [with_xmlsec=/usr])
 
 if test x_$with_xmlsec != x_no; then
     if test x_$with_xmlsec != x_/usr; then
@@ -188,8 +185,8 @@ int i = 0;
             [AC_MSG_ERROR([unable to link with XML-Sec])])
 else
     AC_MSG_WARN([xmlsec disabled, building without signature/encryption support])
-    [AC_DEFINE(XMLTOOLING_NO_XMLSEC,1,
-        [Define if you wish to disable XML-Security-dependent features.])]
+    AC_DEFINE(XMLTOOLING_NO_XMLSEC,1,
+        [Define if you wish to disable XML-Security-dependent features.])
 fi
 AM_CONDITIONAL(BUILD_XMLSEC,test x_$with_xmlsec != x_no)
 
index 8170abf..9bd8b3e 100644 (file)
-/*\r
- *  Copyright 2001-2006 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * XMLToolingConfig.cpp\r
- * \r
- * Library configuration \r
- */\r
-\r
-#include "internal.h"\r
-#include "XMLToolingConfig.h"\r
-#include "impl/UnknownElement.h"\r
-#include "signature/impl/XMLSecSignature.h"\r
-#include "util/NDC.h"\r
-\r
-#ifdef HAVE_DLFCN_H\r
-# include <dlfcn.h>\r
-#endif\r
-\r
-#include <log4cpp/Category.hh>\r
-#include <log4cpp/PropertyConfigurator.hh>\r
-#include <log4cpp/OstreamAppender.hh>\r
-#include <xercesc/util/PlatformUtils.hpp>\r
-#ifndef XMLTOOLING_NO_XMLSEC\r
-    #include <xsec/framework/XSECProvider.hpp>\r
-#endif\r
-\r
-#include <stdexcept>\r
-\r
-using namespace log4cpp;\r
-using namespace xmltooling;\r
-using namespace std;\r
-\r
-namespace {\r
-   XMLToolingInternalConfig g_config;\r
-}\r
-\r
-XMLToolingConfig& XMLToolingConfig::getConfig()\r
-{\r
-    return g_config;\r
-}\r
-\r
-XMLToolingInternalConfig& XMLToolingInternalConfig::getInternalConfig()\r
-{\r
-    return g_config;\r
-}\r
-\r
-bool XMLToolingInternalConfig::log_config(const char* config)\r
-{\r
-    try {\r
-        if (!config || !*config)\r
-            config=getenv("XMLTOOLING_LOG_CONFIG");\r
-        if (!config || !*config)\r
-            config="WARN";\r
-        \r
-        bool level=false;\r
-        Category& root = Category::getRoot();\r
-        if (!strcmp(config,"DEBUG")) {\r
-            root.setPriority(Priority::DEBUG);\r
-            level=true;\r
-        }\r
-        else if (!strcmp(config,"INFO")) {\r
-            root.setPriority(Priority::INFO);\r
-            level=true;\r
-        }\r
-        else if (!strcmp(config,"NOTICE")) {\r
-            root.setPriority(Priority::NOTICE);\r
-            level=true;\r
-        }\r
-        else if (!strcmp(config,"WARN")) {\r
-            root.setPriority(Priority::WARN);\r
-            level=true;\r
-        }\r
-        else if (!strcmp(config,"ERROR")) {\r
-            root.setPriority(Priority::ERROR);\r
-            level=true;\r
-        }\r
-        else if (!strcmp(config,"CRIT")) {\r
-            root.setPriority(Priority::CRIT);\r
-            level=true;\r
-        }\r
-        else if (!strcmp(config,"ALERT")) {\r
-            root.setPriority(Priority::ALERT);\r
-            level=true;\r
-        }\r
-        else if (!strcmp(config,"EMERG")) {\r
-            root.setPriority(Priority::EMERG);\r
-            level=true;\r
-        }\r
-        else if (!strcmp(config,"FATAL")) {\r
-            root.setPriority(Priority::FATAL);\r
-            level=true;\r
-        }\r
-        if (level)\r
-            root.setAppender(new OstreamAppender("default",&cerr));\r
-        else\r
-            PropertyConfigurator::configure(config);\r
-    }\r
-    catch (const ConfigureFailure& e) {\r
-        Category::getInstance(XMLTOOLING_LOGCAT".Logging").crit("failed to initialize log4cpp: %s", e.what());\r
-        return false;\r
-    }\r
-    \r
-    return true;\r
-}\r
-\r
-bool XMLToolingInternalConfig::init()\r
-{\r
-#ifdef _DEBUG\r
-    xmltooling::NDC ndc("init");\r
-#endif\r
-    Category& log=Category::getInstance(XMLTOOLING_LOGCAT".XMLToolingConfig");\r
-    try {\r
-        log.debug("library initialization started");\r
-\r
-        xercesc::XMLPlatformUtils::Initialize();\r
-        log.debug("Xerces initialization complete");\r
-\r
-#ifndef XMLTOOLING_NO_XMLSEC\r
-        XSECPlatformUtils::Initialise();\r
-        m_xsecProvider=new XSECProvider();\r
-        log.debug("XMLSec initialization complete");\r
-#endif\r
-\r
-        m_parserPool=new ParserPool();\r
-        m_lock=xercesc::XMLPlatformUtils::makeMutex();\r
-\r
-        // default registrations\r
-        XMLObjectBuilder::registerDefaultBuilder(new UnknownElementBuilder());\r
-        Marshaller::registerDefaultMarshaller(new UnknownElementMarshaller());\r
-        Unmarshaller::registerDefaultUnmarshaller(new UnknownElementUnmarshaller());\r
-        \r
-        QName dsig(XMLConstants::XMLSIG_NS,Signature::LOCAL_NAME);\r
-        XMLObjectBuilder::registerBuilder(dsig,new XMLSecSignatureBuilder());\r
-        Marshaller::registerMarshaller(dsig,new XMLSecSignatureMarshaller());\r
-        Unmarshaller::registerUnmarshaller(dsig,new XMLSecSignatureUnmarshaller());\r
-    }\r
-    catch (const xercesc::XMLException&) {\r
-        log.fatal("caught exception while initializing Xerces");\r
-        return false;\r
-    }\r
-\r
-    log.info("library initialization complete");\r
-    return true;\r
-}\r
-\r
-void XMLToolingInternalConfig::term()\r
-{\r
-    XMLObjectBuilder::destroyBuilders();\r
-    Marshaller::destroyMarshallers();\r
-    Unmarshaller::destroyUnmarshallers();\r
-\r
-    for (vector<void*>::reverse_iterator i=m_libhandles.rbegin(); i!=m_libhandles.rend(); i++) {\r
-#if defined(WIN32)\r
-        FARPROC fn=GetProcAddress(static_cast<HMODULE>(*i),"xmltooling_extension_term");\r
-        if (fn)\r
-            fn();\r
-        FreeLibrary(static_cast<HMODULE>(*i));\r
-#elif defined(HAVE_DLFCN_H)\r
-        void (*fn)()=(void (*)())dlsym(*i,"xmltooling_extension_term");\r
-        if (fn)\r
-            fn();\r
-        dlclose(*i);\r
-#else\r
-# error "Don't know about dynamic loading on this platform!"\r
-#endif\r
-    }\r
-    m_libhandles.clear();\r
-    \r
-    delete m_parserPool;\r
-    m_parserPool=NULL;\r
-\r
-#ifndef XMLTOOLING_NO_XMLSEC\r
-    delete m_xsecProvider;\r
-    m_xsecProvider=NULL;\r
-    XSECPlatformUtils::Terminate();\r
-#endif\r
-\r
-    xercesc::XMLPlatformUtils::closeMutex(m_lock);\r
-    m_lock=NULL;\r
-    xercesc::XMLPlatformUtils::Terminate();\r
-\r
- #ifdef _DEBUG\r
-    xmltooling::NDC ndc("term");\r
-#endif\r
-   Category::getInstance(XMLTOOLING_LOGCAT".XMLToolingConfig").info("library shutdown complete");\r
-}\r
-\r
-ILockable& XMLToolingInternalConfig::lock()\r
-{\r
-    xercesc::XMLPlatformUtils::lockMutex(m_lock);\r
-    return *this;\r
-}\r
-\r
-void XMLToolingInternalConfig::unlock()\r
-{\r
-    xercesc::XMLPlatformUtils::unlockMutex(m_lock);\r
-}\r
-\r
-bool XMLToolingInternalConfig::load_library(const char* path, void* context)\r
-{\r
-#ifdef _DEBUG\r
-    xmltooling::NDC ndc("LoadLibrary");\r
-#endif\r
-    Category& log=Category::getInstance(XMLTOOLING_LOGCAT".XMLToolingConfig");\r
-    log.info("loading extension: %s", path);\r
-\r
-    Locker locker(this);\r
-\r
-#if defined(WIN32)\r
-    HMODULE handle=NULL;\r
-    char* fixed=const_cast<char*>(path);\r
-    if (strchr(fixed,'/')) {\r
-        fixed=strdup(path);\r
-        char* p=fixed;\r
-        while (p=strchr(p,'/'))\r
-            *p='\\';\r
-    }\r
-\r
-    UINT em=SetErrorMode(SEM_FAILCRITICALERRORS);\r
-    try {\r
-        handle=LoadLibraryEx(fixed,NULL,LOAD_WITH_ALTERED_SEARCH_PATH);\r
-        if (!handle)\r
-             handle=LoadLibraryEx(fixed,NULL,0);\r
-        if (!handle)\r
-            throw runtime_error(string("unable to load extension library: ") + fixed);\r
-        FARPROC fn=GetProcAddress(handle,"xmltooling_extension_init");\r
-        if (!fn)\r
-            throw runtime_error(string("unable to locate xmltooling_extension_init entry point: ") + fixed);\r
-        if (reinterpret_cast<int(*)(void*)>(fn)(context)!=0)\r
-            throw runtime_error(string("detected error in xmltooling_extension_init: ") + fixed);\r
-        if (fixed!=path)\r
-            free(fixed);\r
-        SetErrorMode(em);\r
-    }\r
-    catch(runtime_error& e) {\r
-        log.error(e.what());\r
-        if (handle)\r
-            FreeLibrary(handle);\r
-        SetErrorMode(em);\r
-        if (fixed!=path)\r
-            free(fixed);\r
-        return false;\r
-    }\r
-\r
-#elif defined(HAVE_DLFCN_H)\r
-    void* handle=dlopen(path,RTLD_LAZY);\r
-    if (!handle)\r
-        throw runtime_error(string("unable to load extension library '") + path + "': " + dlerror());\r
-    int (*fn)(void*)=(int (*)(void*))(dlsym(handle,"xmltooling_extension_init"));\r
-    if (!fn) {\r
-        dlclose(handle);\r
-        throw runtime_error(\r
-            string("unable to locate xmltooling_extension_init entry point in '") + path + "': " +\r
-                (dlerror() ? dlerror() : "unknown error")\r
-            );\r
-    }\r
-    try {\r
-        if (fn(context)!=0)\r
-            throw runtime_error(string("detected error in xmltooling_extension_init in ") + path);\r
-    }\r
-    catch(runtime_error& e) {\r
-        log.error(e.what());\r
-        if (handle)\r
-            dlclose(handle);\r
-        return false;\r
-    }\r
-#else\r
-# error "Don't know about dynamic loading on this platform!"\r
-#endif\r
-    m_libhandles.push_back(handle);\r
-    log.info("loaded extension: %s", path);\r
-    return true;\r
-}\r
+/*
+ *  Copyright 2001-2006 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * XMLToolingConfig.cpp
+ * 
+ * Library configuration 
+ */
+
+#include "internal.h"
+#include "XMLToolingConfig.h"
+#include "impl/UnknownElement.h"
+#include "signature/impl/XMLSecSignature.h"
+#include "util/NDC.h"
+
+#ifdef HAVE_DLFCN_H
+# include <dlfcn.h>
+#endif
+
+#include <log4cpp/Category.hh>
+#include <log4cpp/PropertyConfigurator.hh>
+#include <log4cpp/OstreamAppender.hh>
+#include <xercesc/util/PlatformUtils.hpp>
+#ifndef XMLTOOLING_NO_XMLSEC
+    #include <xsec/framework/XSECProvider.hpp>
+#endif
+
+#include <stdexcept>
+
+using namespace log4cpp;
+using namespace xmltooling;
+using namespace std;
+
+namespace {
+   XMLToolingInternalConfig g_config;
+}
+
+XMLToolingConfig& XMLToolingConfig::getConfig()
+{
+    return g_config;
+}
+
+XMLToolingInternalConfig& XMLToolingInternalConfig::getInternalConfig()
+{
+    return g_config;
+}
+
+bool XMLToolingInternalConfig::log_config(const char* config)
+{
+    try {
+        if (!config || !*config)
+            config=getenv("XMLTOOLING_LOG_CONFIG");
+        if (!config || !*config)
+            config="WARN";
+        
+        bool level=false;
+        Category& root = Category::getRoot();
+        if (!strcmp(config,"DEBUG")) {
+            root.setPriority(Priority::DEBUG);
+            level=true;
+        }
+        else if (!strcmp(config,"INFO")) {
+            root.setPriority(Priority::INFO);
+            level=true;
+        }
+        else if (!strcmp(config,"NOTICE")) {
+            root.setPriority(Priority::NOTICE);
+            level=true;
+        }
+        else if (!strcmp(config,"WARN")) {
+            root.setPriority(Priority::WARN);
+            level=true;
+        }
+        else if (!strcmp(config,"ERROR")) {
+            root.setPriority(Priority::ERROR);
+            level=true;
+        }
+        else if (!strcmp(config,"CRIT")) {
+            root.setPriority(Priority::CRIT);
+            level=true;
+        }
+        else if (!strcmp(config,"ALERT")) {
+            root.setPriority(Priority::ALERT);
+            level=true;
+        }
+        else if (!strcmp(config,"EMERG")) {
+            root.setPriority(Priority::EMERG);
+            level=true;
+        }
+        else if (!strcmp(config,"FATAL")) {
+            root.setPriority(Priority::FATAL);
+            level=true;
+        }
+        if (level)
+            root.setAppender(new OstreamAppender("default",&cerr));
+        else
+            PropertyConfigurator::configure(config);
+    }
+    catch (const ConfigureFailure& e) {
+        Category::getInstance(XMLTOOLING_LOGCAT".Logging").crit("failed to initialize log4cpp: %s", e.what());
+        return false;
+    }
+    
+    return true;
+}
+
+bool XMLToolingInternalConfig::init()
+{
+#ifdef _DEBUG
+    xmltooling::NDC ndc("init");
+#endif
+    Category& log=Category::getInstance(XMLTOOLING_LOGCAT".XMLToolingConfig");
+    try {
+        log.debug("library initialization started");
+
+        xercesc::XMLPlatformUtils::Initialize();
+        log.debug("Xerces initialization complete");
+
+#ifndef XMLTOOLING_NO_XMLSEC
+        XSECPlatformUtils::Initialise();
+        m_xsecProvider=new XSECProvider();
+        log.debug("XMLSec initialization complete");
+#endif
+
+        m_parserPool=new ParserPool();
+        m_lock=xercesc::XMLPlatformUtils::makeMutex();
+
+        // default registrations
+        XMLObjectBuilder::registerDefaultBuilder(new UnknownElementBuilder());
+        Marshaller::registerDefaultMarshaller(new UnknownElementMarshaller());
+        Unmarshaller::registerDefaultUnmarshaller(new UnknownElementUnmarshaller());
+#ifndef XMLTOOLING_NO_XMLSEC
+        QName dsig(XMLConstants::XMLSIG_NS,Signature::LOCAL_NAME);
+        XMLObjectBuilder::registerBuilder(dsig,new XMLSecSignatureBuilder());
+        Marshaller::registerMarshaller(dsig,new XMLSecSignatureMarshaller());
+        Unmarshaller::registerUnmarshaller(dsig,new XMLSecSignatureUnmarshaller());
+#endif
+    }
+    catch (const xercesc::XMLException&) {
+        log.fatal("caught exception while initializing Xerces");
+        return false;
+    }
+
+    log.info("library initialization complete");
+    return true;
+}
+
+void XMLToolingInternalConfig::term()
+{
+    XMLObjectBuilder::destroyBuilders();
+    Marshaller::destroyMarshallers();
+    Unmarshaller::destroyUnmarshallers();
+
+    for (vector<void*>::reverse_iterator i=m_libhandles.rbegin(); i!=m_libhandles.rend(); i++) {
+#if defined(WIN32)
+        FARPROC fn=GetProcAddress(static_cast<HMODULE>(*i),"xmltooling_extension_term");
+        if (fn)
+            fn();
+        FreeLibrary(static_cast<HMODULE>(*i));
+#elif defined(HAVE_DLFCN_H)
+        void (*fn)()=(void (*)())dlsym(*i,"xmltooling_extension_term");
+        if (fn)
+            fn();
+        dlclose(*i);
+#else
+# error "Don't know about dynamic loading on this platform!"
+#endif
+    }
+    m_libhandles.clear();
+    
+    delete m_parserPool;
+    m_parserPool=NULL;
+
+#ifndef XMLTOOLING_NO_XMLSEC
+    delete m_xsecProvider;
+    m_xsecProvider=NULL;
+    XSECPlatformUtils::Terminate();
+#endif
+
+    xercesc::XMLPlatformUtils::closeMutex(m_lock);
+    m_lock=NULL;
+    xercesc::XMLPlatformUtils::Terminate();
+
+ #ifdef _DEBUG
+    xmltooling::NDC ndc("term");
+#endif
+   Category::getInstance(XMLTOOLING_LOGCAT".XMLToolingConfig").info("library shutdown complete");
+}
+
+ILockable& XMLToolingInternalConfig::lock()
+{
+    xercesc::XMLPlatformUtils::lockMutex(m_lock);
+    return *this;
+}
+
+void XMLToolingInternalConfig::unlock()
+{
+    xercesc::XMLPlatformUtils::unlockMutex(m_lock);
+}
+
+bool XMLToolingInternalConfig::load_library(const char* path, void* context)
+{
+#ifdef _DEBUG
+    xmltooling::NDC ndc("LoadLibrary");
+#endif
+    Category& log=Category::getInstance(XMLTOOLING_LOGCAT".XMLToolingConfig");
+    log.info("loading extension: %s", path);
+
+    Locker locker(this);
+
+#if defined(WIN32)
+    HMODULE handle=NULL;
+    char* fixed=const_cast<char*>(path);
+    if (strchr(fixed,'/')) {
+        fixed=strdup(path);
+        char* p=fixed;
+        while (p=strchr(p,'/'))
+            *p='\\';
+    }
+
+    UINT em=SetErrorMode(SEM_FAILCRITICALERRORS);
+    try {
+        handle=LoadLibraryEx(fixed,NULL,LOAD_WITH_ALTERED_SEARCH_PATH);
+        if (!handle)
+             handle=LoadLibraryEx(fixed,NULL,0);
+        if (!handle)
+            throw runtime_error(string("unable to load extension library: ") + fixed);
+        FARPROC fn=GetProcAddress(handle,"xmltooling_extension_init");
+        if (!fn)
+            throw runtime_error(string("unable to locate xmltooling_extension_init entry point: ") + fixed);
+        if (reinterpret_cast<int(*)(void*)>(fn)(context)!=0)
+            throw runtime_error(string("detected error in xmltooling_extension_init: ") + fixed);
+        if (fixed!=path)
+            free(fixed);
+        SetErrorMode(em);
+    }
+    catch(runtime_error& e) {
+        log.error(e.what());
+        if (handle)
+            FreeLibrary(handle);
+        SetErrorMode(em);
+        if (fixed!=path)
+            free(fixed);
+        return false;
+    }
+
+#elif defined(HAVE_DLFCN_H)
+    void* handle=dlopen(path,RTLD_LAZY);
+    if (!handle)
+        throw runtime_error(string("unable to load extension library '") + path + "': " + dlerror());
+    int (*fn)(void*)=(int (*)(void*))(dlsym(handle,"xmltooling_extension_init"));
+    if (!fn) {
+        dlclose(handle);
+        throw runtime_error(
+            string("unable to locate xmltooling_extension_init entry point in '") + path + "': " +
+                (dlerror() ? dlerror() : "unknown error")
+            );
+    }
+    try {
+        if (fn(context)!=0)
+            throw runtime_error(string("detected error in xmltooling_extension_init in ") + path);
+    }
+    catch(runtime_error& e) {
+        log.error(e.what());
+        if (handle)
+            dlclose(handle);
+        return false;
+    }
+#else
+# error "Don't know about dynamic loading on this platform!"
+#endif
+    m_libhandles.push_back(handle);
+    log.info("loaded extension: %s", path);
+    return true;
+}
index 42548e0..a6c87cb 100644 (file)
@@ -1,79 +1,85 @@
-/*\r
- *  Copyright 2001-2005 Internet2\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/*\r
- *  internal.h - internally visible classes\r
- */\r
-\r
-#ifndef __xmltooling_internal_h__\r
-#define __xmltooling_internal_h__\r
-\r
-#ifdef WIN32\r
-# define _CRT_SECURE_NO_DEPRECATE 1\r
-# define _CRT_NONSTDC_NO_DEPRECATE 1\r
-#endif\r
-\r
-// eventually we might be able to support autoconf via cygwin...\r
-#if defined (_MSC_VER) || defined(__BORLANDC__)\r
-# include "config_win32.h"\r
-#else\r
-# include "config.h"\r
-#endif\r
-\r
-#include "base.h"\r
-#include "XMLToolingConfig.h"\r
-#include "util/ParserPool.h"\r
-\r
-#include <vector>\r
-#ifndef XMLTOOLING_NO_XMLSEC\r
-    #include <xsec/framework/XSECProvider.hpp>\r
-#endif\r
-\r
-#define XMLTOOLING_LOGCAT "XMLTooling"\r
-\r
-namespace xmltooling {\r
-    \r
-    class XMLToolingInternalConfig : public xmltooling::XMLToolingConfig\r
-    {\r
-    public:\r
-        XMLToolingInternalConfig() : m_lock(NULL), m_parserPool(NULL), m_xsecProvider(NULL) {}\r
-\r
-        static XMLToolingInternalConfig& getInternalConfig();\r
-\r
-        // global per-process setup and shutdown of runtime\r
-        bool init();\r
-        void term();\r
-\r
-        // global mutex available to library applications\r
-        xmltooling::ILockable& lock();\r
-        void unlock();\r
-\r
-        // configuration\r
-        bool load_library(const char* path, void* context=NULL);\r
-        bool log_config(const char* config=NULL);\r
-\r
-        // internal parser pool\r
-        xmltooling::ParserPool* m_parserPool;\r
-        XSECProvider* m_xsecProvider;\r
-\r
-    private:\r
-        std::vector<void*> m_libhandles;\r
-        void* m_lock;\r
-        //PlugManager m_plugMgr;\r
-    };\r
-};\r
-\r
-#endif /* __xmltooling_internal_h__ */\r
+/*
+ *  Copyright 2001-2005 Internet2
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ *  internal.h - internally visible classes
+ */
+
+#ifndef __xmltooling_internal_h__
+#define __xmltooling_internal_h__
+
+#ifdef WIN32
+# define _CRT_SECURE_NO_DEPRECATE 1
+# define _CRT_NONSTDC_NO_DEPRECATE 1
+#endif
+
+// eventually we might be able to support autoconf via cygwin...
+#if defined (_MSC_VER) || defined(__BORLANDC__)
+# include "config_win32.h"
+#else
+# include "config.h"
+#endif
+
+#include "base.h"
+#include "XMLToolingConfig.h"
+#include "util/ParserPool.h"
+
+#include <vector>
+#ifndef XMLTOOLING_NO_XMLSEC
+    #include <xsec/framework/XSECProvider.hpp>
+#endif
+
+#define XMLTOOLING_LOGCAT "XMLTooling"
+
+namespace xmltooling {
+    
+    class XMLToolingInternalConfig : public xmltooling::XMLToolingConfig
+    {
+    public:
+        XMLToolingInternalConfig() : m_lock(NULL), m_parserPool(NULL) {
+#ifndef XMLTOOLING_NO_XMLSEC
+            m_xsecProvider=NULL;
+#endif
+        }
+
+        static XMLToolingInternalConfig& getInternalConfig();
+
+        // global per-process setup and shutdown of runtime
+        bool init();
+        void term();
+
+        // global mutex available to library applications
+        xmltooling::ILockable& lock();
+        void unlock();
+
+        // configuration
+        bool load_library(const char* path, void* context=NULL);
+        bool log_config(const char* config=NULL);
+
+        // internal parser pool
+        xmltooling::ParserPool* m_parserPool;
+#ifndef XMLTOOLING_NO_XMLSEC
+        XSECProvider* m_xsecProvider;
+#endif
+
+    private:
+        std::vector<void*> m_libhandles;
+        void* m_lock;
+        //PlugManager m_plugMgr;
+    };
+};
+
+#endif /* __xmltooling_internal_h__ */
index 4085128..18d02d5 100644 (file)
@@ -52,8 +52,10 @@ public:
     static const XMLCh ID_ATTRIB_NAME[];
 
     SimpleXMLObject() : AbstractDOMCachingXMLObject(NAMESPACE, LOCAL_NAME, NAMESPACE_PREFIX), m_id(NULL), m_value(NULL) {
+#ifndef XMLTOOLING_NO_XMLSEC
         m_children.push_back(NULL);
         m_signature=m_children.begin();
+#endif
     }
 
     virtual ~SimpleXMLObject() {
@@ -101,7 +103,9 @@ private:
     XMLCh* m_id;
     XMLCh* m_value;
     vector<SimpleXMLObject*> m_simples;
+#ifndef XMLTOOLING_NO_XMLSEC
     list<XMLObject*>::iterator m_signature;
+#endif
 };
 
 class SimpleXMLObjectBuilder : public XMLObjectBuilder
@@ -147,8 +151,10 @@ private:
 
         if (XMLHelper::isNodeNamed(root, SimpleXMLObject::NAMESPACE, SimpleXMLObject::LOCAL_NAME))
             simpleXMLObject.getSimpleXMLObjects().push_back(dynamic_cast<SimpleXMLObject*>(childXMLObject));
+#ifndef XMLTOOLING_NO_XMLSEC
         else if (XMLHelper::isNodeNamed(root, XMLConstants::XMLSIG_NS, Signature::LOCAL_NAME))
             simpleXMLObject.setSignature(dynamic_cast<Signature*>(childXMLObject));
+#endif
         else
             throw UnmarshallingException("Unknown child element cannot be added to parent object.");
     }