diff options
Diffstat (limited to 'music-rest/src/main/java/org')
-rw-r--r-- | music-rest/src/main/java/org/onap/music/main/PropertiesLoader.java | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/music-rest/src/main/java/org/onap/music/main/PropertiesLoader.java b/music-rest/src/main/java/org/onap/music/main/PropertiesLoader.java index 7ef36f23..6fbc76a7 100644 --- a/music-rest/src/main/java/org/onap/music/main/PropertiesLoader.java +++ b/music-rest/src/main/java/org/onap/music/main/PropertiesLoader.java @@ -41,37 +41,43 @@ public class PropertiesLoader implements InitializingBean { @Value("${debug}") public String debug; - + @Value("${version}") public String version; @Value("${build}") public String build; - + @Value("${music.properties}") public String musicProperties; - + @Value("${lock.lease.period}") public String lockLeasePeriod; - + @Value("${cassandra.user}") public String cassandraUser; - + @Value("${cassandra.password}") public String cassandraPassword; - + @Value("${cassandra.port}") public String cassandraPort; - + + @Value("${cassandra.connecttimeoutms}") + public String cassandraConnectTimeOutMS; + + @Value("${cassandra.readtimeoutms}") + public String cassandraReadTimeOutMS; + @Value("${cadi}") public String isCadi; - + @Value("${keyspace.active}") public String isKeyspaceActive; @Value("${retry.count}") public String rertryCount; - + @Value("${transId.header.prefix}") private String transIdPrefix; @@ -83,7 +89,7 @@ public class PropertiesLoader implements InitializingBean { @Value("${messageId.header.prefix}") private String messageIdPrefix; - + @Value("${transId.header.required}") private Boolean transIdRequired; @@ -101,19 +107,19 @@ public class PropertiesLoader implements InitializingBean { @Value("${cipher.enc.key}") private String cipherEncKey; - + @SuppressWarnings("unused") - private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PropertiesLoader.class); - + private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PropertiesLoader.class); + @Bean public static PropertySourcesPlaceholderConfigurer propertyConfigInDev() { - + PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer(); pspc.setIgnoreResourceNotFound(true); pspc.setIgnoreUnresolvablePlaceholders(true); return pspc; } - + /** * . */ @@ -133,6 +139,12 @@ public class PropertiesLoader implements InitializingBean { if (cassandraPassword != null && !cassandraPassword.equals("${cassandra.password}")) { MusicUtil.setCassPwd(cassandraPassword); } + if (cassandraConnectTimeOutMS != null && !cassandraConnectTimeOutMS.equals("${cassandra.connecttimeoutms}")) { + MusicUtil.setCassandraConnectTimeOutMS(Integer.parseInt(cassandraConnectTimeOutMS)); + } + if (cassandraReadTimeOutMS != null && !cassandraReadTimeOutMS.equals("${cassandra.readtimeoutms}")) { + MusicUtil.setCassandraReadTimeOutMS(Integer.parseInt(cassandraReadTimeOutMS)); + } if (debug != null && !debug.equals("${debug}")) { MusicUtil.setDebug(Boolean.parseBoolean(debug)); } @@ -209,7 +221,15 @@ public class PropertiesLoader implements InitializingBean { if (properties.getProperty("cassandra.password")!=null) { MusicUtil.setCassPwd(properties.getProperty("cassandra.password")); } - + + if(properties.getProperty("cassandra.connectTimeOutMS")!=null) { + MusicUtil.setCassandraConnectTimeOutMS(Integer.parseInt(properties.getProperty("cassandra.connecttimeoutms"))); + } + + if(properties.getProperty("cassandra.readTimeOutMS")!=null) { + MusicUtil.setCassandraReadTimeOutMS(Integer.parseInt(properties.getProperty("cassandra.readtimeoutms"))); + } + if (properties.getProperty("music.properties")!=null) { MusicUtil.setMusicPropertiesFilePath(properties.getProperty("music.properties")); } @@ -283,11 +303,11 @@ public class PropertiesLoader implements InitializingBean { } } - + @Override public void afterPropertiesSet() throws Exception { // TODO Auto-generated method stub - + } } |