2 * ============LICENSE_START==========================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * ============LICENSE_END=============================================
20 * ====================================================================
23 package org.onap.music.main;
25 import java.util.Properties;
27 public class CorePropertiesLoader {
29 public static void loadProperties(Properties properties) {
30 if (properties.getProperty("cassandra.host")!=null) {
31 MusicUtil.setMyCassaHost(properties.getProperty("cassandra.host"));
34 if (properties.getProperty("cassandra.port")!=null) {
35 MusicUtil.setCassandraPort(Integer.parseInt(properties.getProperty("cassandra.port")));
38 if (properties.getProperty("cassandra.user")!=null) {
39 MusicUtil.setCassName(properties.getProperty("cassandra.user"));
42 if (properties.getProperty("cassandra.password")!=null) {
43 MusicUtil.setCassPwd(properties.getProperty("cassandra.password"));
46 if (properties.getProperty("music.properties")!=null) {
47 MusicUtil.setMusicPropertiesFilePath(properties.getProperty("music.properties"));
50 if (properties.getProperty("debug")!=null) {
51 MusicUtil.setDebug(Boolean.parseBoolean(properties.getProperty("debug")));
54 if (properties.getProperty("version")!=null) {
55 MusicUtil.setVersion(properties.getProperty("version"));
58 if (properties.getProperty("build")!=null) {
59 MusicUtil.setBuild(properties.getProperty("build"));
62 if (properties.getProperty("lock.lease.period")!=null) {
63 MusicUtil.setDefaultLockLeasePeriod(Long.parseLong(properties.getProperty("lock.lease.period")));
66 if (properties.getProperty("cadi")!=null) {
67 MusicUtil.setIsCadi(Boolean.parseBoolean(properties.getProperty("cadi")));
70 if (properties.getProperty("keyspace.active")!=null) {
71 MusicUtil.setKeyspaceActive(Boolean.parseBoolean(properties.getProperty("keyspace.active")));
74 if (properties.getProperty("retry.count")!=null) {
75 MusicUtil.setRetryCount(Integer.parseInt(properties.getProperty("retry.count")));
78 if (properties.getProperty("transId.header.prefix")!=null) {
79 MusicUtil.setTransIdPrefix(properties.getProperty("transId.header.prefix"));
82 if (properties.getProperty("conversation.header.prefix")!=null) {
83 MusicUtil.setConversationIdPrefix(properties.getProperty("conversation.header.prefix"));
86 if (properties.getProperty("clientId.header.prefix")!=null) {
87 MusicUtil.setClientIdPrefix(properties.getProperty("clientId.header.prefix"));
90 if (properties.getProperty("messageId.header.prefix")!=null) {
91 MusicUtil.setMessageIdPrefix(properties.getProperty("messageId.header.prefix"));
94 if (properties.getProperty("transId.header.required")!=null) {
95 MusicUtil.setTransIdRequired(Boolean.parseBoolean(properties.getProperty("transId.header.required")));
98 if (properties.getProperty("conversation.header.required")!=null) {
99 MusicUtil.setConversationIdRequired(Boolean.parseBoolean(properties.getProperty("conversation.header.required")));
102 if (properties.getProperty("clientId.header.required")!=null) {
103 MusicUtil.setClientIdRequired(Boolean.parseBoolean(properties.getProperty("clientId.header.required")));
106 if (properties.getProperty("messageId.header.required")!=null) {
107 MusicUtil.setMessageIdRequired(Boolean.parseBoolean(properties.getProperty("messageId.header.required")));
110 if (properties.getProperty("music.aaf.ns")!=null) {
111 MusicUtil.setMusicAafNs(properties.getProperty("music.aaf.ns"));
114 if (properties.getProperty("cipher.enc.key")!=null) {
115 MusicUtil.setCipherEncKey(properties.getProperty("cipher.enc.key"));