aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/music/main/VotingAppJar.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/onap/music/main/VotingAppJar.java')
-rw-r--r--src/main/java/org/onap/music/main/VotingAppJar.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main/java/org/onap/music/main/VotingAppJar.java b/src/main/java/org/onap/music/main/VotingAppJar.java
index 68c6923c..1c475639 100644
--- a/src/main/java/org/onap/music/main/VotingAppJar.java
+++ b/src/main/java/org/onap/music/main/VotingAppJar.java
@@ -7,8 +7,7 @@ import org.onap.music.datastore.PreparedQueryObject;
import org.onap.music.exceptions.MusicLockingException;
import org.onap.music.exceptions.MusicQueryException;
import org.onap.music.exceptions.MusicServiceException;
-import org.onap.music.service.MusicCoreService;
-import org.onap.music.service.impl.MusicCassaCore;
+import org.onap.music.main.MusicCore;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
@@ -20,7 +19,6 @@ public class VotingAppJar
{
String keyspaceName;
String tableName;
- private static MusicCoreService musicCore = MusicCassaCore.getInstance();
public VotingAppJar() throws MusicServiceException {
keyspaceName = "VotingAppForMusic";
@@ -49,7 +47,7 @@ public class VotingAppJar
"CREATE KEYSPACE " + keyspaceName + " WITH REPLICATION = " + replicationInfo.toString().replaceAll("=", ":"));
try {
- musicCore.nonKeyRelatedPut(queryObject, "eventual");
+ MusicCore.nonKeyRelatedPut(queryObject, "eventual");
} catch (MusicServiceException e) {
if (e.getMessage().equals("Keyspace votingappformusic already exists")) {
// ignore
@@ -65,7 +63,7 @@ public class VotingAppJar
"CREATE TABLE " + keyspaceName + "." + tableName + " (name text PRIMARY KEY, count varint);");
try {
- musicCore.createTable(keyspaceName, tableName, queryObject, "eventual");
+ MusicCore.createTable(keyspaceName, tableName, queryObject, "eventual");
} catch (MusicServiceException e) {
if (e.getMessage().equals("Table votingappformusic.votevount already exists")) {
//ignore
@@ -81,7 +79,7 @@ public class VotingAppJar
"INSERT INTO " + keyspaceName + "." + tableName + " (name, count) "
+ "VALUES ('"+candidateName+"', 0);");
- musicCore.nonKeyRelatedPut(queryObject, "eventual");
+ MusicCore.nonKeyRelatedPut(queryObject, "eventual");
}
public void vote() throws MusicLockingException, MusicQueryException, MusicServiceException {
@@ -96,13 +94,13 @@ public class VotingAppJar
queryObject.appendQueryString(
"INSERT INTO " + keyspaceName + "." + tableName + " (name, count) "
+ "VALUES ('"+candidateName+"', "+numVotes+");");
- musicCore.atomicPut(keyspaceName, tableName, candidateName, queryObject, null);
+ MusicCore.atomicPut(keyspaceName, tableName, candidateName, queryObject, null);
}
private void readAllVotes() throws MusicServiceException {
PreparedQueryObject queryObject = new PreparedQueryObject();
queryObject.appendQueryString("SELECT * FROM " + keyspaceName + "." + tableName);
- ResultSet rs = musicCore.get(queryObject);
+ ResultSet rs = MusicCore.get(queryObject);
for(Row candidate : rs.all()) {
System.out.println(candidate.getString("name") + " - " + candidate.getVarint("count"));
}