2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END============================================
20 * Modifications copyright (c) 2018 Nokia
21 * ===================================================================
25 package org.onap.clamp.clds.util;
27 import com.att.eelf.configuration.EELFLogger;
28 import com.att.eelf.configuration.EELFManager;
30 import java.io.InputStream;
31 import java.util.Properties;
34 * This class give a way to know the Clamp version easily, the version in that
35 * file is set by maven at build time.
38 public class ClampVersioning {
39 private static final String RESOURCE_NAME = "clds-version.properties";
40 private static final String CLDS_VERSION_PROPERTY = "clds.version";
41 private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(ClampVersioning.class);
43 private ClampVersioning() {
46 public static String getCldsVersionFromProps() {
47 String cldsVersion = "";
48 Properties props = new Properties();
49 try (InputStream resourceStream = ResourceFileUtil.getResourceAsStream(RESOURCE_NAME)) {
50 props.load(resourceStream);
51 cldsVersion = props.getProperty(CLDS_VERSION_PROPERTY);
52 } catch (Exception ex) {
53 LOGGER.error("Exception caught during the "+CLDS_VERSION_PROPERTY+" property reading", ex);