Fix the ssl config
[clamp.git] / src / main / java / org / onap / clamp / clds / util / ClampVersioning.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2018 AT&T Intellectual Property. All rights
6  *                             reserved.
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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  * ===================================================================
22  *
23  */
24
25 package org.onap.clamp.clds.util;
26
27 import com.att.eelf.configuration.EELFLogger;
28 import com.att.eelf.configuration.EELFManager;
29
30 import java.io.InputStream;
31 import java.util.Properties;
32
33 /**
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.
36  *
37  */
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);
42
43     private ClampVersioning() {
44     }
45
46     /**
47      * Returns Clds version from properties.
48      *
49      * @return Clds version from properties
50      */
51     public static String getCldsVersionFromProps() {
52         String cldsVersion = "";
53         Properties props = new Properties();
54         try (InputStream resourceStream = ResourceFileUtils.getResourceAsStream(RESOURCE_NAME)) {
55             props.load(resourceStream);
56             cldsVersion = props.getProperty(CLDS_VERSION_PROPERTY);
57         } catch (Exception ex) {
58             LOGGER.error("Exception caught during the " + CLDS_VERSION_PROPERTY + " property reading", ex);
59         }
60         return cldsVersion;
61     }
62 }