Add Simple Test for Native Cassandra Serialization
Project: http://git-wip-us.apache.org/repos/asf/gora/repo Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/2695794a Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/2695794a Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/2695794a Branch: refs/heads/master Commit: 2695794ad01132486447e489b7e179edb357b974 Parents: 516f366 Author: madhawa <madhaw...@gmail.com> Authored: Fri Jun 23 23:42:44 2017 +0530 Committer: madhawa <madhaw...@gmail.com> Committed: Sat Jun 24 22:16:30 2017 +0530 ---------------------------------------------------------------------- gora-cassandra-cql/pom.xml | 69 +- .../serializers/CassandraNativePersistent.java | 91 ++ .../cassandra/store/CassandraQueryFactory.java | 28 +- .../gora/cassandra/store/CassandraStore.java | 171 ++- .../store/CassandraStoreParameters.java | 83 +- gora-cassandra-cql/src/test/conf/cassandra.yaml | 1248 ++++++++++++++---- .../src/test/conf/log4j-server.properties | 2 +- .../mappingManager/gora-cassandra-mapping.xml | 97 -- .../test/conf/mappingManager/gora.properties | 30 - .../conf/nativeSerialization/custom-codecs.xml | 24 + .../gora-cassandra-mapping.xml | 65 + .../conf/nativeSerialization/gora.properties | 30 + .../gora/cassandra/GoraCassandraTestDriver.java | 35 +- ...stCassandraStoreWithNativeSerialization.java | 46 +- .../nativeSerialization/DateAsStringCodec.java | 33 + .../test/nativeSerialization/User.java | 86 +- gora-tutorial/pom.xml | 2 +- pom.xml | 8 +- 18 files changed, 1563 insertions(+), 585 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/gora/blob/2695794a/gora-cassandra-cql/pom.xml ---------------------------------------------------------------------- diff --git a/gora-cassandra-cql/pom.xml b/gora-cassandra-cql/pom.xml index 11da4fc..d56e07a 100644 --- a/gora-cassandra-cql/pom.xml +++ b/gora-cassandra-cql/pom.xml @@ -16,10 +16,11 @@ ~ limitations under the License. --> -<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"> +<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> + <parent> <groupId>org.apache.gora</groupId> <artifactId>gora</artifactId> <version>0.8-SNAPSHOT</version> @@ -29,11 +30,12 @@ <packaging>bundle</packaging> <name>Apache Gora :: Cassandra - CQL</name> - <url>http://gora.apache.org</url> - <description>The Apache Gora open source framework provides an in-memory data model and - persistence for big data. Gora supports persisting to column stores, key value stores, - document stores and RDBMSs, and analyzing the data with extensive Apache Hadoop MapReduce - support.</description> + <url>http://gora.apache.org</url> + <description>The Apache Gora open source framework provides an in-memory data model and + persistence for big data. Gora supports persisting to column stores, key value stores, + document stores and RDBMSs, and analyzing the data with extensive Apache Hadoop MapReduce + support. + </description> <inceptionYear>2010</inceptionYear> <organization> <name>The Apache Software Foundation</name> @@ -49,7 +51,7 @@ </ciManagement> <properties> - <guava.version>17.0</guava.version> + <guava.version>18.0</guava.version> <osgi.import>*</osgi.import> <osgi.export>org.apache.gora.cassandra*;version="${project.version}";-noimport:=true</osgi.export> </properties> @@ -62,13 +64,13 @@ <testSourceDirectory>src/test/java</testSourceDirectory> <sourceDirectory>src/main/java</sourceDirectory> <testResources> - <testResource> - <directory>${project.basedir}/src/test/conf</directory> - <includes> - <include>**/*</include> - </includes> - <!--targetPath>${project.basedir}/target/classes/</targetPath--> - </testResource> + <testResource> + <directory>${project.basedir}/src/test/conf</directory> + <includes> + <include>**/*</include> + </includes> + <!--targetPath>${project.basedir}/target/classes/</targetPath--> + </testResource> </testResources> <plugins> <plugin> @@ -89,6 +91,21 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>2.20</version> + </dependency> + </dependencies> + <configuration> + <forkMode>always</forkMode> + <argLine>-Xmx1024m -XX:MaxPermSize=512m</argLine> + </configuration> + </plugin> </plugins> </build> @@ -124,8 +141,14 @@ </dependency> <dependency> - <groupId>com.datastax.cassandra</groupId> - <artifactId>cassandra-driver-mapping</artifactId> + <groupId>com.datastax.cassandra</groupId> + <artifactId>cassandra-driver-mapping</artifactId> + <version>${cassandra-driver.version}</version> + </dependency> + + <dependency> + <groupId>com.datastax.cassandra</groupId> + <artifactId>cassandra-driver-extras</artifactId> <version>${cassandra-driver.version}</version> </dependency> @@ -144,12 +167,22 @@ <artifactId>slf4j-log4j12</artifactId> </exclusion> <exclusion> + <groupId>io.netty</groupId> + <artifactId>netty-handler</artifactId> + </exclusion> + <exclusion> <groupId>org.slf4j</groupId> <artifactId>log4j-over-slf4j</artifactId> </exclusion> </exclusions> </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-transport-native-epoll</artifactId> + <version>4.0.37.Final</version> + </dependency> + <!-- Misc Dependencies --> <dependency> <groupId>com.google.guava</groupId> @@ -193,7 +226,7 @@ <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-minicluster</artifactId> </dependency> - + </dependencies> </project> http://git-wip-us.apache.org/repos/asf/gora/blob/2695794a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/serializers/CassandraNativePersistent.java ---------------------------------------------------------------------- diff --git a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/serializers/CassandraNativePersistent.java b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/serializers/CassandraNativePersistent.java new file mode 100644 index 0000000..c493433 --- /dev/null +++ b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/serializers/CassandraNativePersistent.java @@ -0,0 +1,91 @@ +package org.apache.gora.cassandra.serializers; + +import com.datastax.driver.mapping.annotations.Transient; +import org.apache.avro.Schema; +import org.apache.gora.persistency.Persistent; +import org.apache.gora.persistency.Tombstone; + +import java.util.List; + +/** + * This class should be used with Native Cassandra Serialization. + */ +public abstract class CassandraNativePersistent implements Persistent { + @Transient + @Override + public void clear() { + + } + + @Transient + @Override + public boolean isDirty(int fieldIndex) { + return false; + } + + @Transient + @Override + public boolean isDirty(String field) { + return false; + } + + @Transient + @Override + public void setDirty() { + + } + + @Transient + @Override + public void setDirty(int fieldIndex) { + + } + + @Transient + @Override + public void setDirty(String field) { + + } + + @Transient + @Override + public void clearDirty(int fieldIndex) { + + } + + @Transient + @Override + public void clearDirty(String field) { + + } + + @Transient + @Override + public Tombstone getTombstone() { + return null; + } + + @Transient + @Override + public List<Schema.Field> getUnmanagedFields() { + return null; + } + + @Transient + @Override + public Persistent newInstance() { + return null; + } + + @Transient + @Override + public boolean isDirty() { + return false; + } + + @Transient + @Override + public void clearDirty() { + + } +} http://git-wip-us.apache.org/repos/asf/gora/blob/2695794a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraQueryFactory.java ---------------------------------------------------------------------- diff --git a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraQueryFactory.java b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraQueryFactory.java index 6decd3c..422fbc6 100644 --- a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraQueryFactory.java +++ b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraQueryFactory.java @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.gora.cassandra.store; import org.apache.gora.cassandra.bean.Field; @@ -30,7 +29,7 @@ class CassandraQueryFactory { static String getCreateKeySpaceQuery(CassandraMapping mapping) { KeySpace keySpace = mapping.getKeySpace(); StringBuilder stringBuffer = new StringBuilder(); - stringBuffer.append("CREATE KEYSPACE ").append(keySpace.getName()).append(" WITH REPLICATION = { 'class' : "); + stringBuffer.append("CREATE KEYSPACE IF NOT EXISTS ").append(keySpace.getName()).append(" WITH REPLICATION = { 'class' : "); KeySpace.PlacementStrategy placementStrategy = keySpace.getPlacementStrategy(); stringBuffer.append("'").append(placementStrategy).append("'").append(", ").append("'"); switch (placementStrategy) { @@ -50,7 +49,7 @@ class CassandraQueryFactory { break; } - if(keySpace.isDurableWritesEnabled()) { + if (keySpace.isDurableWritesEnabled()) { stringBuffer.append(" AND DURABLE_WRITES = ").append(keySpace.isDurableWritesEnabled()); } return stringBuffer.toString(); @@ -58,20 +57,33 @@ class CassandraQueryFactory { static String getCreateTableQuery(CassandraMapping mapping) { StringBuilder stringBuffer = new StringBuilder(); -stringBuffer.append("CREATE TABLE ").append(mapping.getCoreName()).append(" ("); + stringBuffer.append("CREATE TABLE IF NOT EXISTS ").append(mapping.getKeySpace().getName()).append(".").append(mapping.getCoreName()).append(" ("); boolean isCommaNeeded = false; - for(Field field : mapping.getFieldList()) { - if(isCommaNeeded) { + for (Field field : mapping.getFieldList()) { + if (isCommaNeeded) { stringBuffer.append(", "); } stringBuffer.append(field.getColumnName()).append(" ").append(field.getType()); boolean isStaticColumn = Boolean.parseBoolean(field.getProperty("static")); - if( isStaticColumn) { + boolean isPrimaryKey = Boolean.parseBoolean(field.getProperty("primarykey")); + if (isStaticColumn) { stringBuffer.append(" STATIC"); } - isCommaNeeded =true; + if(isPrimaryKey) { + stringBuffer.append(" PRIMARY KEY "); + } + isCommaNeeded = true; } + stringBuffer.append(")"); + if(Boolean.parseBoolean(mapping.getProperty("compactStorage"))) { + stringBuffer.append(" WITH COMPACT STORAGE "); + } else { + String id = mapping.getProperty("id"); + if (id != null) { + stringBuffer.append(" WITH ID = '").append(id).append("'"); + } + } return stringBuffer.toString(); } http://git-wip-us.apache.org/repos/asf/gora/blob/2695794a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java ---------------------------------------------------------------------- diff --git a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java index 7031444..fad0fd4 100644 --- a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java +++ b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java @@ -17,11 +17,33 @@ package org.apache.gora.cassandra.store; +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.ConsistencyLevel; +import com.datastax.driver.core.HostDistance; +import com.datastax.driver.core.PoolingOptions; +import com.datastax.driver.core.ProtocolOptions; +import com.datastax.driver.core.ProtocolVersion; +import com.datastax.driver.core.QueryOptions; +import com.datastax.driver.core.Session; +import com.datastax.driver.core.SocketOptions; +import com.datastax.driver.core.TypeCodec; +import com.datastax.driver.core.policies.ConstantReconnectionPolicy; +import com.datastax.driver.core.policies.DCAwareRoundRobinPolicy; +import com.datastax.driver.core.policies.DefaultRetryPolicy; +import com.datastax.driver.core.policies.DowngradingConsistencyRetryPolicy; +import com.datastax.driver.core.policies.ExponentialReconnectionPolicy; +import com.datastax.driver.core.policies.FallthroughRetryPolicy; +import com.datastax.driver.core.policies.LatencyAwarePolicy; +import com.datastax.driver.core.policies.LoggingRetryPolicy; +import com.datastax.driver.core.policies.RoundRobinPolicy; +import com.datastax.driver.core.policies.TokenAwarePolicy; import com.datastax.driver.mapping.Mapper; import com.datastax.driver.mapping.MappingManager; -import com.datastax.driver.core.*; -import com.datastax.driver.core.policies.*; -import org.apache.gora.cassandra.bean.*; +import org.apache.gora.cassandra.bean.CassandraKey; +import org.apache.gora.cassandra.bean.ClusterKeyField; +import org.apache.gora.cassandra.bean.Field; +import org.apache.gora.cassandra.bean.KeySpace; +import org.apache.gora.cassandra.bean.PartitionKeyField; import org.apache.gora.persistency.BeanFactory; import org.apache.gora.persistency.Persistent; import org.apache.gora.query.PartitionQuery; @@ -32,11 +54,13 @@ import org.apache.gora.store.DataStoreFactory; import org.jdom.Attribute; import org.jdom.Document; import org.jdom.Element; +import org.jdom.JDOMException; import org.jdom.input.SAXBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Properties; @@ -63,7 +87,7 @@ public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> private CassandraMapping mapping; - private boolean isUseCassandraMappingManager; + private boolean isUseNativeSerialization; private Mapper<T> mapper; @@ -74,7 +98,6 @@ public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> } /** - * * In initializing the cassandra datastore, read the mapping file, creates the basic connection to cassandra cluster, * according to the gora properties * @@ -87,15 +110,19 @@ public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> try { this.keyClass = keyClass; this.persistentClass = persistentClass; - String mappingFile = DataStoreFactory.getMappingFile(properties, this, - DEFAULT_MAPPING_FILE); + String mappingFile = DataStoreFactory.getMappingFile(properties, this, DEFAULT_MAPPING_FILE); + List<String> codecs = readCustomCodec(properties); mapping = readMapping(mappingFile); - isUseCassandraMappingManager = Boolean.parseBoolean(properties.getProperty(CassandraStoreParameters.USE_CASSANDRA_NATIVE_SERIALIZATION)); + isUseNativeSerialization = Boolean.parseBoolean(properties.getProperty(CassandraStoreParameters.USE_CASSANDRA_NATIVE_SERIALIZATION)); Cluster.Builder builder = Cluster.builder(); - populateSettings(builder, properties); + builder = populateSettings(builder, properties); this.cluster = builder.build(); + if (codecs != null) { + registerCustomCodecs(codecs); + } this.session = this.cluster.connect(); - if (isUseCassandraMappingManager) { + if (isUseNativeSerialization) { + this.createSchema(); MappingManager mappingManager = new MappingManager(session); mapper = mappingManager.mapper(persistentClass); } @@ -107,6 +134,12 @@ public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> } } + private void registerCustomCodecs(List<String> codecs) throws Exception { + for (String codec : codecs) { + this.cluster.getConfiguration().getCodecRegistry().register((TypeCodec<?>) Class.forName(codec).newInstance()); + } + } + /** * In this method we reads the mapping file and creates the Cassandra Mapping. * @@ -149,22 +182,7 @@ public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> Field cassandraField = new Field(); List fieldAttributes = field.getAttributes(); - for (Object anAttributeList : fieldAttributes) { - Attribute attribute = (Attribute) anAttributeList; - String attributeName = attribute.getName(); - String attributeValue = attribute.getValue(); - switch (attributeName) { - case "name": - cassandraField.setFieldName(attributeValue); - break; - case "column": - cassandraField.setColumnName(attributeValue); - break; - default: - cassandraField.addProperty(attributeName, attributeValue); - break; - } - } + processAttributes(fieldAttributes, cassandraField); map.addCassandraField(cassandraField); } break; @@ -236,22 +254,7 @@ public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> for (Element partitionKeyField : partitionKeyFields) { PartitionKeyField fieldKey = new PartitionKeyField(); List fieldAttributes = partitionKeyField.getAttributes(); - for (Object anAttributeList : fieldAttributes) { - Attribute attribute = (Attribute) anAttributeList; - String attributeName = attribute.getName(); - String attributeValue = attribute.getValue(); - switch (attributeName) { - case "name": - fieldKey.setFieldName(attributeValue); - break; - case "column": - fieldKey.setColumnName(attributeValue); - break; - default: - fieldKey.addProperty(attributeName, attributeValue); - break; - } - } + processAttributes(fieldAttributes, fieldKey); cassandraKey.addPartitionKeyField(fieldKey); } // process composite partitions keys @@ -262,26 +265,10 @@ public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> for (Element partitionKeyField : compositeKeyFields) { PartitionKeyField fieldKey = new PartitionKeyField(); List fieldAttributes = partitionKeyField.getAttributes(); - for (Object anAttributeList : fieldAttributes) { - Attribute attribute = (Attribute) anAttributeList; - String attributeName = attribute.getName(); - String attributeValue = attribute.getValue(); - switch (attributeName) { - case "name": - fieldKey.setFieldName(attributeValue); - break; - case "column": - fieldKey.setColumnName(attributeValue); - break; - default: - fieldKey.addProperty(attributeName, attributeValue); - break; - } - } + processAttributes(fieldAttributes, fieldKey); compositeFieldKey.addField(fieldKey); } cassandraKey.addPartitionKeyField(compositeFieldKey); - } //process cluster keys @@ -300,6 +287,9 @@ public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> case "column": keyField.setColumnName(attributeValue); break; + case "type": + keyField.setType(attributeValue); + break; case "order": keyField.setOrder(ClusterKeyField.Order.valueOf(attributeValue.toUpperCase(Locale.ENGLISH))); break; @@ -319,7 +309,44 @@ public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> return map; } - private void populateSettings(Cluster.Builder builder, Properties properties) { + private void processAttributes(List<Element> attributes, Field fieldKey) { + for (Object anAttributeList : attributes) { + Attribute attribute = (Attribute) anAttributeList; + String attributeName = attribute.getName(); + String attributeValue = attribute.getValue(); + switch (attributeName) { + case "name": + fieldKey.setFieldName(attributeValue); + break; + case "column": + fieldKey.setColumnName(attributeValue); + break; + case "type": + fieldKey.setType(attributeValue); + break; + default: + fieldKey.addProperty(attributeName, attributeValue); + break; + } + } + } + + private List<String> readCustomCodec(Properties properties) throws JDOMException, IOException { + String filename = properties.getProperty(CassandraStoreParameters.CUSTOM_CODEC_FILE); + if (filename != null) { + List<String> codecs = new ArrayList<>(); + SAXBuilder builder = new SAXBuilder(); + Document doc = builder.build(getClass().getClassLoader().getResourceAsStream(filename)); + List<Element> codecElementList = doc.getRootElement().getChildren("codec"); + for (Element codec : codecElementList) { + codecs.add(codec.getValue()); + } + return codecs; + } + return null; + } + + private Cluster.Builder populateSettings(Cluster.Builder builder, Properties properties) { String serversParam = properties.getProperty(CassandraStoreParameters.CASSANDRA_SERVERS); String[] servers = serversParam.split(","); for (String server : servers) { @@ -366,6 +393,7 @@ public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> builder = builder.withSSL(); } } + return builder; } @@ -594,6 +622,15 @@ public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> return builder.withSocketOptions(options); } + /** + * {@inheritDoc} + * <p> + * This is a setter method to set the class of persistent objects. + * + * @param persistentClass class of persistent objects + * {@link org.apache.gora.cassandra.serializers.CassandraNativePersistent} + * {@link org.apache.gora.persistency.Persistent} + */ @Override public void setPersistentClass(Class<T> persistentClass) { this.persistentClass = persistentClass; @@ -611,7 +648,10 @@ public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> @Override public void createSchema() { - + LOG.debug("creating Cassandra keyspace"); + this.session.execute(CassandraQueryFactory.getCreateKeySpaceQuery(mapping)); + LOG.debug("creating Cassandra column family / table"); + this.session.execute(CassandraQueryFactory.getCreateTableQuery(mapping)); } @Override @@ -656,12 +696,13 @@ public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> @Override public void close() { - + this.session.close(); + this.cluster.close(); } @Override public T get(K key) { - if (isUseCassandraMappingManager) { + if (isUseNativeSerialization) { return mapper.get(key); } else { return null; @@ -675,7 +716,7 @@ public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> @Override public void put(K key, T obj) { - if (isUseCassandraMappingManager) { + if (isUseNativeSerialization) { mapper.save(obj); } else { @@ -684,7 +725,7 @@ public class CassandraStore<K, T extends Persistent> implements DataStore<K, T> @Override public boolean delete(K key) { - if (isUseCassandraMappingManager) { + if (isUseNativeSerialization) { mapper.delete(key); return true; } else { http://git-wip-us.apache.org/repos/asf/gora/blob/2695794a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStoreParameters.java ---------------------------------------------------------------------- diff --git a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStoreParameters.java b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStoreParameters.java index bd60a15..c48b1c0 100644 --- a/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStoreParameters.java +++ b/gora-cassandra-cql/src/main/java/org/apache/gora/cassandra/store/CassandraStoreParameters.java @@ -26,105 +26,105 @@ public class CassandraStoreParameters { * Property pointing to cassandra db contact points. * string (multiple values with comma separated) */ - public static final String CASSANDRA_SERVERS = "gora.cassandra.store.cassandraServers"; + public static final String CASSANDRA_SERVERS = "gora.cassandrastore.cassandraServers"; /** *Property pointing to the Cassandra keyspace. * string */ - public static final String KEYSPACE = "gora.cassandra.store.keyspace"; + public static final String KEYSPACE = "gora.cassandrastore.keyspace"; /** * Property pointing to the port to use to connect to the Cassandra hosts. * integer */ - public static final String PORT = "gora.cassandra.store.port"; + public static final String PORT = "gora.cassandrastore.port"; /** * Property pointing to the Cassandra cluster name. * string */ - public static final String CLUSTER_NAME = "gora.cassandra.store.clusterName"; + public static final String CLUSTER_NAME = "gora.cassandrastore.clusterName"; /** * Property pointing to set compression to use for the transport. * "LZ4", "SNAPPY", "NONE" */ - public static final String COMPRESSION = "gora.cassandra.store.compression"; + public static final String COMPRESSION = "gora.cassandrastore.compression"; /** * Property pointing to the username to connect to the server. * string */ - public static final String USERNAME = "gora.cassandra.store.username"; + public static final String USERNAME = "gora.cassandrastore.username"; /** * Property pointing to the password to connect to the server. * string */ - public static final String PASSWORD = "gora.cassandra.store.password"; + public static final String PASSWORD = "gora.cassandrastore.password"; /** * Property pointing to set load balancing policy. * "RoundRobinPolicy", "LatencyAwareRoundRobinPolicy", "TokenAwareRoundRobinPolicy" */ - public static final String LOAD_BALANCING_POLICY = "gora.cassandra.store.loadBalancingPolicy"; + public static final String LOAD_BALANCING_POLICY = "gora.cassandrastore.loadBalancingPolicy"; /** * Property pointing to enable/disable JMX reporting. * boolean */ - public static final String ENABLE_JMX_REPORTING = "gora.cassandra.store.enableJMXReporting"; + public static final String ENABLE_JMX_REPORTING = "gora.cassandrastore.enableJMXReporting"; /** * Property pointing to enable/disable metrics. * boolean */ - public static final String ENABLE_METRICS = "gora.cassandra.store.enableMetrics"; + public static final String ENABLE_METRICS = "gora.cassandrastore.enableMetrics"; /** * Property pointing to set local host core connections size. * integer */ - public static final String LOCAL_CORE_CONNECTIONS_PER_HOST = "gora.cassandra.store.localCoreConnectionsPerHost"; + public static final String LOCAL_CORE_CONNECTIONS_PER_HOST = "gora.cassandrastore.localCoreConnectionsPerHost"; /** * Property pointing to set remote host core connections size. * integer */ - public static final String REMOTE_CORE_CONNECTIONS_PER_HOST = "gora.cassandra.store.remoteCoreConnectionsPerHost"; + public static final String REMOTE_CORE_CONNECTIONS_PER_HOST = "gora.cassandrastore.remoteCoreConnectionsPerHost"; /** * Property pointing to set local host max connections size. * integer */ - public static final String LOCAL_MAX_CONNECTIONS_PER_HOST = "gora.cassandra.store.localMaxConnectionsPerHost"; + public static final String LOCAL_MAX_CONNECTIONS_PER_HOST = "gora.cassandrastore.localMaxConnectionsPerHost"; /** * Property pointing to set remote host max connections size. * integer */ - public static final String REMOTE_MAX_CONNECTIONS_PER_HOST = "gora.cassandra.store.remoteMaxConnectionsPerHost"; + public static final String REMOTE_MAX_CONNECTIONS_PER_HOST = "gora.cassandrastore.remoteMaxConnectionsPerHost"; /** * Property pointing to set local host new connection threshold. * integer */ - public static final String LOCAL_NEW_CONNECTION_THRESHOLD= "gora.cassandra.store.localNewConnectionThreshold"; + public static final String LOCAL_NEW_CONNECTION_THRESHOLD= "gora.cassandrastore.localNewConnectionThreshold"; /** * Property pointing to set remote host new connection threshold. * integer */ - public static final String REMOTE_NEW_CONNECTION_THRESHOLD = "gora.cassandra.store.remoteNewConnectionThreshold"; + public static final String REMOTE_NEW_CONNECTION_THRESHOLD = "gora.cassandrastore.remoteNewConnectionThreshold"; /** * Property pointing to set local host max requests per connection. * integer */ - public static final String LOCAL_MAX_REQUESTS_PER_CONNECTION = "gora.cassandra.store.localMaxRequestsPerConnection"; + public static final String LOCAL_MAX_REQUESTS_PER_CONNECTION = "gora.cassandrastore.localMaxRequestsPerConnection"; /** * Property pointing to set remote host max requests per connection. * integer */ - public static final String REMOTE_MAX_REQUESTS_PER_CONNECTION = "gora.cassandra.store.remoteMaxRequestsPerConnection"; + public static final String REMOTE_MAX_REQUESTS_PER_CONNECTION = "gora.cassandrastore.remoteMaxRequestsPerConnection"; /** * Property pointing to set CQL Protocol version. * integer */ - public static final String PROTOCOL_VERSION = "gora.cassandra.store.protocolVersion"; + public static final String PROTOCOL_VERSION = "gora.cassandrastore.protocolVersion"; /** * Property pointing to set consistency level in Cassandra Query Options. * "ALL", "ANY", "EACH_QUORUM", "LOCAL_ONE", "LOCAL_QUORUM", "LOCAL_SERIAL", "ONE", "QUORUM", "SERIAL", "THREE", "TWO" */ - public static final String CONSISTENCY_LEVEL = "gora.cassandra.store.consistencyLevel"; + public static final String CONSISTENCY_LEVEL = "gora.cassandrastore.consistencyLevel"; /** - * Property pointing to set fetchsize in Cassandra Query Options. + * Property pointing to set fetch size in Cassandra Query Options. * integer */ public static final String FETCH_SIZE = "fetchSize"; @@ -132,91 +132,96 @@ public class CassandraStoreParameters { * Property pointing to set serial consistency level in Cassandra Query Options. * "ALL", "ANY", "EACH_QUORUM", "LOCAL_ONE", "LOCAL_QUORUM", "LOCAL_SERIAL", "ONE", "QUORUM", "SERIAL", "THREE", "TWO" */ - public static final String SERIAL_CONSISTENCY_LEVEL = "gora.cassandra.store.serialConsistencyLevel"; + public static final String SERIAL_CONSISTENCY_LEVEL = "gora.cassandrastore.serialConsistencyLevel"; /** * Property pointing to set reconnection policy * "ConstantReconnectionPolicy", "ExponentialReconnectionPolicy", */ - public static final String RECONNECTION_POLICY = "gora.cassandra.store.reconnectionPolicy"; + public static final String RECONNECTION_POLICY = "gora.cassandrastore.reconnectionPolicy"; /** * Property pointing to set the delay in constant reconnection policy. * long */ - public static final String CONSTANT_RECONNECTION_POLICY_DELAY = "gora.cassandra.store.constantReconnectionPolicyDelay"; + public static final String CONSTANT_RECONNECTION_POLICY_DELAY = "gora.cassandrastore.constantReconnectionPolicyDelay"; /** * Property pointing to set the delay in exponential reconnection policy. * long */ - public static final String EXPONENTIAL_RECONNECTION_POLICY_BASE_DELAY = "gora.cassandra.store.exponentialReconnectionPolicyBaseDelay"; + public static final String EXPONENTIAL_RECONNECTION_POLICY_BASE_DELAY = "gora.cassandrastore.exponentialReconnectionPolicyBaseDelay"; /** * Property pointing to set the max delay in exponential reconnection policy. * long */ - public static final String EXPONENTIAL_RECONNECTION_POLICY_MAX_DELAY = "gora.cassandra.store.exponentialReconnectionPolicyMaxDelay"; + public static final String EXPONENTIAL_RECONNECTION_POLICY_MAX_DELAY = "gora.cassandrastore.exponentialReconnectionPolicyMaxDelay"; /** * Property pointing to set the retry policy. * "DefaultRetryPolicy", "DowngradingConsistencyRetryPolicy", "FallthroughRetryPolicy", * "LoggingDefaultRetryPolicy", "LoggingDowngradingConsistencyRetryPolicy", "LoggingFallthroughRetryPolicy" */ - public static final String RETRY_POLICY = "gora.cassandra.store.retryPolicy"; + public static final String RETRY_POLICY = "gora.cassandrastore.retryPolicy"; /** * Property pointing to set the connection time out in Cassandra Socket Options. * integer */ - public static final String CONNECTION_TIMEOUT_MILLIS = "gora.cassandra.store.connectionTimeoutMillis"; + public static final String CONNECTION_TIMEOUT_MILLIS = "gora.cassandrastore.connectionTimeoutMillis"; /** * Property pointing to set the keep alive in Cassandra Socket Options. * boolean */ - public static final String KEEP_ALIVE = "gora.cassandra.store.keepAlive"; + public static final String KEEP_ALIVE = "gora.cassandrastore.keepAlive"; /** * Property pointing to set the read time out in Cassandra Socket Options. * integer */ - public static final String READ_TIMEOUT_MILLIS = "gora.cassandra.store.readTimeoutMillis"; + public static final String READ_TIMEOUT_MILLIS = "gora.cassandrastore.readTimeoutMillis"; /** * Property pointing to set the receiver buffer size in Cassandra Socket Options. * integer */ - public static final String RECEIVER_BUFFER_SIZE = "gora.cassandra.store.receiverBufferSize"; + public static final String RECEIVER_BUFFER_SIZE = "gora.cassandrastore.receiverBufferSize"; /** * Property pointing to set the reuse address in Cassandra Socket Options. * boolean */ - public static final String REUSE_ADDRESS = "gora.cassandra.store.reuseAddress"; + public static final String REUSE_ADDRESS = "gora.cassandrastore.reuseAddress"; /** * Property pointing to set the sender buffer size in Cassandra Socket Options. * integer */ - public static final String SEND_BUFFER_SIZE = "gora.cassandra.store.sendBufferSize"; + public static final String SEND_BUFFER_SIZE = "gora.cassandrastore.sendBufferSize"; /** * Property pointing to set the soLinger in Cassandra Socket Options. * integer */ - public static final String SO_LINGER = "gora.cassandra.store.soLinger"; + public static final String SO_LINGER = "gora.cassandrastore.soLinger"; /** * Property pointing to set the no tcp delay in Cassandra Socket Options. * boolean */ - public static final String TCP_NODELAY = "gora.cassandra.store.tcpNoDelay"; + public static final String TCP_NODELAY = "gora.cassandrastore.tcpNoDelay"; /** * Property pointing to enable SSL. * boolean */ - public static final String ENABLE_SSL = "gora.cassandra.store.enableSSL"; + public static final String ENABLE_SSL = "gora.cassandrastore.enableSSL"; /** * Property pointing to set aware local data center. * string */ - public static final String DATA_CENTER = "gora.cassandra.store.dataCenter"; + public static final String DATA_CENTER = "gora.cassandrastore.dataCenter"; /** * Property pointing to enable/disable remote data centers for local consistency level. * string */ - public static final String ALLOW_REMOTE_DCS_FOR_LOCAL_CONSISTENCY_LEVEL = "gora.cassandra.store.allowRemoteDCsForLocalConsistencyLevel"; + public static final String ALLOW_REMOTE_DCS_FOR_LOCAL_CONSISTENCY_LEVEL = "gora.cassandrastore.allowRemoteDCsForLocalConsistencyLevel"; /** * Property pointing to use Native Cassandra Native Serialization. * boolean */ - public static final String USE_CASSANDRA_NATIVE_SERIALIZATION = "gora.cassandra.store.useCassandraNativeSerialization"; + public static final String USE_CASSANDRA_NATIVE_SERIALIZATION = "gora.cassandrastore.useCassandraNativeSerialization"; + /** + * Property pointing to the custom codec file. + * string + */ + public static final String CUSTOM_CODEC_FILE = "gora.cassandrastore.custom.codec.file"; }