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.
20 * Library configuration
23 #define SAML_DECLARE_VALIDATORS
26 #include "exceptions.h"
27 #include "SAMLConfig.h"
28 #include "saml1/core/Assertions.h"
29 #include "util/XMLConstants.h"
31 #include <log4cpp/Category.hh>
32 #include <xmltooling/XMLToolingConfig.h>
33 #include <xmltooling/util/NDC.h>
35 using namespace opensaml::saml1;
36 using namespace opensaml;
37 using namespace xmltooling;
38 using namespace log4cpp;
40 #define REGISTER_ELEMENT(namespaceURI,cname) \
41 q=QName(namespaceURI,cname::LOCAL_NAME); \
42 XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
43 Validator::registerValidator(q,new cname##SchemaValidator())
45 #define REGISTER_TYPE(namespaceURI,cname) \
46 q=QName(namespaceURI,cname::TYPE_NAME); \
47 XMLObjectBuilder::registerBuilder(q,new cname##Builder()); \
48 Validator::registerValidator(q,new cname##SchemaValidator())
51 //DECL_EXCEPTION_FACTORY(XMLParserException,xmltooling);
54 SAMLInternalConfig g_config;
57 SAMLConfig& SAMLConfig::getConfig()
62 SAMLInternalConfig& SAMLInternalConfig::getInternalConfig()
67 bool SAMLInternalConfig::init()
70 xmltooling::NDC ndc("init");
72 Category& log=Category::getInstance(SAML_LOGCAT".SAMLConfig");
73 log.debug("library initialization started");
75 XMLToolingConfig::getConfig().init();
76 log.debug("XMLTooling library initialized");
79 REGISTER_ELEMENT(XMLConstants::SAML1_NS,AssertionIDReference);
80 REGISTER_ELEMENT(XMLConstants::SAML1_NS,Audience);
81 REGISTER_ELEMENT(XMLConstants::SAML1_NS,ConfirmationMethod);
83 log.info("library initialization complete");
87 void SAMLInternalConfig::term()
90 xmltooling::NDC ndc("term");
92 XMLToolingConfig::getConfig().term();
93 Category::getInstance(SAML_LOGCAT".SAMLConfig").info("library shutdown complete");