final ConfigurableConsistencyLevel consistencyLevelPolicy = new ConfigurableConsistencyLevel();
consistencyLevelPolicy.setDefaultReadConsistencyLevel(builder.getReadConsistencyLevel());
consistencyLevelPolicy.setDefaultWriteConsistencyLevel(builder.getWriteConsistencyLevel());
keyspace = HFactory.createKeyspace(keyspaceName, cluster, consistencyLevelPolicy);
final ColumnFamilyDefinition gauges =
HFactory.createColumnFamilyDefinition(keyspaceName, builder.getGaugeValuesColumnFamily(), ComparatorType.LONGTYPE);
final ColumnFamilyDefinition markersGauges =
HFactory.createColumnFamilyDefinition(keyspaceName, builder.getMarkerGaugesColumFamily(), ComparatorType.UTF8TYPE);
final ColumnFamilyDefinition counters =
HFactory.createColumnFamilyDefinition(keyspaceName, builder.getCounterColumnFamily(), ComparatorType.UTF8TYPE);
final ColumnFamilyDefinition markersCounters =
HFactory.createColumnFamilyDefinition(keyspaceName, builder.getMarkerCountersColumnFamily(), ComparatorType.UTF8TYPE);
final ColumnFamilyDefinition statuses =
HFactory.createColumnFamilyDefinition(keyspaceName, builder.getStatusColumnFamily(), ComparatorType.UTF8TYPE);
final ColumnFamilyDefinition markersStatuses =
HFactory.createColumnFamilyDefinition(keyspaceName, builder.getMarkerStatusesColumnFamily(), ComparatorType.UTF8TYPE);
final ColumnFamilyDefinition pathTracking =
HFactory.createColumnFamilyDefinition( keyspaceName, builder.getPathTrackingColumFamily(), ComparatorType.UTF8TYPE);
pathTracking.setDefaultValidationClass( ComparatorType.UTF8TYPE.getClassName() );
pathTracking.setComparatorType( ComparatorType.UTF8TYPE );
// creating indexes for cql query
BasicColumnDefinition levelColumn = new BasicColumnDefinition();
levelColumn.setName( StringSerializer.get().toByteBuffer("level"));
levelColumn.setIndexName("level");
levelColumn.setIndexType( ColumnIndexType.KEYS);
levelColumn.setValidationClass(ComparatorType.LONGTYPE.getClassName());
pathTracking.addColumnDefinition( levelColumn );
BasicColumnDefinition startTimeColumn = new BasicColumnDefinition();
startTimeColumn.setName( StringSerializer.get().toByteBuffer("startTime"));
startTimeColumn.setIndexName("startTime");
startTimeColumn.setIndexType( ColumnIndexType.KEYS);
startTimeColumn.setValidationClass(ComparatorType.LONGTYPE.getClassName());
pathTracking.addColumnDefinition( startTimeColumn );
// force the validation class for this column as can fail on non embeded cassandra
BasicColumnDefinition executionTimeColumn = new BasicColumnDefinition();
executionTimeColumn.setName( StringSerializer.get().toByteBuffer("executionTime"));
//startTimeColumn.setIndexName("startTime");
//startTimeColumn.setIndexType( ColumnIndexType.KEYS);
executionTimeColumn.setValidationClass(ComparatorType.LONGTYPE.getClassName());
pathTracking.addColumnDefinition( executionTimeColumn );
final ColumnFamilyDefinition markerPathTracking =
HFactory.createColumnFamilyDefinition( keyspaceName, builder.getMarkerPathTrackingColumFamily(), ComparatorType.UTF8TYPE);
{ // ensure keyspace exists, here if the keyspace doesn't exist we suppose nothing exist
if (cluster.describeKeyspace(keyspaceName) == null) {
LOGGER.info("Creating Sirona Cassandra '" + keyspaceName + "' keyspace.");