aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/music/main/MusicUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/onap/music/main/MusicUtil.java')
-rwxr-xr-xsrc/main/java/org/onap/music/main/MusicUtil.java83
1 files changed, 10 insertions, 73 deletions
diff --git a/src/main/java/org/onap/music/main/MusicUtil.java b/src/main/java/org/onap/music/main/MusicUtil.java
index cfad845d..c11b4c7e 100755
--- a/src/main/java/org/onap/music/main/MusicUtil.java
+++ b/src/main/java/org/onap/music/main/MusicUtil.java
@@ -23,15 +23,12 @@ package org.onap.music.main;
import java.io.File;
import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Properties;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.UUID;
@@ -72,8 +69,7 @@ public class MusicUtil {
public static final String UPSERT = "upsert";
public static final String USERID = "userId";
public static final String PASSWORD = "password";
-
- public static final String AUTHORIZATION = "Authorization";
+ public static final String AUTHORIZATION = "Authorization";
private static final String LOCALHOST = "localhost";
private static final String PROPERTIES_FILE = "/opt/app/music/etc/music.properties";
@@ -85,10 +81,6 @@ public class MusicUtil {
private static String myZkHost = LOCALHOST;
private static String myCassaHost = LOCALHOST;
private static String defaultMusicIp = LOCALHOST;
- private static int cassandraPort = 9042;
- private static int notifytimeout = 30000;
- private static int notifyinterval = 5000;
-
private static boolean debug = true;
private static String version = "2.3.0";
private static String musicRestIp = LOCALHOST;
@@ -96,31 +88,22 @@ public class MusicUtil {
private static long defaultLockLeasePeriod = 6000;
private static final String[] propKeys = new String[] { "zookeeper.host", "cassandra.host", "music.ip", "debug",
"version", "music.rest.ip", "music.properties", "lock.lease.period", "id", "all.ids", "public.ip",
- "all.pubic.ips", "cassandra.user", "cassandra.password", "aaf.endpoint.url","cassandra.port", "notify.timeout", "notify.interval" };
+ "all.pubic.ips", "cassandra.user", "cassandra.password", "aaf.endpoint.url" };
private static String cassName = "cassandra";
private static String cassPwd;
private static String aafEndpointUrl = null;
- public static final ConcurrentMap<String, Long> zkNodeMap = new ConcurrentHashMap<>();
+ public static ConcurrentMap<String, Long> zkNodeMap = new ConcurrentHashMap<>();
+
+ public static final long MusicEternityEpochMillis = 1533081600000L; // Wednesday, August 1, 2018 12:00:00 AM
+
+ public static final long MaxCriticalSectionDurationMillis = 1L * 24 * 60 * 60 * 1000; // 1 day
private MusicUtil() {
throw new IllegalStateException("Utility Class");
}
- /**
- *
- * @return cassandra port
- */
- public static int getCassandraPort() {
- return cassandraPort;
- }
-
- /**
- * set cassandra port
- * @param cassandraPort
- */
- public static void setCassandraPort(int cassandraPort) {
- MusicUtil.cassandraPort = cassandraPort;
- }
+
+
/**
* @return the cassName
*/
@@ -583,51 +566,5 @@ public class MusicUtil {
return authValues;
}
-
- public static void loadProperties() throws Exception {
- Properties prop = new Properties();
- InputStream input = null;
- try {
- // load the properties file
- input = MusicUtil.class.getClassLoader().getResourceAsStream("music.properties");
- prop.load(input);
- } catch (Exception ex) {
- logger.error(EELFLoggerDelegate.errorLogger, "Unable to find properties file.");
- throw new Exception();
- } finally {
- if (input != null) {
- try {
- input.close();
- } catch (IOException e) {
- logger.error(EELFLoggerDelegate.applicationLogger,"Load properties failed "+e.getMessage(),e);
- }
- }
- }
- // get the property value and return it
- MusicUtil.setMyCassaHost(prop.getProperty("cassandra.host"));
- String zkHosts = prop.getProperty("zookeeper.host");
- MusicUtil.setMyZkHost(zkHosts);
- MusicUtil.setCassName(prop.getProperty("cassandra.user"));
- MusicUtil.setCassPwd(prop.getProperty("cassandra.password"));
- MusicUtil.setCassandraPort(Integer.parseInt(prop.getProperty("cassandra.port")));
- MusicUtil.setNotifyTimeOut(Integer.parseInt(prop.getProperty("notify.timeout")));
- MusicUtil.setNotifyInterval(Integer.parseInt(prop.getProperty("notify.interval")));
-
- }
-
- public static void setNotifyInterval(int notifyinterval) {
- MusicUtil.notifyinterval = notifyinterval;
- }
- public static void setNotifyTimeOut(int notifytimeout) {
- MusicUtil.notifytimeout = notifytimeout;
- }
-
- public static int getNotifyInterval() {
- return MusicUtil.notifyinterval;
- }
-
- public static int getNotifyTimeout() {
- return MusicUtil.notifytimeout;
-
- }
+
}