aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/music/datastore
diff options
context:
space:
mode:
authorTschaen, Brendan <ctschaen@att.com>2018-10-16 20:22:35 -0400
committerTschaen, Brendan <ctschaen@att.com>2018-10-16 20:27:37 -0400
commit46350c084766789ea59e83f1917c57c81d653048 (patch)
tree3463279fcee9c26d190d854324bbd7f86422fe2e /src/main/java/org/onap/music/datastore
parent287bdcbb5482f94df091c3b7b766fed0007efa2e (diff)
Include Cassandra locking
Change-Id: I085acf8336d5f27782ee12768846a5befd3ee60d Issue-ID: MUSIC-148 Signed-off-by: Tschaen, Brendan <ctschaen@att.com>
Diffstat (limited to 'src/main/java/org/onap/music/datastore')
-rw-r--r--src/main/java/org/onap/music/datastore/CassaDataStore.java (renamed from src/main/java/org/onap/music/datastore/MusicDataStore.java)98
-rw-r--r--src/main/java/org/onap/music/datastore/CassaLockStore.java173
-rw-r--r--src/main/java/org/onap/music/datastore/MusicLockState.java41
-rw-r--r--src/main/java/org/onap/music/datastore/PreparedQueryObject.java5
-rwxr-xr-xsrc/main/java/org/onap/music/datastore/jsonobjects/JSONCallbackResponse.java89
-rwxr-xr-xsrc/main/java/org/onap/music/datastore/jsonobjects/JsonCallback.java135
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java4
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java5
-rwxr-xr-xsrc/main/java/org/onap/music/datastore/jsonobjects/JsonNotification.java119
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonNotifyClientResponse.java59
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java5
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java9
12 files changed, 274 insertions, 468 deletions
diff --git a/src/main/java/org/onap/music/datastore/MusicDataStore.java b/src/main/java/org/onap/music/datastore/CassaDataStore.java
index 0154ad28..14934f6e 100644
--- a/src/main/java/org/onap/music/datastore/MusicDataStore.java
+++ b/src/main/java/org/onap/music/datastore/CassaDataStore.java
@@ -30,6 +30,8 @@ import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.UUID;
+
import org.onap.music.eelf.logging.EELFLoggerDelegate;
import org.onap.music.eelf.logging.format.AppMessages;
import org.onap.music.eelf.logging.format.ErrorSeverity;
@@ -42,10 +44,8 @@ import com.datastax.driver.core.ColumnDefinitions;
import com.datastax.driver.core.ColumnDefinitions.Definition;
import com.datastax.driver.core.ConsistencyLevel;
import com.datastax.driver.core.DataType;
-import com.datastax.driver.core.HostDistance;
import com.datastax.driver.core.KeyspaceMetadata;
import com.datastax.driver.core.Metadata;
-import com.datastax.driver.core.PoolingOptions;
import com.datastax.driver.core.PreparedStatement;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
@@ -54,13 +54,42 @@ import com.datastax.driver.core.TableMetadata;
import com.datastax.driver.core.exceptions.AlreadyExistsException;
import com.datastax.driver.core.exceptions.InvalidQueryException;
import com.datastax.driver.core.exceptions.NoHostAvailableException;
+import com.datastax.driver.core.utils.UUIDs;
import com.sun.jersey.core.util.Base64;
/**
* @author nelson24
*
*/
-public class MusicDataStore {
+/**
+ * @author bharathb
+ *
+ */
+/**
+ * @author bharathb
+ *
+ */
+/**
+ * @author bharathb
+ *
+ */
+/**
+ * @author bharathb
+ *
+ */
+/**
+ * @author bharathb
+ *
+ */
+/**
+ * @author bharathb
+ *
+ */
+/**
+ * @author bharathb
+ *
+ */
+public class CassaDataStore {
private Session session;
private Cluster cluster;
@@ -90,12 +119,12 @@ public class MusicDataStore {
- private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicDataStore.class);
+ private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CassaDataStore.class);
/**
*
*/
- public MusicDataStore() {
+ public CassaDataStore() {
connectToCassaCluster();
}
@@ -104,7 +133,7 @@ public class MusicDataStore {
* @param cluster
* @param session
*/
- public MusicDataStore(Cluster cluster, Session session) {
+ public CassaDataStore(Cluster cluster, Session session) {
this.session = session;
this.cluster = cluster;
}
@@ -114,7 +143,7 @@ public class MusicDataStore {
* @param remoteIp
* @throws MusicServiceException
*/
- public MusicDataStore(String remoteIp) {
+ public CassaDataStore(String remoteIp) {
try {
connectToCassaCluster(remoteIp);
} catch (MusicServiceException e) {
@@ -151,35 +180,16 @@ public class MusicDataStore {
* clusters.
*/
private void connectToCassaCluster() {
- Iterator<String> it = getAllPossibleLocalIps().iterator();
+ Iterator<String> it = getAllPossibleLocalIps().iterator();
String address = "localhost";
- String[] addresses = null;
- address = MusicUtil.getMyCassaHost();
- addresses = address.split(",");
-
logger.info(EELFLoggerDelegate.applicationLogger,
"Connecting to cassa cluster: Iterating through possible ips:"
+ getAllPossibleLocalIps());
- PoolingOptions poolingOptions = new PoolingOptions();
- poolingOptions
- .setConnectionsPerHost(HostDistance.LOCAL, 4, 10)
- .setConnectionsPerHost(HostDistance.REMOTE, 2, 4);
while (it.hasNext()) {
try {
- if(MusicUtil.getCassName() != null && MusicUtil.getCassPwd() != null) {
- logger.info(EELFLoggerDelegate.applicationLogger,
- "Building with credentials "+MusicUtil.getCassName()+" & "+MusicUtil.getCassPwd());
- cluster = Cluster.builder().withPort(MusicUtil.getCassandraPort())
- .withCredentials(MusicUtil.getCassName(), MusicUtil.getCassPwd())
- //.withLoadBalancingPolicy(new RoundRobinPolicy())
- .withPoolingOptions(poolingOptions)
- .addContactPoints(addresses).build();
- }
- else
- cluster = Cluster.builder().withPort(MusicUtil.getCassandraPort())
- //.withLoadBalancingPolicy(new RoundRobinPolicy())
- .addContactPoints(addresses).build();
-
+ cluster = Cluster.builder().withPort(9042)
+ .withCredentials(MusicUtil.getCassName(), MusicUtil.getCassPwd())
+ .addContactPoint(address).build();
Metadata metadata = cluster.getMetadata();
logger.info(EELFLoggerDelegate.applicationLogger, "Connected to cassa cluster "
+ metadata.getClusterName() + " at " + address);
@@ -206,27 +216,9 @@ public class MusicDataStore {
* @param address
*/
private void connectToCassaCluster(String address) throws MusicServiceException {
- String[] addresses = null;
- addresses = address.split(",");
- PoolingOptions poolingOptions = new PoolingOptions();
- poolingOptions
- .setConnectionsPerHost(HostDistance.LOCAL, 4, 10)
- .setConnectionsPerHost(HostDistance.REMOTE, 2, 4);
- if(MusicUtil.getCassName() != null && MusicUtil.getCassPwd() != null) {
- logger.info(EELFLoggerDelegate.applicationLogger,
- "Building with credentials "+MusicUtil.getCassName()+" & "+MusicUtil.getCassPwd());
- cluster = Cluster.builder().withPort(MusicUtil.getCassandraPort())
- .withCredentials(MusicUtil.getCassName(), MusicUtil.getCassPwd())
- //.withLoadBalancingPolicy(new RoundRobinPolicy())
- .withPoolingOptions(poolingOptions)
- .addContactPoints(addresses).build();
- }
- else {
- cluster = Cluster.builder().withPort(MusicUtil.getCassandraPort())
- //.withLoadBalancingPolicy(new RoundRobinPolicy())
- .withPoolingOptions(poolingOptions)
- .addContactPoints(addresses).build();
- }
+ cluster = Cluster.builder().withPort(9042)
+ .withCredentials(MusicUtil.getCassName(), MusicUtil.getCassPwd())
+ .addContactPoint(address).build();
Metadata metadata = cluster.getMetadata();
logger.info(EELFLoggerDelegate.applicationLogger, "Connected to cassa cluster "
+ metadata.getClusterName() + " at " + address);
@@ -315,7 +307,7 @@ public class MusicDataStore {
DataType colType = colInfo.getType(colName);
Object columnValue = getColValue(row, colName, colType);
Object conditionValue = MusicUtil.convertToActualDataType(colType, entry.getValue());
- if (!columnValue.equals(conditionValue))
+ if (columnValue.equals(conditionValue) == false)
return false;
}
return true;
@@ -479,5 +471,5 @@ public class MusicDataStore {
return results;
}
-
}
+
diff --git a/src/main/java/org/onap/music/datastore/CassaLockStore.java b/src/main/java/org/onap/music/datastore/CassaLockStore.java
new file mode 100644
index 00000000..e03a1c07
--- /dev/null
+++ b/src/main/java/org/onap/music/datastore/CassaLockStore.java
@@ -0,0 +1,173 @@
+package org.onap.music.datastore;
+
+import java.util.UUID;
+
+import org.onap.music.eelf.logging.EELFLoggerDelegate;
+import org.onap.music.exceptions.MusicQueryException;
+import org.onap.music.exceptions.MusicServiceException;
+import org.onap.music.main.MusicUtil;
+
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.Row;
+import com.datastax.driver.core.utils.UUIDs;
+
+/*
+ * This is the lock store that is built on top of Cassandra that is used by MUSIC to maintain lock state.
+ */
+
+public class CassaLockStore {
+
+ private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CassaLockStore.class);
+
+ public class LockObject{
+ public String lockRef;
+ public String createTime;
+ public String acquireTime;
+ public LockObject(String lockRef, String createTime, String acquireTime) {
+ this.lockRef = lockRef;
+ this.acquireTime = acquireTime;
+ this.createTime = createTime;
+
+ }
+ }
+ CassaDataStore dsHandle;
+ public CassaLockStore() {
+ dsHandle = new CassaDataStore();
+ }
+
+ public CassaLockStore(CassaDataStore dsHandle) {
+ this.dsHandle=dsHandle;
+ }
+
+
+ /**
+ *
+ * This method creates a shadow locking table for every main table in Cassandra. This table tracks all information regarding locks.
+ * @param keyspace of the application.
+ * @param table of the application.
+ * @return true if the operation was successful.
+ * @throws MusicServiceException
+ * @throws MusicQueryException
+ */
+ public boolean createLockQueue(String keyspace, String table) throws MusicServiceException, MusicQueryException {
+ logger.info(EELFLoggerDelegate.applicationLogger,
+ "Create lock queue/table for " + keyspace+"."+table);
+ table = "lockQ_"+table;
+ String tabQuery = "CREATE TABLE IF NOT EXISTS "+keyspace+"."+table
+ + " ( key text, lockReference bigint, createTime text, acquireTime text, guard bigint static, PRIMARY KEY ((key), lockReference) ) "
+ + "WITH CLUSTERING ORDER BY (lockReference ASC);";
+ System.out.println(tabQuery);
+ PreparedQueryObject queryObject = new PreparedQueryObject();
+
+ queryObject.appendQueryString(tabQuery);
+ boolean result;
+ result = dsHandle.executePut(queryObject, "eventual");
+ return result;
+ }
+
+ /**
+ * This method creates a lock reference for each invocation. The lock references are monotonically increasing timestamps.
+ * @param keyspace of the locks.
+ * @param table of the locks.
+ * @param lockName is the primary key of the lock table
+ * @return the UUID lock reference.
+ * @throws MusicServiceException
+ * @throws MusicQueryException
+ */
+ public String genLockRefandEnQueue(String keyspace, String table, String lockName) throws MusicServiceException, MusicQueryException {
+ logger.info(EELFLoggerDelegate.applicationLogger,
+ "Create lock reference for " + keyspace + "." + table + "." + lockName);
+ table = "lockQ_" + table;
+ long lockEpochMillis = System.currentTimeMillis();
+ long lockRef = lockEpochMillis;
+
+ logger.info(EELFLoggerDelegate.applicationLogger,
+ "Created lock reference for " + keyspace + "." + table + "." + lockName + ":" + lockRef);
+
+ PreparedQueryObject queryObject = new PreparedQueryObject();
+ String defaultQuery = " UPDATE " + keyspace + "." + table + " SET guard=-1 WHERE key=? IF guard = NULL;";
+
+ queryObject.addValue(lockName);
+ queryObject.appendQueryString(defaultQuery);
+ boolean dqResult = dsHandle.executePut(queryObject, "critical");
+// System.out.println("dqResult: " + dqResult);
+
+
+ queryObject = new PreparedQueryObject();
+ String insQuery = "BEGIN BATCH" +
+ " UPDATE " + keyspace + "." + table + " SET guard=? WHERE key=? IF guard < ?;" +
+ " INSERT INTO " + keyspace + "." + table +
+ "(key, lockReference, createTime, acquireTime) VALUES (?,?,?,?) IF NOT EXISTS; APPLY BATCH;";
+
+ queryObject.addValue(lockRef);
+ queryObject.addValue(lockName);
+ queryObject.addValue(lockRef);
+
+ queryObject.addValue(lockName);
+ queryObject.addValue(lockRef);
+ queryObject.addValue(String.valueOf(lockEpochMillis));
+ queryObject.addValue("0");
+ queryObject.appendQueryString(insQuery);
+ boolean pResult = dsHandle.executePut(queryObject, "critical");
+// System.out.println("pResult: " + pResult);
+ return String.valueOf(lockRef);
+ }
+
+
+ /**
+ * This method returns the top of lock table/queue for the key.
+ * @param keyspace of the application.
+ * @param table of the application.
+ * @param key is the primary key of the application table
+ * @return the UUID lock reference.
+ * @throws MusicServiceException
+ * @throws MusicQueryException
+ */
+ public LockObject peekLockQueue(String keyspace, String table, String key) throws MusicServiceException, MusicQueryException{
+ logger.info(EELFLoggerDelegate.applicationLogger,
+ "Peek in lock table for " + keyspace+"."+table+"."+key);
+ table = "lockQ_"+table;
+ String selectQuery = "select * from "+keyspace+"."+table+" where key='"+key+"' LIMIT 1;";
+ PreparedQueryObject queryObject = new PreparedQueryObject();
+ queryObject.appendQueryString(selectQuery);
+ ResultSet results = dsHandle.executeEventualGet(queryObject);
+ Row row = results.one();
+ String lockReference = "" + row.getLong("lockReference");
+ String createTime = row.getString("createTime");
+ String acquireTime = row.getString("acquireTime");
+
+ return new LockObject(lockReference, createTime,acquireTime);
+ }
+
+
+ /**
+ * This method removes the lock ref from the lock table/queue for the key.
+ * @param keyspace of the application.
+ * @param table of the application.
+ * @param key is the primary key of the application table
+ * @param lockReference the lock reference that needs to be dequeued.
+ * @throws MusicServiceException
+ * @throws MusicQueryException
+ */
+ public void deQueueLockRef(String keyspace, String table, String key, String lockReference) throws MusicServiceException, MusicQueryException{
+ table = "lockQ_"+table;
+ PreparedQueryObject queryObject = new PreparedQueryObject();
+ Long lockReferenceL = Long.parseLong(lockReference);
+ String deleteQuery = "delete from "+keyspace+"."+table+" where key='"+key+"' AND lockReference ="+lockReferenceL+" IF EXISTS;";
+ queryObject.appendQueryString(deleteQuery);
+ dsHandle.executePut(queryObject, "critical");
+ }
+
+
+ public void updateLockAcquireTime(String keyspace, String table, String key, String lockReference) throws MusicServiceException, MusicQueryException{
+ table = "lockQ_"+table;
+ PreparedQueryObject queryObject = new PreparedQueryObject();
+ Long lockReferenceL = Long.parseLong(lockReference);
+ String updateQuery = "update "+keyspace+"."+table+" set acquireTime='"+ System.currentTimeMillis()+"' where key='"+key+"' AND lockReference = "+lockReferenceL+" IF EXISTS;";
+ queryObject.appendQueryString(updateQuery);
+ dsHandle.executePut(queryObject, "eventual");
+
+ }
+
+
+}
diff --git a/src/main/java/org/onap/music/datastore/MusicLockState.java b/src/main/java/org/onap/music/datastore/MusicLockState.java
new file mode 100644
index 00000000..60a15b13
--- /dev/null
+++ b/src/main/java/org/onap/music/datastore/MusicLockState.java
@@ -0,0 +1,41 @@
+package org.onap.music.datastore;
+public class MusicLockState {
+ public enum LockStatus {
+ UNLOCKED, BEING_LOCKED, LOCKED
+ };// captures the state of the lock
+
+ private LockStatus lockStatus;
+ private String lockHolder;
+ private String errorMessage = null;
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ public MusicLockState(LockStatus lockStatus, String lockHolder) {
+ super();
+ this.lockStatus = lockStatus;
+ this.lockHolder = lockHolder;
+ }
+
+ public LockStatus getLockStatus() {
+ return lockStatus;
+ }
+
+ public void setLockStatus(LockStatus lockStatus) {
+ this.lockStatus = lockStatus;
+ }
+
+ public String getLockHolder() {
+ return lockHolder;
+ }
+
+ public void setLockHolder(String lockHolder) {
+ this.lockHolder = lockHolder;
+ }
+
+}
diff --git a/src/main/java/org/onap/music/datastore/PreparedQueryObject.java b/src/main/java/org/onap/music/datastore/PreparedQueryObject.java
index 694d9acd..534f7d65 100644
--- a/src/main/java/org/onap/music/datastore/PreparedQueryObject.java
+++ b/src/main/java/org/onap/music/datastore/PreparedQueryObject.java
@@ -34,6 +34,7 @@ public class PreparedQueryObject {
private List<Object> values;
private StringBuilder query;
+
@@ -67,6 +68,10 @@ public class PreparedQueryObject {
this.query.append(s);
}
+ public void replaceQueryString(String s) {
+ this.query.replace(0, query.length(), s);
+ }
+
/**
* @return
*/
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JSONCallbackResponse.java b/src/main/java/org/onap/music/datastore/jsonobjects/JSONCallbackResponse.java
deleted file mode 100755
index f869c342..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JSONCallbackResponse.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * org.onap.music
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property
- * ===================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ============LICENSE_END=============================================
- * ====================================================================
- */
-
-package org.onap.music.datastore.jsonobjects;
-
-import java.util.List;
-import java.util.Map;
-
-public class JSONCallbackResponse {
-
- private String full_table;
- private String keyspace;
- private Map<String, String> changeValue;
- private String operation;
- private String table_name;
- private String primary_key;
- private Object miscObjects;
- private List<String> updateList;
-
- public String getFull_table() {
- return full_table;
- }
- public void setFull_table(String full_table) {
- this.full_table = full_table;
- }
- public String getKeyspace() {
- return keyspace;
- }
- public void setKeyspace(String keyspace) {
- this.keyspace = keyspace;
- }
- public String getOperation() {
- return operation;
- }
- public void setOperation(String operation) {
- this.operation = operation;
- }
- public String getTable_name() {
- return table_name;
- }
- public void setTable_name(String table_name) {
- this.table_name = table_name;
- }
- public String getPrimary_key() {
- return primary_key;
- }
- public void setPrimary_key(String primary_key) {
- this.primary_key = primary_key;
- }
- public Object getMiscObjects() {
- return miscObjects;
- }
- public void setMiscObjects(Object miscObjects) {
- this.miscObjects = miscObjects;
- }
- public void setChangeValue(Map<String, String> changeValue) {
- this.changeValue = changeValue;
- }
- public Map<String, String> getChangeValue() {
- return changeValue;
- }
- public List<String> getUpdateList() {
- return updateList;
- }
- public void setUpdateList(List<String> updateList) {
- this.updateList = updateList;
- }
-
-
-}
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonCallback.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonCallback.java
deleted file mode 100755
index 4a865320..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonCallback.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * org.onap.music
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property
- * ===================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ============LICENSE_END=============================================
- * ====================================================================
- */
-package org.onap.music.datastore.jsonobjects;
-
-import java.io.Serializable;
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-@ApiModel(value = "JsonCallback", description = "Json model for callback")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class JsonCallback implements Serializable {
- private String applicationName;
- private String applicationUsername;
- private String applicationPassword;
- private String applicationNotificationEndpoint;
- private String notifyOn;
- private String notifyWhenChangeIn;
- private String notifyWhenInsertsIn;
- private String notifyWhenDeletesIn;
- private Map<String, String> responseBody;
-
- private String uuid;
-
- public String getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- @ApiModelProperty(value = "application name")
- public String getApplicationName() {
- return applicationName;
- }
-
- public void setApplicationName(String applicationName) {
- this.applicationName = applicationName;
- }
-
- @ApiModelProperty(value = "notify On")
- public String getNotifyOn() {
- return notifyOn;
- }
-
- public void setNotifyOn(String notifyOn) {
- this.notifyOn = notifyOn;
- }
-
- @ApiModelProperty(value = "application User name")
- public String getApplicationUsername() {
- return applicationUsername;
- }
-
- public void setApplicationUsername(String applicationUsername) {
- this.applicationUsername = applicationUsername;
- }
-
- @ApiModelProperty(value = "application password")
- public String getApplicationPassword() {
- return applicationPassword;
- }
-
- public void setApplicationPassword(String applicationPassword) {
- this.applicationPassword = applicationPassword;
- }
-
- @ApiModelProperty(value = "application notification endpoint")
- public String getApplicationNotificationEndpoint() {
- return applicationNotificationEndpoint;
- }
-
- public void setApplicationNotificationEndpoint(String applicationNotificationEndpoint) {
- this.applicationNotificationEndpoint = applicationNotificationEndpoint;
- }
-
- @ApiModelProperty(value = "notify when updates")
- public String getNotifyWhenChangeIn() {
- return notifyWhenChangeIn;
- }
-
- public void setNotifyWhenChangeIn(String notifyWhenChangeIn) {
- this.notifyWhenChangeIn = notifyWhenChangeIn;
- }
-
- @ApiModelProperty(value = "notify when inserts")
- public String getNotifyWhenInsertsIn() {
- return notifyWhenInsertsIn;
- }
-
- public void setNotifyWhenInsertsIn(String notifyWhenInsertsIn) {
- this.notifyWhenInsertsIn = notifyWhenInsertsIn;
- }
-
- @ApiModelProperty(value = "notify when deletes")
- public String getNotifyWhenDeletesIn() {
- return notifyWhenDeletesIn;
- }
-
- public void setNotifyWhenDeletesIn(String notifyWhenDeletesIn) {
- this.notifyWhenDeletesIn = notifyWhenDeletesIn;
- }
-
- public Map<String, String> getResponseBody() {
- return responseBody;
- }
-
- public void setResponseBody(Map<String, String> responseBody) {
- this.responseBody = responseBody;
- }
-
-}
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
index ce7f509b..a5db4be5 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
@@ -36,8 +36,7 @@ public class JsonDelete {
private ArrayList<String> columns = null;
private Map<String, String> consistencyInfo;
private Map<String, Object> conditions;
- String ttl;
- String timestamp;
+ String ttl, timestamp;
@ApiModelProperty(value = "Conditions")
@@ -86,4 +85,3 @@ public class JsonDelete {
this.timestamp = timestamp;
}
}
-
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java
index c79ba9b7..9630abe0 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java
@@ -38,11 +38,12 @@ import io.swagger.annotations.ApiModelProperty;
public class JsonInsert implements Serializable {
private String keyspaceName;
private String tableName;
- private transient Map<String, Object> values;
+ private Map<String, Object> values;
private String ttl;
private String timestamp;
- private transient Map<String, Object> row_specification;
+ private Map<String, Object> row_specification;
private Map<String, String> consistencyInfo;
+ private byte[] data;
private Map<String, byte[]> objectMap;
@ApiModelProperty(value = "objectMap")
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonNotification.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonNotification.java
deleted file mode 100755
index ce244e2c..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonNotification.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * org.onap.music
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property
- * ===================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ============LICENSE_END=============================================
- * ====================================================================
- */
-package org.onap.music.datastore.jsonobjects;
-
-import java.io.Serializable;
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import io.swagger.annotations.ApiModel;
-
-@ApiModel(value = "JsonNotification", description = "Json model for callback")
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonInclude(Include.NON_NULL)
-public class JsonNotification implements Serializable {
-
- private String notify_field;
- private String endpoint;
- private String username;
- private String password;
- private String notify_change;
- private String notify_insert;
- private String notify_delete;
- private String operation_type;
- private String triggerName;
- private Map<String, String> response_body;
-
- public String getNotify_field() {
- return notify_field;
- }
- public void setNotify_field(String notify_field) {
- this.notify_field = notify_field;
- }
- public String getEndpoint() {
- return endpoint;
- }
- public void setEndpoint(String endpoint) {
- this.endpoint = endpoint;
- }
- public String getUsername() {
- return username;
- }
- public void setUsername(String username) {
- this.username = username;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- public Map<String, String> getResponse_body() {
- return response_body;
- }
- public void setResponse_body(Map<String, String> response_body) {
- this.response_body = response_body;
- }
- public String getNotify_change() {
- return notify_change;
- }
- public void setNotify_change(String notify_change) {
- this.notify_change = notify_change;
- }
- public String getNotify_insert() {
- return notify_insert;
- }
- public void setNotify_insert(String notify_insert) {
- this.notify_insert = notify_insert;
- }
- public String getNotify_delete() {
- return notify_delete;
- }
- public void setNotify_delete(String notify_delete) {
- this.notify_delete = notify_delete;
- }
- public String getOperation_type() {
- return operation_type;
- }
- public void setOperation_type(String operation_type) {
- this.operation_type = operation_type;
- }
- public String getTriggerName() {
- return triggerName;
- }
- public void setTriggerName(String triggerName) {
- this.triggerName = triggerName;
- }
- @Override
- public String toString() {
- try {
- return new com.fasterxml.jackson.databind.ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(this);
- } catch (com.fasterxml.jackson.core.JsonProcessingException e) {
- return notify_field+ " : "+endpoint+ " : "+username+ " : "+password+ " : "+response_body;
- }
-
- }
-
-}
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonNotifyClientResponse.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonNotifyClientResponse.java
deleted file mode 100644
index 963352d0..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonNotifyClientResponse.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * org.onap.music
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property
- * ===================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ============LICENSE_END=============================================
- * ====================================================================
- */
-package org.onap.music.datastore.jsonobjects;
-
-import java.io.Serializable;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-import io.swagger.annotations.ApiModel;
-
-@ApiModel(value = "JsonNotifyClientResponse", description = "Json model for callback")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class JsonNotifyClientResponse implements Serializable {
- private String message;
- private String status;
-
- public String getMessage() {
- return message;
- }
- public void setMessage(String message) {
- this.message = message;
- }
- public String getStatus() {
- return status;
- }
- public void setStatus(String status) {
- this.status = status;
- }
-
- @Override
- public String toString() {
- try {
- return new com.fasterxml.jackson.databind.ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(this);
- } catch (com.fasterxml.jackson.core.JsonProcessingException e) {
- return message+ " : "+status;
- }
-
- }
-
-}
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java
index ef56c5de..64bc3887 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java
@@ -27,13 +27,13 @@ import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Map;
-import org.apache.log4j.Logger;
+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class JsonSelect implements Serializable {
private Map<String, String> consistencyInfo;
- static Logger logger = Logger.getLogger(JsonSelect.class.getName());
+
public Map<String, String> getConsistencyInfo() {
return consistencyInfo;
@@ -51,7 +51,6 @@ public class JsonSelect implements Serializable {
out.writeObject(this);
} catch (IOException e) {
// TODO Auto-generated catch block
- logger.error("Error", e);
e.printStackTrace();
}
return bos.toByteArray();
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java
index c1a56819..3ab5ea0d 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java
@@ -38,12 +38,11 @@ import io.swagger.annotations.ApiModelProperty;
public class JsonUpdate implements Serializable {
private String keyspaceName;
private String tableName;
- private transient Map<String, Object> values;
- private String ttl;
- private String timestamp;
+ private Map<String, Object> values;
+ private String ttl, timestamp;
private Map<String, String> consistencyInfo;
- private transient Map<String, Object> conditions;
- private transient Map<String, Object> row_specification;
+ private Map<String, Object> conditions;
+ private Map<String, Object> row_specification;
@ApiModelProperty(value = "Conditions")
public Map<String, Object> getConditions() {