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-xsrc/main/java/org/onap/music/datastore/MusicDataStore.java592
-rw-r--r--src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java112
-rw-r--r--src/main/java/org/onap/music/datastore/PreparedQueryObject.java128
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/AAFResponse.java46
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java37
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java90
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java140
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonKeySpace.java78
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java53
-rwxr-xr-xsrc/main/java/org/onap/music/datastore/jsonobjects/JsonOnboard.java94
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java61
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.java135
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java141
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/NameSpace.java48
15 files changed, 0 insertions, 1807 deletions
diff --git a/src/main/java/org/onap/music/datastore/Condition.java b/src/main/java/org/onap/music/datastore/Condition.java
deleted file mode 100644
index 2fd4596a..00000000
--- a/src/main/java/org/onap/music/datastore/Condition.java
+++ /dev/null
@@ -1,52 +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;
-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
deleted file mode 100755
index f58bd831..00000000
--- a/src/main/java/org/onap/music/datastore/MusicDataStore.java
+++ /dev/null
@@ -1,592 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * org.onap.music
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property
- * ===================================================================
- * Modifications Copyright (c) 2018-2019 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;
-
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.commons.jcs.access.CacheAccess;
-import org.onap.music.authentication.CachingUtil;
-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.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;
-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;
-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
- *
- */
-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);
-
- /**
- *
- */
- public MusicDataStore() {
- connectToCassaCluster();
- }
-
-
- /**
- * @param cluster
- * @param session
- */
- public MusicDataStore(Cluster cluster, Session session) {
- this.session = session;
- this.cluster = cluster;
- }
-
- /**
- *
- * @param remoteIp
- * @throws MusicServiceException
- */
- public MusicDataStore(String remoteIp) {
- try {
- connectToCassaCluster(remoteIp);
- } catch (MusicServiceException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage());
- }
- }
-
- /**
- *
- * @return
- */
- private ArrayList<String> getAllPossibleLocalIps() {
- ArrayList<String> allPossibleIps = new ArrayList<>();
- try {
- Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();
- while (en.hasMoreElements()) {
- NetworkInterface ni = en.nextElement();
- Enumeration<InetAddress> ee = ni.getInetAddresses();
- while (ee.hasMoreElements()) {
- InetAddress ia = ee.nextElement();
- allPossibleIps.add(ia.getHostAddress());
- }
- }
- } catch (SocketException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), AppMessages.CONNCECTIVITYERROR, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR);
- }catch(Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), ErrorSeverity.ERROR, ErrorTypes.GENERALSERVICEERROR);
- }
- return allPossibleIps;
- }
-
- /**
- * This method iterates through all available IP addresses and connects to multiple cassandra
- * clusters.
- */
- private void connectToCassaCluster() {
- 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())
- .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);
- session = cluster.connect();
-
- break;
- } catch (NoHostAvailableException e) {
- address = it.next();
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.HOSTUNAVAILABLE, ErrorSeverity.ERROR, ErrorTypes.CONNECTIONERROR);
- }
- }
- }
-
- /**
- *
- */
- public void close() {
- session.close();
- }
-
- /**
- * 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();
- 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())
- .withoutJMXReporting()
- .withPoolingOptions(poolingOptions)
- .addContactPoints(addresses).build();
- }
- else {
- 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);
- try {
- session = cluster.connect();
- } catch (Exception ex) {
- logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.CASSANDRACONNECTIVITY, ErrorSeverity.ERROR, ErrorTypes.SERVICEUNAVAILABLE);
- throw new MusicServiceException(
- "Error while connecting to Cassandra cluster.. " + ex.getMessage());
- }
- }
-
- /**
- *
- * @param keyspace
- * @param tableName
- * @param columnName
- * @return DataType
- */
- public DataType returnColumnDataType(String keyspace, String tableName, String columnName) {
- KeyspaceMetadata ks = cluster.getMetadata().getKeyspace(keyspace);
- TableMetadata table = ks.getTable(tableName);
- return table.getColumn(columnName).getType();
-
- }
-
- /**
- *
- * @param keyspace
- * @param tableName
- * @return TableMetadata
- */
- public TableMetadata returnColumnMetadata(String keyspace, String tableName) {
- KeyspaceMetadata ks = cluster.getMetadata().getKeyspace(keyspace);
- return ks.getTable(tableName);
- }
-
-
- /**
- * Utility function to return the Java specific object type.
- *
- * @param row
- * @param colName
- * @param colType
- * @return
- */
- public Object getColValue(Row row, String colName, DataType colType) {
-
- switch (colType.getName()) {
- case VARCHAR:
- return row.getString(colName);
- case UUID:
- return row.getUUID(colName);
- case VARINT:
- return row.getVarint(colName);
- case BIGINT:
- return row.getLong(colName);
- case INT:
- return row.getInt(colName);
- case FLOAT:
- return row.getFloat(colName);
- case DOUBLE:
- return row.getDouble(colName);
- case BOOLEAN:
- return row.getBool(colName);
- case MAP:
- return row.getMap(colName, String.class, String.class);
- case LIST:
- 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();
- }
-
- public boolean doesRowSatisfyCondition(Row row, Map<String, Object> condition) throws Exception {
- ColumnDefinitions colInfo = row.getColumnDefinitions();
-
- for (Map.Entry<String, Object> entry : condition.entrySet()) {
- String colName = entry.getKey();
- DataType colType = colInfo.getType(colName);
- Object columnValue = getColValue(row, colName, colType);
- Object conditionValue = MusicUtil.convertToActualDataType(colType, entry.getValue());
- if (columnValue.equals(conditionValue) == false)
- return false;
- }
- return true;
- }
-
- /**
- * Utility function to store ResultSet values in to a MAP for output.
- *
- * @param results
- * @return MAP
- */
- public Map<String, HashMap<String, Object>> marshalData(ResultSet results) {
- Map<String, HashMap<String, Object>> resultMap =
- new HashMap<>();
- int counter = 0;
- for (Row row : results) {
- ColumnDefinitions colInfo = row.getColumnDefinitions();
- 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(),
- getBlobValue(row, definition.getName(), definition.getType()));
- }
- else
- resultOutput.put(definition.getName(),
- getColValue(row, definition.getName(), definition.getType()));
- }
- }
- resultMap.put("row " + counter, resultOutput);
- counter++;
- }
- return resultMap;
- }
-
-
- // 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
- * @return Boolean Indicates operation success or failure
- * @throws MusicServiceException
- * @throws MusicQueryException
- */
- 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);
- throw new MusicQueryException("Ill formed queryObject for the request = " + "["
- + queryObject.getQuery() + "]");
- }
- logger.info(EELFLoggerDelegate.applicationLogger,
- "In preprared Execute Put: the actual insert query:"
- + queryObject.getQuery() + "; the values"
- + queryObject.getValues());
-/*<<<<<<< HEAD
- PreparedStatement preparedInsert = null;
- try {
-
- 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());
- }catch(Exception e) {
- logger.error("Exception", e);
- 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);
- result = rs.wasApplied();
-
- }
- catch (AlreadyExistsException ae) {
- logger.error(EELFLoggerDelegate.errorLogger, ae.getMessage(),AppMessages.SESSIONFAILED+ " [" + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
- throw new MusicServiceException(ae.getMessage());
- }
- catch (Exception e) {
- 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());
- }
-
-
- 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 = " + "["
- + queryObject.getQuery() + "]");
- }
- logger.info(EELFLoggerDelegate.applicationLogger,
- "Executing Eventual get query:" + queryObject.getQuery());
-
- ResultSet results = null;
- try {
- 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());
- }
- 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);
- throw new MusicQueryException("Error processing Prepared Query Object for the request = " + "["
- + queryObject.getQuery() + "]");
- }
- logger.info(EELFLoggerDelegate.applicationLogger,
- "Executing Critical get query:" + queryObject.getQuery());
- PreparedStatement preparedEventualGet = session.prepare(queryObject.getQuery());
- preparedEventualGet.setConsistencyLevel(ConsistencyLevel.QUORUM);
- ResultSet results = null;
- try {
- 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());
- }
- 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
deleted file mode 100644
index dc1c43a8..00000000
--- a/src/main/java/org/onap/music/datastore/MusicDataStoreHandle.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * org.onap.music
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property
- * Modifications Copyright (C) 2019 IBM.
- * ===================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ===================================================================
- * 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 com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.TableMetadata;
-
-public class MusicDataStoreHandle {
-
- private MusicDataStoreHandle(){
- throw new IllegalStateException("Utility class");
- }
-
- 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 (!"localhost".equals(MusicUtil.getMyCassaHost())) {
- 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
deleted file mode 100644
index 9b109630..00000000
--- a/src/main/java/org/onap/music/datastore/PreparedQueryObject.java
+++ /dev/null
@@ -1,128 +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;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- * @author srupane
- *
- */
-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;
- }
-
- /**
- *
- */
- public PreparedQueryObject() {
-
- this.values = new ArrayList<>();
- this.query = new StringBuilder();
- }
-
- /**
- * @return
- */
- public List<Object> getValues() {
- return values;
- }
-
- /**
- * @param o
- */
- public void addValue(Object o) {
- this.values.add(o);
- }
-
- /**
- * @param s
- */
- public void appendQueryString(String s) {
- this.query.append(s);
- }
- public void replaceQueryString(String s) {
- this.query.replace(0, query.length(), s);
- }
-
- /**
- * @return
- */
- public String getQuery() {
- return this.query.toString();
- }
-
-
-
-}
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/AAFResponse.java b/src/main/java/org/onap/music/datastore/jsonobjects/AAFResponse.java
deleted file mode 100644
index 3544e068..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/AAFResponse.java
+++ /dev/null
@@ -1,46 +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.util.List;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-@ApiModel(value = "JsonTable", description = "Reponse class for AAF request")
-public class AAFResponse {
-
- private List<NameSpace> ns = null;
-
- @ApiModelProperty(value = "Namespace value")
- public List<NameSpace> getNs() {
- return ns;
- }
-
- public void setNs(List<NameSpace> ns) {
- this.ns = ns;
- }
-
-}
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java b/src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java
deleted file mode 100644
index 2fc4215b..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JSONObject.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.onap.music.datastore.jsonobjects;
-/*
- * ============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=============================================
- * ====================================================================
- */
-
-
-public class JSONObject {
-
- private String 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/JsonDelete.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
deleted file mode 100644
index b98a391d..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonDelete.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * org.onap.music
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property
- * ===================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ===================================================================
- * 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;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-@ApiModel(value = "JsonTable", description = "Json model for delete")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class JsonDelete {
-
- private List<String> columns = null;
- private Map<String, String> consistencyInfo;
- private Map<String, Object> conditions;
- String ttl, timestamp;
-
-
- @ApiModelProperty(value = "Conditions")
- public Map<String, Object> getConditions() {
- return conditions;
- }
-
- public void setConditions(Map<String, Object> conditions) {
- this.conditions = conditions;
- }
-
- @ApiModelProperty(value = "Consistency level", allowableValues = "eventual,critical,atomic")
- public Map<String, String> getConsistencyInfo() {
- return consistencyInfo;
- }
-
- public void setConsistencyInfo(Map<String, String> consistencyInfo) {
- this.consistencyInfo = consistencyInfo;
- }
-
- @ApiModelProperty(value = "Column values")
- public List<String> getColumns() {
- return columns;
- }
-
- public void setColumns(List<String> columns) {
- this.columns = columns;
- }
-
-
- @ApiModelProperty(value = "Time to live information")
- public String getTtl() {
- return ttl;
- }
-
- public void setTtl(String ttl) {
- this.ttl = ttl;
- }
-
- @ApiModelProperty(value = "Time stamp")
- public String getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(String timestamp) {
- 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
deleted file mode 100644
index 4533f947..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java
+++ /dev/null
@@ -1,140 +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.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-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;
-
-@ApiModel(value = "JsonTable", description = "Json model for table vlaues insert")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class JsonInsert implements Serializable {
- private String keyspaceName;
- private String tableName;
- private transient Map<String, Object> values;
- private String ttl;
- private String timestamp;
- private transient Map<String, Object> rowSpecification;
- private Map<String, String> consistencyInfo;
- private Map<String, byte[]> objectMap;
- private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(JsonInsert.class);
-
- @ApiModelProperty(value = "objectMap")
- public Map<String, byte[]> getObjectMap() {
- return objectMap;
- }
-
- public void setObjectMap(Map<String, byte[]> objectMap) {
- this.objectMap = objectMap;
- }
-
- @ApiModelProperty(value = "keyspace")
- public String getKeyspaceName() {
- return keyspaceName;
- }
-
- public void setKeyspaceName(String keyspaceName) {
- this.keyspaceName = keyspaceName;
- }
-
- @ApiModelProperty(value = "Table name")
- public String getTableName() {
- return tableName;
- }
-
- public void setTableName(String tableName) {
- this.tableName = tableName;
- }
-
- @ApiModelProperty(value = "Consistency level", allowableValues = "eventual,critical,atomic")
- public Map<String, String> getConsistencyInfo() {
- return consistencyInfo;
- }
-
- public void setConsistencyInfo(Map<String, String> consistencyInfo) {
- this.consistencyInfo = consistencyInfo;
- }
-
- @ApiModelProperty(value = "Time to live information")
- public String getTtl() {
- return ttl;
- }
-
- public void setTtl(String ttl) {
- this.ttl = ttl;
- }
-
- @ApiModelProperty(value = "Time stamp")
- public String getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(String timestamp) {
- this.timestamp = timestamp;
- }
-
- @ApiModelProperty(value = "values returned")
- public Map<String, Object> getValues() {
- return values;
- }
-
- public void setValues(Map<String, Object> values) {
- this.values = values;
- }
-
- @ApiModelProperty(value = "Information for selecting specific rows for insert")
- public Map<String, Object> getRow_specification() {
- return rowSpecification;
- }
-
- public void setRow_specification(Map<String, Object> rowSpecification) {
- this.rowSpecification = rowSpecification;
- }
-
- public byte[] serialize() {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- ObjectOutput out = null;
- try {
- out = new ObjectOutputStream(bos);
- out.writeObject(this);
- } catch (IOException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e, AppMessages.IOERROR, ErrorSeverity.ERROR, ErrorTypes.DATAERROR);
- }
- return bos.toByteArray();
- }
-
-}
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonKeySpace.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonKeySpace.java
deleted file mode 100644
index f2232ffd..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonKeySpace.java
+++ /dev/null
@@ -1,78 +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.Map;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-@ApiModel(value = "JsonTable", description = "Json model creating new keyspace")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class JsonKeySpace {
- private String keyspaceName;
- private Map<String, Object> replicationInfo;
- private String durabilityOfWrites;
- private Map<String, String> consistencyInfo;
-
- @ApiModelProperty(value = "Consistency level", allowableValues = "eventual,critical,atomic")
- public Map<String, String> getConsistencyInfo() {
- return consistencyInfo;
- }
-
- public void setConsistencyInfo(Map<String, String> consistencyInfo) {
- this.consistencyInfo = consistencyInfo;
- }
-
- @ApiModelProperty(value = "Replication information")
- public Map<String, Object> getReplicationInfo() {
- return replicationInfo;
- }
-
- public void setReplicationInfo(Map<String, Object> replicationInfo) {
- this.replicationInfo = replicationInfo;
- }
-
- @ApiModelProperty(value = "Durability", allowableValues = "true,false")
- public String getDurabilityOfWrites() {
- return durabilityOfWrites;
- }
-
- public void setDurabilityOfWrites(String durabilityOfWrites) {
- this.durabilityOfWrites = durabilityOfWrites;
- }
-
- @ApiModelProperty(value = "Keyspace name")
- public String getKeyspaceName() {
- return keyspaceName;
- }
-
- public void setKeyspaceName(String keyspaceName) {
- this.keyspaceName = keyspaceName;
- }
-
-
-
-}
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java
deleted file mode 100644
index 06a76f57..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java
+++ /dev/null
@@ -1,53 +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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-@ApiModel(value = "JsonTable", description = "model for leased lock")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class JsonLeasedLock {
- long leasePeriod;
- String notifyUrl;
-
- @ApiModelProperty(value = "Lease period")
- public long getLeasePeriod() {
- return leasePeriod;
- }
-
- public void setLeasePeriod(long leasePeriod) {
- this.leasePeriod = leasePeriod;
- }
-
- @ApiModelProperty(value = "URL to be notified")
- public String getNotifyUrl() {
- return notifyUrl;
- }
-
- public void setNotifyUrl(String notifyUrl) {
- this.notifyUrl = notifyUrl;
- }
-}
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonOnboard.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonOnboard.java
deleted file mode 100755
index 82993ebc..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonOnboard.java
+++ /dev/null
@@ -1,94 +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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-@ApiModel(value = "JsonOnboard", description = "Defines the Json for Onboarding an application.")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class JsonOnboard {
- private String appname;
- private String userId;
- 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() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- @ApiModelProperty(value = "Application UUID")
- public String getAid() {
- return aid;
- }
-
- public void setAid(String aid) {
- this.aid = aid;
- }
-
- @ApiModelProperty(value = "Application name")
- public String getAppname() {
- return appname;
- }
-
- public void setAppname(String appname) {
- this.appname = appname;
- }
-
- @ApiModelProperty(value = "User Id")
- public String getUserId() {
- return userId;
- }
-
- public void setUserId(String userId) {
- this.userId = userId;
- }
-
- @ApiModelProperty(value = "Is AAF Application", allowableValues = "true, false")
- public String getIsAAF() {
- return isAAF;
- }
-
- public void setIsAAF(String isAAF) {
- this.isAAF = isAAF;
- }
-
-}
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java
deleted file mode 100644
index faef9b8f..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonSelect.java
+++ /dev/null
@@ -1,61 +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.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class JsonSelect implements Serializable {
- private Map<String, String> consistencyInfo;
-
-
- public Map<String, String> getConsistencyInfo() {
- return consistencyInfo;
- }
-
- public void setConsistencyInfo(Map<String, String> consistencyInfo) {
- this.consistencyInfo = consistencyInfo;
- }
-
- public byte[] serialize() {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- ObjectOutput out = null;
- try {
- out = new ObjectOutputStream(bos);
- out.writeObject(this);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- 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
deleted file mode 100644
index badcaebe..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonTable.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.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-@ApiModel(value = "JsonTable", description = "Defines the Json for Creating a new Table.")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class JsonTable {
- private String keyspaceName;
- private String tableName;
-
- private Map<String, String> fields;
- private Map<String, Object> properties;
- private String primaryKey;
- private String partitionKey;
- private String clusteringKey;
- private String filteringKey;
- private String clusteringOrder;
- private Map<String, String> consistencyInfo;
-
- @ApiModelProperty(value = "Consistency level", allowableValues = "eventual,critical,atomic")
- public Map<String, String> getConsistencyInfo() {
- return consistencyInfo;
- }
-
- public void setConsistencyInfo(Map<String, String> consistencyInfo) {
- this.consistencyInfo = consistencyInfo;
- }
-
- @ApiModelProperty(value = "Properties")
- public Map<String, Object> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, Object> properties) {
- this.properties = properties;
- }
-
- @ApiModelProperty(value = "Fields")
- public Map<String, String> getFields() {
- return fields;
- }
-
- public void setFields(Map<String, String> fields) {
- this.fields = fields;
- }
-
- @ApiModelProperty(value = "KeySpace Name")
- public String getKeyspaceName() {
- return keyspaceName;
- }
-
- public void setKeyspaceName(String keyspaceName) {
- this.keyspaceName = keyspaceName;
- }
-
- @ApiModelProperty(value = "Table Name")
- public String getTableName() {
- return tableName;
- }
-
- public void setTableName(String tableName) {
- this.tableName = tableName;
- }
-
- @ApiModelProperty(value = "Clustering Order", notes = "")
- public String getClusteringOrder() {
- return clusteringOrder;
- }
-
- public void setClusteringOrder(String clusteringOrder) {
- this.clusteringOrder = clusteringOrder;
- }
-
- @ApiModelProperty(value = "Primary Key")
- public String getPrimaryKey() {
- return primaryKey;
- }
-
- public void setPrimaryKey(String primaryKey) {
- this.primaryKey = primaryKey;
- }
-
- public String getClusteringKey() {
- return clusteringKey;
- }
-
- public void setClusteringKey(String clusteringKey) {
- this.clusteringKey = clusteringKey;
- }
-
- public String getFilteringKey() {
- return filteringKey;
- }
-
- public void setFilteringKey(String filteringKey) {
- this.filteringKey = filteringKey;
- }
-
- public String getPartitionKey() {
- return 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
deleted file mode 100644
index e31c6ccf..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonUpdate.java
+++ /dev/null
@@ -1,141 +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.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-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;
-
-@ApiModel(value = "JsonTable", description = "Json model for table update")
-@JsonIgnoreProperties(ignoreUnknown = true)
-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, String> consistencyInfo;
- private transient Map<String, Object> conditions;
- private transient Map<String, Object> rowSpecification;
- private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(JsonUpdate.class);
-
- @ApiModelProperty(value = "Conditions")
- public Map<String, Object> getConditions() {
- return conditions;
- }
-
- public void setConditions(Map<String, Object> conditions) {
- this.conditions = conditions;
- }
-
- @ApiModelProperty(value = "Information for selecting sepcific rows")
- public Map<String, Object> getRow_specification() {
- return rowSpecification;
- }
-
- public void setRow_specification(Map<String, Object> rowSpecification) {
- this.rowSpecification = rowSpecification;
- }
-
-
- @ApiModelProperty(value = "Keyspace name")
- public String getKeyspaceName() {
- return keyspaceName;
- }
-
- public void setKeyspaceName(String keyspaceName) {
- this.keyspaceName = keyspaceName;
- }
-
- @ApiModelProperty(value = "Table name")
- public String getTableName() {
- return tableName;
- }
-
- public void setTableName(String tableName) {
- this.tableName = tableName;
- }
-
- @ApiModelProperty(value = "Consistency level", allowableValues = "eventual,critical,atomic")
- public Map<String, String> getConsistencyInfo() {
- return consistencyInfo;
- }
-
- public void setConsistencyInfo(Map<String, String> consistencyInfo) {
- this.consistencyInfo = consistencyInfo;
- }
-
- @ApiModelProperty(value = "Time to live value")
- public String getTtl() {
- return ttl;
- }
-
- public void setTtl(String ttl) {
- this.ttl = ttl;
- }
-
- @ApiModelProperty(value = "Time stamp")
- public String getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(String timestamp) {
- this.timestamp = timestamp;
- }
-
- @ApiModelProperty(value = "Column values")
- public Map<String, Object> getValues() {
- return values;
- }
-
- public void setValues(Map<String, Object> values) {
- this.values = values;
- }
-
- public byte[] serialize() {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- ObjectOutput out = null;
- try {
- out = new ObjectOutputStream(bos);
- out.writeObject(this);
- } catch (IOException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e,AppMessages.IOERROR, ErrorSeverity.ERROR, ErrorTypes.DATAERROR);
- }
- return bos.toByteArray();
- }
-
-}
diff --git a/src/main/java/org/onap/music/datastore/jsonobjects/NameSpace.java b/src/main/java/org/onap/music/datastore/jsonobjects/NameSpace.java
deleted file mode 100644
index 3c18c791..00000000
--- a/src/main/java/org/onap/music/datastore/jsonobjects/NameSpace.java
+++ /dev/null
@@ -1,48 +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;
-
-
-public class NameSpace {
- private String name;
- private List<String> admin;
-
- public List<String> getAdmin() {
- return admin;
- }
-
- public String getName() {
- return name;
- }
-
- public void setAdmin(List<String> admin) {
- this.admin = admin;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}