File cassandra.patch of Package java-monasca-common

commit e5f53e9fdc06b3408fa2dd9e1904f5c63aa7bd6c
Author: James Gu <jgu@suse.com>
Date:   Thu Aug 31 15:15:19 2017 -0700
Status: not upstream, local backport to Pike
URL: https://review.openstack.org/527854

    Add Cassandra db support
    
    Added Cassandra configuration Java class in the common project similar
    to existing db.
    
    Change-Id: I9aa250bab206438f9b98bd211d472c0d8fe12bde
    story: 2001231
    task: 5957

diff --git a/java/monasca-common-cassandra/pom.xml b/java/monasca-common-cassandra/pom.xml
new file mode 100644
index 000000000000..b6e5fdde7782
--- /dev/null
+++ b/java/monasca-common-cassandra/pom.xml
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>monasca-common</groupId>
+    <artifactId>monasca-common</artifactId>
+    <version>${computedVersion}</version>
+  </parent>
+  <artifactId>monasca-common-cassandra</artifactId>
+  <packaging>jar</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+      <version>2.3.1</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/java/monasca-common-cassandra/src/main/java/monasca/common/configuration/CassandraDbConfiguration.java b/java/monasca-common-cassandra/src/main/java/monasca/common/configuration/CassandraDbConfiguration.java
new file mode 100644
index 000000000000..2a5c20771943
--- /dev/null
+++ b/java/monasca-common-cassandra/src/main/java/monasca/common/configuration/CassandraDbConfiguration.java
@@ -0,0 +1,127 @@
+/*
+ * (c) Copyright 2017 SUSE LLC.
+ *
+ * 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.
+ */
+package monasca.common.configuration;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class CassandraDbConfiguration {
+
+  @JsonProperty
+  int maxConnections;
+
+  public int getMaxConnections() {
+    return maxConnections;
+  }
+
+  @JsonProperty
+  int maxRequests;
+
+  public int getMaxRequests() {
+    return maxRequests;
+  }
+
+  @JsonProperty
+  int connectionTimeout;
+
+  public int getConnectionTimeout() {
+    return connectionTimeout;
+  }
+
+  @JsonProperty
+  int readTimeout;
+
+  public int getReadTimeout() {
+    return readTimeout;
+  }
+
+  @JsonProperty
+  String[] contactPoints;
+
+  public String[] getContactPoints() {
+    return contactPoints;
+  }
+
+  @JsonProperty
+  int port;
+
+  public int getPort() {
+    return port;
+  }
+
+  @JsonProperty
+  int readConsistencyLevel;
+
+  @JsonProperty
+  String consistencyLevel;
+
+  public String getConsistencyLevel() {
+    return consistencyLevel;
+  }
+
+  @JsonProperty
+  String keyspace;
+
+  public String getKeySpace() {
+    return keyspace;
+  }
+
+  @JsonProperty
+  String user;
+
+  public String getUser() {
+    return user;
+  }
+
+  @JsonProperty
+  String password;
+
+  public String getPassword() {
+    return password;
+  }
+
+  @JsonProperty
+  long maxDefinitionCacheSize;
+
+  public long getDefinitionMaxCacheSize() {
+    return maxDefinitionCacheSize;
+  }
+
+  @JsonProperty
+  int maxWriteRetries;
+
+  public int getMaxWriteRetries() {
+    return maxWriteRetries;
+  }
+
+  @JsonProperty
+  int maxBatches;
+
+  public int getMaxBatches() {
+    return maxBatches;
+  }
+
+  @JsonProperty
+  int retentionPolicy;
+
+  public int getRetentionPolicy() {
+    return retentionPolicy;
+  }
+
+  @JsonProperty
+  String localDataCenter;
+
+  public String getLocalDataCenter() {
+    return localDataCenter;
+  }
+}
diff --git a/java/pom.xml b/java/pom.xml
index be2c53133929..a0474f47fa5d 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -38,6 +38,7 @@
     <module>monasca-common-middleware</module>
     <module>monasca-common-influxdb</module>
     <module>monasca-common-hibernate</module>
+    <module>monasca-common-cassandra</module>
   </modules>
 
   <profiles>
openSUSE Build Service is sponsored by