src/java/org/apache/cassandra/tools/SSTableImport.java
/**
     * Converts JSON to an SSTable file. JSON input can either be a file specified
     * using an optional command line argument, or supplied on standard in.
     *
     * @param args command line arguments
     * @throws IOException on failure to open/read/write files or output streams
     * @throws ParseException on failure to parse JSON input
     * @throws ConfigurationException on configuration error.
     */
Converts JSON to an SSTable file. JSON input can either be a file specified
using an optional command line argument, or supplied on standard in.

@param args command line arguments
@throws IOException on failure to open/read/write files or output streams
@throws ParseException on failure to parse JSON input
@throws ConfigurationException on configuration error.
Converts JSON to an SSTable file . JSON input can either be a file specified using an optional command line argument or supplied on standard in . @param args command line arguments @throws IOException on failure to open / read / write files or output streams @throws ParseException on failure to parse JSON input @throws ConfigurationException on configuration error .
public static void main(String[] args) throws IOException, ParseException, ConfigurationException
    {
        CommandLineParser parser = new PosixParser();
        try
        {
            cmd = parser.parse(options, args);
        }
        catch (org.apache.commons.cli.ParseException e)
        {
            System.err.println(e.getMessage());
            printProgramUsage();
            System.exit(1);
        }
        if (cmd.getArgs().length != 2)
        {
            printProgramUsage();
            System.exit(1);
        }
        String json     = cmd.getArgs()[0];
        String ssTable  = cmd.getArgs()[1];
        String keyspace = cmd.getOptionValue(KEYSPACE_OPTION);
        String cfamily  = cmd.getOptionValue(COLUMN_FAMILY_OPTION);
        if (cmd.hasOption(KEY_COUNT_OPTION))
        {
            keyCountToImport = Integer.valueOf(cmd.getOptionValue(KEY_COUNT_OPTION));
        }
        if (cmd.hasOption(IS_SORTED_OPTION))
        {
            isSorted = true;
        }
        DatabaseDescriptor.loadSchemas();
        if (Schema.instance.getNonSystemTables().size() < 1)
        {
            String msg = "no non-system tables are defined";
            System.err.println(msg);
            throw new ConfigurationException(msg);
        }
        try
        {
            importJson(json, keyspace, cfamily, ssTable);
        }
        catch (Exception e)
        {
            e.printStackTrace();
            System.err.println("ERROR: " + e.getMessage());
            System.exit(-1);
        }
        System.exit(0);
    }
public static void main ( String [ ] args ) throws IOException , ParseException , ConfigurationException { CommandLineParser parser = new PosixParser ( ) ; try { cmd = parser . parse ( options , args ) ; } catch ( org . apache . commons . cli . ParseException e ) { System . err . println ( e . getMessage ( ) ) ; printProgramUsage ( ) ; System . exit ( 1 ) ; } if ( cmd . getArgs ( ) . length != 2 ) { printProgramUsage ( ) ; System . exit ( 1 ) ; } String json = cmd . getArgs ( ) [ 0 ] ; String ssTable = cmd . getArgs ( ) [ 1 ] ; String keyspace = cmd . getOptionValue ( KEYSPACE_OPTION ) ; String cfamily = cmd . getOptionValue ( COLUMN_FAMILY_OPTION ) ; if ( cmd . hasOption ( KEY_COUNT_OPTION ) ) { keyCountToImport = Integer . valueOf ( cmd . getOptionValue ( KEY_COUNT_OPTION ) ) ; } if ( cmd . hasOption ( IS_SORTED_OPTION ) ) { isSorted = true ; } DatabaseDescriptor . loadSchemas ( ) ; if ( Schema . instance . getNonSystemTables ( ) . size ( ) < 1 ) { String msg = "no non-system tables are defined" ; System . err . println ( msg ) ; throw new ConfigurationException ( msg ) ; } try { importJson ( json , keyspace , cfamily , ssTable ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; System . err . println ( "ERROR: " + e . getMessage ( ) ) ; System . exit ( - 1 ) ; } System . exit ( 0 ) ; }
Converts JSON to an SSTable file.
Converts JSON to an SSTable file .