aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/music/main/MusicCore.java
diff options
context:
space:
mode:
authorNelson, Thomas (arthurdent3) <nelson24@att.com>2019-05-14 20:23:59 +0000
committerTschaen, Brendan <ctschaen@att.com>2019-05-16 12:59:46 -0400
commit66aac8e2b8f61f075b285f969c1f8a88fdb313bd (patch)
tree8ee4e4c06b6a95c6b596c503fa9a6b19936917f0 /src/main/java/org/onap/music/main/MusicCore.java
parentd6e7b63cc580e7b3822be61fe92a493ad5e222a3 (diff)
CADI and a few small updates.
- Include CADI and remove Admin API and admin code. - A few Sonar Fixes. - Properties File Clean up. - Read/Write Locking API. - Various whitespace fixes. Issue-ID: MUSIC-394 Change-Id: I58e1b64b71796bb6bda1c97ea688f434a836d3c7 Signed-off-by: Nelson, Thomas (arthurdent3) <nelson24@att.com>
Diffstat (limited to 'src/main/java/org/onap/music/main/MusicCore.java')
-rw-r--r--src/main/java/org/onap/music/main/MusicCore.java105
1 files changed, 62 insertions, 43 deletions
diff --git a/src/main/java/org/onap/music/main/MusicCore.java b/src/main/java/org/onap/music/main/MusicCore.java
index df718379..324f4681 100644
--- a/src/main/java/org/onap/music/main/MusicCore.java
+++ b/src/main/java/org/onap/music/main/MusicCore.java
@@ -24,7 +24,6 @@ package org.onap.music.main;
import java.util.List;
import java.util.Map;
-
import org.onap.music.datastore.Condition;
import org.onap.music.datastore.PreparedQueryObject;
import org.onap.music.eelf.logging.EELFLoggerDelegate;
@@ -32,105 +31,126 @@ import org.onap.music.exceptions.MusicLockingException;
import org.onap.music.exceptions.MusicQueryException;
import org.onap.music.exceptions.MusicServiceException;
import org.onap.music.lockingservice.cassandra.CassaLockStore;
+import org.onap.music.lockingservice.cassandra.LockType;
import org.onap.music.lockingservice.cassandra.MusicLockState;
import org.onap.music.service.MusicCoreService;
import org.onap.music.service.impl.MusicCassaCore;
-
import com.datastax.driver.core.ResultSet;
public class MusicCore {
private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicCore.class);
- private static boolean unitTestRun=true;
-
+ private static boolean unitTestRun = true;
+
private static MusicCoreService musicCore = MusicUtil.getMusicCoreService();
public static CassaLockStore mLockHandle;
-
-
+
+
/**
* Acquire lock
+ *
* @param fullyQualifiedKey DO NOT RELY ON THIS KEY WORKING. INCLUDE THE KEY IN THE LOCKID.
* @param lockId - the full lock id (key + lockRef)
* @return
- * @throws MusicLockingException
+ * @throws MusicLockingException
* @throws MusicQueryException
* @throws MusicServiceException
*/
- public static ReturnType acquireLock(String fullyQualifiedKey, String lockId)
- throws MusicLockingException, MusicQueryException, MusicServiceException {
+ public static ReturnType acquireLock(String fullyQualifiedKey, String lockId)
+ throws MusicLockingException, MusicQueryException, MusicServiceException {
return musicCore.acquireLock(fullyQualifiedKey, lockId);
}
-
- public static ReturnType acquireLockWithLease(String key, String lockId, long leasePeriod)
- throws MusicLockingException, MusicQueryException, MusicServiceException {
+
+ public static ReturnType acquireLockWithLease(String key, String lockId, long leasePeriod)
+ throws MusicLockingException, MusicQueryException, MusicServiceException {
return musicCore.acquireLockWithLease(key, lockId, leasePeriod);
}
-
+
public static String createLockReference(String fullyQualifiedKey) throws MusicLockingException {
return musicCore.createLockReference(fullyQualifiedKey);
}
-
- public static ResultType createTable(String keyspace, String table, PreparedQueryObject tableQueryObject,
- String consistency) throws MusicServiceException {
+
+ public static String createLockReference(String fullyQualifiedKey, LockType locktype) throws MusicLockingException {
+ return musicCore.createLockReference(fullyQualifiedKey, locktype);
+ }
+
+ public static ResultType createTable(String keyspace, String table, PreparedQueryObject tableQueryObject,
+ String consistency) throws MusicServiceException {
return musicCore.createTable(keyspace, table, tableQueryObject, consistency);
}
-
+
public static ResultSet quorumGet(PreparedQueryObject query) {
- return musicCore.quorumGet(query);
+ return musicCore.quorumGet(query);
}
-
+
+ /**
+ * Gets the top of queue for fullyQualifiedKey
+ *
+ * @param fullyQualifiedKey
+ * @return
+ */
public static String whoseTurnIsIt(String fullyQualifiedKey) {
return musicCore.whoseTurnIsIt(fullyQualifiedKey);
}
-
+
+ /**
+ * Gets the current lockholder(s) for fullyQualifiedKey
+ *
+ * @param fullyQualifiedKey
+ * @return
+ */
+ public static List<String> getCurrentLockHolders(String fullyQualifiedKey) {
+ return musicCore.getCurrentLockHolders(fullyQualifiedKey);
+ }
+
public static void destroyLockRef(String lockId) throws MusicLockingException {
musicCore.destroyLockRef(lockId);
}
-
+
public static ReturnType eventualPut(PreparedQueryObject queryObject) {
return musicCore.eventualPut(queryObject);
}
-
- public static ReturnType eventualPut_nb(PreparedQueryObject queryObject,String keyspace,
- String tablename,String primaryKey) {
+
+ public static ReturnType eventualPut_nb(PreparedQueryObject queryObject, String keyspace, String tablename,
+ String primaryKey) {
return musicCore.eventualPut_nb(queryObject, keyspace, tablename, primaryKey);
}
-
+
public static ReturnType criticalPut(String keyspace, String table, String primaryKeyValue,
PreparedQueryObject queryObject, String lockReference, Condition conditionInfo) {
return musicCore.criticalPut(keyspace, table, primaryKeyValue, queryObject, lockReference, conditionInfo);
}
-
- public static ResultType nonKeyRelatedPut(PreparedQueryObject queryObject, String consistency)
- throws MusicServiceException {
+
+ public static ResultType nonKeyRelatedPut(PreparedQueryObject queryObject, String consistency)
+ throws MusicServiceException {
return musicCore.nonKeyRelatedPut(queryObject, consistency);
}
-
- public static ResultSet get(PreparedQueryObject queryObject) throws MusicServiceException{
+
+ public static ResultSet get(PreparedQueryObject queryObject) throws MusicServiceException {
return musicCore.get(queryObject);
}
-
+
public static ResultSet criticalGet(String keyspace, String table, String primaryKeyValue,
PreparedQueryObject queryObject, String lockReference) throws MusicServiceException {
- return musicCore.criticalGet(keyspace, table, primaryKeyValue, queryObject,lockReference);
+ return musicCore.criticalGet(keyspace, table, primaryKeyValue, queryObject, lockReference);
}
-
+
public static ReturnType atomicPut(String keyspaceName, String tableName, String primaryKey,
- PreparedQueryObject queryObject, Condition conditionInfo) throws MusicLockingException,
- MusicQueryException,MusicServiceException {
+ PreparedQueryObject queryObject, Condition conditionInfo)
+ throws MusicLockingException, MusicQueryException, MusicServiceException {
return musicCore.atomicPut(keyspaceName, tableName, primaryKey, queryObject, conditionInfo);
}
-
+
public static ResultSet atomicGet(String keyspaceName, String tableName, String primaryKey,
PreparedQueryObject queryObject) throws MusicServiceException, MusicLockingException, MusicQueryException {
return musicCore.atomicGet(keyspaceName, tableName, primaryKey, queryObject);
}
-
+
public static List<String> getLockQueue(String fullyQualifiedKey)
throws MusicServiceException, MusicQueryException, MusicLockingException {
return musicCore.getLockQueue(fullyQualifiedKey);
}
-
+
public static long getLockQueueSize(String fullyQualifiedKey)
throws MusicServiceException, MusicQueryException, MusicLockingException {
return musicCore.getLockQueueSize(fullyQualifiedKey);
@@ -139,12 +159,12 @@ public class MusicCore {
public static void deleteLock(String lockName) throws MusicLockingException {
musicCore.deleteLock(lockName);
}
-
- public static ReturnType atomicPutWithDeleteLock(String keyspaceName, String tableName,
- String primaryKey, PreparedQueryObject queryObject, Condition conditionInfo) throws MusicLockingException {
+
+ public static ReturnType atomicPutWithDeleteLock(String keyspaceName, String tableName, String primaryKey,
+ PreparedQueryObject queryObject, Condition conditionInfo) throws MusicLockingException {
return musicCore.atomicPutWithDeleteLock(keyspaceName, tableName, primaryKey, queryObject, conditionInfo);
}
-
+
public static ResultSet atomicGetWithDeleteLock(String keyspaceName, String tableName, String primaryKey,
PreparedQueryObject queryObject) throws MusicServiceException, MusicLockingException {
return musicCore.atomicGetWithDeleteLock(keyspaceName, tableName, primaryKey, queryObject);
@@ -157,6 +177,5 @@ public class MusicCore {
public static MusicLockState releaseLock(String lockId, boolean voluntaryRelease) throws MusicLockingException {
return musicCore.releaseLock(lockId, voluntaryRelease);
}
-
}