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