aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/music/datastore
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/onap/music/datastore')
-rw-r--r--src/main/java/org/onap/music/datastore/Condition.java52
-rwxr-xr-x[-rw-r--r--]src/main/java/org/onap/music/datastore/MusicDataStore.java321
-rw-r--r--src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java108
-rw-r--r--src/main/java/org/onap/music/datastore/PreparedQueryObject.java49
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/AAFResponse.java1
-rwxr-xr-xsrc/main/java/org/onap/music/datastore/jsonobjects/JSONCallbackResponse.java89
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java18
-rwxr-xr-xsrc/main/java/org/onap/music/datastore/jsonobjects/JsonCallback.java135
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java5
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java9
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonKeySpace.java1
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java1
-rwxr-xr-xsrc/main/java/org/onap/music/datastore/jsonobjects/JsonNotification.java127
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonNotifyClientResponse.java59
-rwxr-xr-xsrc/main/java/org/onap/music/datastore/jsonobjects/JsonOnboard.java11
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java7
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java37
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java1
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/NameSpace.java1
19 files changed, 476 insertions, 556 deletions
diff --git a/src/main/java/org/onap/music/datastore/Condition.java b/src/main/java/org/onap/music/datastore/Condition.java
new file mode 100644
index 00000000..2fd4596a
--- /dev/null
+++ b/src/main/java/org/onap/music/datastore/Condition.java
@@ -0,0 +1,52 @@
+/*
+ * ============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;
+import java.util.Map;
+
+import org.onap.music.main.MusicCore;
+
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.Row;
+
+public class Condition {
+ Map<String, Object> conditions;
+ PreparedQueryObject selectQueryForTheRow;
+
+ public Condition(Map<String, Object> conditions, PreparedQueryObject selectQueryForTheRow) {
+ this.conditions = conditions;
+ this.selectQueryForTheRow = selectQueryForTheRow;
+ }
+
+ public boolean testCondition() throws Exception {
+ // first generate the row
+ ResultSet results = MusicCore.quorumGet(selectQueryForTheRow);
+ Row row = null;
+ if(results != null) {
+ row = results.one();
+ }
+ if(row == null) {
+ throw new Exception(" No data found to update");
+ }
+ return MusicDataStoreHandle.getDSHandle().doesRowSatisfyCondition(row, conditions);
+ }
+ } \ No newline at end of file
diff --git a/src/main/java/org/onap/music/datastore/MusicDataStore.java b/src/main/java/org/onap/music/datastore/MusicDataStore.java
index c6b022cc..bb8e537e 100644..100755
--- a/src/main/java/org/onap/music/datastore/MusicDataStore.java
+++ b/src/main/java/org/onap/music/datastore/MusicDataStore.java
@@ -9,18 +9,19 @@
* 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;
import java.net.InetAddress;
@@ -33,14 +34,17 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import org.apache.commons.jcs.access.CacheAccess;
import org.onap.music.eelf.logging.EELFLoggerDelegate;
import org.onap.music.eelf.logging.format.AppMessages;
import org.onap.music.eelf.logging.format.ErrorSeverity;
import org.onap.music.eelf.logging.format.ErrorTypes;
import org.onap.music.exceptions.MusicQueryException;
import org.onap.music.exceptions.MusicServiceException;
+import org.onap.music.main.CachingUtil;
import org.onap.music.main.MusicUtil;
+import com.codahale.metrics.JmxReporter;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.ColumnDefinitions;
import com.datastax.driver.core.ColumnDefinitions.Definition;
@@ -54,10 +58,12 @@ import com.datastax.driver.core.PreparedStatement;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Session;
+import com.datastax.driver.core.SimpleStatement;
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.sun.jersey.core.util.Base64;
/**
* @author nelson24
@@ -65,10 +71,33 @@ import com.datastax.driver.core.exceptions.NoHostAvailableException;
*/
public class MusicDataStore {
+ public static final String CONSISTENCY_LEVEL_ONE = "ONE";
+ public static final String CONSISTENCY_LEVEL_QUORUM = "QUORUM";
private Session session;
private Cluster cluster;
+ /**
+ * @param session
+ */
+ public void setSession(Session session) {
+ this.session = session;
+ }
+
+ /**
+ * @param session
+ */
+ public Session getSession() {
+ return session;
+ }
+
+ /**
+ * @param cluster
+ */
+ public void setCluster(Cluster cluster) {
+ this.cluster = cluster;
+ }
+
private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicDataStore.class);
@@ -103,31 +132,8 @@ public class MusicDataStore {
}
}
-
-
/**
- * @param session
- */
- public void setSession(Session session) {
- this.session = session;
- }
-
- /**
- * @param session
- */
- public Session getSession() {
- return session;
- }
-
- /**
- * @param cluster
- */
- public void setCluster(Cluster cluster) {
- this.cluster = cluster;
- }
-
- /**
- *
+ *
* @return
*/
private ArrayList<String> getAllPossibleLocalIps() {
@@ -147,7 +153,7 @@ public class MusicDataStore {
logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), AppMessages.CONNCECTIVITYERROR, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR);
}catch(Exception e) {
logger.error("Exception", e);
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), ErrorSeverity.ERROR, ErrorTypes.GENERALSERVICEERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), ErrorSeverity.ERROR, ErrorTypes.GENERALSERVICEERROR);
}
return allPossibleIps;
}
@@ -157,12 +163,12 @@ 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(",");
-
+ addresses = address.split(",");
+
logger.info(EELFLoggerDelegate.applicationLogger,
"Connecting to cassa cluster: Iterating through possible ips:"
+ getAllPossibleLocalIps());
@@ -172,20 +178,21 @@ public class MusicDataStore {
.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();
-
+ 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())
+ .withoutJMXReporting()
+ .withPoolingOptions(poolingOptions)
+ .addContactPoints(addresses).build();
+ }
+ else
+ cluster = Cluster.builder().withPort(MusicUtil.getCassandraPort())
+ //.withLoadBalancingPolicy(new RoundRobinPolicy())
+ .addContactPoints(addresses).build();
+
Metadata metadata = cluster.getMetadata();
logger.info(EELFLoggerDelegate.applicationLogger, "Connected to cassa cluster "
+ metadata.getClusterName() + " at " + address);
@@ -201,7 +208,7 @@ public class MusicDataStore {
}
/**
- *
+ *
*/
public void close() {
session.close();
@@ -209,31 +216,41 @@ public class MusicDataStore {
/**
* This method connects to cassandra cluster on specific address.
- *
+ *
* @param address
*/
private void connectToCassaCluster(String address) throws MusicServiceException {
- String[] addresses = null;
- addresses = address.split(",");
- PoolingOptions poolingOptions = new PoolingOptions();
+ 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();
+ 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())
+ .withoutJMXReporting()
+ .withPoolingOptions(poolingOptions)
+ .addContactPoints(addresses).build();
}
else {
- cluster = Cluster.builder().withPort(MusicUtil.getCassandraPort())
- //.withLoadBalancingPolicy(new RoundRobinPolicy())
- .withPoolingOptions(poolingOptions)
- .addContactPoints(addresses).build();
+ cluster = Cluster.builder().withPort(MusicUtil.getCassandraPort())
+ //.withLoadBalancingPolicy(new RoundRobinPolicy())
+ .withoutJMXReporting()
+ .withPoolingOptions(poolingOptions)
+ .addContactPoints(addresses).build();
}
+
+ // JmxReporter reporter =
+ // JmxReporter.forRegistry(cluster.getMetrics().getRegistry())
+ // .inDomain(cluster.getClusterName() + "-metrics")
+ // .build();
+
+ // reporter.start();
+
Metadata metadata = cluster.getMetadata();
logger.info(EELFLoggerDelegate.applicationLogger, "Connected to cassa cluster "
+ metadata.getClusterName() + " at " + address);
@@ -248,7 +265,7 @@ public class MusicDataStore {
}
/**
- *
+ *
* @param keyspace
* @param tableName
* @param columnName
@@ -262,7 +279,7 @@ public class MusicDataStore {
}
/**
- *
+ *
* @param keyspace
* @param tableName
* @return TableMetadata
@@ -275,7 +292,7 @@ public class MusicDataStore {
/**
* Utility function to return the Java specific object type.
- *
+ *
* @param row
* @param colName
* @param colType
@@ -303,15 +320,15 @@ public class MusicDataStore {
case MAP:
return row.getMap(colName, String.class, String.class);
case LIST:
- return row.getList(colName, String.class);
+ return row.getList(colName, String.class);
default:
return null;
}
}
-
+
public byte[] getBlobValue(Row row, String colName, DataType colType) {
- ByteBuffer bb = row.getBytes(colName);
- return bb.array();
+ ByteBuffer bb = row.getBytes(colName);
+ return bb.array();
}
public boolean doesRowSatisfyCondition(Row row, Map<String, Object> condition) throws Exception {
@@ -322,7 +339,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;
@@ -330,7 +347,7 @@ public class MusicDataStore {
/**
* Utility function to store ResultSet values in to a MAP for output.
- *
+ *
* @param results
* @return MAP
*/
@@ -343,12 +360,12 @@ public class MusicDataStore {
HashMap<String, Object> resultOutput = new HashMap<>();
for (Definition definition : colInfo) {
if (!(("vector_ts").equals(definition.getName()))) {
- if(definition.getType().toString().toLowerCase().contains("blob")) {
- resultOutput.put(definition.getName(),
+ if(definition.getType().toString().toLowerCase().contains("blob")) {
+ resultOutput.put(definition.getName(),
getBlobValue(row, definition.getName(), definition.getType()));
- }
- else
- resultOutput.put(definition.getName(),
+ }
+ else
+ resultOutput.put(definition.getName(),
getColValue(row, definition.getName(), definition.getType()));
}
}
@@ -360,9 +377,14 @@ public class MusicDataStore {
// Prepared Statements 1802 additions
+
+ public boolean executePut(PreparedQueryObject queryObject, String consistency)
+ throws MusicServiceException, MusicQueryException {
+ return executePut(queryObject, consistency, 0);
+ }
/**
* This Method performs DDL and DML operations on Cassandra using specified consistency level
- *
+ *
* @param queryObject Object containing cassandra prepared query and values.
* @param consistency Specify consistency level for data synchronization across cassandra
* replicas
@@ -370,13 +392,13 @@ public class MusicDataStore {
* @throws MusicServiceException
* @throws MusicQueryException
*/
- public boolean executePut(PreparedQueryObject queryObject, String consistency)
+ public boolean executePut(PreparedQueryObject queryObject, String consistency,long timeSlot)
throws MusicServiceException, MusicQueryException {
boolean result = false;
-
+ long timeOfWrite = System.currentTimeMillis();
if (!MusicUtil.isValidQueryObject(!queryObject.getValues().isEmpty(), queryObject)) {
- logger.error(EELFLoggerDelegate.errorLogger, queryObject.getQuery(),AppMessages.QUERYERROR, ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, queryObject.getQuery(),AppMessages.QUERYERROR, ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
throw new MusicQueryException("Ill formed queryObject for the request = " + "["
+ queryObject.getQuery() + "]");
}
@@ -384,43 +406,59 @@ public class MusicDataStore {
"In preprared Execute Put: the actual insert query:"
+ queryObject.getQuery() + "; the values"
+ queryObject.getValues());
+/*<<<<<<< HEAD
PreparedStatement preparedInsert = null;
try {
-
- preparedInsert = session.prepare(queryObject.getQuery());
-
+
+ preparedInsert = session.prepare(queryObject.getQuery());
+
} catch(InvalidQueryException iqe) {
logger.error("Exception", iqe);
- logger.error(EELFLoggerDelegate.errorLogger, iqe.getMessage(),AppMessages.QUERYERROR, ErrorSeverity.CRITICAL, ErrorTypes.QUERYERROR);
- throw new MusicQueryException(iqe.getMessage());
+ logger.error(EELFLoggerDelegate.errorLogger, iqe.getMessage(),AppMessages.QUERYERROR, ErrorSeverity.CRITICAL, ErrorTypes.QUERYERROR);
+ throw new MusicQueryException(iqe.getMessage());
}catch(Exception e) {
logger.error("Exception", e);
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.QUERYERROR, ErrorSeverity.CRITICAL, ErrorTypes.QUERYERROR);
- throw new MusicQueryException(e.getMessage());
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.QUERYERROR, ErrorSeverity.CRITICAL, ErrorTypes.QUERYERROR);
+ throw new MusicQueryException(e.getMessage());
}
+=======*/
+ SimpleStatement preparedInsert = null;
+
try {
+ preparedInsert = new SimpleStatement(queryObject.getQuery(), queryObject.getValues().toArray());
if (consistency.equalsIgnoreCase(MusicUtil.CRITICAL)) {
logger.info(EELFLoggerDelegate.applicationLogger, "Executing critical put query");
preparedInsert.setConsistencyLevel(ConsistencyLevel.QUORUM);
} else if (consistency.equalsIgnoreCase(MusicUtil.EVENTUAL)) {
logger.info(EELFLoggerDelegate.applicationLogger, "Executing simple put query");
+ if(queryObject.getConsistency() == null)
+ preparedInsert.setConsistencyLevel(ConsistencyLevel.ONE);
+ else
+ preparedInsert.setConsistencyLevel(MusicUtil.getConsistencyLevel(queryObject.getConsistency()));
+ } else if (consistency.equalsIgnoreCase(MusicUtil.ONE)) {
preparedInsert.setConsistencyLevel(ConsistencyLevel.ONE);
+ } else if (consistency.equalsIgnoreCase(MusicUtil.QUORUM)) {
+ preparedInsert.setConsistencyLevel(ConsistencyLevel.LOCAL_QUORUM);
+ } else if (consistency.equalsIgnoreCase(MusicUtil.ALL)) {
+ preparedInsert.setConsistencyLevel(ConsistencyLevel.ALL);
}
+ long timestamp = MusicUtil.v2sTimeStampInMicroseconds(timeSlot, timeOfWrite);
+ preparedInsert.setDefaultTimestamp(timestamp);
- ResultSet rs = session.execute(preparedInsert.bind(queryObject.getValues().toArray()));
+ ResultSet rs = session.execute(preparedInsert);
result = rs.wasApplied();
}
catch (AlreadyExistsException ae) {
logger.error("Exception", ae);
logger.error(EELFLoggerDelegate.errorLogger, ae.getMessage(),AppMessages.SESSIONFAILED+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
- throw new MusicServiceException(ae.getMessage());
+ throw new MusicServiceException(ae.getMessage());
}
catch (Exception e) {
logger.error("Exception", e);
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.SESSIONFAILED+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
- throw new MusicQueryException("Executing Session Failure for Request = " + "["
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.SESSIONFAILED+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ throw new MusicQueryException("Executing Session Failure for Request = " + "["
+ queryObject.getQuery() + "]" + " Reason = " + e.getMessage());
}
@@ -428,52 +466,63 @@ public class MusicDataStore {
return result;
}
- /**
+ /* *//**
* This method performs DDL operations on Cassandra using consistency level ONE.
- *
+ *
* @param queryObject Object containing cassandra prepared query and values.
* @return ResultSet
* @throws MusicServiceException
* @throws MusicQueryException
- */
+ *//*
public ResultSet executeEventualGet(PreparedQueryObject queryObject)
throws MusicServiceException, MusicQueryException {
-
+ CacheAccess<String, PreparedStatement> queryBank = CachingUtil.getStatementBank();
+ PreparedStatement preparedEventualGet = null;
if (!MusicUtil.isValidQueryObject(!queryObject.getValues().isEmpty(), queryObject)) {
- logger.error(EELFLoggerDelegate.errorLogger, "",AppMessages.QUERYERROR+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
- throw new MusicQueryException("Ill formed queryObject for the request = " + "["
+ logger.error(EELFLoggerDelegate.errorLogger, "",AppMessages.QUERYERROR+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ throw new MusicQueryException("Ill formed queryObject for the request = " + "["
+ queryObject.getQuery() + "]");
}
logger.info(EELFLoggerDelegate.applicationLogger,
"Executing Eventual get query:" + queryObject.getQuery());
-
+
ResultSet results = null;
try {
- PreparedStatement preparedEventualGet = session.prepare(queryObject.getQuery());
- preparedEventualGet.setConsistencyLevel(ConsistencyLevel.ONE);
- results = session.execute(preparedEventualGet.bind(queryObject.getValues().toArray()));
+ if(queryBank.get(queryObject.getQuery()) != null )
+ preparedEventualGet=queryBank.get(queryObject.getQuery());
+ else {
+ preparedEventualGet = session.prepare(queryObject.getQuery());
+ CachingUtil.updateStatementBank(queryObject.getQuery(), preparedEventualGet);
+ }
+ if(queryObject.getConsistency() == null) {
+ preparedEventualGet.setConsistencyLevel(ConsistencyLevel.ONE);
+ }
+ else {
+ preparedEventualGet.setConsistencyLevel(MusicUtil.getConsistencyLevel(queryObject.getConsistency()));
+ }
+ results = session.execute(preparedEventualGet.bind(queryObject.getValues().toArray()));
} catch (Exception ex) {
logger.error("Exception", ex);
- logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.UNKNOWNERROR+ "[" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
- throw new MusicServiceException(ex.getMessage());
+ logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.UNKNOWNERROR+ "[" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ throw new MusicServiceException(ex.getMessage());
}
return results;
}
- /**
- *
+ *//**
+ *
* This method performs DDL operation on Cassandra using consistency level QUORUM.
- *
+ *
* @param queryObject Object containing cassandra prepared query and values.
* @return ResultSet
* @throws MusicServiceException
* @throws MusicQueryException
- */
+ *//*
public ResultSet executeCriticalGet(PreparedQueryObject queryObject)
throws MusicServiceException, MusicQueryException {
if (!MusicUtil.isValidQueryObject(!queryObject.getValues().isEmpty(), queryObject)) {
- logger.error(EELFLoggerDelegate.errorLogger, "",AppMessages.QUERYERROR+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ logger.error(EELFLoggerDelegate.errorLogger, "",AppMessages.QUERYERROR+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
throw new MusicQueryException("Error processing Prepared Query Object for the request = " + "["
+ queryObject.getQuery() + "]");
}
@@ -486,11 +535,65 @@ public class MusicDataStore {
results = session.execute(preparedEventualGet.bind(queryObject.getValues().toArray()));
} catch (Exception ex) {
logger.error("Exception", ex);
- logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.UNKNOWNERROR+ "[" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
- throw new MusicServiceException(ex.getMessage());
+ logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.UNKNOWNERROR+ "[" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ throw new MusicServiceException(ex.getMessage());
+ }
+ return results;
+
+ }
+ */
+ public ResultSet executeGet(PreparedQueryObject queryObject,String consistencyLevel) throws MusicQueryException, MusicServiceException {
+ if (!MusicUtil.isValidQueryObject(!queryObject.getValues().isEmpty(), queryObject)) {
+ logger.error(EELFLoggerDelegate.errorLogger, "",AppMessages.QUERYERROR+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ throw new MusicQueryException("Error processing Prepared Query Object for the request = " + "["
+ + queryObject.getQuery() + "]");
+ }
+ ResultSet results = null;
+ try {
+ SimpleStatement statement = new SimpleStatement(queryObject.getQuery(), queryObject.getValues().toArray());
+
+ if (consistencyLevel.equalsIgnoreCase(CONSISTENCY_LEVEL_ONE)) {
+ if(queryObject.getConsistency() == null) {
+ statement.setConsistencyLevel(ConsistencyLevel.ONE);
+ }
+ else {
+ statement.setConsistencyLevel(MusicUtil.getConsistencyLevel(queryObject.getConsistency()));
+ }
+ }
+ else if (consistencyLevel.equalsIgnoreCase(CONSISTENCY_LEVEL_QUORUM)) {
+ statement.setConsistencyLevel(ConsistencyLevel.QUORUM);
+ }
+
+ results = session.execute(statement);
+
+ } catch (Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.UNKNOWNERROR+ "[" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ throw new MusicServiceException(ex.getMessage());
}
+
return results;
+
+ }
+
+ /**
+ * This method performs DDL operations on Cassandra using consistency level ONE.
+ *
+ * @param queryObject Object containing cassandra prepared query and values.
+ */
+ public ResultSet executeOneConsistencyGet(PreparedQueryObject queryObject)
+ throws MusicServiceException, MusicQueryException {
+ return executeGet(queryObject, CONSISTENCY_LEVEL_ONE);
+ }
+ /**
+ *
+ * This method performs DDL operation on Cassandra using consistency level QUORUM.
+ *
+ * @param queryObject Object containing cassandra prepared query and values.
+ */
+ public ResultSet executeQuorumConsistencyGet(PreparedQueryObject queryObject)
+ throws MusicServiceException, MusicQueryException {
+ return executeGet(queryObject, CONSISTENCY_LEVEL_QUORUM);
}
}
diff --git a/src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java b/src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java
new file mode 100644
index 00000000..bb8f3cbd
--- /dev/null
+++ b/src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java
@@ -0,0 +1,108 @@
+/*
+ * ============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;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onap.music.eelf.logging.EELFLoggerDelegate;
+import org.onap.music.exceptions.MusicServiceException;
+import org.onap.music.main.MusicUtil;
+import org.onap.music.service.impl.MusicZKCore;
+
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.TableMetadata;
+
+public class MusicDataStoreHandle {
+
+
+
+ public static MusicDataStore mDstoreHandle = null;
+ private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicDataStoreHandle.class);
+
+ /**
+ *
+ * @param remoteIp
+ * @return
+ */
+ public static MusicDataStore getDSHandle(String remoteIp) {
+ logger.info(EELFLoggerDelegate.metricsLogger,"Acquiring data store handle");
+ long start = System.currentTimeMillis();
+ if (mDstoreHandle == null) {
+ mDstoreHandle = new MusicDataStore(remoteIp);
+ }
+ long end = System.currentTimeMillis();
+ logger.info(EELFLoggerDelegate.metricsLogger,"Time taken to acquire data store handle:" + (end - start) + " ms");
+ return mDstoreHandle;
+ }
+
+ /**
+ *
+ * @return
+ * @throws MusicServiceException
+ */
+ public static MusicDataStore getDSHandle() throws MusicServiceException {
+ logger.info(EELFLoggerDelegate.metricsLogger,"Acquiring data store handle");
+ long start = System.currentTimeMillis();
+ if (mDstoreHandle == null) {
+ // Quick Fix - Best to put this into every call to getDSHandle?
+ if (! MusicUtil.getMyCassaHost().equals("localhost") ) {
+ mDstoreHandle = new MusicDataStore(MusicUtil.getMyCassaHost());
+ } else {
+ mDstoreHandle = new MusicDataStore();
+ }
+ }
+ if(mDstoreHandle.getSession() == null) {
+ String message = "Connection to Cassandra has not been enstablished."
+ + " Please check connection properites and reboot.";
+ logger.info(EELFLoggerDelegate.applicationLogger, message);
+ throw new MusicServiceException(message);
+ }
+ long end = System.currentTimeMillis();
+ logger.info(EELFLoggerDelegate.metricsLogger,"Time taken to acquire data store handle:" + (end - start) + " ms");
+ return mDstoreHandle;
+ }
+
+
+ /**
+ *
+ * @param keyspace
+ * @param tablename
+ * @return
+ * @throws MusicServiceException
+ */
+ public static TableMetadata returnColumnMetadata(String keyspace, String tablename) throws MusicServiceException {
+ return getDSHandle().returnColumnMetadata(keyspace, tablename);
+ }
+
+ /**
+ *
+ * @param results
+ * @return
+ * @throws MusicServiceException
+ */
+ public static Map<String, HashMap<String, Object>> marshallResults(ResultSet results) throws MusicServiceException {
+ return getDSHandle().marshalData(results);
+ }
+
+}
diff --git a/src/main/java/org/onap/music/datastore/PreparedQueryObject.java b/src/main/java/org/onap/music/datastore/PreparedQueryObject.java
index 694d9acd..9b109630 100644
--- a/src/main/java/org/onap/music/datastore/PreparedQueryObject.java
+++ b/src/main/java/org/onap/music/datastore/PreparedQueryObject.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore;
import java.util.ArrayList;
@@ -34,8 +35,53 @@ public class PreparedQueryObject {
private List<Object> values;
private StringBuilder query;
+ private String consistency;
+ private String keyspaceName;
+ private String tableName;
+ private String operation;
+ private String primaryKeyValue;
+
+
+
+ public String getKeyspaceName() {
+ return keyspaceName;
+ }
+
+ public void setKeyspaceName(String keyspaceName) {
+ this.keyspaceName = keyspaceName;
+ }
+
+ public String getTableName() {
+ return tableName;
+ }
+
+ public void setTableName(String tableName) {
+ this.tableName = tableName;
+ }
+ public String getOperation() {
+ return operation;
+ }
+
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+ public String getPrimaryKeyValue() {
+ return primaryKeyValue;
+ }
+
+ public void setPrimaryKeyValue(String primaryKeyValue) {
+ this.primaryKeyValue = primaryKeyValue;
+ }
+
+ public String getConsistency() {
+ return consistency;
+ }
+
+ public void setConsistency(String consistency) {
+ this.consistency = consistency;
+ }
/**
*
@@ -66,6 +112,9 @@ public class PreparedQueryObject {
public void appendQueryString(String s) {
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/AAFResponse.java b/src/main/java/org/onap/music/datastore/jsonobjects/AAFResponse.java
index b0f41311..3544e068 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/AAFResponse.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/AAFResponse.java
@@ -21,6 +21,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.util.List;
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 c5a56a71..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 fullTable;
- private String keyspace;
- private Map<String, String> changeValue;
- private String operation;
- private String tableName;
- private String primaryKey;
- private Object miscObjects;
- private List<String> updateList;
-
- public String getFull_table() {
- return fullTable;
- }
- public void setFull_table(String fullTable) {
- this.fullTable = fullTable;
- }
- 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 tableName;
- }
- public void setTable_name(String tableName) {
- this.tableName = tableName;
- }
- public String getPrimary_key() {
- return primaryKey;
- }
- public void setPrimary_key(String primaryKey) {
- this.primaryKey = primaryKey;
- }
- 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/JSONObject.java b/src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java
index 8de0a2cd..2fc4215b 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java
@@ -24,14 +24,14 @@ package org.onap.music.datastore.jsonobjects;
public class JSONObject {
- private String data;
+ private String data;
- public String getData() {
- return data;
- }
-
- public void setData(String data) {
- this.data = data;
- }
-
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
}
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..c90dd005 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.util.ArrayList;
@@ -36,8 +37,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 +86,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 456fb951..4533f947 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java
@@ -20,6 +20,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.io.ByteArrayOutputStream;
@@ -54,12 +55,12 @@ public class JsonInsert implements Serializable {
@ApiModelProperty(value = "objectMap")
public Map<String, byte[]> getObjectMap() {
- return objectMap;
- }
+ return objectMap;
+ }
public void setObjectMap(Map<String, byte[]> objectMap) {
- this.objectMap = objectMap;
- }
+ this.objectMap = objectMap;
+ }
@ApiModelProperty(value = "keyspace")
public String getKeyspaceName() {
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonKeySpace.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonKeySpace.java
index 54de02fd..f2232ffd 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonKeySpace.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonKeySpace.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.util.Map;
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java
index 497e17d1..06a76f57 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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 5190de58..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonNotification.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * org.onap.music
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property
- * Modifications Copyright (C) 2018 IBM.
- * ===================================================================
- * 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 org.onap.music.eelf.logging.EELFLoggerDelegate;
-import org.onap.music.eelf.logging.format.AppMessages;
-import org.onap.music.eelf.logging.format.ErrorSeverity;
-import org.onap.music.eelf.logging.format.ErrorTypes;
-
-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;
- private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(JsonNotification.class);
-
- 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) {
- logger.error(EELFLoggerDelegate.errorLogger, e, AppMessages.EXECUTIONINTERRUPTED, ErrorSeverity.ERROR, ErrorTypes.GENERALSERVICEERROR);
- 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/JsonOnboard.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonOnboard.java
index 0bac1e31..82993ebc 100755
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonOnboard.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonOnboard.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@@ -34,6 +35,16 @@ public class JsonOnboard {
private String password;
private String isAAF;
private String aid;
+ private String keyspace;
+
+ @ApiModelProperty(value = "Application Keyspace")
+ public String getKeyspace() {
+ return keyspace;
+ }
+
+ public void setKeyspace_name(String keyspace) {
+ this.keyspace = keyspace;
+ }
@ApiModelProperty(value = "Application Password")
public String getPassword() {
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 73237cd2..faef9b8f 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java
@@ -20,6 +20,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.io.ByteArrayOutputStream;
@@ -28,13 +29,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;
@@ -52,7 +53,7 @@ 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/JsonTable.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java
index 2e0a5ded..cf691590 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.util.Map;
@@ -116,29 +117,29 @@ public class JsonTable {
this.primaryKey = primaryKey;
}
- public String getClusteringKey() {
- return clusteringKey;
- }
+ public String getClusteringKey() {
+ return clusteringKey;
+ }
- public void setClusteringKey(String clusteringKey) {
- this.clusteringKey = clusteringKey;
- }
+ public void setClusteringKey(String clusteringKey) {
+ this.clusteringKey = clusteringKey;
+ }
- public String getFilteringKey() {
- return filteringKey;
- }
+ public String getFilteringKey() {
+ return filteringKey;
+ }
- public void setFilteringKey(String filteringKey) {
- this.filteringKey = filteringKey;
- }
+ public void setFilteringKey(String filteringKey) {
+ this.filteringKey = filteringKey;
+ }
- public String getPartitionKey() {
- return partitionKey;
- }
+ public String getPartitionKey() {
+ return partitionKey;
+ }
- public void setPartitionKey(String partitionKey) {
- this.partitionKey = partitionKey;
- }
+ public void setPartitionKey(String partitionKey) {
+ this.partitionKey = partitionKey;
+ }
}
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 514f34ab..e31c6ccf 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java
@@ -20,6 +20,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.io.ByteArrayOutputStream;
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/NameSpace.java b/src/main/java/org/onap/music/datastore/jsonobjects/NameSpace.java
index 232353c1..3c18c791 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/NameSpace.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/NameSpace.java
@@ -19,6 +19,7 @@
* ============LICENSE_END=============================================
* ====================================================================
*/
+
package org.onap.music.datastore.jsonobjects;
import java.util.List;