src/java/org/apache/cassandra/tools/SSTableExport.java
/**
     * Given arguments specifying an SSTable, and optionally an output file,
     * export the contents of the SSTable to JSON.
     *  
     * @param args command lines arguments
     *
     * @throws IOException on failure to open/read/write files or output streams
     * @throws ConfigurationException on configuration failure (wrong params given)
     */
Given arguments specifying an SSTable, and optionally an output file,
export the contents of the SSTable to JSON.

@param args command lines arguments

@throws IOException on failure to open/read/write files or output streams
@throws ConfigurationException on configuration failure (wrong params given)
Given arguments specifying an SSTable and optionally an output file export the contents of the SSTable to JSON . @param args command lines arguments @throws IOException on failure to open / read / write files or output streams @throws ConfigurationException on configuration failure ( wrong params given )
public static void main(String[] args) throws IOException, ConfigurationException
    {
        String usage = String.format("Usage: %s <sstable> [-k key [-k key [...]] -x key [-x key [...]]]%n", SSTableExport.class.getName());
        CommandLineParser parser = new PosixParser();
        try
        {
            cmd = parser.parse(options, args);
        }
        catch (ParseException e1)
        {
            System.err.println(e1.getMessage());
            System.err.println(usage);
            System.exit(1);
        }
        if (cmd.getArgs().length != 1)
        {
            System.err.println("You must supply exactly one sstable");
            System.err.println(usage);
            System.exit(1);
        }
        String[] keys = cmd.getOptionValues(KEY_OPTION);
        String[] excludes = cmd.getOptionValues(EXCLUDEKEY_OPTION);
        String ssTableFileName = new File(cmd.getArgs()[0]).getAbsolutePath();
        DatabaseDescriptor.loadSchemas();
        if (Schema.instance.getNonSystemTables().size() < 1)
        {
            String msg = "no non-system tables are defined";
            System.err.println(msg);
            throw new ConfigurationException(msg);
        }
        if (cmd.hasOption(ENUMERATEKEYS_OPTION))
        {
            enumeratekeys(ssTableFileName, System.out);
        }
        else
        {
            if ((keys != null) && (keys.length > 0))
                export(ssTableFileName, System.out, Arrays.asList(keys), excludes);
            else
                export(ssTableFileName, excludes);
        }
        System.exit(0);
    }
public static void main ( String [ ] args ) throws IOException , ConfigurationException { String usage = String . format ( "Usage: %s <sstable> [-k key [-k key [...]] -x key [-x key [...]]]%n" , SSTableExport . class . getName ( ) ) ; CommandLineParser parser = new PosixParser ( ) ; try { cmd = parser . parse ( options , args ) ; } catch ( ParseException e1 ) { System . err . println ( e1 . getMessage ( ) ) ; System . err . println ( usage ) ; System . exit ( 1 ) ; } if ( cmd . getArgs ( ) . length != 1 ) { System . err . println ( "You must supply exactly one sstable" ) ; System . err . println ( usage ) ; System . exit ( 1 ) ; } String [ ] keys = cmd . getOptionValues ( KEY_OPTION ) ; String [ ] excludes = cmd . getOptionValues ( EXCLUDEKEY_OPTION ) ; String ssTableFileName = new File ( cmd . getArgs ( ) [ 0 ] ) . getAbsolutePath ( ) ; DatabaseDescriptor . loadSchemas ( ) ; if ( Schema . instance . getNonSystemTables ( ) . size ( ) < 1 ) { String msg = "no non-system tables are defined" ; System . err . println ( msg ) ; throw new ConfigurationException ( msg ) ; } if ( cmd . hasOption ( ENUMERATEKEYS_OPTION ) ) { enumeratekeys ( ssTableFileName , System . out ) ; } else { if ( ( keys != null ) && ( keys . length > 0 ) ) export ( ssTableFileName , System . out , Arrays . asList ( keys ) , excludes ) ; else export ( ssTableFileName , excludes ) ; } System . exit ( 0 ) ; }
Given arguments specifying an SSTable, and optionally an output file,
 export the contents of the SSTable to JSON.
Given arguments specifying an SSTable and optionally an output file export the contents of the SSTable to JSON .