Skip to content

Package: SystemInfoServiceImpl

SystemInfoServiceImpl

nameinstructionbranchcomplexitylinemethod
SystemInfoServiceImpl()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getSystemInfo()
M: 55 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 14 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2023, 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.service.systeminfo.internal;
14:
15: import org.eclipse.kapua.commons.setting.system.SystemSetting;
16: import org.eclipse.kapua.commons.setting.system.SystemSettingKey;
17: import org.eclipse.kapua.locator.KapuaLocator;
18: import org.eclipse.kapua.locator.KapuaProvider;
19: import org.eclipse.kapua.service.systeminfo.SystemInfo;
20: import org.eclipse.kapua.service.systeminfo.SystemInfoFactory;
21: import org.eclipse.kapua.service.systeminfo.SystemInfoService;
22:
23: @KapuaProvider
24: public class SystemInfoServiceImpl implements SystemInfoService {
25: private final KapuaLocator locator = KapuaLocator.getInstance();
26:
27:
28: @Override
29: public SystemInfo getSystemInfo() {
30: SystemSetting systemSetting = SystemSetting.getInstance();
31: String version = systemSetting.getString(SystemSettingKey.VERSION);
32: String revision = systemSetting.getString(SystemSettingKey.BUILD_REVISION);
33: String branch = systemSetting.getString(SystemSettingKey.BUILD_BRANCH);
34: String timestamp = systemSetting.getString(SystemSettingKey.BUILD_TIMESTAMP);
35: String buildNumber = systemSetting.getString(SystemSettingKey.BUILD_NUMBER);
36:
37: SystemInfoFactory systemInfoFactory = locator.getFactory(SystemInfoFactory.class);
38: SystemInfo systemInfo = systemInfoFactory.newSystemInfo();
39: systemInfo.setVersion(version);
40: systemInfo.setRevision(revision);
41: systemInfo.setBuildBranch(branch);
42: systemInfo.setBuildTimestamp(timestamp + " UTC");
43: systemInfo.setBuildNumber(buildNumber);
44: return systemInfo;
45: }
46: }