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 import org.onap.music.eelf.logging.EELFLoggerDelegate;
29 public class CorePropertiesLoader {
31 public static void loadProperties(Properties properties) {
32 if (properties.getProperty("cassandra.host")!=null) {
33 MusicUtil.setMyCassaHost(properties.getProperty("cassandra.host"));
36 if (properties.getProperty("cassandra.port")!=null) {
37 MusicUtil.setCassandraPort(Integer.parseInt(properties.getProperty("cassandra.port")));
40 if (properties.getProperty("cassandra.user")!=null) {
41 MusicUtil.setCassName(properties.getProperty("cassandra.user"));
44 if (properties.getProperty("cassandra.password")!=null) {
45 MusicUtil.setCassPwd(properties.getProperty("cassandra.password"));
48 if (properties.getProperty("music.properties")!=null) {
49 MusicUtil.setMusicPropertiesFilePath(properties.getProperty("music.properties"));
52 if (properties.getProperty("debug")!=null) {
53 MusicUtil.setDebug(Boolean.parseBoolean(properties.getProperty("debug")));
56 if (properties.getProperty("version")!=null) {
57 MusicUtil.setVersion(properties.getProperty("version"));
60 if (properties.getProperty("build")!=null) {
61 MusicUtil.setBuild(properties.getProperty("build"));
64 if (properties.getProperty("lock.lease.period")!=null) {
65 MusicUtil.setDefaultLockLeasePeriod(Long.parseLong(properties.getProperty("lock.lease.period")));
68 if (properties.getProperty("cadi")!=null) {
69 MusicUtil.setIsCadi(Boolean.parseBoolean(properties.getProperty("cadi")));
72 if (properties.getProperty("keyspace.active")!=null) {
73 MusicUtil.setKeyspaceActive(Boolean.parseBoolean(properties.getProperty("keyspace.active")));
76 if (properties.getProperty("retry.count")!=null) {
77 MusicUtil.setRetryCount(Integer.parseInt(properties.getProperty("retry.count")));
80 if (properties.getProperty("transId.header.prefix")!=null) {
81 MusicUtil.setTransIdPrefix(properties.getProperty("transId.header.prefix"));
84 if (properties.getProperty("conversation.header.prefix")!=null) {
85 MusicUtil.setConversationIdPrefix(properties.getProperty("conversation.header.prefix"));
88 if (properties.getProperty("clientId.header.prefix")!=null) {
89 MusicUtil.setClientIdPrefix(properties.getProperty("clientId.header.prefix"));
92 if (properties.getProperty("messageId.header.prefix")!=null) {
93 MusicUtil.setMessageIdPrefix(properties.getProperty("messageId.header.prefix"));
96 if (properties.getProperty("transId.header.required")!=null) {
97 MusicUtil.setTransIdRequired(Boolean.parseBoolean(properties.getProperty("transId.header.required")));
100 if (properties.getProperty("conversation.header.required")!=null) {
101 MusicUtil.setConversationIdRequired(Boolean.parseBoolean(properties.getProperty("conversation.header.required")));
104 if (properties.getProperty("clientId.header.required")!=null) {
105 MusicUtil.setClientIdRequired(Boolean.parseBoolean(properties.getProperty("clientId.header.required")));
108 if (properties.getProperty("messageId.header.required")!=null) {
109 MusicUtil.setMessageIdRequired(Boolean.parseBoolean(properties.getProperty("messageId.header.required")));
112 if (properties.getProperty("music.aaf.ns")!=null) {
113 MusicUtil.setMusicAafNs(properties.getProperty("music.aaf.ns"));
116 if (properties.getProperty("cipher.enc.key")!=null) {
117 MusicUtil.setCipherEncKey(properties.getProperty("cipher.enc.key"));