aboutsummaryrefslogtreecommitdiffstats
path: root/jar/src/main/java/org
diff options
context:
space:
mode:
authorNelson,Thomas(tn1381)(arthurdent3) <tn1381@att.com>2019-01-29 15:55:37 -0500
committerNelson,Thomas(tn1381)(arthurdent3) <tn1381@att.com>2019-01-29 16:05:01 -0500
commita27be9fdbbf2d271c9c5780ba70fe15a24dbdb63 (patch)
tree1fa631eae149ed6be33b636e7eac03dadbef64c3 /jar/src/main/java/org
parent95489883ce973e84267fcbcee685f1598d4bdd6e (diff)
Push variuos changes
- Spring Boot - Cadi - Cassandra Locking Change-Id: Ie9882f81f0ca141bdb7862cdabf978481fcd7c4a Issue-ID: MUSIC-296,MUSIC-272 Signed-off-by: Nelson,Thomas(tn1381)(arthurdent3) <tn1381@att.com>
Diffstat (limited to 'jar/src/main/java/org')
-rw-r--r--jar/src/main/java/org/onap/music/datastore/MusicDataStore.java99
-rw-r--r--jar/src/main/java/org/onap/music/datastore/PreparedQueryObject.java1
-rw-r--r--jar/src/main/java/org/onap/music/datastore/jsonobjects/AAFResponse.java1
-rw-r--r--jar/src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java18
-rw-r--r--jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java1
-rw-r--r--jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java1
-rw-r--r--jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonKeySpace.java1
-rw-r--r--jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java1
-rwxr-xr-xjar/src/main/java/org/onap/music/datastore/jsonobjects/JsonOnboard.java1
-rw-r--r--jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java1
-rw-r--r--jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java1
-rw-r--r--jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java1
-rw-r--r--jar/src/main/java/org/onap/music/datastore/jsonobjects/NameSpace.java1
-rw-r--r--jar/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java167
-rw-r--r--jar/src/main/java/org/onap/music/eelf/logging/EELFLoggerDelegate.java1
-rw-r--r--jar/src/main/java/org/onap/music/eelf/logging/format/AppMessages.java286
-rw-r--r--jar/src/main/java/org/onap/music/eelf/logging/format/ErrorCodes.java127
-rw-r--r--jar/src/main/java/org/onap/music/eelf/logging/format/ErrorSeverity.java1
-rw-r--r--jar/src/main/java/org/onap/music/eelf/logging/format/ErrorTypes.java27
-rw-r--r--jar/src/main/java/org/onap/music/exceptions/MusicExceptionMapper.java1
-rw-r--r--jar/src/main/java/org/onap/music/exceptions/MusicLockingException.java1
-rw-r--r--jar/src/main/java/org/onap/music/exceptions/MusicPolicyVoilationException.java1
-rw-r--r--jar/src/main/java/org/onap/music/exceptions/MusicQueryException.java1
-rw-r--r--jar/src/main/java/org/onap/music/lockingservice/LockListener.java1
-rw-r--r--jar/src/main/java/org/onap/music/lockingservice/MusicLockState.java9
-rw-r--r--jar/src/main/java/org/onap/music/lockingservice/MusicLockingService.java59
-rw-r--r--jar/src/main/java/org/onap/music/lockingservice/ProtocolSupport.java11
-rw-r--r--jar/src/main/java/org/onap/music/lockingservice/ZNodeName.java5
-rw-r--r--jar/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java43
-rw-r--r--jar/src/main/java/org/onap/music/lockingservice/ZooKeeperOperation.java1
-rwxr-xr-xjar/src/main/java/org/onap/music/main/CachingUtil.java55
-rw-r--r--jar/src/main/java/org/onap/music/main/CipherUtil.java407
-rw-r--r--jar/src/main/java/org/onap/music/main/CronJobManager.java1
-rw-r--r--jar/src/main/java/org/onap/music/main/MusicCore.java157
-rw-r--r--jar/src/main/java/org/onap/music/main/MusicDigest.java1
-rwxr-xr-xjar/src/main/java/org/onap/music/main/MusicUtil.java71
-rwxr-xr-xjar/src/main/java/org/onap/music/main/PropertiesListener.java3
-rw-r--r--jar/src/main/java/org/onap/music/main/ResultType.java7
-rw-r--r--jar/src/main/java/org/onap/music/main/ReturnType.java1
-rw-r--r--jar/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java33
-rwxr-xr-xjar/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java1
-rw-r--r--jar/src/main/java/org/onap/music/rest/RestMusicBmAPI.java1
-rwxr-xr-xjar/src/main/java/org/onap/music/rest/RestMusicDataAPI.java61
-rw-r--r--jar/src/main/java/org/onap/music/rest/RestMusicHealthCheckAPI.java103
-rw-r--r--jar/src/main/java/org/onap/music/rest/RestMusicLocksAPI.java5
-rwxr-xr-xjar/src/main/java/org/onap/music/rest/RestMusicQAPI.java1
-rw-r--r--jar/src/main/java/org/onap/music/rest/RestMusicTestAPI.java43
-rw-r--r--jar/src/main/java/org/onap/music/rest/RestMusicVersionAPI.java29
48 files changed, 948 insertions, 902 deletions
diff --git a/jar/src/main/java/org/onap/music/datastore/MusicDataStore.java b/jar/src/main/java/org/onap/music/datastore/MusicDataStore.java
index 71006f73..959ea83d 100644
--- a/jar/src/main/java/org/onap/music/datastore/MusicDataStore.java
+++ b/jar/src/main/java/org/onap/music/datastore/MusicDataStore.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore;
import java.net.InetAddress;
@@ -141,7 +142,7 @@ public class MusicDataStore {
} catch (SocketException e) {
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), AppMessages.CONNCECTIVITYERROR, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR);
}catch(Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), ErrorSeverity.ERROR, ErrorTypes.GENERALSERVICEERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), ErrorSeverity.ERROR, ErrorTypes.GENERALSERVICEERROR);
}
return allPossibleIps;
}
@@ -155,8 +156,8 @@ public class MusicDataStore {
String address = "localhost";
String[] addresses = null;
address = MusicUtil.getMyCassaHost();
- addresses = address.split(",");
-
+ addresses = address.split(",");
+
logger.info(EELFLoggerDelegate.applicationLogger,
"Connecting to cassa cluster: Iterating through possible ips:"
+ getAllPossibleLocalIps());
@@ -166,19 +167,19 @@ public class MusicDataStore {
.setConnectionsPerHost(HostDistance.REMOTE, 2, 4);
while (it.hasNext()) {
try {
- if(MusicUtil.getCassName() != null && MusicUtil.getCassPwd() != null) {
- logger.info(EELFLoggerDelegate.applicationLogger,
- "Building with credentials "+MusicUtil.getCassName()+" & "+MusicUtil.getCassPwd());
- cluster = Cluster.builder().withPort(9042)
- .withCredentials(MusicUtil.getCassName(), MusicUtil.getCassPwd())
- //.withLoadBalancingPolicy(new RoundRobinPolicy())
- .withPoolingOptions(poolingOptions)
- .addContactPoints(addresses).build();
- }
- else
- cluster = Cluster.builder().withPort(9042)
- //.withLoadBalancingPolicy(new RoundRobinPolicy())
- .addContactPoints(addresses).build();
+ if(MusicUtil.getCassName() != null && MusicUtil.getCassPwd() != null) {
+ logger.info(EELFLoggerDelegate.applicationLogger,
+ "Building with credentials "+MusicUtil.getCassName()+" & "+MusicUtil.getCassPwd());
+ cluster = Cluster.builder().withPort(9042)
+ .withCredentials(MusicUtil.getCassName(), MusicUtil.getCassPwd())
+ //.withLoadBalancingPolicy(new RoundRobinPolicy())
+ .withPoolingOptions(poolingOptions)
+ .addContactPoints(addresses).build();
+ }
+ else
+ cluster = Cluster.builder().withPort(9042)
+ //.withLoadBalancingPolicy(new RoundRobinPolicy())
+ .addContactPoints(addresses).build();
Metadata metadata = cluster.getMetadata();
logger.info(EELFLoggerDelegate.applicationLogger, "Connected to cassa cluster "
@@ -206,26 +207,26 @@ public class MusicDataStore {
* @param address
*/
private void connectToCassaCluster(String address) throws MusicServiceException {
- String[] addresses = null;
- addresses = address.split(",");
- PoolingOptions poolingOptions = new PoolingOptions();
+ String[] addresses = null;
+ addresses = address.split(",");
+ PoolingOptions poolingOptions = new PoolingOptions();
poolingOptions
.setConnectionsPerHost(HostDistance.LOCAL, 4, 10)
.setConnectionsPerHost(HostDistance.REMOTE, 2, 4);
if(MusicUtil.getCassName() != null && MusicUtil.getCassPwd() != null) {
- logger.info(EELFLoggerDelegate.applicationLogger,
- "Building with credentials "+MusicUtil.getCassName()+" & "+MusicUtil.getCassPwd());
- cluster = Cluster.builder().withPort(9042)
- .withCredentials(MusicUtil.getCassName(), MusicUtil.getCassPwd())
- //.withLoadBalancingPolicy(new RoundRobinPolicy())
- .withPoolingOptions(poolingOptions)
- .addContactPoints(addresses).build();
+ logger.info(EELFLoggerDelegate.applicationLogger,
+ "Building with credentials "+MusicUtil.getCassName()+" & "+MusicUtil.getCassPwd());
+ cluster = Cluster.builder().withPort(9042)
+ .withCredentials(MusicUtil.getCassName(), MusicUtil.getCassPwd())
+ //.withLoadBalancingPolicy(new RoundRobinPolicy())
+ .withPoolingOptions(poolingOptions)
+ .addContactPoints(addresses).build();
}
else {
- cluster = Cluster.builder().withPort(9042)
- //.withLoadBalancingPolicy(new RoundRobinPolicy())
- .withPoolingOptions(poolingOptions)
- .addContactPoints(addresses).build();
+ cluster = Cluster.builder().withPort(9042)
+ //.withLoadBalancingPolicy(new RoundRobinPolicy())
+ .withPoolingOptions(poolingOptions)
+ .addContactPoints(addresses).build();
}
Metadata metadata = cluster.getMetadata();
logger.info(EELFLoggerDelegate.applicationLogger, "Connected to cassa cluster "
@@ -355,7 +356,7 @@ public class MusicDataStore {
boolean result = false;
if (!MusicUtil.isValidQueryObject(!queryObject.getValues().isEmpty(), queryObject)) {
- logger.error(EELFLoggerDelegate.errorLogger, queryObject.getQuery(),AppMessages.QUERYERROR, ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, queryObject.getQuery(),AppMessages.QUERYERROR, ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
throw new MusicQueryException("Ill formed queryObject for the request = " + "["
+ queryObject.getQuery() + "]");
}
@@ -365,15 +366,15 @@ public class MusicDataStore {
+ queryObject.getValues());
PreparedStatement preparedInsert = null;
try {
-
- preparedInsert = session.prepare(queryObject.getQuery());
-
+
+ preparedInsert = session.prepare(queryObject.getQuery());
+
} catch(InvalidQueryException iqe) {
- logger.error(EELFLoggerDelegate.errorLogger, iqe.getMessage(),AppMessages.QUERYERROR, ErrorSeverity.CRITICAL, ErrorTypes.QUERYERROR);
- throw new MusicQueryException(iqe.getMessage());
+ logger.error(EELFLoggerDelegate.errorLogger, iqe.getMessage(),AppMessages.QUERYERROR, ErrorSeverity.CRITICAL, ErrorTypes.QUERYERROR);
+ throw new MusicQueryException(iqe.getMessage());
}catch(Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.QUERYERROR, ErrorSeverity.CRITICAL, ErrorTypes.QUERYERROR);
- throw new MusicQueryException(e.getMessage());
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.QUERYERROR, ErrorSeverity.CRITICAL, ErrorTypes.QUERYERROR);
+ throw new MusicQueryException(e.getMessage());
}
try {
@@ -391,11 +392,11 @@ public class MusicDataStore {
}
catch (AlreadyExistsException ae) {
logger.error(EELFLoggerDelegate.errorLogger, ae.getMessage(),AppMessages.SESSIONFAILED+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
- throw new MusicServiceException(ae.getMessage());
+ throw new MusicServiceException(ae.getMessage());
}
catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.SESSIONFAILED+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
- throw new MusicQueryException("Executing Session Failure for Request = " + "["
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.SESSIONFAILED+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ throw new MusicQueryException("Executing Session Failure for Request = " + "["
+ queryObject.getQuery() + "]" + " Reason = " + e.getMessage());
}
@@ -415,8 +416,8 @@ public class MusicDataStore {
throws MusicServiceException, MusicQueryException {
if (!MusicUtil.isValidQueryObject(!queryObject.getValues().isEmpty(), queryObject)) {
- logger.error(EELFLoggerDelegate.errorLogger, "",AppMessages.QUERYERROR+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
- throw new MusicQueryException("Ill formed queryObject for the request = " + "["
+ logger.error(EELFLoggerDelegate.errorLogger, "",AppMessages.QUERYERROR+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ throw new MusicQueryException("Ill formed queryObject for the request = " + "["
+ queryObject.getQuery() + "]");
}
logger.info(EELFLoggerDelegate.applicationLogger,
@@ -424,13 +425,13 @@ public class MusicDataStore {
ResultSet results = null;
try {
- PreparedStatement preparedEventualGet = session.prepare(queryObject.getQuery());
+ PreparedStatement preparedEventualGet = session.prepare(queryObject.getQuery());
preparedEventualGet.setConsistencyLevel(ConsistencyLevel.ONE);
results = session.execute(preparedEventualGet.bind(queryObject.getValues().toArray()));
} catch (Exception ex) {
- logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.UNKNOWNERROR+ "[" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
- throw new MusicServiceException(ex.getMessage());
+ logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.UNKNOWNERROR+ "[" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ throw new MusicServiceException(ex.getMessage());
}
return results;
}
@@ -447,7 +448,7 @@ public class MusicDataStore {
public ResultSet executeCriticalGet(PreparedQueryObject queryObject)
throws MusicServiceException, MusicQueryException {
if (!MusicUtil.isValidQueryObject(!queryObject.getValues().isEmpty(), queryObject)) {
- logger.error(EELFLoggerDelegate.errorLogger, "",AppMessages.QUERYERROR+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, "",AppMessages.QUERYERROR+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
throw new MusicQueryException("Error processing Prepared Query Object for the request = " + "["
+ queryObject.getQuery() + "]");
}
@@ -459,8 +460,8 @@ public class MusicDataStore {
try {
results = session.execute(preparedEventualGet.bind(queryObject.getValues().toArray()));
} catch (Exception ex) {
- logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.UNKNOWNERROR+ "[" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
- throw new MusicServiceException(ex.getMessage());
+ logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.UNKNOWNERROR+ "[" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ throw new MusicServiceException(ex.getMessage());
}
return results;
diff --git a/jar/src/main/java/org/onap/music/datastore/PreparedQueryObject.java b/jar/src/main/java/org/onap/music/datastore/PreparedQueryObject.java
index 694d9acd..28920cbb 100644
--- a/jar/src/main/java/org/onap/music/datastore/PreparedQueryObject.java
+++ b/jar/src/main/java/org/onap/music/datastore/PreparedQueryObject.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore;
import java.util.ArrayList;
diff --git a/jar/src/main/java/org/onap/music/datastore/jsonobjects/AAFResponse.java b/jar/src/main/java/org/onap/music/datastore/jsonobjects/AAFResponse.java
index df6089ee..6be6796c 100644
--- a/jar/src/main/java/org/onap/music/datastore/jsonobjects/AAFResponse.java
+++ b/jar/src/main/java/org/onap/music/datastore/jsonobjects/AAFResponse.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.util.ArrayList;
diff --git a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java
index 8de0a2cd..2fc4215b 100644
--- a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java
+++ b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java
@@ -24,14 +24,14 @@ package org.onap.music.datastore.jsonobjects;
public class JSONObject {
- private String data;
+ private String data;
- public String getData() {
- return data;
- }
-
- public void setData(String data) {
- this.data = data;
- }
-
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
}
diff --git a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
index a5db4be5..c90dd005 100644
--- a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
+++ b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.util.ArrayList;
diff --git a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java
index a58552c6..8e1d7ee8 100644
--- a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java
+++ b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.io.ByteArrayOutputStream;
diff --git a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonKeySpace.java b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonKeySpace.java
index 54de02fd..f2232ffd 100644
--- a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonKeySpace.java
+++ b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonKeySpace.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.util.Map;
diff --git a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java
index 497e17d1..06a76f57 100644
--- a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java
+++ b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
diff --git a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonOnboard.java b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonOnboard.java
index 0bac1e31..f7c3f8a7 100755
--- a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonOnboard.java
+++ b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonOnboard.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
diff --git a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java
index 64bc3887..831a9c61 100644
--- a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java
+++ b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.io.ByteArrayOutputStream;
diff --git a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java
index 5d508adb..368e4fac 100644
--- a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java
+++ b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.util.Map;
diff --git a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java
index 3ab5ea0d..47e1a12b 100644
--- a/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java
+++ b/jar/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.io.ByteArrayOutputStream;
diff --git a/jar/src/main/java/org/onap/music/datastore/jsonobjects/NameSpace.java b/jar/src/main/java/org/onap/music/datastore/jsonobjects/NameSpace.java
index 232353c1..3c18c791 100644
--- a/jar/src/main/java/org/onap/music/datastore/jsonobjects/NameSpace.java
+++ b/jar/src/main/java/org/onap/music/datastore/jsonobjects/NameSpace.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.util.List;
diff --git a/jar/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java b/jar/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java
index 1f4abea1..fdd706b2 100644
--- a/jar/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java
+++ b/jar/src/main/java/org/onap/music/eelf/healthcheck/MusicHealthCheck.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.eelf.healthcheck;
import java.io.BufferedReader;
@@ -57,119 +58,119 @@ import com.datastax.driver.core.ResultSet;
*
*/
public class MusicHealthCheck {
-
- private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicUtil.class);
-
- private String cassandrHost;
- private String zookeeperHost;
-
-
-
-
-
-
-
-
- public String getCassandraStatus() {
- logger.info(EELFLoggerDelegate.applicationLogger,"Getting Status for Cassandra");
- if(this.getAdminKeySpace()) {
- return "ACTIVE";
+
+ private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicUtil.class);
+
+ private String cassandrHost;
+ private String zookeeperHost;
+
+
+
+
+
+
+
+
+ public String getCassandraStatus() {
+ logger.info(EELFLoggerDelegate.applicationLogger,"Getting Status for Cassandra");
+ if(this.getAdminKeySpace()) {
+ return "ACTIVE";
}else {
- logger.info(EELFLoggerDelegate.applicationLogger,"Cassandra Service is not responding");
+ logger.info(EELFLoggerDelegate.applicationLogger,"Cassandra Service is not responding");
return "INACTIVE";
}
}
-
-
- private Boolean getAdminKeySpace() {
-
- String appName = "";
-
- PreparedQueryObject pQuery = new PreparedQueryObject();
+
+
+ private Boolean getAdminKeySpace() {
+
+ String appName = "";
+
+ PreparedQueryObject pQuery = new PreparedQueryObject();
pQuery.appendQueryString(
"select * from admin.keyspace_master");
//pQuery.addValue(MusicUtil.convertToActualDataType(DataType.text(), appName));
try {
- ResultSet rs = MusicCore.get(pQuery);
-
- if(rs != null) {
- return Boolean.TRUE;
- }else {
- return Boolean.FALSE;
- }
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(),AppMessages.CASSANDRACONNECTIVITY, ErrorTypes.CONNECTIONERROR, ErrorSeverity.CRITICAL);
- }
+ ResultSet rs = MusicCore.get(pQuery);
+
+ if(rs != null) {
+ return Boolean.TRUE;
+ }else {
+ return Boolean.FALSE;
+ }
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(),AppMessages.CASSANDRACONNECTIVITY, ErrorTypes.CONNECTIONERROR, ErrorSeverity.CRITICAL);
+ }
return Boolean.FALSE;
- }
-
- public String getZookeeperStatus() {
-
-
- String host = MusicUtil.getMyZkHost();
- logger.info(EELFLoggerDelegate.applicationLogger,"Getting Status for Zookeeper Host: "+host);
- try {
- MusicLockingService lockingService = MusicCore.getLockingServiceHandle();
- //additionally need to call the ZK to create,aquire and delete lock
- } catch (MusicLockingException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(),AppMessages.LOCKINGERROR, ErrorTypes.CONNECTIONERROR, ErrorSeverity.CRITICAL);
- return "INACTIVE";
- }
-
- logger.info(EELFLoggerDelegate.applicationLogger,"Zookeeper is Active and Running");
+ }
+
+ public String getZookeeperStatus() {
+
+
+ String host = MusicUtil.getMyZkHost();
+ logger.info(EELFLoggerDelegate.applicationLogger,"Getting Status for Zookeeper Host: "+host);
+ try {
+ MusicLockingService lockingService = MusicCore.getLockingServiceHandle();
+ //additionally need to call the ZK to create,aquire and delete lock
+ } catch (MusicLockingException e) {
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(),AppMessages.LOCKINGERROR, ErrorTypes.CONNECTIONERROR, ErrorSeverity.CRITICAL);
+ return "INACTIVE";
+ }
+
+ logger.info(EELFLoggerDelegate.applicationLogger,"Zookeeper is Active and Running");
return "ACTIVE";
- //return "Zookeeper is not responding";
+ //return "Zookeeper is not responding";
- }
+ }
- public String getCassandrHost() {
- return cassandrHost;
- }
+ public String getCassandrHost() {
+ return cassandrHost;
+ }
- public void setCassandrHost(String cassandrHost) {
- this.cassandrHost = cassandrHost;
- }
+ public void setCassandrHost(String cassandrHost) {
+ this.cassandrHost = cassandrHost;
+ }
- public String getZookeeperHost() {
- return zookeeperHost;
- }
+ public String getZookeeperHost() {
+ return zookeeperHost;
+ }
- public void setZookeeperHost(String zookeeperHost) {
- this.zookeeperHost = zookeeperHost;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ public void setZookeeperHost(String zookeeperHost) {
+ this.zookeeperHost = zookeeperHost;
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
}
diff --git a/jar/src/main/java/org/onap/music/eelf/logging/EELFLoggerDelegate.java b/jar/src/main/java/org/onap/music/eelf/logging/EELFLoggerDelegate.java
index 0c290b6f..0d1eb641 100644
--- a/jar/src/main/java/org/onap/music/eelf/logging/EELFLoggerDelegate.java
+++ b/jar/src/main/java/org/onap/music/eelf/logging/EELFLoggerDelegate.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.eelf.logging;
import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN;
diff --git a/jar/src/main/java/org/onap/music/eelf/logging/format/AppMessages.java b/jar/src/main/java/org/onap/music/eelf/logging/format/AppMessages.java
index 2c7952b2..545740dd 100644
--- a/jar/src/main/java/org/onap/music/eelf/logging/format/AppMessages.java
+++ b/jar/src/main/java/org/onap/music/eelf/logging/format/AppMessages.java
@@ -27,157 +27,157 @@ package org.onap.music.eelf.logging.format;
*
*/
public enum AppMessages {
-
-
-
- /*
- * 100-199 Security/Permission Related - Authentication problems
- * [ERR100E] Missing Information
- * [ERR101E] Authentication error occured
- *
- * 200-299 Availability/Timeout Related/IO - connectivity error - connection timeout
- * [ERR200E] Connectivity
- * [ERR201E] Host not available
- * [ERR202E] Error while connecting to Cassandra cluster
- * [ERR203E] IO Error has occured
- * [ERR204E] Execution Interrupted
- * [ERR205E] Session Expired
- * [ERR206E] Cache not authenticated
- *
- *
- * 300-399 Data Access/Integrity Related
- * [ERR300E] Incorrect data
- *
- * 400-499 - Cassandra Query Related
- * [ERR400E] Error while processing prepared query object
- * [ERR401E] Executing Session Failure for Request
- * [ERR402E] Ill formed queryObject for the request
- * [ERR403E] Error processing Prepared Query Object
- *
- * 500-599 - Zookeepr/Locking Related
- * [ERR500E] Invalid lock
- * [ERR501E] Locking Error has occured
- * [ERR502E] Zookeeper error has occured
- * [ERR503E] Failed to aquire lock store handle
- * [ERR504E] Failed to create Lock Reference
- * [ERR505E] Lock does not exist
- * [ERR506E] Failed to aquire lock
- * [ERR507E] Lock not aquired
- * [ERR508E] Lock state not set
- * [ERR509E] Lock not destroyed
- * [ERR510E] Lock not released
- * [ERR511E] Lock not deleted
- * [ERR512E] Failed to get ZK Lock Handle
- *
- *
- * 600 - 699 - Music Service Errors
- * [ERR600E] Error initializing the cache
- *
- * 700-799 Schema Interface Type/Validation - received Pay-load checksum is
- * invalid - received JSON is not valid
- *
- * 800-899 Business/Flow Processing Related - check out to service is not
- * allowed - Roll-back is done - failed to generate heat file
- *
- *
- * 900-999 Unknown Errors - Unexpected exception
- * [ERR900E] Unexpected error occured
- * [ERR901E] Number format exception
- *
- *
- * 1000-1099 Reserved - do not use
- *
- */
-
-
-
-
- MISSINGINFO("[ERR100E]", "Missing Information ","Details: NA", "Please check application credentials and/or headers"),
- AUTHENTICATIONERROR("[ERR101E]", "Authentication error occured ","Details: NA", "Please verify application credentials"),
- CONNCECTIVITYERROR("[ERR200E]"," Connectivity error","Details: NA ","Please check connectivity to external resources"),
- HOSTUNAVAILABLE("[ERR201E]","Host not available","Details: NA","Please verify the host details"),
- CASSANDRACONNECTIVITY("[ERR202E]","Error while connecting to Cassandra cluster",""," Please check cassandra cluster details"),
- IOERROR("[ERR203E]","IO Error has occured","","Please check IO"),
- EXECUTIONINTERRUPTED("[ERR204E]"," Execution Interrupted","",""),
- SESSIONEXPIRED("[ERR205E]"," Session Expired","","Session has expired."),
- CACHEAUTHENTICATION("[ERR206E]","Cache not authenticated",""," Cache not authenticated"),
-
- INCORRECTDATA("[ERR300E]"," Incorrect data",""," Please verify the request payload and try again"),
- MULTIPLERECORDS("[ERR301E]"," Multiple records found",""," Please verify the request payload and try again"),
- ALREADYEXIST("[ERR302E]"," Record already exist",""," Please verify the request payload and try again"),
- MISSINGDATA("[ERR300E]"," Incorrect data",""," Please verify the request payload and try again"),
-
- QUERYERROR("[ERR400E]","Error while processing prepared query object",""," Please verify the query"),
- SESSIONFAILED("[ERR401E]","Executing Session Failure for Request","","Please verify the session and request"),
-
- INVALIDLOCK("[ERR500E]"," Invalid lock or acquire failed",""," Lock is not valid to aquire"),
- LOCKINGERROR("[ERR501E]"," Locking Error has occured",""," Locking Error has occured"),
- KEEPERERROR("[ERR502E]"," Zookeeper error has occured","","Please check zookeeper details"),
- LOCKHANDLE("[ERR503E]","Failed to aquire lock store handle",""," Failed to aquire lock store handle"),
- CREATELOCK("[ERR504E]","Failed to aquire lock store handle ","","Failed to aquire lock store handle "),
- LOCKSTATE("[ERR508E]"," Lock state not set",""," Lock state not set"),
- DESTROYLOCK("[ERR509E]"," Lock not destroyed",""," Lock not destroyed"),
- RELEASELOCK("[ERR510E]"," Lock not released",""," Lock not released"),
- DELTELOCK("[ERR511E]",""," Lock not deleted "," Lock not deleted "),
- CACHEERROR("[ERR600E]"," Error initializing the cache",""," Error initializing the cache"),
-
- UNKNOWNERROR("[ERR900E]"," Unexpected error occured",""," Please check logs for details");
-
-
-
- ErrorTypes eType;
- ErrorSeverity alarmSeverity;
- ErrorSeverity errorSeverity;
- String errorCode;
- String errorDescription;
- String details;
- String resolution;
+
+
+
+ /*
+ * 100-199 Security/Permission Related - Authentication problems
+ * [ERR100E] Missing Information
+ * [ERR101E] Authentication error occured
+ *
+ * 200-299 Availability/Timeout Related/IO - connectivity error - connection timeout
+ * [ERR200E] Connectivity
+ * [ERR201E] Host not available
+ * [ERR202E] Error while connecting to Cassandra cluster
+ * [ERR203E] IO Error has occured
+ * [ERR204E] Execution Interrupted
+ * [ERR205E] Session Expired
+ * [ERR206E] Cache not authenticated
+ *
+ *
+ * 300-399 Data Access/Integrity Related
+ * [ERR300E] Incorrect data
+ *
+ * 400-499 - Cassandra Query Related
+ * [ERR400E] Error while processing prepared query object
+ * [ERR401E] Executing Session Failure for Request
+ * [ERR402E] Ill formed queryObject for the request
+ * [ERR403E] Error processing Prepared Query Object
+ *
+ * 500-599 - Zookeepr/Locking Related
+ * [ERR500E] Invalid lock
+ * [ERR501E] Locking Error has occured
+ * [ERR502E] Zookeeper error has occured
+ * [ERR503E] Failed to aquire lock store handle
+ * [ERR504E] Failed to create Lock Reference
+ * [ERR505E] Lock does not exist
+ * [ERR506E] Failed to aquire lock
+ * [ERR507E] Lock not aquired
+ * [ERR508E] Lock state not set
+ * [ERR509E] Lock not destroyed
+ * [ERR510E] Lock not released
+ * [ERR511E] Lock not deleted
+ * [ERR512E] Failed to get ZK Lock Handle
+ *
+ *
+ * 600 - 699 - Music Service Errors
+ * [ERR600E] Error initializing the cache
+ *
+ * 700-799 Schema Interface Type/Validation - received Pay-load checksum is
+ * invalid - received JSON is not valid
+ *
+ * 800-899 Business/Flow Processing Related - check out to service is not
+ * allowed - Roll-back is done - failed to generate heat file
+ *
+ *
+ * 900-999 Unknown Errors - Unexpected exception
+ * [ERR900E] Unexpected error occured
+ * [ERR901E] Number format exception
+ *
+ *
+ * 1000-1099 Reserved - do not use
+ *
+ */
+
+
+
+
+ MISSINGINFO("[ERR100E]", "Missing Information ","Details: NA", "Please check application credentials and/or headers"),
+ AUTHENTICATIONERROR("[ERR101E]", "Authentication error occured ","Details: NA", "Please verify application credentials"),
+ CONNCECTIVITYERROR("[ERR200E]"," Connectivity error","Details: NA ","Please check connectivity to external resources"),
+ HOSTUNAVAILABLE("[ERR201E]","Host not available","Details: NA","Please verify the host details"),
+ CASSANDRACONNECTIVITY("[ERR202E]","Error while connecting to Cassandra cluster",""," Please check cassandra cluster details"),
+ IOERROR("[ERR203E]","IO Error has occured","","Please check IO"),
+ EXECUTIONINTERRUPTED("[ERR204E]"," Execution Interrupted","",""),
+ SESSIONEXPIRED("[ERR205E]"," Session Expired","","Session has expired."),
+ CACHEAUTHENTICATION("[ERR206E]","Cache not authenticated",""," Cache not authenticated"),
+
+ INCORRECTDATA("[ERR300E]"," Incorrect data",""," Please verify the request payload and try again"),
+ MULTIPLERECORDS("[ERR301E]"," Multiple records found",""," Please verify the request payload and try again"),
+ ALREADYEXIST("[ERR302E]"," Record already exist",""," Please verify the request payload and try again"),
+ MISSINGDATA("[ERR300E]"," Incorrect data",""," Please verify the request payload and try again"),
+
+ QUERYERROR("[ERR400E]","Error while processing prepared query object",""," Please verify the query"),
+ SESSIONFAILED("[ERR401E]","Executing Session Failure for Request","","Please verify the session and request"),
+
+ INVALIDLOCK("[ERR500E]"," Invalid lock or acquire failed",""," Lock is not valid to aquire"),
+ LOCKINGERROR("[ERR501E]"," Locking Error has occured",""," Locking Error has occured"),
+ KEEPERERROR("[ERR502E]"," Zookeeper error has occured","","Please check zookeeper details"),
+ LOCKHANDLE("[ERR503E]","Failed to aquire lock store handle",""," Failed to aquire lock store handle"),
+ CREATELOCK("[ERR504E]","Failed to aquire lock store handle ","","Failed to aquire lock store handle "),
+ LOCKSTATE("[ERR508E]"," Lock state not set",""," Lock state not set"),
+ DESTROYLOCK("[ERR509E]"," Lock not destroyed",""," Lock not destroyed"),
+ RELEASELOCK("[ERR510E]"," Lock not released",""," Lock not released"),
+ DELTELOCK("[ERR511E]",""," Lock not deleted "," Lock not deleted "),
+ CACHEERROR("[ERR600E]"," Error initializing the cache",""," Error initializing the cache"),
+
+ UNKNOWNERROR("[ERR900E]"," Unexpected error occured",""," Please check logs for details");
+
+
+
+ ErrorTypes eType;
+ ErrorSeverity alarmSeverity;
+ ErrorSeverity errorSeverity;
+ String errorCode;
+ String errorDescription;
+ String details;
+ String resolution;
- AppMessages(String errorCode, String errorDescription, String details,String resolution) {
-
- this.errorCode = errorCode;
- this.errorDescription = errorDescription;
- this.details = details;
- this.resolution = resolution;
- }
+ AppMessages(String errorCode, String errorDescription, String details,String resolution) {
+
+ this.errorCode = errorCode;
+ this.errorDescription = errorDescription;
+ this.details = details;
+ this.resolution = resolution;
+ }
-
-
-
- AppMessages(ErrorTypes eType, ErrorSeverity alarmSeverity,
- ErrorSeverity errorSeverity, String errorCode, String errorDescription, String details,
- String resolution) {
-
- this.eType = eType;
- this.alarmSeverity = alarmSeverity;
- this.errorSeverity = errorSeverity;
- this.errorCode = errorCode;
- this.errorDescription = errorDescription;
- this.details = details;
- this.resolution = resolution;
- }
+
+
+
+ AppMessages(ErrorTypes eType, ErrorSeverity alarmSeverity,
+ ErrorSeverity errorSeverity, String errorCode, String errorDescription, String details,
+ String resolution) {
+
+ this.eType = eType;
+ this.alarmSeverity = alarmSeverity;
+ this.errorSeverity = errorSeverity;
+ this.errorCode = errorCode;
+ this.errorDescription = errorDescription;
+ this.details = details;
+ this.resolution = resolution;
+ }
- public String getDetails() {
- return this.details;
- }
+ public String getDetails() {
+ return this.details;
+ }
- public String getResolution() {
- return this.resolution;
- }
+ public String getResolution() {
+ return this.resolution;
+ }
- public String getErrorCode() {
- return this.errorCode;
- }
+ public String getErrorCode() {
+ return this.errorCode;
+ }
- public String getErrorDescription() {
- return this.errorDescription;
- }
+ public String getErrorDescription() {
+ return this.errorDescription;
+ }
-
+
-
-
-
+
+
+
}
diff --git a/jar/src/main/java/org/onap/music/eelf/logging/format/ErrorCodes.java b/jar/src/main/java/org/onap/music/eelf/logging/format/ErrorCodes.java
index b18c1771..0afd9eea 100644
--- a/jar/src/main/java/org/onap/music/eelf/logging/format/ErrorCodes.java
+++ b/jar/src/main/java/org/onap/music/eelf/logging/format/ErrorCodes.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.eelf.logging.format;
@@ -28,67 +29,67 @@ package org.onap.music.eelf.logging.format;
*
*/
public enum ErrorCodes {
-
-
- /*
- * 100-199 Security/Permission Related - Authentication problems
- * [ERR100E] Missing Information
- * [ERR101E] Authentication error occured
- *
- * 200-299 Availability/Timeout Related/IO - connectivity error - connection timeout
- * [ERR200E] Connectivity
- * [ERR201E] Host not available
- * [ERR202E] Error while connecting to Cassandra cluster
- * [ERR203E] IO Error has occured
- * [ERR204E] Execution Interrupted
- * [ERR205E] Session Expired
- * [ERR206E] Cache not authenticated
- *
- *
- * 300-399 Data Access/Integrity Related
- *
- * 400-499 - Cassandra Query Related
- * [ERR400E] Error while processing prepared query object
- * [ERR401E] Executing Session Failure for Request
- * [ERR402E] Ill formed queryObject for the request
- * [ERR403E] Error processing Prepared Query Object
- *
- * 500-599 - Zookeepr/Locking Related
- * [ERR500E] Invalid lock
- * [ERR501E] Locking Error has occured
- * [ERR502E] Zookeeper error has occured
- * [ERR503E] Failed to aquire lock store handle
- * [ERR504E] Failed to create Lock Reference
- * [ERR505E] Lock does not exist
- * [ERR506E] Failed to aquire lock
- * [ERR507E] Lock not aquired
- * [ERR508E] Lock state not set
- * [ERR509E] Lock not destroyed
- * [ERR510E] Lock not released
- * [ERR511E] Lock not deleted
- * [ERR512E] Failed to get ZK Lock Handle
- *
- *
- * 600 - 699 - Music Service Errors
- * [ERR600E] Error initializing the cache
- *
- * 700-799 Schema Interface Type/Validation - received Pay-load checksum is
- * invalid - received JSON is not valid
- *
- * 800-899 Business/Flow Processing Related - check out to service is not
- * allowed - Roll-back is done - failed to generate heat file
- *
- *
- * 900-999 Unknown Errors - Unexpected exception
- * [ERR900E] Unexpected error occured
- * [ERR901E] Number format exception
- *
- *
- * 1000-1099 Reserved - do not use
- *
- */
-
- /*SUCCESS("Success"), FAILURE("Failure");
+
+
+ /*
+ * 100-199 Security/Permission Related - Authentication problems
+ * [ERR100E] Missing Information
+ * [ERR101E] Authentication error occured
+ *
+ * 200-299 Availability/Timeout Related/IO - connectivity error - connection timeout
+ * [ERR200E] Connectivity
+ * [ERR201E] Host not available
+ * [ERR202E] Error while connecting to Cassandra cluster
+ * [ERR203E] IO Error has occured
+ * [ERR204E] Execution Interrupted
+ * [ERR205E] Session Expired
+ * [ERR206E] Cache not authenticated
+ *
+ *
+ * 300-399 Data Access/Integrity Related
+ *
+ * 400-499 - Cassandra Query Related
+ * [ERR400E] Error while processing prepared query object
+ * [ERR401E] Executing Session Failure for Request
+ * [ERR402E] Ill formed queryObject for the request
+ * [ERR403E] Error processing Prepared Query Object
+ *
+ * 500-599 - Zookeepr/Locking Related
+ * [ERR500E] Invalid lock
+ * [ERR501E] Locking Error has occured
+ * [ERR502E] Zookeeper error has occured
+ * [ERR503E] Failed to aquire lock store handle
+ * [ERR504E] Failed to create Lock Reference
+ * [ERR505E] Lock does not exist
+ * [ERR506E] Failed to aquire lock
+ * [ERR507E] Lock not aquired
+ * [ERR508E] Lock state not set
+ * [ERR509E] Lock not destroyed
+ * [ERR510E] Lock not released
+ * [ERR511E] Lock not deleted
+ * [ERR512E] Failed to get ZK Lock Handle
+ *
+ *
+ * 600 - 699 - Music Service Errors
+ * [ERR600E] Error initializing the cache
+ *
+ * 700-799 Schema Interface Type/Validation - received Pay-load checksum is
+ * invalid - received JSON is not valid
+ *
+ * 800-899 Business/Flow Processing Related - check out to service is not
+ * allowed - Roll-back is done - failed to generate heat file
+ *
+ *
+ * 900-999 Unknown Errors - Unexpected exception
+ * [ERR900E] Unexpected error occured
+ * [ERR901E] Number format exception
+ *
+ *
+ * 1000-1099 Reserved - do not use
+ *
+ */
+
+ /*SUCCESS("Success"), FAILURE("Failure");
private String result;
@@ -100,7 +101,7 @@ public enum ErrorCodes {
return result;
}
*/
-
-
+
+
}
diff --git a/jar/src/main/java/org/onap/music/eelf/logging/format/ErrorSeverity.java b/jar/src/main/java/org/onap/music/eelf/logging/format/ErrorSeverity.java
index cda5dd31..4e798239 100644
--- a/jar/src/main/java/org/onap/music/eelf/logging/format/ErrorSeverity.java
+++ b/jar/src/main/java/org/onap/music/eelf/logging/format/ErrorSeverity.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.eelf.logging.format;
/**
diff --git a/jar/src/main/java/org/onap/music/eelf/logging/format/ErrorTypes.java b/jar/src/main/java/org/onap/music/eelf/logging/format/ErrorTypes.java
index 2536f4a4..d263eef5 100644
--- a/jar/src/main/java/org/onap/music/eelf/logging/format/ErrorTypes.java
+++ b/jar/src/main/java/org/onap/music/eelf/logging/format/ErrorTypes.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.eelf.logging.format;
import com.att.eelf.i18n.EELFResolvableErrorEnum;
@@ -28,17 +29,17 @@ import com.att.eelf.i18n.EELFResolvableErrorEnum;
*
*/
public enum ErrorTypes implements EELFResolvableErrorEnum {
-
-
- CONNECTIONERROR,
- SESSIONEXPIRED,
- AUTHENTICATIONERROR,
- SERVICEUNAVAILABLE,
- QUERYERROR,
- DATAERROR,
- GENERALSERVICEERROR,
- MUSICSERVICEERROR,
- LOCKINGERROR,
- UNKNOWN,
-
+
+
+ CONNECTIONERROR,
+ SESSIONEXPIRED,
+ AUTHENTICATIONERROR,
+ SERVICEUNAVAILABLE,
+ QUERYERROR,
+ DATAERROR,
+ GENERALSERVICEERROR,
+ MUSICSERVICEERROR,
+ LOCKINGERROR,
+ UNKNOWN,
+
}
diff --git a/jar/src/main/java/org/onap/music/exceptions/MusicExceptionMapper.java b/jar/src/main/java/org/onap/music/exceptions/MusicExceptionMapper.java
index 14a23d1f..83bb1b8a 100644
--- a/jar/src/main/java/org/onap/music/exceptions/MusicExceptionMapper.java
+++ b/jar/src/main/java/org/onap/music/exceptions/MusicExceptionMapper.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.exceptions;
import java.io.EOFException;
diff --git a/jar/src/main/java/org/onap/music/exceptions/MusicLockingException.java b/jar/src/main/java/org/onap/music/exceptions/MusicLockingException.java
index 1a9e45d9..ab70c54c 100644
--- a/jar/src/main/java/org/onap/music/exceptions/MusicLockingException.java
+++ b/jar/src/main/java/org/onap/music/exceptions/MusicLockingException.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.exceptions;
/**
diff --git a/jar/src/main/java/org/onap/music/exceptions/MusicPolicyVoilationException.java b/jar/src/main/java/org/onap/music/exceptions/MusicPolicyVoilationException.java
index bade21a4..dbd5ae5c 100644
--- a/jar/src/main/java/org/onap/music/exceptions/MusicPolicyVoilationException.java
+++ b/jar/src/main/java/org/onap/music/exceptions/MusicPolicyVoilationException.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.exceptions;
/**
diff --git a/jar/src/main/java/org/onap/music/exceptions/MusicQueryException.java b/jar/src/main/java/org/onap/music/exceptions/MusicQueryException.java
index 24b8568b..803f993f 100644
--- a/jar/src/main/java/org/onap/music/exceptions/MusicQueryException.java
+++ b/jar/src/main/java/org/onap/music/exceptions/MusicQueryException.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.exceptions;
diff --git a/jar/src/main/java/org/onap/music/lockingservice/LockListener.java b/jar/src/main/java/org/onap/music/lockingservice/LockListener.java
index 33188e60..1089a3af 100644
--- a/jar/src/main/java/org/onap/music/lockingservice/LockListener.java
+++ b/jar/src/main/java/org/onap/music/lockingservice/LockListener.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.lockingservice;
/**
diff --git a/jar/src/main/java/org/onap/music/lockingservice/MusicLockState.java b/jar/src/main/java/org/onap/music/lockingservice/MusicLockState.java
index 6c31410f..b33c8326 100644
--- a/jar/src/main/java/org/onap/music/lockingservice/MusicLockState.java
+++ b/jar/src/main/java/org/onap/music/lockingservice/MusicLockState.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.lockingservice;
import java.io.ByteArrayInputStream;
@@ -107,8 +108,8 @@ public class MusicLockState implements Serializable {
}
public String getErrorMessage() {
- return errorMessage;
- }
+ return errorMessage;
+ }
public byte[] serialize() {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
@@ -117,7 +118,7 @@ public class MusicLockState implements Serializable {
out = new ObjectOutputStream(bos);
out.writeObject(this);
} catch (IOException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.IOERROR, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.IOERROR, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR);
}
return bos.toByteArray();
}
@@ -130,7 +131,7 @@ public class MusicLockState implements Serializable {
in = new ObjectInputStream(bis);
o = in.readObject();
} catch (ClassNotFoundException | IOException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.UNKNOWN);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.UNKNOWN);
}
return (MusicLockState) o;
}
diff --git a/jar/src/main/java/org/onap/music/lockingservice/MusicLockingService.java b/jar/src/main/java/org/onap/music/lockingservice/MusicLockingService.java
index 4070238a..aab50dc5 100644
--- a/jar/src/main/java/org/onap/music/lockingservice/MusicLockingService.java
+++ b/jar/src/main/java/org/onap/music/lockingservice/MusicLockingService.java
@@ -15,6 +15,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.lockingservice;
@@ -55,24 +56,24 @@ public class MusicLockingService implements Watcher {
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.IOERROR, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR);
throw new MusicServiceException("IO Error has occured" + e.getMessage());
} catch (InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
throw new MusicServiceException("Exception Occured " + e.getMessage());
}
}
public MusicLockingService(int timeout) throws MusicServiceException {
- CountDownLatch connectedSignal1 = new CountDownLatch(1);
- try {
+ CountDownLatch connectedSignal1 = new CountDownLatch(1);
+ try {
ZooKeeper zk1 = new ZooKeeper(MusicUtil.getMyZkHost(), SESSION_TIMEOUT, this);
connectedSignal1.await(timeout, TimeUnit.SECONDS);
if(!zk1.getState().isConnected()) {
- throw new MusicServiceException("Unable to Connect. Some nodes are down.");
+ throw new MusicServiceException("Unable to Connect. Some nodes are down.");
}
} catch (IOException e ) {
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.IOERROR, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR);
throw new MusicServiceException("IO Error has occured" + e.getMessage());
} catch (InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
throw new MusicServiceException("Exception Occured " + e.getMessage());
}
}
@@ -87,12 +88,12 @@ public class MusicLockingService implements Watcher {
connectedSignal.await();
zkLockHandle = new ZkStatelessLockService(zk);
} catch (IOException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.IOERROR, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.IOERROR, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR);
}catch( InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
- }catch(Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
- }
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ }catch(Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ }
}
public void createLockaIfItDoesNotExist(String lockName) {
@@ -111,17 +112,17 @@ public class MusicLockingService implements Watcher {
public MusicLockState getLockState(String lockName) throws MusicLockingException {
- byte[] data = null;
+ byte[] data = null;
try{
- data = zkLockHandle.getNodeData(lockName);
+ data = zkLockHandle.getNodeData(lockName);
}catch (Exception ex){
- logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}
if(data !=null)
return MusicLockState.deSerialize(data);
else {
- logger.error(EELFLoggerDelegate.errorLogger,"",AppMessages.INVALIDLOCK, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
- throw new MusicLockingException("Invalid lock or acquire failed");
+ logger.error(EELFLoggerDelegate.errorLogger,"",AppMessages.INVALIDLOCK, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ throw new MusicLockingException("Invalid lock or acquire failed");
}
}
@@ -137,12 +138,12 @@ public class MusicLockingService implements Watcher {
try {
return zkLockHandle.lock(lockName, lockId);
} catch (KeeperException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.LOCKINGERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.LOCKINGERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}catch( InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
- }catch(Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
- }
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ }catch(Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ }
return false;
}
@@ -152,11 +153,11 @@ public class MusicLockingService implements Watcher {
}
public void deleteLock(String lockName) throws MusicLockingException {
- if(lockIdExists(lockName))
- zkLockHandle.deleteLock(lockName);
- else{
- throw new MusicLockingException("Lock does not exist.Please check the lock: " + lockName + " and try again");
- }
+ if(lockIdExists(lockName))
+ zkLockHandle.deleteLock(lockName);
+ else{
+ throw new MusicLockingException("Lock does not exist.Please check the lock: " + lockName + " and try again");
+ }
}
public String whoseTurnIsIt(String lockName) {
@@ -176,9 +177,9 @@ public class MusicLockingService implements Watcher {
zkLockHandle.close();
}
- public boolean lockIdExists(String lockIdWithDollar) {
- String lockId = lockIdWithDollar.replace('$', '/');
- return zkLockHandle.checkIfLockExists(lockId);
- }
+ public boolean lockIdExists(String lockIdWithDollar) {
+ String lockId = lockIdWithDollar.replace('$', '/');
+ return zkLockHandle.checkIfLockExists(lockId);
+ }
}
diff --git a/jar/src/main/java/org/onap/music/lockingservice/ProtocolSupport.java b/jar/src/main/java/org/onap/music/lockingservice/ProtocolSupport.java
index 4082b3b8..b8be0c46 100644
--- a/jar/src/main/java/org/onap/music/lockingservice/ProtocolSupport.java
+++ b/jar/src/main/java/org/onap/music/lockingservice/ProtocolSupport.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.lockingservice;
import org.apache.zookeeper.CreateMode;
@@ -128,7 +129,7 @@ class ProtocolSupport {
try {
return operation.execute();
} catch (KeeperException.SessionExpiredException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.SESSIONEXPIRED+" for: " + zookeeper + " so reconnecting due to: " + e, ErrorSeverity.ERROR, ErrorTypes.SESSIONEXPIRED);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.SESSIONEXPIRED+" for: " + zookeeper + " so reconnecting due to: " + e, ErrorSeverity.ERROR, ErrorTypes.SESSIONEXPIRED);
throw e;
} catch (KeeperException.ConnectionLossException e) {
if (exception == null) {
@@ -174,9 +175,9 @@ class ProtocolSupport {
}
});
} catch (KeeperException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
} catch (InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}
}
@@ -199,8 +200,8 @@ class ProtocolSupport {
try {
Thread.sleep(attemptCount * retryDelay);
} catch (InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.GENERALSERVICEERROR);
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),"Thread failed to sleep: " + e);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.GENERALSERVICEERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),"Thread failed to sleep: " + e);
Thread.currentThread().interrupt();
}
}
diff --git a/jar/src/main/java/org/onap/music/lockingservice/ZNodeName.java b/jar/src/main/java/org/onap/music/lockingservice/ZNodeName.java
index 0c190f14..308e133f 100644
--- a/jar/src/main/java/org/onap/music/lockingservice/ZNodeName.java
+++ b/jar/src/main/java/org/onap/music/lockingservice/ZNodeName.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.lockingservice;
import org.onap.music.eelf.logging.EELFLoggerDelegate;
@@ -50,9 +51,9 @@ class ZNodeName implements Comparable<ZNodeName> {
// If an exception occurred we misdetected a sequence suffix,
// so return -1.
} catch (NumberFormatException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),"Number format exception "+idx, ErrorSeverity.ERROR, ErrorTypes.GENERALSERVICEERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),"Number format exception "+idx, ErrorSeverity.ERROR, ErrorTypes.GENERALSERVICEERROR);
} catch (ArrayIndexOutOfBoundsException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),"Array out of bounds for "+idx, ErrorSeverity.ERROR, ErrorTypes.GENERALSERVICEERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),"Array out of bounds for "+idx, ErrorSeverity.ERROR, ErrorTypes.GENERALSERVICEERROR);
}
}
}
diff --git a/jar/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java b/jar/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java
index e99df255..1c56238c 100644
--- a/jar/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java
+++ b/jar/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java
@@ -15,6 +15,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.lockingservice;
@@ -61,9 +62,9 @@ public class ZkStatelessLockService extends ProtocolSupport {
}
});
}catch (InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}catch (KeeperException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}
}
@@ -71,7 +72,7 @@ public class ZkStatelessLockService extends ProtocolSupport {
try {
zookeeper.close();
}catch (InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}
}
@@ -85,9 +86,9 @@ public class ZkStatelessLockService extends ProtocolSupport {
}
});
}catch (InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}catch (KeeperException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}
}
@@ -100,9 +101,9 @@ public class ZkStatelessLockService extends ProtocolSupport {
return null;
}catch (InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}catch (KeeperException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}
return null;
}
@@ -115,9 +116,9 @@ public class ZkStatelessLockService extends ProtocolSupport {
result = true;
}
}catch (InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}catch (KeeperException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}
return result;
}
@@ -132,9 +133,9 @@ public class ZkStatelessLockService extends ProtocolSupport {
try {
retryOperation(zop);
}catch (InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}catch (KeeperException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
}
return zop.getId();
}
@@ -172,14 +173,14 @@ public class ZkStatelessLockService extends ProtocolSupport {
};
zopdel.execute();
} catch (InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
// set that we have been interrupted.
Thread.currentThread().interrupt();
} catch (KeeperException.NoNodeException e) {
// do nothing
- throw new KeeperException.NoNodeException("Lock doesn't exists. Release lock operation failed.");
+ throw new KeeperException.NoNodeException("Lock doesn't exists. Release lock operation failed.");
} catch (KeeperException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
throw (RuntimeException) new RuntimeException(e.getMessage()).initCause(e);
}
}
@@ -199,13 +200,13 @@ public class ZkStatelessLockService extends ProtocolSupport {
}
return sortedNames.first().getName();
} catch (InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
// set that we have been interrupted.
Thread.currentThread().interrupt();
} catch (KeeperException.NoNodeException e) {
// do nothing
} catch (KeeperException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
throw (RuntimeException) new RuntimeException(e.getMessage()).initCause(e);
}
}
@@ -228,14 +229,14 @@ public class ZkStatelessLockService extends ProtocolSupport {
};
zopdel.execute();
} catch (InterruptedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
// set that we have been interrupted.
Thread.currentThread().interrupt();
} catch (KeeperException.NoNodeException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
// do nothing
} catch (KeeperException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.KEEPERERROR, ErrorSeverity.ERROR, ErrorTypes.LOCKINGERROR);
throw (RuntimeException) new RuntimeException(e.getMessage()).initCause(e);
}
}
@@ -286,7 +287,7 @@ public class ZkStatelessLockService extends ProtocolSupport {
CreateMode.PERSISTENT_SEQUENTIAL);
if (logger.isDebugEnabled()) {
- logger.debug(EELFLoggerDelegate.debugLogger, "Created id: " + id);
+ logger.debug(EELFLoggerDelegate.debugLogger, "Created id: " + id);
}
if (id != null)
break;
@@ -316,7 +317,7 @@ public class ZkStatelessLockService extends ProtocolSupport {
ZNodeName lastChildName = lessThanMe.last();
String lastChildId = lastChildName.getName();
if (logger.isDebugEnabled()) {
- logger.debug(EELFLoggerDelegate.debugLogger, "watching less than me node: " + lastChildId);
+ logger.debug(EELFLoggerDelegate.debugLogger, "watching less than me node: " + lastChildId);
}
Stat stat = zookeeper.exists(lastChildId, false);
if (stat != null) {
diff --git a/jar/src/main/java/org/onap/music/lockingservice/ZooKeeperOperation.java b/jar/src/main/java/org/onap/music/lockingservice/ZooKeeperOperation.java
index 7020d14d..d5ee5615 100644
--- a/jar/src/main/java/org/onap/music/lockingservice/ZooKeeperOperation.java
+++ b/jar/src/main/java/org/onap/music/lockingservice/ZooKeeperOperation.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.lockingservice;
import org.apache.zookeeper.KeeperException;
diff --git a/jar/src/main/java/org/onap/music/main/CachingUtil.java b/jar/src/main/java/org/onap/music/main/CachingUtil.java
index aa06aae2..f0dc06fc 100755
--- a/jar/src/main/java/org/onap/music/main/CachingUtil.java
+++ b/jar/src/main/java/org/onap/music/main/CachingUtil.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.main;
import java.util.Arrays;
@@ -122,12 +123,12 @@ public class CachingUtil implements Runnable {
@Override
public void run() {
- logger.info(EELFLoggerDelegate.applicationLogger,"Scheduled task invoked. Refreshing Cache...");
+ logger.info(EELFLoggerDelegate.applicationLogger,"Scheduled task invoked. Refreshing Cache...");
try {
- initializeAafCache();
- } catch (MusicServiceException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.INFO, ErrorTypes.GENERALSERVICEERROR);
- }
+ initializeAafCache();
+ } catch (MusicServiceException e) {
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.UNKNOWNERROR, ErrorSeverity.INFO, ErrorTypes.GENERALSERVICEERROR);
+ }
}
public static boolean authenticateAAFUser(String nameSpace, String userId, String password,
@@ -135,9 +136,9 @@ public class CachingUtil implements Runnable {
if (aafCache.get(nameSpace) != null) {
if (keySpace != null && !musicCache.get(keySpace).equals(nameSpace)) {
- logger.info(EELFLoggerDelegate.applicationLogger,"Create new application for the same namespace.");
+ logger.info(EELFLoggerDelegate.applicationLogger,"Create new application for the same namespace.");
} else if (aafCache.get(nameSpace).get(userId).equals(password)) {
- logger.info(EELFLoggerDelegate.applicationLogger,"Authenticated with cache value..");
+ logger.info(EELFLoggerDelegate.applicationLogger,"Authenticated with cache value..");
// reset invalid attempts to 0
userAttempts.put(nameSpace, 0);
return true;
@@ -155,7 +156,7 @@ public class CachingUtil implements Runnable {
logger.info(EELFLoggerDelegate.applicationLogger,"Resetting failed attempt.");
userAttempts.put(nameSpace, 0);
} else {
- logger.info(EELFLoggerDelegate.applicationLogger,"No more attempts allowed. Please wait for atleast 2 min.");
+ logger.info(EELFLoggerDelegate.applicationLogger,"No more attempts allowed. Please wait for atleast 2 min.");
throw new Exception("No more attempts allowed. Please wait for atleast 2 min.");
}
}
@@ -167,10 +168,10 @@ public class CachingUtil implements Runnable {
AAFResponse responseObj = triggerAAF(nameSpace, userId, password);
if (responseObj.getNs().size() > 0) {
if (responseObj.getNs().get(0).getAdmin().contains(userId)) {
- //Map<String, String> map = new HashMap<>();
+ //Map<String, String> map = new HashMap<>();
//map.put(userId, password);
//aafCache.put(nameSpace, map);
- return true;
+ return true;
}
}
logger.info(EELFLoggerDelegate.applicationLogger,"Invalid user. Cache not updated");
@@ -180,7 +181,7 @@ public class CachingUtil implements Runnable {
private static AAFResponse triggerAAF(String nameSpace, String userId, String password)
throws Exception {
if (MusicUtil.getAafEndpointUrl() == null) {
- logger.error(EELFLoggerDelegate.errorLogger,"",AppMessages.UNKNOWNERROR,ErrorSeverity.WARN, ErrorTypes.GENERALSERVICEERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,"",AppMessages.UNKNOWNERROR,ErrorSeverity.WARN, ErrorTypes.GENERALSERVICEERROR);
throw new Exception("AAF endpoint is not set. Please specify in the properties file.");
}
Client client = Client.create();
@@ -255,8 +256,8 @@ public class CachingUtil implements Runnable {
if(isAAF != null)
appNameCache.put(namespace, isAAF);
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), AppMessages.QUERYERROR,ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
- e.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), AppMessages.QUERYERROR,ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ e.printStackTrace();
}
}
return isAAF;
@@ -290,7 +291,7 @@ public class CachingUtil implements Runnable {
try {
appName = rs.getString("application_name");
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), AppMessages.QUERYERROR, ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), AppMessages.QUERYERROR, ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
e.printStackTrace();
}
return appName;
@@ -317,8 +318,8 @@ public class CachingUtil implements Runnable {
public static Map<String, Object> verifyOnboarding(String ns, String userId, String password) {
Map<String, Object> resultMap = new HashMap<>();
if (ns == null || userId == null || password == null) {
- logger.error(EELFLoggerDelegate.errorLogger,"", AppMessages.MISSINGINFO ,ErrorSeverity.WARN, ErrorTypes.AUTHENTICATIONERROR);
- logger.error(EELFLoggerDelegate.errorLogger,"One or more required headers is missing. userId: "+userId+" :: password: "+password);
+ logger.error(EELFLoggerDelegate.errorLogger,"", AppMessages.MISSINGINFO ,ErrorSeverity.WARN, ErrorTypes.AUTHENTICATIONERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,"One or more required headers is missing. userId: "+userId+" :: password: "+password);
resultMap.put("Exception",
"One or more required headers appName(ns), userId, password is missing. Please check.");
return resultMap;
@@ -327,20 +328,20 @@ public class CachingUtil implements Runnable {
queryObject.appendQueryString(
"select * from admin.keyspace_master where application_name = ? allow filtering");
try {
- queryObject.addValue(MusicUtil.convertToActualDataType(DataType.text(), ns));
+ queryObject.addValue(MusicUtil.convertToActualDataType(DataType.text(), ns));
} catch(Exception e) {
- resultMap.put("Exception",
+ resultMap.put("Exception",
"Unable to process input data. Invalid input data type. Please check ns, userId and password values. "+e.getMessage());
- return resultMap;
+ return resultMap;
}
Row rs = null;
- try {
- rs = MusicCore.get(queryObject).one();
- } catch (MusicServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- resultMap.put("Exception", "Unable to process operation. Error is "+e.getMessage());
- return resultMap;
+ try {
+ rs = MusicCore.get(queryObject).one();
+ } catch (MusicServiceException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ resultMap.put("Exception", "Unable to process operation. Error is "+e.getMessage());
+ return resultMap;
} catch (InvalidQueryException e) {
logger.error(EELFLoggerDelegate.errorLogger,"Exception admin keyspace not configured."+e.getMessage());
resultMap.put("Exception", "Please make sure admin.keyspace_master table is configured.");
@@ -350,7 +351,7 @@ public class CachingUtil implements Runnable {
logger.error(EELFLoggerDelegate.errorLogger,"Application is not onboarded. Please contact admin.");
resultMap.put("Exception", "Application is not onboarded. Please contact admin.");
} else {
- if(!(rs.getString("username").equals(userId)) || !(BCrypt.checkpw(password, rs.getString("password")))) {
+ if(!(rs.getString("username").equals(userId)) || !(BCrypt.checkpw(password, rs.getString("password")))) {
logger.error(EELFLoggerDelegate.errorLogger,"", AppMessages.AUTHENTICATIONERROR, ErrorSeverity.WARN, ErrorTypes.AUTHENTICATIONERROR);
logger.error(EELFLoggerDelegate.errorLogger,"Namespace, UserId and password doesn't match. namespace: "+ns+" and userId: "+userId);
resultMap.put("Exception", "Namespace, UserId and password doesn't match. namespace: "+ns+" and userId: "+userId);
diff --git a/jar/src/main/java/org/onap/music/main/CipherUtil.java b/jar/src/main/java/org/onap/music/main/CipherUtil.java
index 1c7a687b..8b1149c9 100644
--- a/jar/src/main/java/org/onap/music/main/CipherUtil.java
+++ b/jar/src/main/java/org/onap/music/main/CipherUtil.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.main;
import java.io.FileNotFoundException;
@@ -43,227 +44,227 @@ import org.onap.music.eelf.logging.EELFLoggerDelegate;
public class CipherUtil {
- /**
- * Default key.
- */
- private static String keyString = null;
+ /**
+ * Default key.
+ */
+ private static String keyString = null;
- private static final String ALGORITHM = "AES";
- private static final String ALGORYTHM_DETAILS = ALGORITHM + "/CBC/PKCS5PADDING";
- private static final int BLOCK_SIZE = 128;
- @SuppressWarnings("unused")
- private static SecretKeySpec secretKeySpec;
- private static IvParameterSpec ivspec;
- private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CipherUtil.class);
- /**
- * @deprecated Please use {@link #encryptPKC(String)} to encrypt the text.
- *
- * Encrypts the text using the specified secret key.
- *
- * @param plainText
- * Text to encrypt
- * @param secretKey
- * Key to use for encryption
- * @return encrypted version of plain text.
- * @
- * if any encryption step fails
- *
- */
- @Deprecated
- public static String encrypt(String plainText, String secretKey) {
- String encryptedString = null;
- try {
- byte[] encryptText = plainText.getBytes("UTF-8");
- byte[] rawKey = Base64.decodeBase64(secretKey);
- SecretKeySpec sKeySpec = new SecretKeySpec(rawKey, "AES");
- Cipher cipher = Cipher.getInstance("AES");
- cipher.init(Cipher.ENCRYPT_MODE, sKeySpec);
- encryptedString = Base64.encodeBase64String(cipher.doFinal(encryptText));
- } catch (BadPaddingException | IllegalBlockSizeException | InvalidKeyException | NoSuchAlgorithmException
- | NoSuchPaddingException | UnsupportedEncodingException ex) {
- }
- return encryptedString;
- }
+ private static final String ALGORITHM = "AES";
+ private static final String ALGORYTHM_DETAILS = ALGORITHM + "/CBC/PKCS5PADDING";
+ private static final int BLOCK_SIZE = 128;
+ @SuppressWarnings("unused")
+ private static SecretKeySpec secretKeySpec;
+ private static IvParameterSpec ivspec;
+ private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CipherUtil.class);
+ /**
+ * @deprecated Please use {@link #encryptPKC(String)} to encrypt the text.
+ *
+ * Encrypts the text using the specified secret key.
+ *
+ * @param plainText
+ * Text to encrypt
+ * @param secretKey
+ * Key to use for encryption
+ * @return encrypted version of plain text.
+ * @
+ * if any encryption step fails
+ *
+ */
+ @Deprecated
+ public static String encrypt(String plainText, String secretKey) {
+ String encryptedString = null;
+ try {
+ byte[] encryptText = plainText.getBytes("UTF-8");
+ byte[] rawKey = Base64.decodeBase64(secretKey);
+ SecretKeySpec sKeySpec = new SecretKeySpec(rawKey, "AES");
+ Cipher cipher = Cipher.getInstance("AES");
+ cipher.init(Cipher.ENCRYPT_MODE, sKeySpec);
+ encryptedString = Base64.encodeBase64String(cipher.doFinal(encryptText));
+ } catch (BadPaddingException | IllegalBlockSizeException | InvalidKeyException | NoSuchAlgorithmException
+ | NoSuchPaddingException | UnsupportedEncodingException ex) {
+ }
+ return encryptedString;
+ }
- /**
- * @deprecated Please use {@link #encryptPKC(String)} to encrypt the text.
- * Encrypts the text using the secret key in key.properties file.
- *
- * @param plainText
- * Text to encrypt
- * @return Encrypted Text
- * @
- * if any decryption step fails
- */
- @Deprecated
- public static String encrypt(String plainText) {
- return CipherUtil.encrypt(plainText, keyString);
- }
+ /**
+ * @deprecated Please use {@link #encryptPKC(String)} to encrypt the text.
+ * Encrypts the text using the secret key in key.properties file.
+ *
+ * @param plainText
+ * Text to encrypt
+ * @return Encrypted Text
+ * @
+ * if any decryption step fails
+ */
+ @Deprecated
+ public static String encrypt(String plainText) {
+ return CipherUtil.encrypt(plainText, keyString);
+ }
- /**
- * Encrypts the text using a secret key.
- *
- * @param plainText
- * Text to encrypt
- * @return Encrypted Text
- * @
- * if any decryption step fails
- */
- public static String encryptPKC(String plainText) {
- return CipherUtil.encryptPKC(plainText, keyString);
- }
+ /**
+ * Encrypts the text using a secret key.
+ *
+ * @param plainText
+ * Text to encrypt
+ * @return Encrypted Text
+ * @
+ * if any decryption step fails
+ */
+ public static String encryptPKC(String plainText) {
+ return CipherUtil.encryptPKC(plainText, keyString);
+ }
- /**
- *
- * @deprecated Please use {@link #decryptPKC(String)} to Decryption the text.
- *
- * Decrypts the text using the specified secret key.
- *
- * @param encryptedText
- * Text to decrypt
- * @param secretKey
- * Key to use for decryption
- * @return plain text version of encrypted text
- * @
- * if any decryption step fails
- *
- */
- @Deprecated
- public static String decrypt(String encryptedText, String secretKey) {
- String encryptedString = null;
- try {
- byte[] rawKey = Base64.decodeBase64(secretKey);
- SecretKeySpec sKeySpec = new SecretKeySpec(rawKey, "AES");
- byte[] encryptText = Base64.decodeBase64(encryptedText.getBytes("UTF-8"));
- Cipher cipher = Cipher.getInstance("AES");
- cipher.init(Cipher.DECRYPT_MODE, sKeySpec);
- encryptedString = new String(cipher.doFinal(encryptText));
- } catch (BadPaddingException | IllegalBlockSizeException | InvalidKeyException | NoSuchAlgorithmException
- | NoSuchPaddingException | UnsupportedEncodingException ex) {
- }
- return encryptedString;
- }
+ /**
+ *
+ * @deprecated Please use {@link #decryptPKC(String)} to Decryption the text.
+ *
+ * Decrypts the text using the specified secret key.
+ *
+ * @param encryptedText
+ * Text to decrypt
+ * @param secretKey
+ * Key to use for decryption
+ * @return plain text version of encrypted text
+ * @
+ * if any decryption step fails
+ *
+ */
+ @Deprecated
+ public static String decrypt(String encryptedText, String secretKey) {
+ String encryptedString = null;
+ try {
+ byte[] rawKey = Base64.decodeBase64(secretKey);
+ SecretKeySpec sKeySpec = new SecretKeySpec(rawKey, "AES");
+ byte[] encryptText = Base64.decodeBase64(encryptedText.getBytes("UTF-8"));
+ Cipher cipher = Cipher.getInstance("AES");
+ cipher.init(Cipher.DECRYPT_MODE, sKeySpec);
+ encryptedString = new String(cipher.doFinal(encryptText));
+ } catch (BadPaddingException | IllegalBlockSizeException | InvalidKeyException | NoSuchAlgorithmException
+ | NoSuchPaddingException | UnsupportedEncodingException ex) {
+ }
+ return encryptedString;
+ }
- private static SecretKeySpec getSecretKeySpec() {
- byte[] key = Base64.decodeBase64(keyString);
- return new SecretKeySpec(key, ALGORITHM);
- }
+ private static SecretKeySpec getSecretKeySpec() {
+ byte[] key = Base64.decodeBase64(keyString);
+ return new SecretKeySpec(key, ALGORITHM);
+ }
- private static SecretKeySpec getSecretKeySpec(String keyString) {
- byte[] key = Base64.decodeBase64(keyString);
- return new SecretKeySpec(key, ALGORITHM);
- }
+ private static SecretKeySpec getSecretKeySpec(String keyString) {
+ byte[] key = Base64.decodeBase64(keyString);
+ return new SecretKeySpec(key, ALGORITHM);
+ }
- /**
- * Encrypt the text using the secret key in key.properties file
- *
- * @param value
- * @return The encrypted string
- * @throws BadPaddingException
- * @
- * In case of issue with the encryption
- */
- public static String encryptPKC(String value, String skey) {
- Cipher cipher = null;
- byte[] iv = null, finalByte = null;
+ /**
+ * Encrypt the text using the secret key in key.properties file
+ *
+ * @param value
+ * @return The encrypted string
+ * @throws BadPaddingException
+ * @
+ * In case of issue with the encryption
+ */
+ public static String encryptPKC(String value, String skey) {
+ Cipher cipher = null;
+ byte[] iv = null, finalByte = null;
- try {
- cipher = Cipher.getInstance(ALGORYTHM_DETAILS, "SunJCE");
+ try {
+ cipher = Cipher.getInstance(ALGORYTHM_DETAILS, "SunJCE");
- SecureRandom r = SecureRandom.getInstance("SHA1PRNG");
- iv = new byte[BLOCK_SIZE / 8];
- r.nextBytes(iv);
- ivspec = new IvParameterSpec(iv);
- cipher.init(Cipher.ENCRYPT_MODE, getSecretKeySpec(skey), ivspec);
- finalByte = cipher.doFinal(value.getBytes());
+ SecureRandom r = SecureRandom.getInstance("SHA1PRNG");
+ iv = new byte[BLOCK_SIZE / 8];
+ r.nextBytes(iv);
+ ivspec = new IvParameterSpec(iv);
+ cipher.init(Cipher.ENCRYPT_MODE, getSecretKeySpec(skey), ivspec);
+ finalByte = cipher.doFinal(value.getBytes());
- } catch (Exception ex) {
-
- }
- return Base64.encodeBase64String(ArrayUtils.addAll(iv, finalByte));
- }
+ } catch (Exception ex) {
+
+ }
+ return Base64.encodeBase64String(ArrayUtils.addAll(iv, finalByte));
+ }
- /**
- * Decrypts the text using the secret key in key.properties file.
- *
- * @param message
- * The encrypted string that must be decrypted using the ecomp
- * Encryption Key
- * @return The String decrypted
- * @
- * if any decryption step fails
- */
- public static String decryptPKC(String message, String skey) {
- byte[] encryptedMessage = Base64.decodeBase64(message);
- Cipher cipher;
- byte[] decrypted = null;
- try {
- cipher = Cipher.getInstance(ALGORYTHM_DETAILS, "SunJCE");
- ivspec = new IvParameterSpec(ArrayUtils.subarray(encryptedMessage, 0, BLOCK_SIZE / 8));
- byte[] realData = ArrayUtils.subarray(encryptedMessage, BLOCK_SIZE / 8, encryptedMessage.length);
- cipher.init(Cipher.DECRYPT_MODE, getSecretKeySpec(skey), ivspec);
- decrypted = cipher.doFinal(realData);
+ /**
+ * Decrypts the text using the secret key in key.properties file.
+ *
+ * @param message
+ * The encrypted string that must be decrypted using the ecomp
+ * Encryption Key
+ * @return The String decrypted
+ * @
+ * if any decryption step fails
+ */
+ public static String decryptPKC(String message, String skey) {
+ byte[] encryptedMessage = Base64.decodeBase64(message);
+ Cipher cipher;
+ byte[] decrypted = null;
+ try {
+ cipher = Cipher.getInstance(ALGORYTHM_DETAILS, "SunJCE");
+ ivspec = new IvParameterSpec(ArrayUtils.subarray(encryptedMessage, 0, BLOCK_SIZE / 8));
+ byte[] realData = ArrayUtils.subarray(encryptedMessage, BLOCK_SIZE / 8, encryptedMessage.length);
+ cipher.init(Cipher.DECRYPT_MODE, getSecretKeySpec(skey), ivspec);
+ decrypted = cipher.doFinal(realData);
- } catch (Exception ex) {
-
-
- }
+ } catch (Exception ex) {
+
+
+ }
- return new String(decrypted);
- }
+ return new String(decrypted);
+ }
- /**
- * @deprecated Please use {@link #decryptPKC(String)} to Decrypt the text.
- *
- * Decrypts the text using the secret key in key.properties file.
- *
- * @param encryptedText
- * Text to decrypt
- * @return Decrypted text
- * @
- * if any decryption step fails
- */
- @Deprecated
- public static String decrypt(String encryptedText) {
- return CipherUtil.decrypt(encryptedText, keyString);
- }
+ /**
+ * @deprecated Please use {@link #decryptPKC(String)} to Decrypt the text.
+ *
+ * Decrypts the text using the secret key in key.properties file.
+ *
+ * @param encryptedText
+ * Text to decrypt
+ * @return Decrypted text
+ * @
+ * if any decryption step fails
+ */
+ @Deprecated
+ public static String decrypt(String encryptedText) {
+ return CipherUtil.decrypt(encryptedText, keyString);
+ }
- /**
- *
- * Decrypts the text using the secret key in key.properties file.
- *
- * @param encryptedText
- * Text to decrypt
- * @return Decrypted text
- * @
- * if any decryption step fails
- */
- public static String decryptPKC(String encryptedText) {
- return CipherUtil.decryptPKC(encryptedText, keyString);
- }
+ /**
+ *
+ * Decrypts the text using the secret key in key.properties file.
+ *
+ * @param encryptedText
+ * Text to decrypt
+ * @return Decrypted text
+ * @
+ * if any decryption step fails
+ */
+ public static String decryptPKC(String encryptedText) {
+ return CipherUtil.decryptPKC(encryptedText, keyString);
+ }
-
- public static void readAndSetKeyString() {
- try {
- Scanner in = new Scanner(new FileReader("/opt/app/music/etc/properties.txt"));
- StringBuilder sb = new StringBuilder();
- while(in.hasNext()) {
- sb.append(in.next());
- }
- in.close();
- keyString = sb.toString();
- } catch (FileNotFoundException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage());
- }
- }
+
+ public static void readAndSetKeyString() {
+ try {
+ Scanner in = new Scanner(new FileReader("/opt/app/music/etc/properties.txt"));
+ StringBuilder sb = new StringBuilder();
+ while(in.hasNext()) {
+ sb.append(in.next());
+ }
+ in.close();
+ keyString = sb.toString();
+ } catch (FileNotFoundException e) {
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage());
+ }
+ }
- /*public static void main(String[] args) {
+ /*public static void main(String[] args) {
- System.out.println("Encrypted password: "+encryptPKC("cassandra"));
+ System.out.println("Encrypted password: "+encryptPKC("cassandra"));
- System.out.println("Decrypted password: "+decryptPKC("dDhqAp5/RwZbl9yRSZg15fN7Qul9eiE/JFkKemtTib0="));
- System.out.println("Decrypted password: "+decryptPKC("I/dOtD/YYzBStbtOYhKuUUyPHSW2G9ZzdSyB8bJp4vk="));
- System.out.println("Decrypted password: "+decryptPKC("g7zJqg74dLsH/fyL7I75b4eySy3pbMS2xVqkrB5lDl8="));
- }*/
+ System.out.println("Decrypted password: "+decryptPKC("dDhqAp5/RwZbl9yRSZg15fN7Qul9eiE/JFkKemtTib0="));
+ System.out.println("Decrypted password: "+decryptPKC("I/dOtD/YYzBStbtOYhKuUUyPHSW2G9ZzdSyB8bJp4vk="));
+ System.out.println("Decrypted password: "+decryptPKC("g7zJqg74dLsH/fyL7I75b4eySy3pbMS2xVqkrB5lDl8="));
+ }*/
}
diff --git a/jar/src/main/java/org/onap/music/main/CronJobManager.java b/jar/src/main/java/org/onap/music/main/CronJobManager.java
index fb4a2ac3..85769451 100644
--- a/jar/src/main/java/org/onap/music/main/CronJobManager.java
+++ b/jar/src/main/java/org/onap/music/main/CronJobManager.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.main;
import java.util.concurrent.Executors;
diff --git a/jar/src/main/java/org/onap/music/main/MusicCore.java b/jar/src/main/java/org/onap/music/main/MusicCore.java
index cad384a3..21509fa4 100644
--- a/jar/src/main/java/org/onap/music/main/MusicCore.java
+++ b/jar/src/main/java/org/onap/music/main/MusicCore.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.main;
@@ -87,7 +88,7 @@ public class MusicCore {
try {
mLockHandle = new MusicLockingService();
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.LOCKHANDLE,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.LOCKHANDLE,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
throw new MusicLockingException("Failed to aquire Locl store handle " + e);
}
}
@@ -105,11 +106,11 @@ public class MusicCore {
logger.info(EELFLoggerDelegate.applicationLogger,"Acquiring data store handle");
long start = System.currentTimeMillis();
if (mDstoreHandle == null) {
- try {
- MusicUtil.loadProperties();
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "No properties file defined. Falling back to default.");
- }
+ try {
+ MusicUtil.loadProperties();
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "No properties file defined. Falling back to default.");
+ }
mDstoreHandle = new MusicDataStore(remoteIp);
}
long end = System.currentTimeMillis();
@@ -126,11 +127,11 @@ public class MusicCore {
logger.info(EELFLoggerDelegate.applicationLogger,"Acquiring data store handle");
long start = System.currentTimeMillis();
if (mDstoreHandle == null) {
- try {
- MusicUtil.loadProperties();
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "No properties file defined. Falling back to default.");
- }
+ try {
+ MusicUtil.loadProperties();
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "No properties file defined. Falling back to default.");
+ }
// Quick Fix - Best to put this into every call to getDSHandle?
if (! MusicUtil.getMyCassaHost().equals("localhost") ) {
mDstoreHandle = new MusicDataStore(MusicUtil.getMyCassaHost());
@@ -139,9 +140,9 @@ public class MusicCore {
}
}
if(mDstoreHandle.getSession() == null) {
- String message = "Connection to Cassandra has not been enstablished."
- + " Please check connection properites and reboot.";
- logger.info(EELFLoggerDelegate.applicationLogger, message);
+ String message = "Connection to Cassandra has not been enstablished."
+ + " Please check connection properites and reboot.";
+ logger.info(EELFLoggerDelegate.applicationLogger, message);
throw new MusicServiceException(message);
}
long end = System.currentTimeMillis();
@@ -156,8 +157,8 @@ public class MusicCore {
try {
lockId = getLockingServiceHandle().createLockId("/" + lockName);
} catch (MusicLockingException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.CREATELOCK+lockName,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
-
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.CREATELOCK+lockName,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+
}
long end = System.currentTimeMillis();
logger.info(EELFLoggerDelegate.applicationLogger,"Time taken to create lock reference:" + (end - start) + " ms");
@@ -196,7 +197,7 @@ public class MusicCore {
logger.info(EELFLoggerDelegate.applicationLogger,"Time taken to get lock state:" + (end - start) + " ms");
return mls;
} catch (NullPointerException | MusicLockingException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.INVALIDLOCK,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.INVALIDLOCK,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
}
return null;
}
@@ -221,7 +222,7 @@ public class MusicCore {
}
}
} else
- logger.error(EELFLoggerDelegate.errorLogger,key, AppMessages.INVALIDLOCK,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,key, AppMessages.INVALIDLOCK,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
/*
* call the traditional acquire lock now and if the result returned is true, set the
@@ -248,7 +249,7 @@ public class MusicCore {
}
} catch (Exception e) {
StringWriter sw = new StringWriter();
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), "[ERR506E] Failed to aquire lock ",ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), "[ERR506E] Failed to aquire lock ",ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
String exceptionAsString = sw.toString();
return new ReturnType(ResultType.FAILURE,
@@ -272,14 +273,14 @@ public class MusicCore {
if (!result) {
logger.info(EELFLoggerDelegate.applicationLogger,"In acquire lock: Not your turn, someone else has the lock");
try {
- if (!getLockingServiceHandle().lockIdExists(lockId)) {
- logger.info(EELFLoggerDelegate.applicationLogger, "In acquire lock: this lockId doesn't exist");
- return new ReturnType(ResultType.FAILURE, "Lockid doesn't exist");
- }
- } catch (MusicLockingException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.INVALIDLOCK+lockId,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
- throw new MusicLockingException();
- }
+ if (!getLockingServiceHandle().lockIdExists(lockId)) {
+ logger.info(EELFLoggerDelegate.applicationLogger, "In acquire lock: this lockId doesn't exist");
+ return new ReturnType(ResultType.FAILURE, "Lockid doesn't exist");
+ }
+ } catch (MusicLockingException e) {
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.INVALIDLOCK+lockId,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ throw new MusicLockingException();
+ }
logger.info(EELFLoggerDelegate.applicationLogger,"In acquire lock: returning failure");
return new ReturnType(ResultType.FAILURE, "Not your turn, someone else has the lock");
}
@@ -304,7 +305,7 @@ public class MusicCore {
return new ReturnType(ResultType.SUCCESS, "You already have the lock!");
}
} catch (NullPointerException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.INVALIDLOCK+lockId,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.INVALIDLOCK+lockId,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
}
// change status to "being locked". This state transition is necessary to ensure syncing
@@ -320,7 +321,7 @@ public class MusicCore {
try {
getLockingServiceHandle().setLockState(key, newMls);
} catch (MusicLockingException e1) {
- logger.error(EELFLoggerDelegate.errorLogger,e1.getMessage(), AppMessages.LOCKSTATE+key,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e1.getMessage(), AppMessages.LOCKSTATE+key,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
}
logger.info(EELFLoggerDelegate.applicationLogger,"In acquire lock: Set lock state to being_locked");
@@ -341,7 +342,7 @@ public class MusicCore {
try {
getLockingServiceHandle().setLockState(key, newMls);
} catch (MusicLockingException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.LOCKSTATE+key,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.LOCKSTATE+key,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
}
logger.info(EELFLoggerDelegate.applicationLogger,"In acquire lock: Set lock state to locked and assigned current lock ref "
+ lockId + " as holder");
@@ -412,7 +413,7 @@ public class MusicCore {
getDSHandle().executePut(updateQuery, "critical");
} catch (MusicServiceException | MusicQueryException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.QUERYERROR +""+updateQuery ,ErrorSeverity.MAJOR, ErrorTypes.QUERYERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.QUERYERROR +""+updateQuery ,ErrorSeverity.MAJOR, ErrorTypes.QUERYERROR);
}
}
@@ -429,7 +430,7 @@ public class MusicCore {
try {
results = getDSHandle().executeCriticalGet(query);
} catch (MusicServiceException | MusicQueryException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.UNKNOWNERROR ,ErrorSeverity.MAJOR, ErrorTypes.GENERALSERVICEERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.UNKNOWNERROR ,ErrorSeverity.MAJOR, ErrorTypes.GENERALSERVICEERROR);
}
return results;
@@ -456,7 +457,7 @@ public class MusicCore {
try {
return getLockingServiceHandle().whoseTurnIsIt("/" + lockName) + "";
} catch (MusicLockingException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.LOCKINGERROR+lockName ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.LOCKINGERROR+lockName ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
}
return null;
@@ -478,7 +479,7 @@ public class MusicCore {
try {
getLockingServiceHandle().unlockAndDeleteId(lockId);
} catch (MusicLockingException | NoNodeException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.DESTROYLOCK+lockId ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.DESTROYLOCK+lockId ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
}
long end = System.currentTimeMillis();
logger.info(EELFLoggerDelegate.applicationLogger,"Time taken to destroy lock reference:" + (end - start) + " ms");
@@ -489,11 +490,11 @@ public class MusicCore {
try {
getLockingServiceHandle().unlockAndDeleteId(lockId);
} catch (MusicLockingException e1) {
- logger.error(EELFLoggerDelegate.errorLogger,e1.getMessage(), AppMessages.RELEASELOCK+lockId ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e1.getMessage(), AppMessages.RELEASELOCK+lockId ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
} catch (KeeperException.NoNodeException nne) {
- logger.error(EELFLoggerDelegate.errorLogger,"Failed to release Lock " + lockId + " " + nne);
- MusicLockState mls = new MusicLockState("Lock doesn't exists. Release lock operation failed.");
- return mls;
+ logger.error(EELFLoggerDelegate.errorLogger,"Failed to release Lock " + lockId + " " + nne);
+ MusicLockState mls = new MusicLockState("Lock doesn't exists. Release lock operation failed.");
+ return mls;
}
String lockName = getLockNameFromId(lockId);
MusicLockState mls;
@@ -510,7 +511,7 @@ public class MusicCore {
try {
getLockingServiceHandle().setLockState(lockName, mls);
} catch (MusicLockingException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.RELEASELOCK+lockId ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.RELEASELOCK+lockId ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
}
long end = System.currentTimeMillis();
logger.info(EELFLoggerDelegate.applicationLogger,"Time taken to release lock:" + (end - start) + " ms");
@@ -518,12 +519,12 @@ public class MusicCore {
}
public static void voluntaryReleaseLock(String lockId) throws MusicLockingException{
- try {
- getLockingServiceHandle().unlockAndDeleteId(lockId);
- } catch (KeeperException.NoNodeException e) {
- // ??? No way
- }
- }
+ try {
+ getLockingServiceHandle().unlockAndDeleteId(lockId);
+ } catch (KeeperException.NoNodeException e) {
+ // ??? No way
+ }
+ }
/**
*
@@ -536,8 +537,8 @@ public class MusicCore {
try {
getLockingServiceHandle().deleteLock("/" + lockName);
} catch (MusicLockingException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.DELTELOCK+lockName ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
- throw new MusicLockingException(e.getMessage());
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.DELTELOCK+lockName ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ throw new MusicLockingException(e.getMessage());
}
long end = System.currentTimeMillis();
logger.info(EELFLoggerDelegate.applicationLogger,"Time taken to delete lock:" + (end - start) + " ms");
@@ -565,7 +566,7 @@ public class MusicCore {
try {
getLockingServiceHandle().getzkLockHandle().createNode(nodeName);
} catch (MusicLockingException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), "[ERR512E] Failed to get ZK Lock Handle " ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), "[ERR512E] Failed to get ZK Lock Handle " ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
}
}
@@ -580,7 +581,7 @@ public class MusicCore {
try {
getLockingServiceHandle().getzkLockHandle().setNodeData(nodeName, data);
} catch (MusicLockingException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), "[ERR512E] Failed to get ZK Lock Handle " ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), "[ERR512E] Failed to get ZK Lock Handle " ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
}
logger.info(EELFLoggerDelegate.applicationLogger,"Performed zookeeper write to " + nodeName);
long end = System.currentTimeMillis();
@@ -598,7 +599,7 @@ public class MusicCore {
try {
data = getLockingServiceHandle().getzkLockHandle().getNodeData(nodeName);
} catch (MusicLockingException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), "[ERR512E] Failed to get ZK Lock Handle " ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), "[ERR512E] Failed to get ZK Lock Handle " ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
}
long end = System.currentTimeMillis();
logger.info(EELFLoggerDelegate.applicationLogger,"Time taken for the actual zk put:" + (end - start) + " ms");
@@ -623,7 +624,7 @@ public class MusicCore {
try {
result = getDSHandle().executePut(queryObject, MusicUtil.EVENTUAL);
} catch (MusicServiceException | MusicQueryException ex) {
- logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage(), "[ERR512E] Failed to get ZK Lock Handle " ,ErrorSeverity.WARN, ErrorTypes.MUSICSERVICEERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage(), "[ERR512E] Failed to get ZK Lock Handle " ,ErrorSeverity.WARN, ErrorTypes.MUSICSERVICEERROR);
logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage() + " " + ex.getCause() + " " + ex);
return new ReturnType(ResultType.FAILURE, ex.getMessage());
}
@@ -695,7 +696,7 @@ public class MusicCore {
try {
result = getDSHandle().executePut(queryObject, consistency);
} catch (MusicQueryException | MusicServiceException ex) {
- logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage(), AppMessages.UNKNOWNERROR ,ErrorSeverity.WARN, ErrorTypes.MUSICSERVICEERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage(), AppMessages.UNKNOWNERROR ,ErrorSeverity.WARN, ErrorTypes.MUSICSERVICEERROR);
throw new MusicServiceException(ex.getMessage());
}
return result?ResultType.SUCCESS:ResultType.FAILURE;
@@ -711,7 +712,7 @@ public class MusicCore {
public static ResultSet get(PreparedQueryObject queryObject) throws MusicServiceException {
ResultSet results = null;
try {
- results = getDSHandle().executeEventualGet(queryObject);
+ results = getDSHandle().executeEventualGet(queryObject);
} catch (MusicQueryException | MusicServiceException e) {
logger.error(EELFLoggerDelegate.errorLogger,e.getMessage());
throw new MusicServiceException(e.getMessage());
@@ -741,7 +742,7 @@ public class MusicCore {
} else
throw new MusicServiceException("YOU DO NOT HAVE THE LOCK");
} catch (MusicQueryException | MusicServiceException | MusicLockingException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.UNKNOWNERROR ,ErrorSeverity.WARN, ErrorTypes.MUSICSERVICEERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.UNKNOWNERROR ,ErrorSeverity.WARN, ErrorTypes.MUSICSERVICEERROR);
}
return results;
}
@@ -853,31 +854,31 @@ public class MusicCore {
voluntaryReleaseLock(lockId);
return result;
} else {
- destroyLockRef(lockId);
+ destroyLockRef(lockId);
logger.info(EELFLoggerDelegate.applicationLogger,"unable to acquire lock, id " + lockId);
return null;
}
}
- public static ResultSet atomicGetWithDeleteLock(String keyspaceName, String tableName, String primaryKey,
- PreparedQueryObject queryObject) throws MusicServiceException, MusicLockingException {
- String key = keyspaceName + "." + tableName + "." + primaryKey;
- String lockId = createLockReference(key);
- long leasePeriod = MusicUtil.getDefaultLockLeasePeriod();
-
- ReturnType lockAcqResult = acquireLock(key, lockId);
-
- if (lockAcqResult.getResult().equals(ResultType.SUCCESS)) {
- logger.info(EELFLoggerDelegate.applicationLogger, "acquired lock with id " + lockId);
- ResultSet result = criticalGet(keyspaceName, tableName, primaryKey, queryObject, lockId);
- deleteLock(key);
- return result;
- } else {
- deleteLock(key);
- logger.info(EELFLoggerDelegate.applicationLogger, "unable to acquire lock, id " + lockId);
- return null;
- }
- }
+ public static ResultSet atomicGetWithDeleteLock(String keyspaceName, String tableName, String primaryKey,
+ PreparedQueryObject queryObject) throws MusicServiceException, MusicLockingException {
+ String key = keyspaceName + "." + tableName + "." + primaryKey;
+ String lockId = createLockReference(key);
+ long leasePeriod = MusicUtil.getDefaultLockLeasePeriod();
+
+ ReturnType lockAcqResult = acquireLock(key, lockId);
+
+ if (lockAcqResult.getResult().equals(ResultType.SUCCESS)) {
+ logger.info(EELFLoggerDelegate.applicationLogger, "acquired lock with id " + lockId);
+ ResultSet result = criticalGet(keyspaceName, tableName, primaryKey, queryObject, lockId);
+ deleteLock(key);
+ return result;
+ } else {
+ deleteLock(key);
+ logger.info(EELFLoggerDelegate.applicationLogger, "unable to acquire lock, id " + lockId);
+ return null;
+ }
+ }
@@ -916,7 +917,7 @@ public class MusicCore {
}
boolean isAAF = Boolean.valueOf(isAAFApp);
if (userId == null || password == null) {
- logger.error(EELFLoggerDelegate.errorLogger,"", AppMessages.MISSINGINFO ,ErrorSeverity.WARN, ErrorTypes.AUTHENTICATIONERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,"", AppMessages.MISSINGINFO ,ErrorSeverity.WARN, ErrorTypes.AUTHENTICATIONERROR);
logger.error(EELFLoggerDelegate.errorLogger,"One or more required headers is missing. userId: " + userId
+ " :: password: " + password);
resultMap.put("Exception",
@@ -932,14 +933,14 @@ public class MusicCore {
if (isAAF && nameSpace != null && userId != null && password != null) {
boolean isValid = true;
try {
- isValid = CachingUtil.authenticateAAFUser(nameSpace, userId, password, keyspace);
+ isValid = CachingUtil.authenticateAAFUser(nameSpace, userId, password, keyspace);
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.AUTHENTICATIONERROR ,ErrorSeverity.WARN, ErrorTypes.AUTHENTICATIONERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.AUTHENTICATIONERROR ,ErrorSeverity.WARN, ErrorTypes.AUTHENTICATIONERROR);
logger.error(EELFLoggerDelegate.errorLogger,"Got exception while AAF authentication for namespace " + nameSpace);
resultMap.put("Exception", e.getMessage());
}
if (!isValid) {
- logger.error(EELFLoggerDelegate.errorLogger,"", AppMessages.AUTHENTICATIONERROR ,ErrorSeverity.WARN, ErrorTypes.AUTHENTICATIONERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,"", AppMessages.AUTHENTICATIONERROR ,ErrorSeverity.WARN, ErrorTypes.AUTHENTICATIONERROR);
resultMap.put("Exception", "User not authenticated...");
}
if (!resultMap.isEmpty())
diff --git a/jar/src/main/java/org/onap/music/main/MusicDigest.java b/jar/src/main/java/org/onap/music/main/MusicDigest.java
index 893cb51f..d05969e3 100644
--- a/jar/src/main/java/org/onap/music/main/MusicDigest.java
+++ b/jar/src/main/java/org/onap/music/main/MusicDigest.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.main;
/**
diff --git a/jar/src/main/java/org/onap/music/main/MusicUtil.java b/jar/src/main/java/org/onap/music/main/MusicUtil.java
index 77afb57e..0e844215 100755
--- a/jar/src/main/java/org/onap/music/main/MusicUtil.java
+++ b/jar/src/main/java/org/onap/music/main/MusicUtil.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.main;
import java.io.File;
@@ -531,42 +532,42 @@ public class MusicUtil {
public static void loadProperties() throws Exception {
- CipherUtil.readAndSetKeyString();
+ CipherUtil.readAndSetKeyString();
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) {
- e.printStackTrace();
- }
- }
- }
- String cassPwd = prop.getProperty("cassandra.password");
- String isEncrypted = prop.getProperty("cassandra.password.isencrypted");
- logger.info(EELFLoggerDelegate.applicationLogger,"cassandra.password:" + cassPwd);
- logger.info(EELFLoggerDelegate.applicationLogger,"cassandra.password.isencrypted:" + isEncrypted);
- if("true".equals(isEncrypted)) {
- logger.info(EELFLoggerDelegate.applicationLogger,"Decrypting....");
- cassPwd = CipherUtil.decryptPKC(cassPwd);
- logger.info(EELFLoggerDelegate.applicationLogger,"Decrypted password: "+cassPwd);
- MusicUtil.setCassPwd(cassPwd);
- } else
- MusicUtil.setCassPwd(cassPwd);
- // 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"));
- }
+ 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) {
+ e.printStackTrace();
+ }
+ }
+ }
+ String cassPwd = prop.getProperty("cassandra.password");
+ String isEncrypted = prop.getProperty("cassandra.password.isencrypted");
+ logger.info(EELFLoggerDelegate.applicationLogger,"cassandra.password:" + cassPwd);
+ logger.info(EELFLoggerDelegate.applicationLogger,"cassandra.password.isencrypted:" + isEncrypted);
+ if("true".equals(isEncrypted)) {
+ logger.info(EELFLoggerDelegate.applicationLogger,"Decrypting....");
+ cassPwd = CipherUtil.decryptPKC(cassPwd);
+ logger.info(EELFLoggerDelegate.applicationLogger,"Decrypted password: "+cassPwd);
+ MusicUtil.setCassPwd(cassPwd);
+ } else
+ MusicUtil.setCassPwd(cassPwd);
+ // 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"));
+ }
}
diff --git a/jar/src/main/java/org/onap/music/main/PropertiesListener.java b/jar/src/main/java/org/onap/music/main/PropertiesListener.java
index afd35387..beb88af6 100755
--- a/jar/src/main/java/org/onap/music/main/PropertiesListener.java
+++ b/jar/src/main/java/org/onap/music/main/PropertiesListener.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.main;
import java.io.FileInputStream;
@@ -130,7 +131,7 @@ public class PropertiesListener implements ServletContextListener {
}
}
} catch (IOException e) {
- logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.IOERROR ,ErrorSeverity.CRITICAL, ErrorTypes.CONNECTIONERROR);
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.IOERROR ,ErrorSeverity.CRITICAL, ErrorTypes.CONNECTIONERROR);
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage());
}
diff --git a/jar/src/main/java/org/onap/music/main/ResultType.java b/jar/src/main/java/org/onap/music/main/ResultType.java
index 61ba0295..f5ef2070 100644
--- a/jar/src/main/java/org/onap/music/main/ResultType.java
+++ b/jar/src/main/java/org/onap/music/main/ResultType.java
@@ -19,13 +19,14 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.main;
public enum ResultType {
SUCCESS("Success"), FAILURE("Failure"),
- SYNTAXERROR("SyntaxError"), EXCEPTION("Exception"),
- BODYMISSING("Incomplete Request body. Please correct your input request and retry.");
-
+ SYNTAXERROR("SyntaxError"), EXCEPTION("Exception"),
+ BODYMISSING("Incomplete Request body. Please correct your input request and retry.");
+
private String result;
ResultType(String result) {
diff --git a/jar/src/main/java/org/onap/music/main/ReturnType.java b/jar/src/main/java/org/onap/music/main/ReturnType.java
index 1453a1bf..e3905fd8 100644
--- a/jar/src/main/java/org/onap/music/main/ReturnType.java
+++ b/jar/src/main/java/org/onap/music/main/ReturnType.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.main;
import java.util.HashMap;
diff --git a/jar/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java b/jar/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java
index a406afce..9d4f5ed9 100644
--- a/jar/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java
+++ b/jar/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.response.jsonobjects;
import java.util.HashMap;
@@ -39,7 +40,7 @@ import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "JsonResponse", description = "General Response JSON")
public class JsonResponse {
- /* Status is required */
+ /* Status is required */
private ResultType status;
/* Standard informational fields */
@@ -69,7 +70,7 @@ public class JsonResponse {
this.status = status;
}
- /**
+ /**
*
* @return
*/
@@ -130,7 +131,7 @@ public class JsonResponse {
* @return the music version
*/
public String getMusicVersion() {
- return this.musicVersion;
+ return this.musicVersion;
}
/**
@@ -139,20 +140,20 @@ public class JsonResponse {
* @return
*/
public JsonResponse setMusicVersion(String version) {
- this.musicVersion = version;
- return this;
+ this.musicVersion = version;
+ return this;
}
public Map<String, HashMap<String, Object>> getDataResult() {
- return this.dataResult;
+ return this.dataResult;
}
public JsonResponse setDataResult(Map<String, HashMap<String, Object>> map) {
- this.dataResult = map;
- return this;
+ this.dataResult = map;
+ return this;
}
- /**
+ /**
*
* @return
*/
@@ -237,16 +238,16 @@ public class JsonResponse {
if (musicVersion!=null) {fullMap.put("version", musicVersion);}
if (dataResult!=null) {
- fullMap.put("result", dataResult);
+ fullMap.put("result", dataResult);
}
if (lock!=null) {
- Map<String, Object> lockMap = new HashMap<>();
- if (lock!=null) {lockMap.put("lock", lock);}
- if (lockStatus!=null) {lockMap.put("lock-status", lockStatus);}
- if (lockHolder!=null) {lockMap.put("lock-holder", lockHolder);}
- if (lockLease!=null) {lockMap.put("lock-lease", lockLease);}
- fullMap.put("lock", lockMap);
+ Map<String, Object> lockMap = new HashMap<>();
+ if (lock!=null) {lockMap.put("lock", lock);}
+ if (lockStatus!=null) {lockMap.put("lock-status", lockStatus);}
+ if (lockHolder!=null) {lockMap.put("lock-holder", lockHolder);}
+ if (lockLease!=null) {lockMap.put("lock-lease", lockLease);}
+ fullMap.put("lock", lockMap);
}
return fullMap;
diff --git a/jar/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java b/jar/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java
index e7c7fb6c..cc7c01c7 100755
--- a/jar/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java
+++ b/jar/src/main/java/org/onap/music/rest/RestMusicAdminAPI.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.rest;
diff --git a/jar/src/main/java/org/onap/music/rest/RestMusicBmAPI.java b/jar/src/main/java/org/onap/music/rest/RestMusicBmAPI.java
index 55eb47f2..097c7b40 100644
--- a/jar/src/main/java/org/onap/music/rest/RestMusicBmAPI.java
+++ b/jar/src/main/java/org/onap/music/rest/RestMusicBmAPI.java
@@ -15,6 +15,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.rest;
import java.util.List;
diff --git a/jar/src/main/java/org/onap/music/rest/RestMusicDataAPI.java b/jar/src/main/java/org/onap/music/rest/RestMusicDataAPI.java
index 47d1eae7..fc31cd9e 100755
--- a/jar/src/main/java/org/onap/music/rest/RestMusicDataAPI.java
+++ b/jar/src/main/java/org/onap/music/rest/RestMusicDataAPI.java
@@ -7,18 +7,19 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.rest;
import java.util.ArrayList;
@@ -85,7 +86,7 @@ public class RestMusicDataAPI {
* (e.g. if the full version is 1.24.5, X-minorVersion = "24") - Is optional for the client on
* request; however, this header should be provided if the client needs to take advantage of
* MINOR incremented version functionality - Is mandatory for the server on response
- *
+ *
*** X-patchVersion *** - Used only to communicate a PATCH version in a response for
* troubleshooting purposes only, and will not be provided by the client on request - This will
* be the latest PATCH version of the MINOR requested by the client, or the latest PATCH version
@@ -107,7 +108,7 @@ public class RestMusicDataAPI {
private static final String USERID = "userId";
private static final String PASSWORD = "password";
private static final String VERSION = "v2";
-
+
private class RowIdentifier {
public String primarKeyValue;
public StringBuilder rowIdString;
@@ -126,7 +127,7 @@ public class RestMusicDataAPI {
/**
* Create Keyspace REST
- *
+ *
* @param kspObject
* @param keyspaceName
* @return
@@ -149,7 +150,7 @@ public class RestMusicDataAPI {
JsonKeySpace kspObject,
@ApiParam(value = "Keyspace Name",required = true) @PathParam("name") String keyspaceName) {
ResponseBuilder response = MusicUtil.buildVersionResponse(VERSION, minorVersion, patchVersion);
-
+
Map<String, Object> authMap = CachingUtil.verifyOnboarding(ns, userId, password);
if (!authMap.isEmpty()) {
logger.error(EELFLoggerDelegate.errorLogger,"", AppMessages.MISSINGDATA ,ErrorSeverity.CRITICAL, ErrorTypes.AUTHENTICATIONERROR);
@@ -192,7 +193,7 @@ public class RestMusicDataAPI {
repString = "{" + MusicUtil.jsonMaptoSqlString(replicationInfo, ",") + "}";
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.MISSINGDATA ,ErrorSeverity.CRITICAL, ErrorTypes.DATAERROR);
-
+
}
queryObject.appendQueryString(
"CREATE KEYSPACE " + keyspaceName + " WITH replication = " + repString);
@@ -214,7 +215,7 @@ public class RestMusicDataAPI {
logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage(), AppMessages.UNKNOWNERROR ,ErrorSeverity.WARN, ErrorTypes.MUSICSERVICEERROR);
return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE).setError("err:" + ex.getMessage()).toMap()).build();
}
-
+
try {
queryObject = new PreparedQueryObject();
queryObject.appendQueryString("CREATE ROLE IF NOT EXISTS '" + userId
@@ -228,7 +229,7 @@ public class RestMusicDataAPI {
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.UNKNOWNERROR,ErrorSeverity.WARN, ErrorTypes.MUSICSERVICEERROR);
}
-
+
try {
boolean isAAF = Boolean.valueOf(CachingUtil.isAAFApplication(ns));
String hashedpwd = BCrypt.hashpw(password, BCrypt.gensalt());
@@ -250,12 +251,12 @@ public class RestMusicDataAPI {
logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.UNKNOWNERROR,ErrorSeverity.WARN, ErrorTypes.MUSICSERVICEERROR);
return response.status(Response.Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE).setError(e.getMessage()).toMap()).build();
}
-
+
return response.status(Status.OK).entity(new JsonResponse(ResultType.SUCCESS).setMessage("Keyspace " + keyspaceName + " Created").toMap()).build();
}
/**
- *
+ *
* @param kspObject
* @param keyspaceName
* @return
@@ -325,7 +326,7 @@ public class RestMusicDataAPI {
}
/**
- *
+ *
* @param tableObj
* @param version
* @param keyspace
@@ -369,7 +370,7 @@ public class RestMusicDataAPI {
int counter = 0;
String primaryKey;
for (Map.Entry<String, String> entry : fields.entrySet()) {
-
+
if (entry.getKey().equals("PRIMARY KEY")) {
if(! entry.getValue().contains("("))
primaryKey = entry.getValue();
@@ -433,7 +434,7 @@ public class RestMusicDataAPI {
}
/**
- *
+ *
* @param keyspace
* @param tablename
* @param fieldName
@@ -473,7 +474,7 @@ public class RestMusicDataAPI {
PreparedQueryObject query = new PreparedQueryObject();
query.appendQueryString("Create index " + indexName + " if not exists on " + keyspace + "."
+ tablename + " (" + fieldName + ");");
-
+
ResultType result = ResultType.FAILURE;
try {
result = MusicCore.nonKeyRelatedPut(query, "eventual");
@@ -490,7 +491,7 @@ public class RestMusicDataAPI {
}
/**
- *
+ *
* @param insObj
* @param keyspace
* @param tablename
@@ -518,7 +519,7 @@ public class RestMusicDataAPI {
ResponseBuilder response = MusicUtil.buildVersionResponse(VERSION, minorVersion, patchVersion);
Map<String, Object> authMap = null;
-
+
try {
authMap = MusicCore.autheticateUser(ns, userId, password, keyspace,
aid, "insertIntoTable");
@@ -587,7 +588,7 @@ public class RestMusicDataAPI {
}
counter = counter + 1;
}
-
+
if(primaryKey == null || primaryKey.length() <= 0) {
logger.error(EELFLoggerDelegate.errorLogger, "Some required partition key parts are missing: "+primaryKeyName );
return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.SYNTAXERROR).setError("Some required partition key parts are missing: "+primaryKeyName).toMap()).build();
@@ -646,7 +647,7 @@ public class RestMusicDataAPI {
logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage(), AppMessages.UNKNOWNERROR ,ErrorSeverity.WARN, ErrorTypes.MUSICSERVICEERROR);
return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE).setError(ex.getMessage()).toMap()).build();
}
-
+
if (result==null) {
logger.error(EELFLoggerDelegate.errorLogger,"", AppMessages.UNKNOWNERROR ,ErrorSeverity.WARN, ErrorTypes.MUSICSERVICEERROR);
return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE).setError("Null result - Please Contact admin").toMap()).build();
@@ -655,7 +656,7 @@ public class RestMusicDataAPI {
}
/**
- *
+ *
* @param insObj
* @param keyspace
* @param tablename
@@ -853,7 +854,7 @@ public class RestMusicDataAPI {
timingString = timingString + lockManagementTime;
}
logger.info(EELFLoggerDelegate.applicationLogger, timingString);
-
+
if (operationResult==null) {
logger.error(EELFLoggerDelegate.errorLogger,"Null result - Please Contact admin", AppMessages.UNKNOWNERROR ,ErrorSeverity.WARN, ErrorTypes.GENERALSERVICEERROR);
return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE).setError("Null result - Please Contact admin").toMap()).build();
@@ -864,11 +865,11 @@ public class RestMusicDataAPI {
logger.error(EELFLoggerDelegate.errorLogger,operationResult.getMessage(), AppMessages.UNKNOWNERROR ,ErrorSeverity.WARN, ErrorTypes.GENERALSERVICEERROR);
return response.status(Status.BAD_REQUEST).entity(new JsonResponse(operationResult.getResult()).setError(operationResult.getMessage()).toMap()).build();
}
-
+
}
/**
- *
+ *
* @param delObj
* @param keyspace
* @param tablename
@@ -1014,7 +1015,7 @@ public class RestMusicDataAPI {
}
/**
- *
+ *
* @param tabObj
* @param keyspace
* @param tablename
@@ -1066,7 +1067,7 @@ public class RestMusicDataAPI {
}
/**
- *
+ *
* @param selObj
* @param keyspace
* @param tablename
@@ -1137,7 +1138,7 @@ public class RestMusicDataAPI {
} else if (consistency.equalsIgnoreCase(MusicUtil.ATOMIC)) {
results = MusicCore.atomicGet(keyspace, tablename, rowId.primarKeyValue, queryObject);
}
-
+
else if (consistency.equalsIgnoreCase(MusicUtil.ATOMICDELETELOCK)) {
results = MusicCore.atomicGetWithDeleteLock(keyspace, tablename, rowId.primarKeyValue, queryObject);
}
@@ -1146,7 +1147,7 @@ public class RestMusicDataAPI {
}
/**
- *
+ *
* @param keyspace
* @param tablename
* @param info
@@ -1212,7 +1213,7 @@ public class RestMusicDataAPI {
}
/**
- *
+ *
* @param keyspace
* @param tablename
* @param info
@@ -1242,7 +1243,7 @@ public class RestMusicDataAPI {
}
/**
- *
+ *
* @param keyspace
* @param tablename
* @param rowParams
diff --git a/jar/src/main/java/org/onap/music/rest/RestMusicHealthCheckAPI.java b/jar/src/main/java/org/onap/music/rest/RestMusicHealthCheckAPI.java
index 752a538b..c1071e5b 100644
--- a/jar/src/main/java/org/onap/music/rest/RestMusicHealthCheckAPI.java
+++ b/jar/src/main/java/org/onap/music/rest/RestMusicHealthCheckAPI.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.rest;
import java.util.HashMap;
@@ -58,56 +59,56 @@ import io.swagger.annotations.ApiOperation;
@Path("/v{version: [0-9]+}/service")
@Api(value="Healthcheck Api")
public class RestMusicHealthCheckAPI {
-
-
- private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicUtil.class);
-
-
- @GET
- @Path("/cs")
- @ApiOperation(value = "Get Health Status", response = Map.class)
- @Produces(MediaType.APPLICATION_JSON)
- public Response cassandraStatus(@Context HttpServletResponse response) {
- logger.info(EELFLoggerDelegate.applicationLogger,"Replying to request for MUSIC Health Check status for Cassandra");
-
- Map<String, Object> resultMap = new HashMap<>();
-
- MusicHealthCheck cassHealthCheck = new MusicHealthCheck();
- String status = cassHealthCheck.getCassandraStatus();
- if(status.equals("ACTIVE")) {
- resultMap.put("ACTIVE", "Cassandra Running and Listening to requests");
- return Response.status(Status.OK).entity(resultMap).build();
- }else {
- resultMap.put("INACTIVE", "Cassandra Service is not responding");
- return Response.status(Status.BAD_REQUEST).entity(resultMap).build();
- }
-
-
-
- }
-
- @GET
- @Path("/zk")
- @ApiOperation(value = "Get Health Status", response = Map.class)
- @Produces(MediaType.APPLICATION_JSON)
- public Response ZKStatus(@Context HttpServletResponse response) {
- logger.info(EELFLoggerDelegate.applicationLogger,"Replying to request for MUSIC Health Check status for Zookeeper");
- Map<String, Object> resultMap = new HashMap<>();
- MusicHealthCheck ZKHealthCheck = new MusicHealthCheck();
- String status = ZKHealthCheck.getZookeeperStatus();
- if(status.equals("ACTIVE")) {
- resultMap.put("ACTIVE", "Zookeeper is Active and Running");
- return Response.status(Status.OK).entity(resultMap).build();
- }else {
- resultMap.put("INACTIVE", "Zookeeper is not responding");
- return Response.status(Status.BAD_REQUEST).entity(resultMap).build();
- }
- }
-
-
-
-
-
-
+
+
+ private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicUtil.class);
+
+
+ @GET
+ @Path("/cs")
+ @ApiOperation(value = "Get Health Status", response = Map.class)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response cassandraStatus(@Context HttpServletResponse response) {
+ logger.info(EELFLoggerDelegate.applicationLogger,"Replying to request for MUSIC Health Check status for Cassandra");
+
+ Map<String, Object> resultMap = new HashMap<>();
+
+ MusicHealthCheck cassHealthCheck = new MusicHealthCheck();
+ String status = cassHealthCheck.getCassandraStatus();
+ if(status.equals("ACTIVE")) {
+ resultMap.put("ACTIVE", "Cassandra Running and Listening to requests");
+ return Response.status(Status.OK).entity(resultMap).build();
+ }else {
+ resultMap.put("INACTIVE", "Cassandra Service is not responding");
+ return Response.status(Status.BAD_REQUEST).entity(resultMap).build();
+ }
+
+
+
+ }
+
+ @GET
+ @Path("/zk")
+ @ApiOperation(value = "Get Health Status", response = Map.class)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response ZKStatus(@Context HttpServletResponse response) {
+ logger.info(EELFLoggerDelegate.applicationLogger,"Replying to request for MUSIC Health Check status for Zookeeper");
+ Map<String, Object> resultMap = new HashMap<>();
+ MusicHealthCheck ZKHealthCheck = new MusicHealthCheck();
+ String status = ZKHealthCheck.getZookeeperStatus();
+ if(status.equals("ACTIVE")) {
+ resultMap.put("ACTIVE", "Zookeeper is Active and Running");
+ return Response.status(Status.OK).entity(resultMap).build();
+ }else {
+ resultMap.put("INACTIVE", "Zookeeper is not responding");
+ return Response.status(Status.BAD_REQUEST).entity(resultMap).build();
+ }
+ }
+
+
+
+
+
+
}
diff --git a/jar/src/main/java/org/onap/music/rest/RestMusicLocksAPI.java b/jar/src/main/java/org/onap/music/rest/RestMusicLocksAPI.java
index 22112ddf..5b587511 100644
--- a/jar/src/main/java/org/onap/music/rest/RestMusicLocksAPI.java
+++ b/jar/src/main/java/org/onap/music/rest/RestMusicLocksAPI.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.rest;
import java.util.Map;
@@ -413,10 +414,10 @@ public class RestMusicLocksAPI {
return response.status(Status.BAD_REQUEST).entity(resultMap).build();
}
try{
- MusicCore.deleteLock(lockName);
+ MusicCore.deleteLock(lockName);
}catch (Exception e) {
return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE).setError(e.getMessage()).toMap()).build();
- }
+ }
return response.status(Status.OK).entity(new JsonResponse(ResultType.SUCCESS).toMap()).build();
}
diff --git a/jar/src/main/java/org/onap/music/rest/RestMusicQAPI.java b/jar/src/main/java/org/onap/music/rest/RestMusicQAPI.java
index e08adaf7..1c964074 100755
--- a/jar/src/main/java/org/onap/music/rest/RestMusicQAPI.java
+++ b/jar/src/main/java/org/onap/music/rest/RestMusicQAPI.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.rest;
diff --git a/jar/src/main/java/org/onap/music/rest/RestMusicTestAPI.java b/jar/src/main/java/org/onap/music/rest/RestMusicTestAPI.java
index 287fa176..539f43f3 100644
--- a/jar/src/main/java/org/onap/music/rest/RestMusicTestAPI.java
+++ b/jar/src/main/java/org/onap/music/rest/RestMusicTestAPI.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.rest;
import java.util.HashMap;
@@ -41,27 +42,27 @@ import io.swagger.annotations.ApiOperation;
@Path("/v{version: [0-9]+}/test")
@Api(value="Test Api")
public class RestMusicTestAPI {
-
- @SuppressWarnings("unused")
+
+ @SuppressWarnings("unused")
private EELFLoggerDelegate logger =EELFLoggerDelegate.getLogger(RestMusicTestAPI.class);
- /**
- * Returns a test JSON. This will confirm that REST is working.
- * @return
- */
- @GET
- @ApiOperation(value = "Get Test", response = Map.class)
- @Produces(MediaType.APPLICATION_JSON)
- public Map<String, HashMap<String, String>> simpleTests(
- @Context HttpServletResponse response) {
- response.addHeader("X-latestVersion",MusicUtil.getVersion());
- Map<String, HashMap<String, String>> testMap = new HashMap<>();
- for(int i=0; i < 3; i++){
- HashMap<String, String> innerMap = new HashMap<>();
- innerMap.put(i+"", i+1+"");
- innerMap.put(i+1+"", i+2+"");
- testMap.put(i+"", innerMap);
- }
- return testMap;
- }
+ /**
+ * Returns a test JSON. This will confirm that REST is working.
+ * @return
+ */
+ @GET
+ @ApiOperation(value = "Get Test", response = Map.class)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map<String, HashMap<String, String>> simpleTests(
+ @Context HttpServletResponse response) {
+ response.addHeader("X-latestVersion",MusicUtil.getVersion());
+ Map<String, HashMap<String, String>> testMap = new HashMap<>();
+ for(int i=0; i < 3; i++){
+ HashMap<String, String> innerMap = new HashMap<>();
+ innerMap.put(i+"", i+1+"");
+ innerMap.put(i+1+"", i+2+"");
+ testMap.put(i+"", innerMap);
+ }
+ return testMap;
+ }
}
diff --git a/jar/src/main/java/org/onap/music/rest/RestMusicVersionAPI.java b/jar/src/main/java/org/onap/music/rest/RestMusicVersionAPI.java
index a5f2ac49..74b8e5dd 100644
--- a/jar/src/main/java/org/onap/music/rest/RestMusicVersionAPI.java
+++ b/jar/src/main/java/org/onap/music/rest/RestMusicVersionAPI.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.rest;
import java.util.Map;
@@ -46,18 +47,18 @@ import io.swagger.annotations.ApiOperation;
@Api(value="Version Api")
public class RestMusicVersionAPI {
- private EELFLoggerDelegate logger =EELFLoggerDelegate.getLogger(RestMusicVersionAPI.class);
-
- /**
- * Get the version of MUSIC
- * @return
- */
- @GET
- @ApiOperation(value = "Get Version", response = Map.class)
- @Produces(MediaType.APPLICATION_JSON)
- public Map<String,Object> version(@Context HttpServletResponse response) {
- logger.info("Replying to request for MUSIC version with MUSIC:" + MusicUtil.getVersion());
- response.addHeader("X-latestVersion",MusicUtil.getVersion());
- return new JsonResponse(ResultType.SUCCESS).setMusicVersion("MUSIC:" + MusicUtil.getVersion()).toMap();
- }
+ private EELFLoggerDelegate logger =EELFLoggerDelegate.getLogger(RestMusicVersionAPI.class);
+
+ /**
+ * Get the version of MUSIC
+ * @return
+ */
+ @GET
+ @ApiOperation(value = "Get Version", response = Map.class)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Map<String,Object> version(@Context HttpServletResponse response) {
+ logger.info("Replying to request for MUSIC version with MUSIC:" + MusicUtil.getVersion());
+ response.addHeader("X-latestVersion",MusicUtil.getVersion());
+ return new JsonResponse(ResultType.SUCCESS).setMusicVersion("MUSIC:" + MusicUtil.getVersion()).toMap();
+ }
} \ No newline at end of file