@ SuppressWarnings ( "unchecked" ) private String keyspaceDefaultsToCQLString ( ) { // Default defaults: boolean durable_writes = true ; Map < String , Object > replication = new HashMap < String , Object > ( ) ; replication . put ( "class" , "SimpleStrategy" ) ; replication . put ( "replication_factor" , "1" ) ; // Legacy support: ReplicationFactor if ( m_dbservice . getParam ( "ReplicationFactor" ) != null ) { replication . put ( "replication_factor" , m_dbservice . getParamString ( "ReplicationFactor" ) ) ; } // Override any options specified in ks_defaults Map < String , Object > ksDefs = m_dbservice . getParamMap ( "ks_defaults" ) ; if ( ksDefs != null ) { if ( ksDefs . containsKey ( "durable_writes" ) ) { durable_writes = Boolean . parseBoolean ( ksDefs . get ( "durable_writes" ) . toString ( ) ) ; } if ( ksDefs . containsKey ( "strategy_class" ) ) { replication . put ( "class" , ksDefs . get ( "strategy_class" ) . toString ( ) ) ; } if ( ksDefs . containsKey ( "strategy_options" ) ) { Object value = ksDefs . get ( "strategy_options" ) ; if ( value instanceof Map ) { Map < String , Object > replOpts = ( Map < String , Object > ) value ; if ( replOpts . containsKey ( "replication_factor" ) ) { replication . put ( "replication_factor" , replOpts . get ( "replication_factor" ) . toString ( ) ) ; } } } } StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( " WITH DURABLE_WRITES=" ) ; buffer . append ( durable_writes ) ; buffer . append ( " AND REPLICATION=" ) ; buffer . append ( mapToCQLString ( replication ) ) ; return buffer . toString ( ) ; }
Allow RF to be overridden with ReplicationFactor in the given options .