Fix bug in filtering new FM notification
[dcaegen2/services/son-handler.git] / src / main / java / org / onap / dcaegen2 / services / sonhms / restclient / ConfigurationClient.java
1 /*******************************************************************************
2  *  ============LICENSE_START=======================================================
3  *  son-handler
4  *  ================================================================================
5  *   Copyright (C) 2021 Wipro Limited.
6  *   ==============================================================================
7  *     Licensed under the Apache License, Version 2.0 (the "License");
8  *     you may not use this file except in compliance with the License.
9  *     You may obtain a copy of the License at
10  *
11  *          http://www.apache.org/licenses/LICENSE-2.0
12  *
13  *     Unless required by applicable law or agreed to in writing, software
14  *     distributed under the License is distributed on an "AS IS" BASIS,
15  *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  *     See the License for the specific language governing permissions and
17  *     limitations under the License.
18  *     ============LICENSE_END=========================================================
19  *
20  *******************************************************************************/
21
22 package org.onap.dcaegen2.services.sonhms.restclient;
23
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
26
27 /**
28  * Class with method to get the Client type depending on the
29  * configuration client specified.
30  *
31  * @see org.onap.dcaegen2.services.sonhms.Configuration
32  */
33
34 public class ConfigurationClient
35 {
36      private static Logger log = LoggerFactory.getLogger(ConfigurationClient.class);
37
38     /**
39      * Method to get the Client type.
40      *
41      * @param config_name client name(CPS or ConfigDB)
42      * @return configuration client type
43      *
44      */
45     public static ConfigInterface configClient(String config_name)
46     {
47         if (config_name == null || config_name.isEmpty()){
48             log.info("Returning null from ConfigClient class");
49             return null;
50         }
51         if ("ConfigDB".equalsIgnoreCase(config_name)) {
52             log.info("Creating SdnrClient object");
53             return new SdnrRestClient();
54         }
55         if ("CPS".equalsIgnoreCase(config_name)) {
56             log.info("Creating CPSClient object");
57             return new CpsClient();
58         }
59         return null;
60     }
61 }