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')
-rwxr-xr-xsrc/main/java/org/onap/music/datastore/MusicDataStore.java40
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java20
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java11
-rw-r--r--src/main/java/org/onap/music/datastore/jsonobjects/JsonLock.java8
4 files changed, 41 insertions, 38 deletions
diff --git a/src/main/java/org/onap/music/datastore/MusicDataStore.java b/src/main/java/org/onap/music/datastore/MusicDataStore.java
index c771d80a..6195dbef 100755
--- a/src/main/java/org/onap/music/datastore/MusicDataStore.java
+++ b/src/main/java/org/onap/music/datastore/MusicDataStore.java
@@ -35,15 +35,14 @@ 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.CipherUtil;
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;
@@ -53,7 +52,6 @@ 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;
@@ -62,7 +60,6 @@ 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
@@ -177,10 +174,11 @@ public class MusicDataStore {
while (it.hasNext()) {
try {
if(MusicUtil.getCassName() != null && MusicUtil.getCassPwd() != null) {
+ String cassPwd = CipherUtil.decryptPKC(MusicUtil.getCassPwd());
logger.info(EELFLoggerDelegate.applicationLogger,
"Building with credentials "+MusicUtil.getCassName()+" & "+MusicUtil.getCassPwd());
cluster = Cluster.builder().withPort(MusicUtil.getCassandraPort())
- .withCredentials(MusicUtil.getCassName(), MusicUtil.getCassPwd())
+ .withCredentials(MusicUtil.getCassName(), cassPwd)
//.withLoadBalancingPolicy(new RoundRobinPolicy())
.withoutJMXReporting()
.withPoolingOptions(poolingOptions)
@@ -225,10 +223,11 @@ public class MusicDataStore {
.setConnectionsPerHost(HostDistance.LOCAL, 4, 10)
.setConnectionsPerHost(HostDistance.REMOTE, 2, 4);
if(MusicUtil.getCassName() != null && MusicUtil.getCassPwd() != null) {
+ String cassPwd = CipherUtil.decryptPKC(MusicUtil.getCassPwd());
logger.info(EELFLoggerDelegate.applicationLogger,
- "Building with credentials "+MusicUtil.getCassName()+" & "+MusicUtil.getCassPwd());
+ "Building with credentials "+MusicUtil.getCassName()+" & "+ MusicUtil.getCassPwd());
cluster = Cluster.builder().withPort(MusicUtil.getCassandraPort())
- .withCredentials(MusicUtil.getCassName(), MusicUtil.getCassPwd())
+ .withCredentials(MusicUtil.getCassName(), cassPwd)
//.withLoadBalancingPolicy(new RoundRobinPolicy())
.withoutJMXReporting()
.withPoolingOptions(poolingOptions)
@@ -410,7 +409,7 @@ public class MusicDataStore {
throw new MusicQueryException("Ill formed queryObject for the request = " + "["
+ queryObject.getQuery() + "]");
}
- logger.info(EELFLoggerDelegate.applicationLogger,
+ logger.debug(EELFLoggerDelegate.applicationLogger,
"In preprared Execute Put: the actual insert query:"
+ queryObject.getQuery() + "; the values"
+ queryObject.getValues());
@@ -442,18 +441,19 @@ public class MusicDataStore {
}
catch (AlreadyExistsException ae) {
- logger.error(EELFLoggerDelegate.errorLogger, ae.getMessage(),AppMessages.SESSIONFAILED+ " [" +
- queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR, ae);
- throw new MusicServiceException(ae.getMessage());
- }
- catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(),AppMessages.SESSIONFAILED + " ["
- + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR, e);
+ // logger.error(EELFLoggerDelegate.errorLogger,"AlreadExistsException: " + ae.getMessage(),AppMessages.QUERYERROR,
+ // ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ throw new MusicQueryException("AlreadyExistsException: " + ae.getMessage(),ae);
+ } catch ( InvalidQueryException e ) {
+ // logger.error(EELFLoggerDelegate.errorLogger,"InvalidQueryException: " + e.getMessage(),AppMessages.SESSIONFAILED + " ["
+ // + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR);
+ throw new MusicQueryException("InvalidQueryException: " + e.getMessage(),e);
+ } catch (Exception e) {
+ // logger.error(EELFLoggerDelegate.errorLogger,e.getClass().toString() + ":" + e.getMessage(),AppMessages.SESSIONFAILED + " ["
+ // + queryObject.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR, e);
throw new MusicServiceException("Executing Session Failure for Request = " + "["
- + queryObject.getQuery() + "]" + " Reason = " + e.getMessage());
+ + queryObject.getQuery() + "]" + " Reason = " + e.getMessage(),e);
}
-
-
return result;
}
@@ -556,9 +556,9 @@ public class MusicDataStore {
results = session.execute(statement);
} catch (Exception ex) {
- logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage(),AppMessages.UNKNOWNERROR+ "[" + queryObject
+ logger.error(EELFLoggerDelegate.errorLogger, "Execute Get Error" + ex.getMessage(),AppMessages.UNKNOWNERROR+ "[" + queryObject
.getQuery() + "]", ErrorSeverity.ERROR, ErrorTypes.QUERYERROR, ex);
- throw new MusicServiceException(ex.getMessage());
+ throw new MusicServiceException("Execute Get Error" + ex.getMessage());
}
return results;
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 09cd65dc..d3ec10da 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonInsert.java
@@ -40,7 +40,7 @@ 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")
+@ApiModel(value = "InsertTable", description = "Json model for table vlaues insert")
@JsonIgnoreProperties(ignoreUnknown = true)
public class JsonInsert implements Serializable {
private static final long serialVersionUID = 1L;
@@ -54,7 +54,7 @@ public class JsonInsert implements Serializable {
private Map<String, byte[]> objectMap;
private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(JsonInsert.class);
- @ApiModelProperty(value = "objectMap")
+ @ApiModelProperty(value = "objectMap",hidden = true)
public Map<String, byte[]> getObjectMap() {
return objectMap;
}
@@ -90,7 +90,10 @@ public class JsonInsert implements Serializable {
this.consistencyInfo = consistencyInfo;
}
- @ApiModelProperty(value = "Time to live information")
+ @ApiModelProperty(value = "Columns and tables support an optional "
+ + "expiration period called TTL (time-to-live) in seconds.",
+ notes="TTL precision is one second, which is calculated by the coordinator "
+ + "node. When using TTL, ensure that all nodes in the cluster have synchronized clocks.",allowEmptyValue = true)
public String getTtl() {
return ttl;
}
@@ -99,7 +102,10 @@ public class JsonInsert implements Serializable {
this.ttl = ttl;
}
- @ApiModelProperty(value = "Time stamp")
+ @ApiModelProperty(value = "Time stamp (epoch_in_microseconds)",
+ notes = "Marks inserted data (write time) with TIMESTAMP. "
+ + "Enter the time since epoch (January 1, 1970) in microseconds."
+ + "By default, the actual time of write is used.", allowEmptyValue = true)
public String getTimestamp() {
return timestamp;
}
@@ -108,7 +114,9 @@ public class JsonInsert implements Serializable {
this.timestamp = timestamp;
}
- @ApiModelProperty(value = "values returned")
+ @ApiModelProperty(value = "Json Object of key/values", notes="Where key is the column name and value is the data value for that column.",
+ example = "{'emp_id': 'df98a3d40cd6','emp_name': 'john',"
+ + "'emp_salary': 50,'address':{'street' : '1 Some way','city' : 'New York'}}")
public Map<String, Object> getValues() {
return values;
}
@@ -117,7 +125,7 @@ public class JsonInsert implements Serializable {
this.values = values;
}
- @ApiModelProperty(value = "Information for selecting specific rows for insert")
+ @ApiModelProperty(value = "Information for selecting specific rows for insert",hidden = true)
public Map<String, Object> getRowSpecification() {
return rowSpecification;
}
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 edb30857..86bbe3dc 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonLeasedLock.java
@@ -27,11 +27,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
-@ApiModel(value = "JsonTable", description = "model for leased lock")
+@ApiModel(value = "Json Leasesd Lock", description = "model for leased lock")
@JsonIgnoreProperties(ignoreUnknown = true)
public class JsonLeasedLock {
private long leasePeriod;
- private String notifyUrl;
@ApiModelProperty(value = "Lease period")
public long getLeasePeriod() {
@@ -42,12 +41,4 @@ public class JsonLeasedLock {
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/JsonLock.java b/src/main/java/org/onap/music/datastore/jsonobjects/JsonLock.java
index 88e1c3f3..f353c018 100644
--- a/src/main/java/org/onap/music/datastore/jsonobjects/JsonLock.java
+++ b/src/main/java/org/onap/music/datastore/jsonobjects/JsonLock.java
@@ -29,12 +29,16 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
-@ApiModel(value = "JsonTable", description = "model for leased lock")
+@ApiModel(value = "Json Lock Type", description = "Model for Lock Type")
@JsonIgnoreProperties(ignoreUnknown = true)
public class JsonLock {
private LockType locktype;
- @ApiModelProperty(value = "Type of music lock")
+ @ApiModelProperty(
+ value = "Type of music lock",
+ name = "lockType",
+ allowEmptyValue = false,
+ allowableValues = "READ|WRITE")
public LockType getLocktype() {
return this.locktype;
}