blueflood-core/src/main/java/com/rackspacecloud/blueflood/tools/ops/Migration.java
private static Map<String, Object> parseOptions(String[] args) {
        final GnuParser parser = new GnuParser();
        final Map<String, Object> options = new HashMap<String, Object>();
        try {
            final long now = System.currentTimeMillis();
            CommandLine line = parser.parse(cliOptions, args);
            
            options.put(SRC, line.getOptionValue(SRC));
            options.put(DST, line.getOptionValue(DST));
            
            // default range is one year ago until now.
            options.put(FROM, line.hasOption(FROM) ? parseDateTime(line.getOptionValue(FROM)) : now-(365L*24L*60L*60L*1000L));
            options.put(TO, line.hasOption(TO) ? parseDateTime(line.getOptionValue(TO)) : now);
            
            options.put(LIMIT, line.hasOption(LIMIT) ? Integer.parseInt(line.getOptionValue(LIMIT)) : Integer.MAX_VALUE);
            options.put(SKIP, line.hasOption(SKIP) ? Integer.parseInt(line.getOptionValue(SKIP)) : 0);
            options.put(BATCH_SIZE, line.hasOption(BATCH_SIZE) ? Integer.parseInt(line.getOptionValue(BATCH_SIZE)) : 100);
            
            // create a mapping of all cf names -> cf.
            // then determine which column family to process.
            Map<String, ColumnFamily<Locator, Long>> nameToCf = new HashMap<String, ColumnFamily<Locator, Long>>() {{
                for (CassandraModel.MetricColumnFamily cf : CassandraModel.getMetricColumnFamilies()) {
                    put(cf.getName(), cf);
                }
            }};
            if (nameToCf.get(line.getOptionValue(COLUMN_FAMILY)) == null) {
                throw new ParseException("Invalid column family");
            }
            CassandraModel.MetricColumnFamily columnFamily = (CassandraModel.MetricColumnFamily)nameToCf.get(line.getOptionValue(COLUMN_FAMILY)); 
            options.put(COLUMN_FAMILY, columnFamily);
            
            options.put(TTL, line.hasOption(TTL) ? Integer.parseInt(line.getOptionValue(TTL)) : (int)(5 * columnFamily.getDefaultTTL().toSeconds()));
            
            options.put(READ_THREADS, line.hasOption(READ_THREADS) ? Integer.parseInt(line.getOptionValue(READ_THREADS)) : 1);
            options.put(WRITE_THREADS, line.hasOption(WRITE_THREADS) ? Integer.parseInt(line.getOptionValue(WRITE_THREADS)) : 1);
            
            options.put(VERIFY, line.hasOption(VERIFY));
            
            options.put(DISCOVER, line.hasOption(DISCOVER) ? NodeDiscoveryType.RING_DESCRIBE : NodeDiscoveryType.NONE);
            options.put(RATE, line.hasOption(RATE) ? Integer.parseInt(line.getOptionValue(RATE)) : 500);
            
        } catch (ParseException ex) {
            HelpFormatter helpFormatter = new HelpFormatter();
            helpFormatter.printHelp("bf-migrate", cliOptions);
            System.exit(-1);
        }
        
        return options;
    }
private static Map<String, Object> parseOptions(String[] args) {
        final GnuParser parser = new GnuParser();
        final Map<String, Object> options = new HashMap<String, Object>();
        try {
            final long now = System.currentTimeMillis();
            CommandLine line = parser.parse(cliOptions, args);
            
            options.put(SRC, line.getOptionValue(SRC));
            options.put(DST, line.getOptionValue(DST));
            
            // default range is one year ago until now.
            options.put(FROM, line.hasOption(FROM) ? parseDateTime(line.getOptionValue(FROM)) : now-(365L*24L*60L*60L*1000L));
            options.put(TO, line.hasOption(TO) ? parseDateTime(line.getOptionValue(TO)) : now);
            
            options.put(LIMIT, line.hasOption(LIMIT) ? Integer.parseInt(line.getOptionValue(LIMIT)) : Integer.MAX_VALUE);
            options.put(SKIP, line.hasOption(SKIP) ? Integer.parseInt(line.getOptionValue(SKIP)) : 0);
            options.put(BATCH_SIZE, line.hasOption(BATCH_SIZE) ? Integer.parseInt(line.getOptionValue(BATCH_SIZE)) : 100);
            
            // create a mapping of all cf names -> cf.
            // then determine which column family to process.
            Map<String, ColumnFamily<Locator, Long>> nameToCf = new HashMap<String, ColumnFamily<Locator, Long>>() {{
                for (CassandraModel.MetricColumnFamily cf : CassandraModel.getMetricColumnFamilies()) {
                    put(cf.getName(), cf);
                }
            }};
            if (nameToCf.get(line.getOptionValue(COLUMN_FAMILY)) == null) {
                throw new ParseException("Invalid column family");
            }
            CassandraModel.MetricColumnFamily columnFamily = (CassandraModel.MetricColumnFamily)nameToCf.get(line.getOptionValue(COLUMN_FAMILY)); 
            options.put(COLUMN_FAMILY, columnFamily);
            
            options.put(TTL, line.hasOption(TTL) ? Integer.parseInt(line.getOptionValue(TTL)) : (int)(5 * columnFamily.getDefaultTTL().toSeconds()));
            
            options.put(READ_THREADS, line.hasOption(READ_THREADS) ? Integer.parseInt(line.getOptionValue(READ_THREADS)) : 1);
            options.put(WRITE_THREADS, line.hasOption(WRITE_THREADS) ? Integer.parseInt(line.getOptionValue(WRITE_THREADS)) : 1);
            
            options.put(VERIFY, line.hasOption(VERIFY));
            
            options.put(DISCOVER, line.hasOption(DISCOVER) ? NodeDiscoveryType.RING_DESCRIBE : NodeDiscoveryType.NONE);
            options.put(RATE, line.hasOption(RATE) ? Integer.parseInt(line.getOptionValue(RATE)) : 500);
            
        } catch (ParseException ex) {
            HelpFormatter helpFormatter = new HelpFormatter();
            helpFormatter.printHelp("bf-migrate", cliOptions);
            System.exit(-1);
        }
        
        return options;
    }
private static Map < String , Object > parseOptions ( String [ ] args ) { final GnuParser parser = new GnuParser ( ) ; final Map < String , Object > options = new HashMap < String , Object > ( ) ; try { final long now = System . currentTimeMillis ( ) ; CommandLine line = parser . parse ( cliOptions , args ) ; options . put ( SRC , line . getOptionValue ( SRC ) ) ; options . put ( DST , line . getOptionValue ( DST ) ) ; // default range is one year ago until now. options . put ( FROM , line . hasOption ( FROM ) ? parseDateTime ( line . getOptionValue ( FROM ) ) : now - ( 365L * 24L * 60L * 60L * 1000L ) ) ; options . put ( TO , line . hasOption ( TO ) ? parseDateTime ( line . getOptionValue ( TO ) ) : now ) ; options . put ( LIMIT , line . hasOption ( LIMIT ) ? Integer . parseInt ( line . getOptionValue ( LIMIT ) ) : Integer . MAX_VALUE ) ; options . put ( SKIP , line . hasOption ( SKIP ) ? Integer . parseInt ( line . getOptionValue ( SKIP ) ) : 0 ) ; options . put ( BATCH_SIZE , line . hasOption ( BATCH_SIZE ) ? Integer . parseInt ( line . getOptionValue ( BATCH_SIZE ) ) : 100 ) ; // create a mapping of all cf names -> cf. // then determine which column family to process. Map < String , ColumnFamily < Locator , Long > > nameToCf = new HashMap < String , ColumnFamily < Locator , Long > > ( ) { { for ( CassandraModel . MetricColumnFamily cf : CassandraModel . getMetricColumnFamilies ( ) ) { put ( cf . getName ( ) , cf ) ; } } } ; if ( nameToCf . get ( line . getOptionValue ( COLUMN_FAMILY ) ) == null ) { throw new ParseException ( "Invalid column family" ) ; } CassandraModel . MetricColumnFamily columnFamily = ( CassandraModel . MetricColumnFamily ) nameToCf . get ( line . getOptionValue ( COLUMN_FAMILY ) ) ; options . put ( COLUMN_FAMILY , columnFamily ) ; options . put ( TTL , line . hasOption ( TTL ) ? Integer . parseInt ( line . getOptionValue ( TTL ) ) : ( int ) ( 5 * columnFamily . getDefaultTTL ( ) . toSeconds ( ) ) ) ; options . put ( READ_THREADS , line . hasOption ( READ_THREADS ) ? Integer . parseInt ( line . getOptionValue ( READ_THREADS ) ) : 1 ) ; options . put ( WRITE_THREADS , line . hasOption ( WRITE_THREADS ) ? Integer . parseInt ( line . getOptionValue ( WRITE_THREADS ) ) : 1 ) ; options . put ( VERIFY , line . hasOption ( VERIFY ) ) ; options . put ( DISCOVER , line . hasOption ( DISCOVER ) ? NodeDiscoveryType . RING_DESCRIBE : NodeDiscoveryType . NONE ) ; options . put ( RATE , line . hasOption ( RATE ) ? Integer . parseInt ( line . getOptionValue ( RATE ) ) : 500 ) ; } catch ( ParseException ex ) { HelpFormatter helpFormatter = new HelpFormatter ( ) ; helpFormatter . printHelp ( "bf-migrate" , cliOptions ) ; System . exit ( - 1 ) ; } return options ; }
should be populated.
should be populated .