#include "internal.h"
#include "exceptions.h"
#include "XMLToolingConfig.h"
+#include "encryption/Encryption.h"
#include "impl/UnknownElement.h"
-#include "signature/impl/XMLSecSignature.h"
+#include "signature/KeyInfo.h"
+#include "signature/Signature.h"
#include "util/NDC.h"
+#include "util/XMLConstants.h"
+#include "validation/Validator.h"
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#include <stdexcept>
-using namespace log4cpp;
+using namespace xmlencryption;
+using namespace xmlsignature;
using namespace xmltooling;
+using namespace log4cpp;
using namespace std;
-DECL_EXCEPTION_FACTORY(XMLParserException);
-DECL_EXCEPTION_FACTORY(XMLObjectException);
-DECL_EXCEPTION_FACTORY(MarshallingException);
-DECL_EXCEPTION_FACTORY(UnmarshallingException);
-DECL_EXCEPTION_FACTORY(UnknownElementException);
-DECL_EXCEPTION_FACTORY(UnknownAttributeException);
-DECL_EXCEPTION_FACTORY(ValidationException);
-DECL_EXCEPTION_FACTORY(SignatureException);
+DECL_EXCEPTION_FACTORY(XMLParserException,xmltooling);
+DECL_EXCEPTION_FACTORY(XMLObjectException,xmltooling);
+DECL_EXCEPTION_FACTORY(MarshallingException,xmltooling);
+DECL_EXCEPTION_FACTORY(UnmarshallingException,xmltooling);
+DECL_EXCEPTION_FACTORY(UnknownElementException,xmltooling);
+DECL_EXCEPTION_FACTORY(UnknownAttributeException,xmltooling);
+DECL_EXCEPTION_FACTORY(UnknownExtensionException,xmltooling);
+DECL_EXCEPTION_FACTORY(ValidationException,xmltooling);
+
+#ifndef XMLTOOLING_NO_XMLSEC
+ DECL_EXCEPTION_FACTORY(SignatureException,xmlsignature);
+#endif
-namespace {
+namespace xmltooling {
XMLToolingInternalConfig g_config;
}
#endif
m_parserPool=new ParserPool();
+ m_validatingPool=new ParserPool(true,true);
m_lock=xercesc::XMLPlatformUtils::makeMutex();
// default registrations
XMLObjectBuilder::registerDefaultBuilder(new UnknownElementBuilder());
+
+ registerKeyInfoClasses();
+ registerEncryptionClasses();
+
+ REGISTER_EXCEPTION_FACTORY(XMLParserException,xmltooling);
+ REGISTER_EXCEPTION_FACTORY(XMLObjectException,xmltooling);
+ REGISTER_EXCEPTION_FACTORY(MarshallingException,xmltooling);
+ REGISTER_EXCEPTION_FACTORY(UnmarshallingException,xmltooling);
+ REGISTER_EXCEPTION_FACTORY(UnknownElementException,xmltooling);
+ REGISTER_EXCEPTION_FACTORY(UnknownAttributeException,xmltooling);
+ REGISTER_EXCEPTION_FACTORY(ValidationException,xmltooling);
+
#ifndef XMLTOOLING_NO_XMLSEC
- XMLObjectBuilder::registerBuilder(QName(XMLConstants::XMLSIG_NS,Signature::LOCAL_NAME),new XMLSecSignatureBuilder());
+ XMLObjectBuilder::registerBuilder(QName(XMLConstants::XMLSIG_NS,Signature::LOCAL_NAME),new SignatureBuilder());
+ REGISTER_EXCEPTION_FACTORY(SignatureException,xmlsignature);
#endif
- REGISTER_EXCEPTION_FACTORY(XMLParserException);
- REGISTER_EXCEPTION_FACTORY(XMLObjectException);
- REGISTER_EXCEPTION_FACTORY(MarshallingException);
- REGISTER_EXCEPTION_FACTORY(UnmarshallingException);
- REGISTER_EXCEPTION_FACTORY(UnknownElementException);
- REGISTER_EXCEPTION_FACTORY(UnknownAttributeException);
- REGISTER_EXCEPTION_FACTORY(ValidationException);
- REGISTER_EXCEPTION_FACTORY(SignatureException);
}
catch (const xercesc::XMLException&) {
log.fatal("caught exception while initializing Xerces");
void XMLToolingInternalConfig::term()
{
XMLObjectBuilder::destroyBuilders();
+ KeyInfoSchemaValidators.destroyValidators();
+ EncryptionSchemaValidators.destroyValidators();
+ XMLToolingException::deregisterFactories();
for (vector<void*>::reverse_iterator i=m_libhandles.rbegin(); i!=m_libhandles.rend(); i++) {
#if defined(WIN32)
delete m_parserPool;
m_parserPool=NULL;
+ delete m_validatingPool;
+ m_validatingPool=NULL;
#ifndef XMLTOOLING_NO_XMLSEC
delete m_xsecProvider;
Category::getInstance(XMLTOOLING_LOGCAT".XMLToolingConfig").info("library shutdown complete");
}
-ILockable& XMLToolingInternalConfig::lock()
+Lockable* XMLToolingInternalConfig::lock()
{
xercesc::XMLPlatformUtils::lockMutex(m_lock);
- return *this;
+ return this;
}
void XMLToolingInternalConfig::unlock()