diff options
10 files changed, 53 insertions, 27 deletions
diff --git a/docs/architecture.rst b/docs/architecture.rst index 74cb0c40..73cfbc2d 100644 --- a/docs/architecture.rst +++ b/docs/architecture.rst @@ -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 ============ diff --git a/docs/index.rst b/docs/index.rst index 437a50d8..19822636 100755 --- a/docs/index.rst +++ b/docs/index.rst @@ -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 ============================= diff --git a/docs/offeredapis.rst b/docs/offeredapis.rst index a9a59650..c75bd0c0 100644 --- a/docs/offeredapis.rst +++ b/docs/offeredapis.rst @@ -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 ============ diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 9387c206..e736d848 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -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 diff --git a/music-core/src/main/java/org/onap/music/datastore/MusicDataStore.java b/music-core/src/main/java/org/onap/music/datastore/MusicDataStore.java index cb22c0f4..9ce73cc8 100755 --- a/music-core/src/main/java/org/onap/music/datastore/MusicDataStore.java +++ b/music-core/src/main/java/org/onap/music/datastore/MusicDataStore.java @@ -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()) diff --git a/music-core/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java b/music-core/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java index 0a277e08..0ba1a7ef 100644 --- a/music-core/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java +++ b/music-core/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java @@ -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(")"); diff --git a/music-core/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java b/music-core/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java index a727357f..0c5d39c8 100644 --- a/music-core/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java +++ b/music-core/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java @@ -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=?;"; diff --git a/music-core/src/main/java/org/onap/music/main/CorePropertiesLoader.java b/music-core/src/main/java/org/onap/music/main/CorePropertiesLoader.java index c3866672..2e5ca689 100644 --- a/music-core/src/main/java/org/onap/music/main/CorePropertiesLoader.java +++ b/music-core/src/main/java/org/onap/music/main/CorePropertiesLoader.java @@ -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) { diff --git a/music-core/src/main/java/org/onap/music/main/DeadlockDetectionUtil.java b/music-core/src/main/java/org/onap/music/main/DeadlockDetectionUtil.java index 4c9a74b7..23ccca7f 100644 --- a/music-core/src/main/java/org/onap/music/main/DeadlockDetectionUtil.java +++ b/music-core/src/main/java/org/onap/music/main/DeadlockDetectionUtil.java @@ -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; diff --git a/music-rest/src/main/java/org/onap/music/rest/RestMusicQAPI.java b/music-rest/src/main/java/org/onap/music/rest/RestMusicQAPI.java index 4def0e45..63b72cda 100755 --- a/music-rest/src/main/java/org/onap/music/rest/RestMusicQAPI.java +++ b/music-rest/src/main/java/org/onap/music/rest/RestMusicQAPI.java @@ -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 ( ... ),) } } |