Skip to content

Package: ServiceModuleBundle

ServiceModuleBundle

nameinstructionbranchcomplexitylinemethod
ServiceModuleBundle()
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
shutdown()
M: 29 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%
startup()
M: 29 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2016, 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.commons.core;
14:
15: import org.eclipse.kapua.KapuaException;
16: import org.eclipse.kapua.commons.event.ServiceEventBusManager;
17: import org.eclipse.kapua.locator.KapuaLocator;
18: import org.slf4j.Logger;
19: import org.slf4j.LoggerFactory;
20:
21: import java.util.Set;
22:
23: public class ServiceModuleBundle {
24:
25: private static final Logger logger = LoggerFactory.getLogger(ServiceModuleBundle.class);
26:
27: public ServiceModuleBundle() {
28: // Initialize the kapua locator
29: KapuaLocator.getInstance();
30: }
31:
32: public final void startup() throws KapuaException {
33: logger.info("Starting up...");
34:
35: logger.info("Startup Kapua Eventbus...");
36: ServiceEventBusManager.start();
37:
38: logger.info("Startup Kapua Service Modules...");
39: Set<ServiceModule> serviceModules = ServiceModuleConfiguration.getServiceModules();
40:• for (ServiceModule service : serviceModules) {
41: service.start();
42: }
43:
44: logger.info("Startup...DONE");
45: }
46:
47: public final void shutdown() throws KapuaException {
48: logger.info("Shutting down...");
49:
50: logger.info("Shutdown Kapua Service Modules...");
51: Set<ServiceModule> serviceModules = ServiceModuleConfiguration.getServiceModules();
52:• for (ServiceModule service : serviceModules) {
53: service.stop();
54: }
55:
56: logger.info("Shutdown Kapua Eventbus...");
57: ServiceEventBusManager.stop();
58:
59: logger.info("Shutdown...DONE");
60: }
61:
62: }