removed code smells
[music.git] / music-core / src / main / java / org / onap / music / main / CorePropertiesLoader.java
1 /*
2  * ============LICENSE_START==========================================
3  * org.onap.music
4  * ===================================================================
5  *  Copyright (c) 2017 AT&T Intellectual Property
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  * 
19  * ============LICENSE_END=============================================
20  * ====================================================================
21  */
22
23 package org.onap.music.main;
24
25 import java.util.Properties;
26
27 public class CorePropertiesLoader {
28
29     public static void loadProperties(Properties properties) {
30         if (properties.getProperty("cassandra.host")!=null) {
31             MusicUtil.setMyCassaHost(properties.getProperty("cassandra.host"));
32         }
33
34         if (properties.getProperty("cassandra.port")!=null) {
35             MusicUtil.setCassandraPort(Integer.parseInt(properties.getProperty("cassandra.port")));
36         }
37
38         if (properties.getProperty("cassandra.user")!=null) {
39             MusicUtil.setCassName(properties.getProperty("cassandra.user"));
40         }
41
42         if (properties.getProperty("cassandra.password")!=null) {
43             MusicUtil.setCassPwd(properties.getProperty("cassandra.password"));
44         }
45         
46         if (properties.getProperty("music.properties")!=null) {
47             MusicUtil.setMusicPropertiesFilePath(properties.getProperty("music.properties"));
48         }
49
50         if (properties.getProperty("debug")!=null) {
51             MusicUtil.setDebug(Boolean.parseBoolean(properties.getProperty("debug")));
52         }
53
54         if (properties.getProperty("version")!=null) {
55             MusicUtil.setVersion(properties.getProperty("version"));
56         }
57
58         if (properties.getProperty("build")!=null) {
59             MusicUtil.setBuild(properties.getProperty("build"));
60         }
61
62         if (properties.getProperty("lock.lease.period")!=null) {
63             MusicUtil.setDefaultLockLeasePeriod(Long.parseLong(properties.getProperty("lock.lease.period")));
64         }
65
66         if (properties.getProperty("cadi")!=null) {
67             MusicUtil.setIsCadi(Boolean.parseBoolean(properties.getProperty("cadi")));
68         }
69
70         if (properties.getProperty("keyspace.active")!=null) {
71             MusicUtil.setKeyspaceActive(Boolean.parseBoolean(properties.getProperty("keyspace.active")));
72         }
73
74         if (properties.getProperty("retry.count")!=null) {
75             MusicUtil.setRetryCount(Integer.parseInt(properties.getProperty("retry.count")));
76         }
77
78         if (properties.getProperty("transId.header.prefix")!=null) {
79             MusicUtil.setTransIdPrefix(properties.getProperty("transId.header.prefix"));
80         }
81
82         if (properties.getProperty("conversation.header.prefix")!=null) {
83             MusicUtil.setConversationIdPrefix(properties.getProperty("conversation.header.prefix"));
84         }
85
86         if (properties.getProperty("clientId.header.prefix")!=null) {
87             MusicUtil.setClientIdPrefix(properties.getProperty("clientId.header.prefix"));
88         }
89
90         if (properties.getProperty("messageId.header.prefix")!=null) {
91             MusicUtil.setMessageIdPrefix(properties.getProperty("messageId.header.prefix"));
92         }
93
94         if (properties.getProperty("transId.header.required")!=null) {
95             MusicUtil.setTransIdRequired(Boolean.parseBoolean(properties.getProperty("transId.header.required")));
96         }
97
98         if (properties.getProperty("conversation.header.required")!=null) {
99             MusicUtil.setConversationIdRequired(Boolean.parseBoolean(properties.getProperty("conversation.header.required")));
100         }
101
102         if (properties.getProperty("clientId.header.required")!=null) {
103             MusicUtil.setClientIdRequired(Boolean.parseBoolean(properties.getProperty("clientId.header.required")));
104         }
105
106         if (properties.getProperty("messageId.header.required")!=null) {
107             MusicUtil.setMessageIdRequired(Boolean.parseBoolean(properties.getProperty("messageId.header.required")));
108         }
109
110         if (properties.getProperty("music.aaf.ns")!=null) {
111             MusicUtil.setMusicAafNs(properties.getProperty("music.aaf.ns"));
112         }
113
114         if (properties.getProperty("cipher.enc.key")!=null) {
115             MusicUtil.setCipherEncKey(properties.getProperty("cipher.enc.key"));
116         }
117
118     }
119     
120 }