aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/music/main/VotingAppJar.java
diff options
context:
space:
mode:
authorTschaen, Brendan <ctschaen@att.com>2018-11-15 10:31:53 -0500
committerTschaen, Brendan <ctschaen@att.com>2018-11-15 10:32:38 -0500
commita1f03a639a2ba38ec5c19e96c3c9d703fa048a8f (patch)
treecfa2b706104c5a05cd67ce88568296876b7d3a49 /src/main/java/org/onap/music/main/VotingAppJar.java
parent7addd52dc73e6571028ca7f6a018e75ec1c9b0ca (diff)
Revert "music core implemented as a service"
This reverts commit 7addd52dc73e6571028ca7f6a018e75ec1c9b0ca. Change-Id: I0875ce10521363b8e17eb6cd2cf9d8848e572bea Issue-ID: MUSIC-189 Signed-off-by: Tschaen, Brendan <ctschaen@att.com>
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"));
}