Merge "Release 3.2.38"
authorBharath Balasubramanian <bharathb@research.att.com>
Thu, 16 Apr 2020 17:15:23 +0000 (17:15 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 16 Apr 2020 17:15:23 +0000 (17:15 +0000)
docs/architecture.rst
docs/index.rst
docs/offeredapis.rst
docs/release-notes.rst
music-core/src/main/java/org/onap/music/datastore/MusicDataStore.java
music-core/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java
music-core/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java
music-core/src/main/java/org/onap/music/main/CorePropertiesLoader.java
music-core/src/main/java/org/onap/music/main/DeadlockDetectionUtil.java
music-rest/src/main/java/org/onap/music/rest/RestMusicQAPI.java

index 74cb0c4..73cfbc2 100644 (file)
@@ -1,5 +1,6 @@
 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
 .. http://creativecommons.org/licenses/by/4.0
+.. _architecture:
 
 Architecture
 ============
index 437a50d..1982263 100755 (executable)
@@ -1,6 +1,7 @@
 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
 .. http://creativecommons.org/licenses/by/4.0
 .. Copyright 2017 AT&T Intellectual Property.  All rights reserved.
+.. _master_index:
 
 Music Developer Documentation
 =============================
index a9a5965..c75bd0c 100644 (file)
@@ -1,6 +1,7 @@
 .. This work is licensed under a
   Creative Commons Attribution 4.0 International License.
 .. http://creativecommons.org/licenses/by/4.0
+.. _offeredapis:
 
 Offered APIs
 ============
index 9387c20..e736d84 100644 (file)
@@ -1,5 +1,6 @@
 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
 .. http://creativecommons.org/licenses/by/4.0
+.. _release_notes:
 
 
 Release Notes
index cb22c0f..9ce73cc 100755 (executable)
@@ -159,7 +159,12 @@ public class MusicDataStore {
 
         Cluster cluster;
         if(MusicUtil.getCassName() != null && MusicUtil.getCassPwd() != null) {
-            String cassPwd = CipherUtil.decryptPKC(MusicUtil.getCassPwd());
+            String cassPwd;
+            if (MusicUtil.getCipherEncKey() != null && !("").equals(MusicUtil.getCipherEncKey())) {
+                cassPwd = CipherUtil.decryptPKC(MusicUtil.getCassPwd());
+            } else {
+                cassPwd = MusicUtil.getCassPwd();
+            }
             logger.info(EELFLoggerDelegate.applicationLogger,
                     "Building with credentials "+MusicUtil.getCassName()+" & "+ MusicUtil.getCassPwd());
             cluster = Cluster.builder().withPort(MusicUtil.getCassandraPort())
index 0a277e0..0ba1a7e 100644 (file)
@@ -166,8 +166,10 @@ public class JsonTable {
             if (entry.getKey().equals("PRIMARY KEY")) {
                 primaryKey = entry.getValue(); // replaces primaryKey
                 primaryKey = primaryKey.trim();
-            } else {
-                if (counter == 0 )  fieldsString.append("" + entry.getKey() + " " + entry.getValue() + "");
+            } 
+                       else {
+                if (counter == 0 ) 
+                                       fieldsString.append("" + entry.getKey() + " " + entry.getValue() + "");
                 else fieldsString.append("," + entry.getKey() + " " + entry.getValue() + "");
             }
 
@@ -209,7 +211,8 @@ public class JsonTable {
                             clusterKey=clusterKey.substring(1);
                         }
                         clusterKey = clusterKey.trim();
-                        if (clusterKey.equals(",") ) clusterKey=""; // print error if needed    ( ... ),)
+                        if (clusterKey.equals(",") )
+                                                       clusterKey=""; // print error if needed    ( ... ),)
                     }
 
                     if (!(partitionKey.isEmpty() || clusterKey.isEmpty())
@@ -226,12 +229,16 @@ public class JsonTable {
 
                     }
 
-                    if (partitionKey.isEmpty() )  primaryKey="";
-                    else  if (clusterKey.isEmpty() ) primaryKey=" (" + partitionKey  + ")";
-                    else  primaryKey=" (" + partitionKey + ")," + clusterKey;
+                    if (partitionKey.isEmpty() ) 
+                                               primaryKey="";
+                    else  if (clusterKey.isEmpty() ) 
+                                               primaryKey=" (" + partitionKey  + ")";
+                    else 
+                                               primaryKey=" (" + partitionKey + ")," + clusterKey;
 
             
-                    if (primaryKey != null) fieldsString.append(", PRIMARY KEY (" + primaryKey + " )");
+                    if (primaryKey != null) 
+                                               fieldsString.append(", PRIMARY KEY (" + primaryKey + " )");
 
                 } else { // end of length > 0
                 
@@ -248,11 +255,15 @@ public class JsonTable {
                                 Status.BAD_REQUEST.getStatusCode());
                     }
 
-                    if (partitionKey.isEmpty() )  primaryKey="";
-                    else  if (clusterKey.isEmpty() ) primaryKey=" (" + partitionKey  + ")";
-                    else  primaryKey=" (" + partitionKey + ")," + clusterKey;
+                    if (partitionKey.isEmpty() ) 
+                                               primaryKey="";
+                    else  if (clusterKey.isEmpty() )
+                                               primaryKey=" (" + partitionKey  + ")";
+                    else 
+                                               primaryKey=" (" + partitionKey + ")," + clusterKey;
 
-                    if (primaryKey != null) fieldsString.append(", PRIMARY KEY (" + primaryKey + " )");
+                    if (primaryKey != null) 
+                                               fieldsString.append(", PRIMARY KEY (" + primaryKey + " )");
                 }
                 fieldsString.append(")");
 
index a727357..0c5d39c 100644 (file)
@@ -40,8 +40,6 @@ import org.onap.music.main.ResultType;
 import org.onap.music.main.ReturnType;
 import com.datastax.driver.core.ResultSet;
 import com.datastax.driver.core.Row;
-import com.datastax.driver.core.Session;
-import com.datastax.driver.extras.codecs.enums.EnumNameCodec;
 
 /*
  * This is the lock store that is built on top of Cassandra that is used by MUSIC to maintain lock state. 
@@ -469,8 +467,10 @@ public class CassaLockStore {
     }  
 
     public boolean checkForDeadlock(String keyspace, String table, String lockName, LockType locktype, String owner, boolean forAcquire) throws MusicServiceException, MusicQueryException {
-        if (locktype.equals(LockType.READ)) return false;
-        if (owner==null || owner.length()==0) return false;
+        if (locktype.equals(LockType.READ)) 
+                       return false;
+        if (owner==null || owner.length()==0)
+                       return false;
 
         String lockTable = table_prepend_name + table;
         PreparedQueryObject queryObject = new PreparedQueryObject();
@@ -489,7 +489,8 @@ public class CassaLockStore {
             ddu.setExisting(row.getString("key"), row.getString("owner"), ("0".equals(row.getString("acquiretime")))?OwnershipType.CREATED:OwnershipType.ACQUIRED);
         }
         boolean deadlock = ddu.checkForDeadlock(lockName, owner, forAcquire?OwnershipType.ACQUIRED:OwnershipType.CREATED);
-        if (deadlock) logger.warn("Deadlock detected when " + owner + " tried to create lock on " + keyspace + "." + lockTable + "." + lockName);
+        if (deadlock)
+                  logger.warn("Deadlock detected when " + owner + " tried to create lock on " + keyspace + "." + lockTable + "." + lockName);
         return deadlock;
     }
 
@@ -518,7 +519,7 @@ public class CassaLockStore {
     }
 
     public ReturnType promoteLock(String keyspace, String table, String key, String lockRef)
-            throws MusicLockingException, MusicServiceException, MusicQueryException {
+            throws MusicServiceException, MusicQueryException {
         String lockqtable = table_prepend_name + table;
         String selectQuery = "select * from " + keyspace + "." + lockqtable + " where key=?;";
 
index c386667..2e5ca68 100644 (file)
@@ -24,8 +24,6 @@ package org.onap.music.main;
 
 import java.util.Properties;
 
-import org.onap.music.eelf.logging.EELFLoggerDelegate;
-
 public class CorePropertiesLoader {
 
     public static void loadProperties(Properties properties) {
index 4c9a74b..23ccca7 100644 (file)
@@ -39,7 +39,8 @@ public class DeadlockDetectionUtil {
                @Override
                public String toString() {
                        StringBuffer sb = new StringBuffer();
-                       for (Node link : links) sb.append(link.id);
+                       for (Node link : links)
+                               sb.append(link.id);
                        return "Node [id=" + id + ", links=" + sb.toString() + ", visited=" + visited + ", onStack=" + onStack + "]";
                }
 
@@ -109,13 +110,17 @@ public class DeadlockDetectionUtil {
        }
 
        private boolean findCycle(Node currentNode) {
-               if (currentNode==null) return false;
-               if (currentNode.isOnStack()) return true;
-               if (currentNode.isVisited()) return false;
+               if (currentNode==null)
+                       return false;
+               if (currentNode.isOnStack())
+                       return true;
+               if (currentNode.isVisited())
+                       return false;
                currentNode.setOnStack(true);
                currentNode.setVisited(true);
                for (Node childNode : currentNode.getLinks()) {
-                       if (findCycle(childNode)) return true;
+                       if (findCycle(childNode))
+                               return true;
                }
                currentNode.setOnStack(false);
                return false;
index 4def0e4..63b72cd 100755 (executable)
@@ -174,9 +174,11 @@ public class RestMusicQAPI {
                 clusteringKey=clusteringKey.replaceAll("[\\(]+","");
                 clusteringKey=clusteringKey.replaceAll("[\\)]+","");
                 clusteringKey = clusteringKey.trim();
-                if (clusteringKey.indexOf(',') == 0) clusteringKey=clusteringKey.substring(1);
+                if (clusteringKey.indexOf(',') == 0)
+                                       clusteringKey=clusteringKey.substring(1);
                 clusteringKey = clusteringKey.trim();
-                if (clusteringKey.equals(",") ) clusteringKey=""; // print error if needed    ( ... ),)
+                if (clusteringKey.equals(",") )
+                                       clusteringKey=""; // print error if needed    ( ... ),)
             }
         }