Skip to content

Package: KapuaBrokerJAXBContextLoader

KapuaBrokerJAXBContextLoader

nameinstructionbranchcomplexitylinemethod
KapuaBrokerJAXBContextLoader()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
init()
M: 14 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
reset()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2018, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.broker.core;
14:
15: import org.eclipse.kapua.KapuaException;
16: import org.eclipse.kapua.broker.core.setting.BrokerSetting;
17: import org.eclipse.kapua.broker.core.setting.BrokerSettingKey;
18: import org.eclipse.kapua.commons.util.ClassUtil;
19: import org.eclipse.kapua.commons.util.xml.JAXBContextProvider;
20: import org.eclipse.kapua.commons.util.xml.XmlUtil;
21: import org.slf4j.Logger;
22: import org.slf4j.LoggerFactory;
23:
24: /**
25: * Jaxb context loader
26: *
27: */
28: public class KapuaBrokerJAXBContextLoader {
29:
30: protected static final Logger logger = LoggerFactory.getLogger(KapuaBrokerJAXBContextLoader.class);
31:
32: private static final String BROKER_JAXB_CONTEXT_CLASS_NAME;
33:
34: static {
35: BrokerSetting config = BrokerSetting.getInstance();
36: BROKER_JAXB_CONTEXT_CLASS_NAME = config.getString(BrokerSettingKey.BROKER_JAXB_CONTEXT_CLASS_NAME);
37: }
38:
39: public void init() throws KapuaException {
40: logger.info(">>> Broker jaxb context loader... load context");
41: JAXBContextProvider jaxbContextProvider = ClassUtil.newInstance(BROKER_JAXB_CONTEXT_CLASS_NAME, BrokerJAXBContextProvider.class);
42: XmlUtil.setContextProvider(jaxbContextProvider);
43: logger.info(">>> Broker jaxb context loader... load context DONE");
44: }
45:
46: public void reset() {
47: XmlUtil.setContextProvider(null);
48: }
49:
50: }